Exemplo n.º 1
0
 public static LedAnimation Parse(string value)
 {
     string[] parts = value.Split(',');
     var animation = new LedAnimation();
     LedAnimationType type;
     int duration;
     int ifrequency;
     if (parts.Length > 2 && Enum.TryParse(parts[0], out type) && int.TryParse(parts[1], out ifrequency)
         && int.TryParse(parts[2], out duration))
     {
         animation.Type = type;
         animation.Frequency = ConversionHelper.ToSingle(ifrequency);
         animation.Duration = duration;
     }
     return animation;
 }
Exemplo n.º 2
0
        public static LedAnimation Parse(string value)
        {
            string[]         parts     = value.Split(',');
            var              animation = new LedAnimation();
            LedAnimationType type;
            int              duration;
            int              ifrequency;

            if (parts.Length > 2 && Enum.TryParse(parts[0], out type) && int.TryParse(parts[1], out ifrequency) &&
                int.TryParse(parts[2], out duration))
            {
                animation.Type      = type;
                animation.Frequency = ConversionHelper.ToSingle(ifrequency);
                animation.Duration  = duration;
            }
            return(animation);
        }