コード例 #1
0
        public string Execute(string[] args, out EventLogEntryType result)
        {
            DirectoryHandlerClosedEventArgs directoryHandlerClosedEventArgs =
                new DirectoryHandlerClosedEventArgs(args[0], "Close");

            string s = _imageServer.CloseHandler(directoryHandlerClosedEventArgs, out result);

            return(directoryHandlerClosedEventArgs.Closed ? s : null);
        }
コード例 #2
0
        public string Execute(string[] args, out bool result, out bool responseBack)
        {
            _server.CloseHandler(args[0]);
            ConfigCommand            configCommand = new ConfigCommand(_server);
            CommandRecievedEventArgs requestArgs   = configCommand.GetCurrentConfig();

            _server.HandlerRemoved(requestArgs);
            result       = true;
            responseBack = false;
            return(String.Empty);
        }
コード例 #3
0
        /// <summary>
        /// That function will execute the task of the command.
        /// </summary>
        /// <param name="args">arguments</param>
        /// <param name="result"> tells if the command succeded or not.</param>
        /// <returns>command return a string describes the operartion of the command.</returns>
        public string Execute(string[] args, out bool result, TcpClient tcpClient)
        {
            //try
            // {
            result = true;
            if (args == null || args.Length == 0)
            {
                throw new Exception("Invalid args for deleting handler");
            }
            string HandlertoDelete = args[0];

            string[]      directories = (ConfigurationManager.AppSettings.Get("Handler").Split(';'));
            StringBuilder newHandlers = new StringBuilder();

            for (int i = 0; i < directories.Length; i++)
            {
                if (directories[i] != HandlertoDelete)
                {
                    newHandlers.Append(directories[i] + ";");
                }
            }
            string        updatededHandlers = (newHandlers.ToString()).TrimEnd(';');
            Configuration config            = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            config.AppSettings.Settings.Remove("Handler");
            config.AppSettings.Settings.Add("Handler", updatededHandlers);
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
            DirectoryCloseEventArgs directoryCloseEventArgs = new DirectoryCloseEventArgs(HandlertoDelete, null);

            m_imageServer.CloseHandler(this, directoryCloseEventArgs);
            string[] Args = { HandlertoDelete };
            //array[0] = HandlertoDelete;
            CommandRecievedEventArgs crea = new CommandRecievedEventArgs((int)CommandEnum.CloseHandlerCommand, Args, HandlertoDelete);

            ImageServer.NotifyAll(crea);
            return(JsonConvert.SerializeObject(crea));
        }