Exemple #1
0
        public int CheckForUpdate()
        {
            string text = Application.StartupPath + "\\UpdateList.xml";
            int    result;

            if (!File.Exists(text))
            {
                result = -1;
            }
            else
            {
                XmlFiles xmlFiles = new XmlFiles(text);
                string   text2    = Environment.GetEnvironmentVariable("Temp") + "\\_" + xmlFiles.FindNode("//Application").Attributes["applicationId"].Value + "_y_x_m_\\";
                this.UpdaterUrl = xmlFiles.GetNodeValue("//Url") + "/UpdateList.xml";
                this.DownAutoUpdateFile(text2);
                string text3 = text2 + "\\UpdateList.xml";
                if (!File.Exists(text3))
                {
                    result = -1;
                }
                else
                {
                    XmlFiles    xmlFiles2 = new XmlFiles(text3);
                    XmlFiles    xmlFiles3 = new XmlFiles(text);
                    XmlNodeList nodeList  = xmlFiles2.GetNodeList("AutoUpdater/Files");
                    XmlNodeList nodeList2 = xmlFiles3.GetNodeList("AutoUpdater/Files");
                    int         num       = 0;
                    for (int i = 0; i < nodeList.Count; i++)
                    {
                        string[]  array     = new string[3];
                        string    text4     = nodeList.Item(i).Attributes["Name"].Value.Trim();
                        string    text5     = nodeList.Item(i).Attributes["Ver"].Value.Trim();
                        ArrayList arrayList = new ArrayList();
                        for (int j = 0; j < nodeList2.Count; j++)
                        {
                            string value  = nodeList2.Item(j).Attributes["Name"].Value.Trim();
                            string value2 = nodeList2.Item(j).Attributes["Ver"].Value.Trim();
                            arrayList.Add(value);
                            arrayList.Add(value2);
                        }
                        int num2 = arrayList.IndexOf(text4);
                        if (num2 == -1)
                        {
                            array[0] = text4;
                            array[1] = text5;
                            num++;
                        }
                        else if (num2 > -1 && text5.CompareTo(arrayList[num2 + 1].ToString()) > 0)
                        {
                            array[0] = text4;
                            array[1] = text5;
                            num++;
                        }
                    }
                    result = num;
                }
            }
            return(result);
        }
        /// <summary>
        /// �������ļ�
        /// </summary>
        /// <param name="serverXmlFile"></param>
        /// <param name="localXmlFile"></param>
        /// <param name="updateFileList"></param>
        /// <returns></returns>
        public int CheckForUpdate(string serverXmlFile,string localXmlFile,out Hashtable updateFileList)
        {
            updateFileList = new Hashtable();
            if(!File.Exists(localXmlFile) || !File.Exists(serverXmlFile))
            {
                return -1;
            }

            XmlFiles serverXmlFiles = new XmlFiles(serverXmlFile);
            XmlFiles localXmlFiles = new XmlFiles(localXmlFile);

            XmlNodeList newNodeList = serverXmlFiles.GetNodeList("AutoUpdater/Files");
            XmlNodeList oldNodeList = localXmlFiles.GetNodeList("AutoUpdater/Files");//5+1+a+s+p+x

            int k = 0;
            for(int i = 0;i < newNodeList.Count;i++)
            {
                string [] fileList = new string[4];

                string newFileName = newNodeList.Item(i).Attributes["Name"].Value.Trim();
                string newVer = newNodeList.Item(i).Attributes["Ver"].Value.Trim();
                string newUpdateTxt = newNodeList.Item(i).Attributes["UpdateTxt"].Value.Trim();

                ArrayList oldFileAl = new ArrayList();
                for(int j = 0;j < oldNodeList.Count;j++)
                {
                    string oldFileName = oldNodeList.Item(j).Attributes["Name"].Value.Trim();
                    string oldVer = oldNodeList.Item(j).Attributes["Ver"].Value.Trim();
                    string oldUpdateTxt = oldNodeList.Item(j).Attributes["UpdateTxt"].Value.Trim();

                    oldFileAl.Add(oldFileName);
                    oldFileAl.Add(oldVer);

                }
                int pos = oldFileAl.IndexOf(newFileName);
                if(pos == -1)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    fileList[3] = newUpdateTxt;
                    updateFileList.Add(k,fileList);
                    k++;
                }
                else if(pos > -1 && newVer.CompareTo(oldFileAl[pos+1].ToString())>0 )
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    fileList[3] = newUpdateTxt;
                    updateFileList.Add(k,fileList);
                    k++;
                }

            }
            return k;
        }
Exemple #3
0
        /// <summary>
        /// 检查更新文件
        /// </summary>
        /// <param name="serverXmlFile"></param>
        /// <param name="localXmlFile"></param>
        /// <param name="updateFileList"></param>
        /// <returns></returns>
        public int CheckForUpdate(string serverXmlFile, string localXmlFile, out Hashtable updateFileList)
        {
            updateFileList = new Hashtable();
            if (!File.Exists(localXmlFile) || !File.Exists(serverXmlFile))
            {
                return(-1);
            }

            XmlFiles serverXmlFiles = new XmlFiles(serverXmlFile);
            XmlFiles localXmlFiles  = new XmlFiles(localXmlFile);

            XmlNodeList newNodeList = serverXmlFiles.GetNodeList("AutoUpdater/Files");
            XmlNodeList oldNodeList = localXmlFiles.GetNodeList("AutoUpdater/Files");            //5+1+a+s+p+x

            int k = 0;

            for (int i = 0; i < newNodeList.Count; i++)
            {
                string [] fileList = new string[4];

                string newFileName  = newNodeList.Item(i).Attributes["Name"].Value.Trim();
                string newVer       = newNodeList.Item(i).Attributes["Ver"].Value.Trim();
                string newUpdateTxt = newNodeList.Item(i).Attributes["UpdateTxt"].Value.Trim();

                ArrayList oldFileAl = new ArrayList();
                for (int j = 0; j < oldNodeList.Count; j++)
                {
                    string oldFileName  = oldNodeList.Item(j).Attributes["Name"].Value.Trim();
                    string oldVer       = oldNodeList.Item(j).Attributes["Ver"].Value.Trim();
                    string oldUpdateTxt = oldNodeList.Item(j).Attributes["UpdateTxt"].Value.Trim();

                    oldFileAl.Add(oldFileName);
                    oldFileAl.Add(oldVer);
                }
                int pos = oldFileAl.IndexOf(newFileName);
                if (pos == -1)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    fileList[3] = newUpdateTxt;
                    updateFileList.Add(k, fileList);
                    k++;
                }
                else if (pos > -1 && newVer.CompareTo(oldFileAl[pos + 1].ToString()) > 0)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    fileList[3] = newUpdateTxt;
                    updateFileList.Add(k, fileList);
                    k++;
                }
            }
            return(k);
        }
Exemple #4
0
        public int CheckForUpdate(string serverXmlFile, string localXmlFile, out Hashtable updateFileList)
        {
            updateFileList = new Hashtable();
            int result;

            if (!File.Exists(localXmlFile) || !File.Exists(serverXmlFile))
            {
                result = -1;
            }
            else
            {
                XmlFiles    xmlFiles  = new XmlFiles(serverXmlFile);
                XmlFiles    xmlFiles2 = new XmlFiles(localXmlFile);
                XmlNodeList nodeList  = xmlFiles.GetNodeList("AutoUpdater/Files");
                XmlNodeList nodeList2 = xmlFiles2.GetNodeList("AutoUpdater/Files");
                int         num       = 0;
                for (int i = 0; i < nodeList.Count; i++)
                {
                    string[]  array     = new string[3];
                    string    text      = nodeList.Item(i).Attributes["Name"].Value.Trim();
                    string    text2     = nodeList.Item(i).Attributes["Ver"].Value.Trim();
                    ArrayList arrayList = new ArrayList();
                    for (int j = 0; j < nodeList2.Count; j++)
                    {
                        string value  = nodeList2.Item(j).Attributes["Name"].Value.Trim();
                        string value2 = nodeList2.Item(j).Attributes["Ver"].Value.Trim();
                        arrayList.Add(value);
                        arrayList.Add(value2);
                    }
                    int num2 = arrayList.IndexOf(text);
                    if (num2 == -1)
                    {
                        array[0] = text;
                        array[1] = text2;
                        updateFileList.Add(num, array);
                        num++;
                    }
                    else if (num2 > -1 && text2.CompareTo(arrayList[num2 + 1].ToString()) > 0)
                    {
                        array[0] = text;
                        array[1] = text2;
                        updateFileList.Add(num, array);
                        num++;
                    }
                }
                result = num;
            }
            return(result);
        }
Exemple #5
0
        /// <summary>
        /// 根据版本信息,下载相应版本的Config.xml文件
        /// </summary>
        /// <param name="list"></param>
        protected void DownloadVersion()
        {
            try
            {
                _appUpdate.ServerVersions.Sort();
                int precent = 0;
                int count   = 0;//记录总的文件数量
                int total   = _appUpdate.ServerVersions.Count;
                foreach (Version v in _appUpdate.ServerVersions)
                {
                    precent++;
                    string serverconfigurl = _appUpdate.LocalVersion.ServerUrl;
                    serverconfigurl += serverconfigurl.EndsWith("/") ? v.ValueVersion.ToString() : "/" + v.ValueVersion;
                    serverconfigurl += "/Config.xml";
                    string localconfigpath = _appUpdate.LocalFileDir;
                    localconfigpath += localconfigpath.EndsWith("\\") ? v.ValueVersion.ToString() : "\\" + v.ValueVersion;
                    localconfigpath += "\\Config.xml";
                    CreateDirtory(localconfigpath);

                    try
                    {
                        _appUpdate.DownloadFile(serverconfigurl, localconfigpath);
                    }
                    catch (System.Net.WebException webex)
                    {
                        string msg = "下载[" + v.StrVersion + "]版本配置文件Config.xml失败!" + serverconfigurl + Environment.NewLine + webex.Message;
                        LogHelper.WriteLog(msg);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.WriteLog(ex);
                    }
                    if (System.IO.File.Exists(localconfigpath))
                    {
                        XmlFiles    xmlconfigfile = new XmlFiles(localconfigpath);
                        XmlNodeList filenodes     = xmlconfigfile.GetNodeList("//File");
                        count += filenodes == null ? 0 : filenodes.Count;
                    }

                    VersionProgressChanged(precent);
                }
                VersionProgressComplete(count);
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex);
            }
        }
        /// <summary>
        /// 获取更新内容
        /// 2016年12月28日 wenj
        /// </summary>
        /// <param name="serverXmlFile"></param>
        /// <returns>返回内容集合</returns>
        public string[] GetUpdateNotes(string serverXmlFile)
        {
            if (!File.Exists(serverXmlFile))
            {
                return(null);
            }

            XmlFiles    serverXmlFiles = new XmlFiles(serverXmlFile);
            XmlNodeList newNodeList    = serverXmlFiles.GetNodeList("AutoUpdater/UpdateNotes");

            if (newNodeList.Count > 0)
            {
                string[] rtnList = new string[newNodeList.Count];
                for (int i = 0; i < newNodeList.Count; i++)
                {
                    string note = newNodeList.Item(i).Attributes["Note"].Value.Trim();
                    rtnList[i] = note;
                }
                return(rtnList);
            }
            return(null);
        }
Exemple #7
0
        /// <summary>
        /// �������ļ�
        /// </summary>
        /// <param name="serverXmlFile"></param>
        /// <param name="localXmlFile"></param>
        /// <param name="updateFileList"></param>
        /// <returns></returns>
        public int CheckForUpdate()
        {
            string localXmlFile = Application.StartupPath + "\\UpdateList.xml";
            if(!File.Exists(localXmlFile))
            {
                return -1;
            }

            XmlFiles updaterXmlFiles = new XmlFiles(localXmlFile );

            string tempUpdatePath = Environment.GetEnvironmentVariable("Temp") + "\\"+ "_"+ updaterXmlFiles.FindNode("//Application").Attributes["applicationId"].Value+"_"+"y"+"_"+"x"+"_"+"m"+"_"+"\\";
            this.UpdaterUrl = updaterXmlFiles.GetNodeValue("//Url") + "/UpdateList.xml";
            this.DownAutoUpdateFile(tempUpdatePath);

            string serverXmlFile = tempUpdatePath  +"\\UpdateList.xml";
            if(!File.Exists(serverXmlFile))
            {
                return -1;
            }

            XmlFiles serverXmlFiles = new XmlFiles(serverXmlFile);
            XmlFiles localXmlFiles = new XmlFiles(localXmlFile);

            XmlNodeList newNodeList = serverXmlFiles.GetNodeList("AutoUpdater/Files");
            XmlNodeList oldNodeList = localXmlFiles.GetNodeList("AutoUpdater/Files");

            int k = 0;
            for(int i = 0;i < newNodeList.Count;i++)
            {
                string [] fileList = new string[3];

                string newFileName = newNodeList.Item(i).Attributes["Name"].Value.Trim();
                string newVer = newNodeList.Item(i).Attributes["Ver"].Value.Trim();

                ArrayList oldFileAl = new ArrayList();
                for(int j = 0;j < oldNodeList.Count;j++)
                {
                    string oldFileName = oldNodeList.Item(j).Attributes["Name"].Value.Trim();
                    string oldVer = oldNodeList.Item(j).Attributes["Ver"].Value.Trim();

                    oldFileAl.Add(oldFileName);
                    oldFileAl.Add(oldVer);

                }
                int pos = oldFileAl.IndexOf(newFileName);
                if(pos == -1)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    k++;
                }
                else if(pos > -1 && newVer.CompareTo(oldFileAl[pos+1].ToString())>0 )
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    k++;
                }

            }
            return k;
        }
Exemple #8
0
        /// <summary>
        /// 下载文件列表
        /// </summary>
        protected void DownloadFiles()
        {
            try
            {
                string serverUrl = _appUpdate.LocalVersion.ServerUrl;
                serverUrl += serverUrl.EndsWith("/") ? "" : "/";
                string localDir = _appUpdate.LocalFileDir;
                localDir += localDir.EndsWith("\\") ? "" : "\\";

                //foreach (Version v in _appUpdate.ServerVersions)
                for (int i = 0; i < _appUpdate.ServerVersions.Count; i++)
                {
                    Version v = _appUpdate.ServerVersions[i];
                    string  localconfigpath = localDir;
                    localconfigpath += v.ValueVersion + "\\Config.xml";
                    if (false == System.IO.File.Exists(localconfigpath))
                    {
                        continue;
                    }

                    XmlFiles    xmlconfigfile = new XmlFiles(localconfigpath);
                    XmlNodeList filenodes     = xmlconfigfile.GetNodeList("//File");
                    if (filenodes == null || filenodes.Count < 1)
                    {
                        continue;
                    }

                    List <FileModel> fileList = new List <FileModel>();
                    foreach (XmlNode node in filenodes)
                    {
                        try
                        {
                            FileModel model = new FileModel();

                            model.FileName     = Path.GetFileName(node.Attributes["Name"].Value);
                            model.FileUri      = serverUrl + v.ValueVersion + "/" + node.Attributes["Name"].Value;
                            model.TempPath     = localDir + v.ValueVersion + "\\" + node.Attributes["Name"].Value.Replace("/", "\\");
                            model.FileVersion  = v.StrVersion;
                            model.VersionValue = v.ValueVersion;
                            fileList.Add(model);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteException(ex);
                        }
                    }

                    bool isDownOk = DownloadFiles(v, fileList);
                    if (isDownOk == false)
                    {
                        continue;
                    }

                    string localVersionDir = localDir;
                    localVersionDir += localVersionDir.EndsWith("\\") ? v.ValueVersion.ToString() : "\\" + v.ValueVersion;
                    if (CheckMainAppIsRun())
                    {
                        KillMainApp();
                    }
                    CopyFile(localVersionDir, Application.StartupPath);
                    UpdateLocalXml(v.StrVersion, v.ValueVersion.ToString(), _appUpdate.NewVersion.ServerUrl, _appUpdate.NewVersion.EntryPoint);

                    //检测到是自我更新,则需要重启应用程序
                    if (CheckSelfUpdate(fileList) && i < _appUpdate.ServerVersions.Count - 1)
                    {
                        Application.Restart();
                        return;
                    }
                }

                StartMainApp();
            }
            catch (Exception ex)
            {
                LogHelper.WriteException(ex);
                Application.Restart();
            }
        }
Exemple #9
0
        /// <summary>
        /// 检查更新文件
        /// </summary>
        /// <param name="serverXmlFile"></param>
        /// <param name="localXmlFile"></param>
        /// <param name="updateFileList"></param>
        /// <returns></returns>
        public int CheckForUpdate()
        {
            string localXmlFile = Application.StartupPath + "\\UpdateList.xml";

            if (!File.Exists(localXmlFile))
            {
                return(-1);
            }

            XmlFiles updaterXmlFiles = new XmlFiles(localXmlFile);


            string tempUpdatePath = Environment.GetEnvironmentVariable("Temp") + "\\" + "_" + updaterXmlFiles.FindNode("//Application").Attributes["applicationId"].Value + "_" + "y" + "_" + "x" + "_" + "m" + "_" + "\\";

            this.UpdaterUrl = updaterXmlFiles.GetNodeValue("//Url") + "/UpdateList.xml";
            this.DownAutoUpdateFile(tempUpdatePath);

            string serverXmlFile = tempUpdatePath + "\\UpdateList.xml";

            if (!File.Exists(serverXmlFile))
            {
                return(-1);
            }

            XmlFiles serverXmlFiles = new XmlFiles(serverXmlFile);
            XmlFiles localXmlFiles  = new XmlFiles(localXmlFile);

            XmlNodeList newNodeList = serverXmlFiles.GetNodeList("AutoUpdater/Files");
            XmlNodeList oldNodeList = localXmlFiles.GetNodeList("AutoUpdater/Files");

            int k = 0;

            for (int i = 0; i < newNodeList.Count; i++)
            {
                string [] fileList = new string[3];

                string newFileName = newNodeList.Item(i).Attributes["Name"].Value.Trim();
                string newVer      = newNodeList.Item(i).Attributes["Ver"].Value.Trim();

                ArrayList oldFileAl = new ArrayList();
                for (int j = 0; j < oldNodeList.Count; j++)
                {
                    string oldFileName = oldNodeList.Item(j).Attributes["Name"].Value.Trim();
                    string oldVer      = oldNodeList.Item(j).Attributes["Ver"].Value.Trim();

                    oldFileAl.Add(oldFileName);
                    oldFileAl.Add(oldVer);
                }
                int pos = oldFileAl.IndexOf(newFileName);
                if (pos == -1)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    k++;
                }
                else if (pos > -1 && newVer.CompareTo(oldFileAl[pos + 1].ToString()) != 0)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    k++;
                }
            }
            return(k);
        }
 private Dictionary<string, string[]> GetOldFileVersions(string localfile)
 {
     Dictionary<string, string[]> dictionary = new Dictionary<string, string[]>();
     if (File.Exists(localfile))
     {
         try
         {
             XmlFiles files = new XmlFiles(localfile);
             foreach (XmlNode node in files.GetNodeList("Component"))
             {
                 if (node.Name == "Files")
                 {
                     foreach (XmlNode node2 in node.ChildNodes)
                     {
                         if (node2.Name == "File")
                         {
                             string key = node2.Attributes["Name"].Value.Trim();
                             string str2 = node2.Attributes["Ver"].Value.Trim();
                             string str3 = string.Empty;
                             try
                             {
                                 str3 = node2.Attributes["Checksum"].Value.Trim();
                             }
                             catch
                             {
                             }
                             dictionary.Add(key, new string[] { str2, str3 });
                         }
                     }
                     continue;
                 }
             }
         }
         catch (Exception exception)
         {
             this.WriteErrLog(string.Format("解析“{0}”出错,请检查问题后再重新上传该组件:{1}", localfile, exception.Message));
             throw exception;
         }
     }
     return dictionary;
 }
Exemple #11
0
        /// <summary>
        /// 检查更新文件
        /// </summary>
        /// <param name="serverXmlFile">从服务器下载的配置文件</param>
        /// <param name="localXmlFile">本地的配置文件</param>
        /// <param name="updateFileList">更新的文件列表</param>
        /// <returns></returns>
        public int CheckForUpdate(string serverXmlFile, string localXmlFile, out Hashtable updateFileList)
        {
            updateFileList = new Hashtable();
            if (!File.Exists(localXmlFile) || !File.Exists(serverXmlFile))
            {
                return(-1);
            }

            XmlFiles serverXmlFiles = new XmlFiles(serverXmlFile);
            XmlFiles localXmlFiles  = new XmlFiles(localXmlFile);

            XmlNodeList newNodeList = serverXmlFiles.GetNodeList("AutoUpdater/Files");
            XmlNodeList oldNodeList = localXmlFiles.GetNodeList("AutoUpdater/Files");
            //ArrayList oldFileAl = new ArrayList();
            //for (int j = 0; j < oldNodeList.Count; j++)
            //{
            //    string oldFileName = oldNodeList.Item(j).Attributes["Name"].Value.Trim();
            //    string oldVer = oldNodeList.Item(j).Attributes["Ver"].Value.Trim();

            //    oldFileAl.Add(oldFileName);
            //    oldFileAl.Add(oldVer);

            //}
            Hashtable oldFileAl = new Hashtable();

            for (int j = 0; j < oldNodeList.Count; j++)
            {
                string oldFileName = oldNodeList.Item(j).Attributes["Name"].Value.Trim();
                string oldVer      = oldNodeList.Item(j).Attributes["Ver"].Value.Trim();

                oldFileAl.Add(oldFileName, oldVer);
            }
            int k = 0;

            for (int i = 0; i < newNodeList.Count; i++)
            {
                string[] fileList = new string[2];

                string newFileName = newNodeList.Item(i).Attributes["Name"].Value.Trim();
                string newVer      = newNodeList.Item(i).Attributes["Ver"].Value.Trim();

                //int pos = oldFileAl.IndexOf(newFileName);
                //if (pos == -1)
                //{
                //    fileList[0] = newFileName;
                //    fileList[1] = newVer;
                //    updateFileList.Add(k, fileList);
                //    k++;
                //}
                //else if (pos > -1 && newVer.CompareTo(oldFileAl[pos ].ToString()) < 0)
                //{
                //    fileList[0] = newFileName;
                //    fileList[1] = newVer;
                //    updateFileList.Add(k, fileList);
                //    k++;
                //}

                bool b = oldFileAl.Contains(newFileName);
                if (b == false)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    updateFileList.Add(k, fileList);
                    k++;
                }
                else if (b == true && newVer.CompareTo(oldFileAl[newFileName].ToString()) > 0)
                {
                    fileList[0] = newFileName;
                    fileList[1] = newVer;
                    updateFileList.Add(k, fileList);
                    k++;
                }
            }
            return(k);
        }
Exemple #12
0
 public int CheckForUpdate(string temppath, string serverXmlFile, string localXmlFile, out List<string[]> updateFileList)
 {
     updateFileList = new List<string[]>();
     if (!System.IO.File.Exists(localXmlFile) || !System.IO.File.Exists(serverXmlFile))
     {
         return -1;
     }
     XmlFiles files = new XmlFiles(serverXmlFile);
     XmlFiles files2 = new XmlFiles(localXmlFile);
     XmlNodeList nodeList = files.GetNodeList("AutoUpdater/Components");
     XmlNodeList list2 = files2.GetNodeList("AutoUpdater/Components");
     Dictionary<string, XmlNode> dictionary = new Dictionary<string, XmlNode>(list2.Count);
     string[] commandLineArgs = Environment.GetCommandLineArgs();
     if (((commandLineArgs == null) || (commandLineArgs.Length <= 1)) || (commandLineArgs[1].ToLower() != "true"))
     {
         for (int j = 0; j < list2.Count; j++)
         {
             dictionary.Add(list2.Item(j).Attributes["Name"].Value.Trim(), list2[j]);
         }
     }
     int num2 = 0;
     bool result = false;
     try
     {
         string nodeValue = files.GetNodeValue("//reset");
         if (!string.IsNullOrEmpty(nodeValue))
         {
             bool.TryParse(nodeValue, out result);
         }
     }
     catch
     {
     }
     Dictionary<string, bool> dictionary2 = new Dictionary<string, bool>();
     for (int i = nodeList.Count - 1; i >= 0; i--)
     {
         XmlNode node = nodeList[i];
         string componentName = node.Attributes["Name"].Value.Trim();
         string updateUrl = node.Attributes["Url"].Value.Trim();
         string path = this.DownAutoUpdateFile(temppath, componentName, updateUrl);
         string str5 = Path.Combine(Environment.CurrentDirectory, string.Format("{0}component.xml", componentName));
         if (!System.IO.File.Exists(path))
         {
             MessageBox.Show("找不到文件:" + path);
         }
         XmlNode node2 = null;
         if (!System.IO.File.Exists(str5))
         {
             foreach (XmlNode node3 in list2)
             {
                 if (node3.Attributes["Name"].Value.Trim() == componentName)
                 {
                     foreach (XmlNode node4 in node3.ChildNodes)
                     {
                         if (node4.Name == "Files")
                         {
                             node2 = node4;
                             break;
                         }
                     }
                     break;
                 }
             }
         }
         else
         {
             XmlFiles files3 = new XmlFiles(str5);
             foreach (XmlNode node5 in files3.GetNodeList("Component"))
             {
                 if (node5.Name == "Files")
                 {
                     node2 = node5;
                     break;
                 }
             }
         }
         XmlFiles files4 = new XmlFiles(path);
         foreach (XmlNode node6 in files4.GetNodeList("Component"))
         {
             if (!(node6.Name == "Files"))
             {
                 continue;
             }
             bool flag2 = dictionary.ContainsKey(componentName);
             Dictionary<string, string> dictionary3 = new Dictionary<string, string>();
             if (flag2 && (node2 != null))
             {
                 foreach (XmlNode node7 in node2.ChildNodes)
                 {
                     if (node7.Name == "File")
                     {
                         if (!dictionary3.ContainsKey(node7.Attributes["Name"].Value.Trim()))
                         {
                             dictionary3.Add(node7.Attributes["Name"].Value.Trim(), node7.Attributes["Ver"].Value.Trim());
                         }
                         else
                         {
                             MessageBox.Show(string.Format("包含重复的升级项目文件:{0},系统将忽略!", node7.Attributes["Name"].Value.Trim()));
                         }
                     }
                 }
             }
             foreach (XmlNode node8 in node6.ChildNodes)
             {
                 if (!(node8.Name == "File"))
                 {
                     continue;
                 }
                 string[] item = new string[5];
                 string key = node8.Attributes["Name"].Value.Trim();
                 string str7 = node8.Attributes["Ver"].Value.Trim();
                 if (!dictionary3.ContainsKey(key) || (dictionary3.ContainsKey(key) && ((str7.CompareTo(dictionary3[key]) > 0) || (result && (str7.CompareTo(dictionary3[key]) < 0)))))
                 {
                     item[0] = key;
                     item[1] = str7;
                     item[3] = updateUrl;
                     if (!dictionary3.ContainsKey(key) || (str7.CompareTo(dictionary3[key]) > 0))
                     {
                         item[4] = key;
                     }
                     else
                     {
                         item[4] = key + str7;
                     }
                     if (!dictionary2.ContainsKey(key))
                     {
                         updateFileList.Add(item);
                         dictionary2.Add(key, true);
                     }
                     num2++;
                 }
             }
         }
     }
     return num2;
 }