コード例 #1
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;
            }
        }
コード例 #2
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);
        }
コード例 #3
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);
     }
 }