Beispiel #1
0
        protected UserboxCommand GetUserboxCommand(string index)
        {
            string value;

            if (_settings.Items.TryGetValue(FullKey(index), out value))
            {
                return(UserboxCommand.Parse(value));
            }
            return(default(UserboxCommand));
        }
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);
        }
Beispiel #3
0
 protected void Set(string index, UserboxCommand value)
 {
     Set(index, value.ToString());
 }