Exemplo n.º 1
0
 void OnCommandRecieved(ServerConnectionEventArgs e)
 {
     try
     {
         switch (e.Command)
         {
         case "TRACK":
             if (e.Parameters.Length <= 1)
             {
                 Console.WriteLine("Warning, malformed TRACK_MAP command");
             }
             else
             {
                 SetMapTrackingMode(e.Parameters[0]);
             }
             break;
         }
     }
     catch (Exception ex)
     {
         var sb = new StringBuilder();
         foreach (var s in e.Parameters)
         {
             if (s == null)
             {
                 sb.AppendFormat("null,");
             }
             else
             {
                 sb.AppendFormat("{0},", s);
             }
         }
         Console.WriteLine("Error recieving client command {0} - {1}: {2}\n", e.Command, sb, ex);
     }
 }
 protected override ServerConnectionEventArgs ParseCommand(string line)
 {
     var args = line.Split('|'); // split arguments
     var command = new ServerConnectionEventArgs();
     command.ServerConnection = this;
     command.Command = args[0];
     command.Result = ServerConnectionEventArgs.ResultTypes.Success;
     command.Parameters = new string[args.Length - 1];
     for (var j = 1; j < args.Length; ++j) command.Parameters[j - 1] = MyUnescape(args[j]);
     return command;
 }
        protected virtual ServerConnectionEventArgs ParseCommand(string line)
        {
            var args    = line.Split(' '); // split arguments
            var command = new ServerConnectionEventArgs();

            command.ServerConnection = this;
            command.Command          = args[0];
            command.Result           = ServerConnectionEventArgs.ResultTypes.Success;
            command.Parameters       = new string[args.Length - 1];
            for (var j = 1; j < args.Length; ++j)
            {
                command.Parameters[j - 1] = args[j];
            }
            return(command);
        }
Exemplo n.º 4
0
 void con_CommandRecieved(object sender, ServerConnectionEventArgs e)
 {
     OnCommandRecieved(e);
 }
Exemplo n.º 5
0
 void OnCommandRecieved(ServerConnectionEventArgs e)
 {
     try
     {
         switch (e.Command)
         {
             case "TRACK":
                 if (e.Parameters.Length <= 1) Console.WriteLine("Warning, malformed TRACK_MAP command");
                 else SetMapTrackingMode(e.Parameters[0]);
                 break;
         }
     }
     catch (Exception ex)
     {
         var sb = new StringBuilder();
         foreach (var s in e.Parameters)
         {
             if (s == null) sb.AppendFormat("null,");
             else sb.AppendFormat("{0},", s);
         }
         Console.WriteLine("Error recieving client command {0} - {1}: {2}\n", e.Command, sb, ex);
     }
 }
Exemplo n.º 6
0
 void con_CommandRecieved(object sender, ServerConnectionEventArgs e)
 {
     OnCommandRecieved(e);
 }