예제 #1
0
        private void ReadConfig(string path)
        {
            XmlDocument xd       = new XmlDocument();
            string      fileName = path;

            try
            {
                verModle = new VersionModel();
                xd.Load(fileName);

                verModle.LastTime  = xd.SelectSingleNode("//LastUpdateTime").InnerText;
                verModle.Version   = xd.SelectSingleNode("//Version").InnerText;
                verModle.PubNumber = xd.SelectSingleNode("//PubNumber").InnerText;
                XmlNodeList FileList = xd.SelectNodes("//UpdateFileList/File");
                foreach (XmlNode xn in FileList)
                {
                    string      ver       = xn.Attributes["Ver"].Value;
                    string      lasttime  = xn.Attributes["LastTime"].Value;
                    string      name      = xn.Attributes["Name"].Value;
                    string      pubnumber = xn.Attributes["PubNumber"].Value;
                    FileDetails file      = new FileDetails();
                    file.lastime           = lasttime;
                    file.version           = ver;
                    file.pubnumber         = pubnumber;
                    verModle.fileDic[name] = file;
                }
            }
            catch (Exception e)
            {
                LogClass.WriteLogFile("readconfig error:" + e.Message);
            }
        }
예제 #2
0
        private void buttonInitVersion_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("版本初始化将会删掉版本配置文件,确认初始化?", "提示", MessageBoxButtons.OKCancel);

            if (dr == DialogResult.OK)
            {
                if (File.Exists("UpdateVersion.xml"))
                {
                    File.Delete("UpdateVersion.xml");
                }
                verModle = new VersionModel();
            }
        }
예제 #3
0
 public Form1()
 {
     InitializeComponent();
     verModle = new VersionModel();
 }