예제 #1
0
 public string Execute(string[] args, out bool result)
 {
     try
     {
         List <string> sendArgs = new List <string>();
         //Get parameters from app config
         sendArgs.Add(ConfigurationManager.AppSettings.Get("OutputDir"));
         sendArgs.Add(ConfigurationManager.AppSettings.Get("SourceName"));
         sendArgs.Add(ConfigurationManager.AppSettings.Get("LogName"));
         sendArgs.Add(ConfigurationManager.AppSettings.Get("ThumbnailSize"));
         //Split handlers by ;
         string[] handlers = HandlerListManager.GetHandlerListManager().Handlers;
         //Convert string array into list.
         for (int i = 0; i < handlers.Length; i++)
         {
             sendArgs.Add(handlers[i]);
         }
         //Create recieve command.
         ConfigurationRecieveEventArgs configurationEvent =
             new ConfigurationRecieveEventArgs((int)ConfigurationEnum.SettingsConfiguration, sendArgs.ToArray());
         //Serialize it.
         string output = JsonConvert.SerializeObject(configurationEvent);
         result = true;
         return(output);
     }
     catch (Exception)
     {
         result = false;
         return("Couldn't get settings propetries.");
     }
 }
예제 #2
0
 /// <summary>
 /// Close handlers
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void CloseHandler(object sender, DirectoryCloseEventArgs e)
 {
     try
     {
         //Disable raising events.
         m_dirWatcher.EnableRaisingEvents = false;
         //Remove event on command receive.
         ((ImageServer)sender).CommandRecieved -= this.OnCommandRecieved;
         m_dirWatcher.Created -= new FileSystemEventHandler(NewFileHandler);
         m_dirWatcher.Changed -= new FileSystemEventHandler(NewFileHandler);
         HandlerListManager.GetHandlerListManager().removeHandler(m_path);
         m_logging.Log("Close handler of " + m_path, MessageTypeEnum.INFO);
     }
     catch
     {
         m_logging.Log("Failed closing handler of " + m_path, MessageTypeEnum.FAIL);
     }
 }