Esempio n. 1
0
        public static List<FileENT> GetUpdateList()
        {
            List<FileENT> list = new List<FileENT>();

            XmlDocument xml = new XmlDocument();
            xml.Load(AppParameter.LocalUPdateConfig);

            XmlNodeList nodeList = xml.SelectNodes("/updateFiles/file[@version>" + AppParameter.Version + "]");

            FileENT ent = null;
            foreach (XmlNode node in nodeList)
            {
                ent = new FileENT();

                ent.FileFullName = node.Attributes["name"].Value;
                ent.Src = node.Attributes["src"].Value;
                ent.Version = node.Attributes["version"].Value;
                ent.Size =Convert.ToInt32( node.Attributes["size"].Value);
                ent.Option = (UpdateOption)Enum.Parse(typeof(UpdateOption), node.Attributes["option"].Value);

                list.Add(ent);
            }

            return list;
        }
Esempio n. 2
0
        /// <summary>
        /// 执行单个更新
        /// </summary>
        /// <param name="ent"></param>
        /// <returns></returns>
        public bool ExecUpdateItem(FileENT ent)
        {
            bool result = true;

            try
            {

                if (ent.Option == UpdateOption.del)
                    File.Delete(ent.FileFullName);
                else
                    HttpHelper.DownLoadFile(ent.Src, Path.Combine(AppParameter.MainPath, ent.FileFullName));
            }
            catch { result = false; }
            return result;
        }