Exemplo n.º 1
0
        public SpoolerResult StartSession(string spooler_app_and_path, string working_dir, string spooler_arguments, int start_delay)
        {
            Trace.WriteLine("SpoolerClient2.StartSession");
            MyDebugLogger.Add("SpoolerClient::StartSession", "Starting", DebugLogger.LogType.Secondary);
            SpoolerResult spoolerResult = SpoolerResult.Fail_Connect;

            try
            {
                var spoolerConnection = new RemoteSpoolerConnection(spooler_app_and_path, working_dir, spooler_arguments);
                MyDebugLogger.Add("SpoolerClient::StartSession", "Remote Connection Object Created", DebugLogger.LogType.Secondary);
                spoolerConnection.StartUpDelay     = start_delay;
                spoolerConnection.UseNoSpoolerMode = __use_no_spooler_mode;
                spoolerConnection.XMLProcessor     = new OnReceiveXMLFromSpooler(ProcessXMLFromServer);
                spoolerConnection.StartUp(42345);
                MyDebugLogger.Add("SpoolerClient::StartSession", "Socket Client Initialized", DebugLogger.LogType.Secondary);
                spooler_connection = spoolerConnection;
                spoolerResult      = InitialConnect();
                Trace.WriteLine(string.Format("SpoolerClient2.StartSession Completed {0}", spoolerResult));
                MyDebugLogger.Add("SpoolerClient::StartSession", "Connected to Spooler", DebugLogger.LogType.Secondary);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogException("Exception in SpoolerClient2.StartSession " + ex.Message, ex);
                spooler_connection = null;
                CloseSession();
            }
            if (spooler_connection != null)
            {
                StartThreads();
            }

            MyDebugLogger.Add("SpoolerClient::StartSession", "SpoolerClient threads created", DebugLogger.LogType.Secondary);
            return(spoolerResult);
        }
Exemplo n.º 2
0
        public override SpoolerResult SendSpoolerMessageInternal(string message)
        {
            SpoolerResult spoolerResult = SpoolerResult.Fail_Connect;

            if (spooler_server != null)
            {
                var data = spooler_server.onClientMessage(message);
                if (!string.IsNullOrEmpty(data))
                {
                    OnRawMessage(data);
                }

                spoolerResult = SpoolerResult.OK;
            }
            return(spoolerResult);
        }
Exemplo n.º 3
0
        public SpoolerResult StartInternalSpoolerSession()
        {
            Trace.WriteLine("SpoolerClient2.StartSession");
            MyDebugLogger.Add("SpoolerClientInternal::StartSession", "Starting", DebugLogger.LogType.Secondary);
            SpoolerResult spoolerResult = SpoolerResult.Fail_Connect;

            try
            {
                var spoolerConnection = new InternalSpoolerConnection
                {
                    XMLProcessor = new OnReceiveXMLFromSpooler((this).ProcessXMLFromServer)
                };
                if (!spoolerConnection.StartServer(42345))
                {
                    return(SpoolerResult.Fail_Connect);
                }

                spoolerConnection.OnReceivedSpoolerShutdownMessage = new EventHandler <EventArgs>(ReceivedSpoolerShutdownMessage);
                spoolerConnection.OnReceivedSpoolerShowMessage     = new EventHandler <EventArgs>(ReceivedSpoolerShowMessage);
                spoolerConnection.OnReceivedSpoolerHideMessage     = new EventHandler <EventArgs>(ReceivedSpoolerHideMessage);
                spooler_connection = spoolerConnection;
                spoolerResult      = InitialConnect();
                Trace.WriteLine(string.Format("SpoolerClient2.StartSession Completed {0}", spoolerResult));
                MyDebugLogger.Add("SpoolerClientInternal::StartSession", "Connected to Spooler", DebugLogger.LogType.Secondary);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogException("Exception in SpoolerClient2.StartSession " + ex.Message, ex);
                spooler_connection = null;
                CloseSession();
            }
            if (spooler_connection != null)
            {
                StartThreads();
            }

            MyDebugLogger.Add("SpoolerClientInternal::StartSession", "SpoolerClient threads created", DebugLogger.LogType.Secondary);
            return(spoolerResult);
        }
Exemplo n.º 4
0
 private Tuple <int, string> ResultConvertor(SpoolerResult <int, int> spoolerResult)
 {
     return(new Tuple <int, string>(spoolerResult.Input, spoolerResult.Result.ToString()));
 }