private void Load(TypeValue typeValue, int start, int end, int step) { var max = 0; var min = 0; var zero = 0; switch (typeValue) { case TypeValue.Minute: min = 0; max = 59; zero = 1; break; case TypeValue.Hour: min = 0; max = 23; zero = 1; break; case TypeValue.Day: min = 1; max = 31; break; case TypeValue.Month: min = 1; max = 12; break; case TypeValue.Week: min = 0; max = 6; zero = 1; break; default: throw new KLIBException(2, "Type Value invalid in Cron Load."); } // If values is zero end = end == 0 ? max : end; start = start == 0 ? min : start; // Validation the conditions if (start < min || start > max || end < min || end > max || start > end) { throw new KLIBException(2, $"Value of {typeValue.ToString()} is wrong in the Cron"); } int size = (end - start + zero) / step; var foo = new int[size]; int c = 0; for (int i = start; i < end + zero; i += step) { foo[c++] = i; } switch (typeValue) { case TypeValue.Minute: minutes = foo; break; case TypeValue.Hour: hours = foo; break; case TypeValue.Day: days = foo; break; case TypeValue.Month: months = foo; break; case TypeValue.Week: weeks = foo; break; default: throw new KLIBException(2, "Type Value invalid in Cron Load."); } }
public override object ToSqliteValue() { if (IsNull) { return(DBNull.Value); } else if (typeof(T).Equals(typeof(double))) { return(((double)(object)TypeValue).ToString("0.0000000000", NetSystem.Globalization.CultureInfo.InvariantCulture).TrimEnd('0')); } else { return(TypeValue.ToString()); } }
public string ClassifTypeName() { ClassificationsTypes t; if (Enum.TryParse(TypeValue.ToString(), out t)) { if (Devmasters.Core.TextUtil.IsNumeric(t.ToString())) { Util.Consts.Logger.Warning("Missing Classification value" + TypeValue); return("(neznámý)"); } return(t.ToNiceDisplayName()); } else { Util.Consts.Logger.Warning("Missing Classification value" + TypeValue); return("(neznámý)"); } }
void Internal.IResponseReader.ReadResponse(Internal.ByteReader reader) { NAME = reader.ReadDomain(); // TYPE may be not understood TypeValue = reader.ReadUIn16(); if (Enum.IsDefined(typeof(QTYPE), TypeValue)) { // known type TYPE = (QTYPE)TypeValue; TypeString = TYPE.ToString(); } else { // unknown type TYPE = null; TypeString = String.Format("[{0}]", TypeValue.ToString()); } CLASS = reader.ReadUIn16Enum <QCLASS>(); TTL = reader.ReadUint32(); RDLENGTH = reader.ReadUIn16(); }
public override string ToString() { return(string.Format("{0}{1:0000}{5} {4,-42} {2,15} {3,-11}", Func, Addr, Value, Unit, Desc, TypeValue.ToString()[0])); }
/// --------------------------------------------------------------------------- /// <summary>Parses values for enum</summary> /// --------------------------------------------------------------------------- static public string ParseType(TypeValue value) { return ParseType(value.GetType().ToString(), value.ToString()); }