예제 #1
0
        /// <summary>
        /// the function executes the get config command
        /// </summary>
        /// <param name= args> the commands arguments </param>
        /// <param name= result> the result of the function, if succeeded or not </param>
        /// <return> returns the app config info as a string </return>
        public string Execute(string[] args, out bool result)
        {
            // gets the instance of the app config info
            ServiceInfo info = ServiceInfo.CreateServiceInfo();

            result = true;
            string handlers = String.Join(",", info.Handlers);

            string[] answer = (info.OutputDir + "," + info.SourceName + "," + info.LogName + "," + info.ThumbnailSize + "," + handlers).Split(',');
            // return the info converted to Json ready to be sent to client
            InfoEventArgs infoArgs = new InfoEventArgs((int)EnumTranslator.CommandToInfo((int)CommandEnum.GetConfigCommand), answer);

            return(JsonConvert.SerializeObject(infoArgs));
        }
예제 #2
0
        /// <summary>
        /// the function executes the get log command
        /// </summary>
        /// <param name= args> the commands arguments </param>
        /// <param name= result> the result of the function, if succeeded or not </param>
        /// <return> returns the log history as a string </return>
        public string Execute(string[] args, out bool result)
        {
            LogHistory logHistory = LogHistory.CreateLogHistory();

            result = true;
            List <string[]> logList = logHistory.Logs;

            // the log array to return, each cell has the message type comma message
            string[] answer = new string[logList.Count];
            int      i      = 0;

            // create an array of strings representing the log
            foreach (string[] log in logList.ToArray())
            {
                // log[0] is the message type, log[1] is the message itself
                answer[i] = log[0] + "," + log[1];
                i++;
            }
            // return the info converted to Json ready to be sent to client
            InfoEventArgs info = new InfoEventArgs((int)EnumTranslator.CommandToInfo((int)CommandEnum.LogCommand), answer);

            return(JsonConvert.SerializeObject(info));
        }