Ejemplo n.º 1
0
 public void Start(int port)
 {
     Base.ClientServer.OnChildProcessLogAdded += this.logManager.ChildProcessLogAdded;
     this.logManager.OnAddLIstenGroup         += delegate(object s, ListenerGroupEventArgs e)
     {
         Base.ClientServer.SendMessage <ChildProcessLogConnectMessage>(e.ClientID, new ChildProcessLogConnectMessage(e.ClientID, e.ProcessName, e.PID));
     };
     this.logManager.OnDeleteLIstenGroup += delegate(object s, ListenerGroupEventArgs e)
     {
         Base.ClientServer.SendMessage <ChildProcessLogDisconnectMessage>(e.ClientID, new ChildProcessLogDisconnectMessage(e.ClientID, e.ProcessName, e.PID));
     };
     this.logManager.OnChildProcessLogAdded += delegate(object s, ChildProcessLogEventArgs e)
     {
         RCClient rcclient = s as RCClient;
         e.Message.ClientID = rcclient.ID;
         foreach (int userID in e.Clients)
         {
             Base.ControlServer.SendToUser <ChildProcessLogMessage>(userID, e.Message);
         }
     };
     this.jobProcessor.Start();
     this.tcpServer.Start(this.jobProcessor, port);
     FileWatcher.Start();
     FileDistributor.Start();
 }
Ejemplo n.º 2
0
        private static void OnFileRenamed(string oldPath, string newPath)
        {
            bool isDirectory = false;

            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(newPath);
                if (directoryInfo.Attributes == FileAttributes.Directory)
                {
                    isDirectory = true;
                }
            }
            catch (UnauthorizedAccessException)
            {
                return;
            }
            string pathName;
            string oldFileName;

            FileWatcher.SplitePathAndFile(oldPath, out pathName, out oldFileName);
            string newFileName;

            FileWatcher.SplitePathAndFile(newPath, out pathName, out newFileName);
            FileDistributor.OnFileRenamed(pathName, oldFileName, newFileName, isDirectory);
        }
Ejemplo n.º 3
0
 public void Stop()
 {
     this.tcpServer.Stop();
     this.jobProcessor.Stop();
     FileDistributor.Exit();
     FileWatcher.Exit();
     if (Base.ClientServer != null)
     {
         Base.ClientServer.OnChildProcessLogAdded -= this.logManager.ChildProcessLogAdded;
     }
 }
Ejemplo n.º 4
0
        private static void OnFileChanged(string fullPath, WatcherChangeTypes changeType)
        {
            bool isDirectory = false;

            try
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(fullPath);
                if (directoryInfo.Attributes == FileAttributes.Directory)
                {
                    isDirectory = true;
                }
            }
            catch (UnauthorizedAccessException)
            {
                return;
            }
            string pathName;
            string fileName;

            FileWatcher.SplitePathAndFile(fullPath, out pathName, out fileName);
            FileDistributor.OnFileChanged(pathName, fileName, isDirectory, changeType);
        }