public void SetFromFile(string file) { this.Columns.Clear(); this.Conditions.Clear(); string[] lines = File.ReadAllLines(file); int l = 2; foreach (string line in lines) { string[] values = line.Split(';'); this.Columns.Add(new KeyValuePair <string, int>(values[0], l)); Func <FHXObject, FHXParameter> Condition = new Func <FHXObject, FHXParameter>((FHXObject o) => { FHXParameter p = null; for (int i = 1; i < values.Length; i++) { p = o.GetSingleParameterFromPath(values[i]); if (p != null) { return(p); } } return(p); }); this.Conditions.Add(new KeyValuePair <string, Func <FHXObject, FHXParameter> >(values[0], Condition)); l++; } }
public void Add(FHXObject parent, FHXParameter param, FHXCompareType type) { string rpath = param.RelativePath(parent); if (!_results.Keys.Contains(rpath)) { _results.Add(rpath, new FHXCompareResult(parent, type, param.Value)); } else { _results[rpath].NewValue = param.Value; } }
private static void ExportParameterInDoc(FHXParameter par, Table t, int row) { for (var i = 0; i < 2; i++) { t.Rows[row].Cells[i].SetBorder(TableCellBorderType.Left, new Border(BorderStyle.Tcbs_single, BorderSize.two, 1, Color.Black)); t.Rows[row].Cells[i].SetBorder(TableCellBorderType.Right, new Border(BorderStyle.Tcbs_single, BorderSize.two, 1, Color.Black)); t.Rows[row].Cells[i].SetBorder(TableCellBorderType.Bottom, new Border(BorderStyle.Tcbs_single, BorderSize.two, 1, Color.Black)); t.Rows[row].Cells[i].SetBorder(TableCellBorderType.Top, new Border(BorderStyle.Tcbs_single, BorderSize.two, 1, Color.Black)); } t.Rows[row].Cells[0].Paragraphs.First().Append(par.Name); t.Rows[row].Cells[1].Paragraphs.First().Append(par.Value); }
public static List <FHXReference> Search(FHXParameter parameter, List <FHXParameter> sources) { List <FHXReference> results = new List <FHXReference>(); string dv_path = parameter.DeltaVPath; for (int j = 0; j < sources.Count; j++) { if (sources[j].VariableType == "string" && sources[j] != parameter) { if (sources[j].Value.Contains(dv_path)) { results.Add(new FHXReference("EXTERNAL", parameter, sources[j])); } } } return(results); }
private void BuildModule(FHXObject module, ExcelWorksheet sht, int line) { foreach (var cond in Conditions) { try { FHXParameter p = cond.Value(module); if (p != null) { int col = Columns.Single(i => i.Key == cond.Key).Value; sht.Cells[line, col].Value = p.Value; } } catch (Exception ex) { //Console.WriteLine(ex.Message); } } }
public static FHXCompareResultList CompareObjects(FHXObject a, FHXObject b) { FHXCompareResultList res = new FHXCompareResultList(); List <FHXParameter> psa = a.GetAllParameters(); List <FHXParameter> psb = b.GetAllParameters(); foreach (var pa in psa) { string rpath = pa.RelativePath(a); //Check if b contains the parameter if (psb.Any(i => i.RelativePath(b) == rpath)) { //If it contains it //FHXParameter pb = psb.Single(i => i.RelativePath(b) == rpath); FHXParameter pb = psb.Where(i => i.RelativePath(b) == rpath).ToArray()[0]; if (pa.Value != pb.Value) { res.Add(a, pa, FHXCompareType.DIFFERENT); res.Add(b, pb, FHXCompareType.DIFFERENT); } } else { //If not res.Add(a, pa, FHXCompareType.IN); } } foreach (var pb in psb) { string rpath = pb.RelativePath(b); //Check if b contains the parameter if (!psb.Any(i => i.RelativePath(b) == rpath)) { //If not res.Add(b, pb, FHXCompareType.IN); } } return(res); }
public FHXReference(string type, FHXParameter source, FHXParameter usage) { this.Type = type; this.Source = source; this.Usage = usage; }
public FHXSearchResult(FHXParameter paramSource) { this.ParamSource = paramSource; }
public string GetParameterValue(string name) { FHXParameter p = GetParameter(name); return(p == null ? "" : p.Value); }
public void AddParameter(FHXParameter p) { Parameters.Add(p); p.SetParent(this); }