Beispiel #1
0
        public static UserboxCommand Parse(string value)
        {
            string[] parts   = value.Split(',');
            var      command = new UserboxCommand();
            var      type    = UserboxCommandType.Stop;

            if (parts.Length > 0 && Enum.TryParse(parts[0], out type))
            {
                command.Type = type;
            }
            DateTime timestamp;

            switch (type)
            {
            case UserboxCommandType.Start:
                if (parts.Length > 1)
                {
                    if (TryParseDate(parts[1], out timestamp))
                    {
                        command.Timestamp = timestamp;
                    }
                }
                break;

            case UserboxCommandType.Screenshot:
                if (parts.Length > 3)
                {
                    if (TryParseDate(parts[3], out timestamp))
                    {
                        command.Timestamp = timestamp;
                    }
                }
                break;
            }
            return(command);
        }
Beispiel #2
0
 public static UserboxCommand Parse(string value)
 {
     string[] parts = value.Split(',');
     var command = new UserboxCommand();
     var type = UserboxCommandType.Stop;
     if (parts.Length > 0 && Enum.TryParse(parts[0], out type)) command.Type = type;
     DateTime timestamp;
     switch (type)
     {
         case UserboxCommandType.Start:
             if (parts.Length > 1)
             {
                 if (TryParseDate(parts[1], out timestamp)) command.Timestamp = timestamp;
             }
             break;
         case UserboxCommandType.Screenshot:
             if (parts.Length > 3)
             {
                 if (TryParseDate(parts[3], out timestamp)) command.Timestamp = timestamp;
             }
             break;
     }
     return command;
 }