Exemplo n.º 1
0
        protected UserboxCommand GetUserboxCommand(string index)
        {
            string value;

            if (_settings.Items.TryGetValue(FullKey(index), out value))
            {
                return(UserboxCommand.Parse(value));
            }
            return(default(UserboxCommand));
        }
Exemplo n.º 2
0
 public static UserboxCommand Parse(string value)
 {
     string[] parts = value.Split(',');
     var command = new UserboxCommand();
     var type = UserboxCommandType.Stop;
     if (parts.Length > 0 && EnumHelper.TryParseEnum(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;
 }
Exemplo n.º 3
0
        public static UserboxCommand Parse(string value)
        {
            string[] parts   = value.Split(',');
            var      command = new UserboxCommand();
            var      type    = UserboxCommandType.Stop;

            if (parts.Length > 0 && EnumHelper.TryParseEnum(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);
        }
Exemplo n.º 4
0
 protected void Set(string index, UserboxCommand value)
 {
     Set(index, value.ToString());
 }