public static uint[] Convert(string dotted) { if (dotted == null) { throw new ArgumentNullException("dotted"); } var parts = dotted.Split(new[] { '.' }); var result = new List <uint> (); foreach (var s in parts.Where(s => !string.IsNullOrEmpty(s))) { #if CF result.Add(uint.Parse(s)); #else uint temp; #if NETCF if (TryParsers.UInt32TryParse(s, out temp)) #else if (uint.TryParse(s, out temp)) #endif { result.Add(temp); } else { throw new ArgumentException(string.Format("Parameter {0} is out of 32 bit unsigned integer range", s), "dotted"); } #endif } return(result.ToArray()); }
public CrestronLoggerTraceListener(string initializeData) { string[] info = initializeData.Split(new char[] { ' ', ',', ';' }); uint lev; bool logonly; if (info.Length == 0) { return; } if (info.Length > 0) { if (TryParsers.UInt32TryParse(info[0], out lev) && lev <= 10) { _debugLevel = lev; } if (info.Length > 1) { if (TryParsers.BooleanTryParse(info[1], out logonly)) { _logOnlyThisLevel = logonly; } if (info.Length > 2) { LoggerModeEnum le; try { le = (LoggerModeEnum)Enum.Parse(typeof(LoggerModeEnum), info[2], true); _loggerMode = le; } catch (ArgumentException) { } } } } }