Exemplo n.º 1
0
        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++;
            }
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 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);
         }
     }
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 public FHXReference(string type, FHXParameter source, FHXParameter usage)
 {
     this.Type   = type;
     this.Source = source;
     this.Usage  = usage;
 }
Exemplo n.º 8
0
 public FHXSearchResult(FHXParameter paramSource)
 {
     this.ParamSource = paramSource;
 }
Exemplo n.º 9
0
        public string GetParameterValue(string name)
        {
            FHXParameter p = GetParameter(name);

            return(p == null ? "" : p.Value);
        }
Exemplo n.º 10
0
 public void AddParameter(FHXParameter p)
 {
     Parameters.Add(p);
     p.SetParent(this);
 }