Exemplo n.º 1
0
        public static void CompareXmlFile(string xml, string xmlRight, bool ignoreNote = true)
        {
            XmlVisitor node1     = XmlFileHelper.CreateFromFile(xml).GetRoot();
            XmlVisitor rightnode = XmlFileHelper.CreateFromFile(xmlRight).GetRoot();

            Console.WriteLine($"now lack implement of CompareXmlFile {xml} {xmlRight}");
        }
Exemplo n.º 2
0
        private void setTextBox(TextBox textBox, string name)
        {
            XmlVisitor root = XmlFileHelper.CreateFromFile(configFile).GetRoot();
            XmlVisitor node = root.FirstChildByPath(name);

            if (null != node)
            {
                textBox.Text = node.Value;
            }
        }
Exemplo n.º 3
0
        private bool Save2Config(TextBox textBox, string nodeName)
        {
            XmlFileHelper configInfo = XmlFileHelper.CreateFromFile(configFile);
            XmlVisitor    root       = configInfo.GetRoot();
            XmlVisitor    compiler   = root.FirstChildByPath(nodeName);

            if (null == compiler)
            {
                root.AppendChild(nodeName, textBox.Text);
            }
            else
            {
                compiler.Value = textBox.Text;
            }
            configInfo.Save2File(configFile);
            return(true);
        }
Exemplo n.º 4
0
        //BMRG-0037
        private Dictionary <string, List <PathInfo> > GetConfigBeacon(string filename)
        {
            Dictionary <string, List <PathInfo> > allBeacons = new Dictionary <string, List <PathInfo> >();

            XmlFileHelper xmlfile = XmlFileHelper.CreateFromFile(filename);

            if (null != xmlfile)
            {
                XmlVisitor        root    = xmlfile.GetRoot();
                List <XmlVisitor> beacons = root.Children().ToList();
                foreach (XmlVisitor node in beacons)
                {
                    string            beaconName = node.GetAttribute("name");
                    List <PathInfo>   list       = new List <PathInfo>();
                    List <XmlVisitor> pathList   = node.Children().ToList();
                    foreach (XmlVisitor up in pathList)
                    {
                        string            pathName  = up.GetAttribute("name");
                        List <PointInfo>  pointList = new List <PointInfo>();
                        List <XmlVisitor> pnList    = up.Children().ToList();
                        foreach (XmlVisitor pn in pnList)
                        {
                            string ptName = pn.GetAttribute("name");
                            int    id     = DataOpr.Xmlvalue2Int(pn, "id");
                            Point  point  = (Point)Sys.GetNode(id, Sydb.pointInfoList.Cast <Basic>().ToList());
                            string pos    = pn.FirstChildByPath("position").Value;
                            string orit   = pn.FirstChildByPath("orientation_in_route").Value;
                            if (orit == Sys.Convergent || orit == Sys.Divergent)
                            {
                                PointInfo info = new PointInfo(point, pos, orit, true);
                                pointList.Add(info);
                            }
                            else
                            {
                                //log error
                            }
                        }
                        PathInfo path = new PathInfo(pathName, pointList);
                        list.Add(path);
                    }
                    allBeacons.Add(beaconName, list);
                }
            }
            return(allBeacons);
        }
Exemplo n.º 5
0
 public bool Init(string bmvFile)
 {
     if (Option.LEURF == this.option)
     {
         try
         {
             XmlFileHelper xmlfile = XmlFileHelper.CreateFromFile(bmvFile);
             xmlBMVInfo = xmlfile.GetRoot();
         }
         catch (System.Exception ex)
         {
             logMsg = "Read block mode variant file error, please check!";
             WriteLog(logMsg, LogManager.Level.Error);
             return(false);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 6
0
 public bool Init(string file1, string file2)
 {
     if (Option.BEACON == this.option)
     {
         try
         {
             XmlFileHelper xmlfile = XmlFileHelper.CreateFromFile(file1);
             XmlVisitor    root    = xmlfile.GetRoot();
             xmlBeaconInfo = root.FirstChildByPath("Beacons");
         }
         catch (System.Exception ex)
         {
             logMsg = "Read beacon layout file error, please check!";
             WriteLog(logMsg, LogManager.Level.Error);
             return(false);
         }
         this.balComPath = file2;
         return(true);
     }
     else if (Option.BMV == this.option)
     {
         XmlFileHelper xmlfile = null;
         try
         {
             xmlfile = XmlFileHelper.CreateFromFile(file1);
             XmlVisitor root = xmlfile.GetRoot();
             xmlBeaconInfo = root.FirstChildByPath("Beacons");
         }
         catch (System.Exception ex)
         {
             logMsg = "Read beacon layout file error, please check!";
             WriteLog(logMsg, LogManager.Level.Error);
             return(false);
         }
         try
         {
             xmlfile     = XmlFileHelper.CreateFromFile(file2);
             xmlSyDBInfo = xmlfile.GetRoot();
         }
         catch (System.Exception ex)
         {
             logMsg = "Read system database file error, please check!";
             WriteLog(logMsg, LogManager.Level.Error);
             return(false);
         }
         return(true);
     }
     else if (Option.LEUXML == this.option)
     {
         XmlFileHelper xmlfile = null;
         try
         {
             xmlfile      = XmlFileHelper.CreateFromFile(file1);
             xmlLEURFInfo = xmlfile.GetRoot();
         }
         catch (System.Exception ex)
         {
             logMsg = "Read LEU Result Filtered Value file error, please check!";
             WriteLog(logMsg, LogManager.Level.Error);
             return(false);
         }
         try
         {
             xmlfile      = XmlFileHelper.CreateFromFile(file2);
             xmlLEUTFInfo = xmlfile.GetRoot();
         }
         catch (System.Exception ex)
         {
             logMsg = "Read LEU XML Template file error, please check!";
             WriteLog(logMsg, LogManager.Level.Error);
             return(false);
         }
         return(true);
     }
     else if (Option.LEUBIN == this.option)
     {
         this.leuFilesDir = file1;
         this.leuComPath  = file2;
         return(true);
     }
     else
     {
         logMsg = "The option does not match the input files, please check!";
         WriteLog(logMsg, LogManager.Level.Error);
         return(false);
     }
 }
Exemplo n.º 7
0
        public Restriction(string xmlfullname)
        {
            XmlFileHelper f = XmlFileHelper.CreateFromFile(xmlfullname);

            root = f.GetRoot();
        }