Exemplo n.º 1
0
 public void SendCommand(CommandRecievedEventArgs command)
 {
     if (client.Connected)
     {
         writer.Write(command.ToJSON());
     }
 }
        public string Execute(string[] args, out bool result)
        {
            string logHistory = m_log.LogToJSON();

            string[] cmndArgs = { logHistory };
            CommandRecievedEventArgs cmndRecieved = new CommandRecievedEventArgs((int)CommandEnum.LogHistoryCommand, cmndArgs, null);

            result = true;
            return(cmndRecieved.ToJSON());
        }
        public string Execute(string[] args, out bool result)
        {
            string path = args[0];

            server.closeSpecificHandler(path);
            CommandRecievedEventArgs cmndRecieved = new CommandRecievedEventArgs((int)CommandEnum.HandlerRemoveCommand, args, null);

            server.RaiseNotifiyEvent(cmndRecieved);
            result = true;
            return(cmndRecieved.ToJSON());
        }
Exemplo n.º 4
0
        public void Notify(CommandRecievedEventArgs cmdRecieved)
        {
            foreach (TcpClient client in clients)
            {
                NetworkStream stream = client.GetStream();
                BinaryWriter  writer = new BinaryWriter(stream, Encoding.UTF8, true);

                string jsonCommand = cmdRecieved.ToJSON();

                m_mutex.WaitOne();
                writer.Write(jsonCommand);
                m_mutex.ReleaseMutex();
            }
        }
Exemplo n.º 5
0
        public string Execute(string[] args, out bool result)
        {
            JObject JsonConfig = new JObject();
            JArray  pathJSON   = new JArray();

            foreach (string path in server.pathList)
            {
                pathJSON.Add(path);
            }
            JsonConfig["Handler"]       = pathJSON;
            JsonConfig["OutputDir"]     = ConfigurationManager.AppSettings["OutputDir"];
            JsonConfig["SourceName"]    = ConfigurationManager.AppSettings["SourceName"];
            JsonConfig["LogName"]       = ConfigurationManager.AppSettings["LogName"];
            JsonConfig["ThumbnailSize"] = ConfigurationManager.AppSettings["ThumbnailSize"];
            string[] cmndArgs = { JsonConfig.ToString() };
            CommandRecievedEventArgs cmndRecieved = new CommandRecievedEventArgs((int)CommandEnum.ConfigCommand, cmndArgs, null);

            result = true;
            return(cmndRecieved.ToJSON());
        }