/// <summary> /// /// </summary> public StepRepl() { TypeList = Enum.GetValues(typeof(ReplType)) .Cast <ReplType>() .Select(v => new KeyValuePair <ReplType, string>(v, v.ToString())) .ToList(); rtype = TypeList[0].Key; SourceList = Fields.List.Where(i => i.Key != Fields.Type.Number).ToList(); source = SourceList[SourceList.FindIndex(i => i.Key == Fields.Type.NumberString)].Key; SourceList.Add(new KeyValuePair <Fields.Type, string>(Fields.Type.Null, "None used")); }
/// <summary> /// /// </summary> public StepRepl() { TypeList = Enum.GetValues(typeof(ReplType)) .Cast<ReplType>() .Select(v => new KeyValuePair<ReplType, string>(v, v.ToString())) .ToList(); rtype = TypeList[0].Key; SourceList = Fields.List.Where(i => i.Key != Fields.Type.Number).ToList(); source = SourceList[SourceList.FindIndex(i => i.Key == Fields.Type.NumberString)].Key; SourceList.Add(new KeyValuePair<Fields.Type, string>(Fields.Type.Null, "None used")); }
/// <summary> /// Находит в строке S первое вхождение параметра в %% с заданным типом и возвращает этот параметр без % /// </summary> /// <param name="S"></param> /// <returns></returns> string GetStrVar(string S, ReplType replType) { int beg = 0, end; string var = ""; beg = S.IndexOf("%"); while (beg < S.Length && beg > -1) { if (beg == -1) return ""; end = S.IndexOf("%", beg + 1); if (end == -1) return ""; var = S.Substring(beg + 1, end - beg - 1); if (replType == ReplType.All || GetReplType(var) == replType) return var; beg = S.IndexOf("%", end + 1); } return ""; }