public void getSavedRules() { strListRules = "17, 4, 5, 6, 7"; foreach (int n in Lib.GetPars(strListRules)) Rules.Add(new Rule.Rule(n)); ClosePriceLists(); }
} // end update #endif //FOR_FUTURE 6/4/2017 /// <summary> /// modelListUpdate(name, dir, Made, MD5) - update list of models in TSmatch.xlsx/Models /// </summary> /// <param name="name">Model name</param> /// <param name="dir">Model path in File sistem</param> /// <param name="Made">version name of TS.Read - important as AttSet field list identifier</param> /// <param name="MD5">checksum of all Model parts</param> /// <returns>Model, updated in the list of models in TSmatch</returns> /// <history> 6.3.2016 PKh /// 15.3.16 return Model instead of null in case of completely new model; wrToFile handle /// 5.4.16 Current Phase handling /// 6.8.16 non static method /// </history> Model modelListUpdate(string name, string dir = null, string Made = null, string MD5 = null, string Phase = null, string str = null) { Log.set("modelListUpdate"); Models.Clear(); Start(); // renowate Models list from TSmatch.xlsx Model mod = getModel(name); if (mod == null) // mod==null - means this is completely new model { Models.Add(new Model(name, dir, ifcPath, Made, Phase, MD5)); mod = getModel(name); mod.wrToFile = true; } else { if (dir != null) mod.dir = dir; if (Made != null) mod.Made = Made; if (Phase != null) mod.Phase = Phase; if (MD5 != null) mod.MD5 = MD5; if (str != null) { mod.strListRules = str; foreach (int n in Lib.GetPars(str)) mod.Rules.Add(new TSmatch.Rule.Rule(n)); } //!!!!!!!!!!!!!!!!!!!!!!!!!!!! ЗДЕСЬ // 1) проверить, доступен ли каталог dir? Если нет -> запустить FileWindowsDialog, потом рекурсивно вызвать modelListUpdate // 2) проверить, изменился ли MD5 и список Правил str? Если нет -> список моделей не переписываем, оставляем прежднюю дату // 3) читать ModelINFO / MD5 в файле, чтобы понять, нужно ли в него переписать модель (установить флаг wrToFile) } Log.exit(); return mod; }
//check if с - part of current Component, and g - part of group //.. is in match in terms of template pattern string with wildcards public bool isOK(string pattern, string c, string g) { var p_c = rulePar(pattern, c); var p_g = rulePar(pattern, g); int cnt = Math.Min(p_c.Count, p_g.Count); for (int i = 0; i < cnt; i++) { if (p_c[i] == p_g[i]) { continue; } if (p_c[i][0] != '@') { return(false); } List <int> pc = Lib.GetPars(p_c[i].Substring(1)); List <int> pg = Lib.GetPars(p_g[i].Substring(1)); int minPars = Math.Min(pc.Count, pg.Count); for (int n = 0; n < minPars; n++) { if (pc[n] < pg[n]) { return(false); } } } return(true); }
/// <summary> /// PrfNormalize operate in <Full>, or in <Mark> mode: /// <para> - Mark: only setup Mark (i.e. Profile type) as pointed in first argument, or</para> /// <para> - Full: setup Mark, and sort digital parameter values the profile template list;</para> /// </summary> private void PrfNormalize(ref List<ElmGr> grp, params string[] prfMark) { foreach (var gr in grp) { foreach (string s in prfMark) { if (!gr.Prf.Contains(s) && !gr.prf.Contains(s)) continue; string initialPrf = gr.Prf; gr.Prf = PrfNormStr(gr.prf, prfMark[0], Lib.GetPars(gr.Prf)); gr.prf = Lib.ToLat(gr.Prf.ToLower()); log.Info("--- " + initialPrf + " -> " + "Prf=" + gr.Prf + "gr.prf=" + gr.prf); break; } } }
public Model(Docs doc, int i, bool doInit = true) { this.date = Lib.getDateTime(doc.Body[i, Decl.MODEL_DATE]); this.name = doc.Body.Strng(i, Decl.MODEL_NAME); this.dir = doc.Body.Strng(i, Decl.MODEL_DIR); this.ifcPath = doc.Body.Strng(i, Decl.MODEL_IFCPATH); this.Made = doc.Body.Strng(i, Decl.MODEL_MADE); this.Phase = doc.Body.Strng(i, Decl.MODEL_PHASE); this.MD5 = doc.Body.Strng(i, Decl.MODEL_MD5); // преобразуем список Правил из вида "5,6,8" в List<Rule> strListRules = doc.Body.Strng(i, Decl.MODEL_R_LIST); if (doInit) { foreach (int n in Lib.GetPars(strListRules)) Rules.Add(new Rule.Rule(n)); } }