Exemple #1
0
 /// <summary>
 /// Remove handler on server side.
 /// </summary>
 /// <param name="handler">Handler to remove.</param>
 /// <param name="channel">Web channel for requests.</param>
 public void RemoveHandler(string handler, WebChannel channel)
 {
     if (handler != null && handler != "")
     {
         if (channel.IsConnected())
         {
             CommandMessage req = new CommandMessage((int)CommandEnum.CloseCommand, new string[] { handler });
             channel.Write(req);
             CommandMessage answer = channel.Read();
             DirectoryHandlers.Remove(handler);
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// Set config data via server request.
 /// </summary>
 /// <param name="channel">Web channel for requests.</param>
 public void SetConfigData(WebChannel channel)
 {
     DirectoryHandlers = new List <string>();
     OutputDir         = SourceName = LogName = ThumbnailSize = "";
     if (channel.IsConnected())
     {
         CommandMessage req = new CommandMessage((int)CommandEnum.GetConfigCommand);
         channel.Write(req);
         CommandMessage answer = channel.Read();
         OutputDir     = answer.Args[0];
         SourceName    = answer.Args[1];
         LogName       = answer.Args[2];
         ThumbnailSize = answer.Args[3];
         for (int i = 4; i < answer.Args.Length; i++)
         {
             DirectoryHandlers.Add(answer.Args[i]);
         }
     }
 }
Exemple #3
0
 /// <summary>
 /// Set logs via server request.
 /// </summary>
 /// <param name="channel">Web channel for request.</param>
 public void SetLogs(WebChannel channel)
 {
     ServiceLogs = new List <Log>();
     if (channel.IsConnected())
     {
         CommandMessage req = new CommandMessage((int)CommandEnum.LogCommand);
         channel.Write(req);
         CommandMessage answer = channel.Read();
         // Iterate over every two arguments. First for message and second for type.
         for (int i = 0; i < answer.Args.Length; i += 2)
         {
             string m   = answer.Args[i];
             string t   = MessageRecievedEventArgs.GetTypeEnum(Int32.Parse(answer.Args[i + 1])).ToString();
             Log    log = new Log(t, m);
             // Adds a single log to an observables logs list.
             ServiceLogs.Add(log);
         }
     }
 }