using System;
using p4dn;
namespace csp4
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class MyCliClient : ClientUser {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main( string[] args ) {
string msg;
Error e = new Error();
ClientUser user = new MyCliClient();
ClientApi client = new ClientApi();
client.Init( e );
if (e.Test()) {
msg = e.Fmt();
Console.WriteLine( msg );
}
string cmd = "help";
if (args.Length > 1) {
string[] s = new string[ args.Length - 1 ];
for (int i = 0; i < s.Length; ++i) {
s[i] = args[ 1 + i];
}
client.SetArgv( s );
cmd = args[ 0 ];
}
client.Run( cmd, user );
client.Final( e );
}
public override void Message( Error err ) {
Console.WriteLine( err.Fmt() );
}
public override void OutputError( string s ) {
Console.WriteLine( s );
}
public override void OutputInfo( char level, string s ) {
switch (level) {
case '0': break;
case '1': Console.Write( "... " ); break;
case '2': Console.Write( "... ... " ); break;
}
Console.WriteLine( s );
}
public override void OutputText( string s ) {
Console.WriteLine( s );
}
public override void Edit( System.IO.FileInfo fileInfo, Error err ) {
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(
"notepad.exe",
fileInfo.FullName );
}
public override void Help( string s ) {
Console.WriteLine( s );
}
}
}