Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    //合并升级信息
                    MergeUpgradeInfo();
                    //获取官方升级版本列表,并存放到本地upgrade/versionlist.config中
                    AutoUpdate   autoUpdate  = new AutoUpdate();
                    string       fileContnet = autoUpdate.GetVersionList();
                    StreamWriter writer      = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
                    writer.Write(fileContnet.Replace("\n", "\r\n"));
                    writer.Close();
                    //取本地更新版本号与官方的最新版本号比较,如果官方有更新,则提示有升级
                    XmlDocument lastupdate = new XmlDocument();
                    lastupdate.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
                    //DateTime build = StrToDateTime(lastupdate.SelectSingleNode("/localupgrade/optionalupgrade/item").InnerText);
                    XmlNodeList local         = lastupdate.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item");
                    XmlDocument currentupdate = new XmlDocument();
                    currentupdate.LoadXml(fileContnet);
                    XmlNodeList service = currentupdate.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item");
                    int         i       = 0;

                    string script = "";
                    foreach (XmlNode serviceitem in service)
                    {
                        bool exist = false;
                        foreach (XmlNode localitem in local)
                        {
                            if (serviceitem.FirstChild.InnerText == localitem.InnerText)
                            {
                                exist = true;
                                break;
                            }
                        }
                        if (!exist)
                        {
                            isNew      = true;
                            info.Text += "<input type='checkbox' value='" + serviceitem["version"].InnerText + "' id='checkbox" + i + "' checked='checked'><label for='checkbox" + i + "'>" + serviceitem["versiondescription"].InnerText + "</label>";
                            info.Text += "<p style='border: 1px dotted rgb(219, 221, 211); background: rgb(255, 255, 204);font-size:12px;padding:0px 0px 0px 15px;'>" + serviceitem["description"].InnerText + "</p>";
                            script    += "{\"version\":\"" + serviceitem["version"].InnerText + "\",\"versiondescription\":\"" + serviceitem["versiondescription"].InnerText + "\",\"link\":\"" + serviceitem["link"].InnerText + "\"},";
                            i++;
                        }
                    }
                    if (!isNew)
                    {
                        info.Text = "暂无更新";
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>var versionList = [" + script.TrimEnd(',') + "]</script>");
                    }
                }
                catch
                {
                    info.Text = "升级发生异常,请稍后再试……";
                }
            }
        }
Пример #2
0
 private void LoadUpgradeInfo()
 {
     if (!base.IsPostBack)
     {
         try
         {
             this.MergeUpgradeInfo();
             AutoUpdate   autoUpdate   = new AutoUpdate();
             string       versionList  = autoUpdate.GetVersionList();
             StreamWriter streamWriter = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
             streamWriter.Write(versionList.Replace("\n", "\r\n"));
             streamWriter.Close();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
             DateTime    t            = this.StrToDateTime(xmlDocument.SelectSingleNode("/localupgrade/requiredupgrade").InnerText);
             XmlDocument xmlDocument2 = new XmlDocument();
             xmlDocument2.LoadXml(versionList);
             XmlNodeList xmlNodeList = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/requiredupgrade/item");
             XmlNode     xmlNode     = xmlNodeList.Item(xmlNodeList.Count - 1);
             DateTime    t2          = this.StrToDateTime(xmlNode["version"].InnerText);
             this.isNew = (t2 > t);
             if (this.isNew)
             {
                 this.upgradeInfo = "<span style='font-size:16px;'>检测到最新版本:" + xmlNode["versiondescription"].InnerText + "</span><br /><span style='padding:3px 0px 3px 10px;display:block;'>" + xmlNode["description"].InnerText + "</span>";
             }
             XmlNodeList xmlNodeList2 = xmlDocument.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.Version + "/item");
             XmlNodeList xmlNodeList3 = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.Version + "/item");
             string      text         = "";
             foreach (XmlNode xmlNode2 in xmlNodeList3)
             {
                 bool flag = false;
                 foreach (XmlNode xmlNode3 in xmlNodeList2)
                 {
                     if (xmlNode2.FirstChild.InnerText == xmlNode3.InnerText)
                     {
                         flag = true;
                         break;
                     }
                 }
                 if (!flag)
                 {
                     this.isHotFix = true;
                     text          = text + xmlNode2["versiondescription"].InnerText + "<br />";
                 }
             }
             if (text != "")
             {
                 this.upgradeInfo = this.upgradeInfo + "<span style='font-size:16px;'>检测到最新补丁:</span><br /><span style='padding:3px 0px 3px 10px;display:block;'>" + text + "</span>";
             }
             if (this.isNew || this.isHotFix)
             {
                 base.RegisterStartupScript("", "<script type='text/javascript'>\r\nshowInfo();\r\n</script>\r\n");
             }
         }
         catch
         {
         }
     }
 }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         try
         {
             this.MergeUpgradeInfo();
             AutoUpdate   autoUpdate   = new AutoUpdate();
             string       versionList  = autoUpdate.GetVersionList();
             StreamWriter streamWriter = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
             streamWriter.Write(versionList.Replace("\n", "\r\n"));
             streamWriter.Close();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
             XmlNodeList xmlNodeList  = xmlDocument.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.Version + "/item");
             XmlDocument xmlDocument2 = new XmlDocument();
             xmlDocument2.LoadXml(versionList);
             XmlNodeList xmlNodeList2 = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.Version + "/item");
             int         num          = 0;
             string      text         = "";
             foreach (XmlNode xmlNode in xmlNodeList2)
             {
                 bool flag = false;
                 foreach (XmlNode xmlNode2 in xmlNodeList)
                 {
                     if (xmlNode.FirstChild.InnerText == xmlNode2.InnerText)
                     {
                         flag = true;
                         break;
                     }
                 }
                 if (!flag)
                 {
                     this.isNew = true;
                     Label  expr_188 = this.info;
                     object text2    = expr_188.Text;
                     expr_188.Text = text2 + "<input type='checkbox' value='" + xmlNode["version"].InnerText + "' id='checkbox" + num + "' checked='checked'><label for='checkbox" + num + "'>" + xmlNode["versiondescription"].InnerText + "</label>";
                     Label expr_21F = this.info;
                     expr_21F.Text = expr_21F.Text + "<p style='border: 1px dotted rgb(219, 221, 211); background: rgb(255, 255, 204);font-size:12px;padding:0px 0px 0px 15px;'>" + xmlNode["description"].InnerText + "</p>";
                     string text3 = text;
                     text = text3 + "{\"version\":\"" + xmlNode["version"].InnerText + "\",\"versiondescription\":\"" + xmlNode["versiondescription"].InnerText + "\",\"link\":\"" + xmlNode["link"].InnerText + "\"},";
                     num++;
                 }
             }
             if (!this.isNew)
             {
                 this.info.Text = "暂无更新";
             }
             else
             {
                 base.RegisterStartupScript("", "<script>var versionList = [" + text.TrimEnd(',') + "]</script>");
             }
         }
         catch
         {
             this.info.Text = "升级发生异常,请稍后再试……";
         }
     }
 }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             //合并升级信息
             MergeUpgradeInfo();
             //获取官方升级版本列表,并存放到本地upgrade/versionlist.config中
             AutoUpdate   autoUpdate  = new AutoUpdate();
             string       fileContnet = autoUpdate.GetVersionList();
             StreamWriter writer      = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
             writer.Write(fileContnet.Replace("\n", "\r\n"));
             writer.Close();
             //取本地更新版本号与官方的最新版本号比较,如果官方有更新,则提示有升级
             XmlDocument lastupdate = new XmlDocument();
             lastupdate.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
             DateTime    build         = StrToDateTime(lastupdate.SelectSingleNode("/localupgrade/requiredupgrade").InnerText);
             XmlDocument currentupdate = new XmlDocument();
             currentupdate.LoadXml(fileContnet);
             XmlNodeList items    = currentupdate.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/requiredupgrade/item");
             XmlNode     lastItem = items.Item(items.Count - 1);
             DateTime    version  = StrToDateTime(lastItem["version"].InnerText);
             isNew = version > build;
             if (isNew)
             {
                 info.Text = "<span style='font-size:20px;padding:0px 0px 15px 0px;display:block;'>检测到最新版本:" + lastItem["versiondescription"].InnerText + "</span>" +
                             "<div style='border: 1px dotted rgb(219, 221, 211);background: #FFFFCC'>" + lastItem["description"].InnerText + "</div>";
                 string script = "var versionList = [";
                 foreach (XmlNode item in items)
                 {
                     if (StrToDateTime(item.FirstChild.InnerText) > build)
                     {
                         script += "{\"version\":\"" + item["version"].InnerText + "\",\"versiondescription\":\"" + item["versiondescription"].InnerText + "\",\"link\":\"" + item["link"].InnerText + "\"},";
                     }
                 }
                 script = script.TrimEnd(',') + "];";
                 base.RegisterStartupScript("", "<script>" + script + "</script>");
             }
             else
             {
                 info.Text = "暂无新版本可更新!";
                 base.RegisterStartupScript("", "<script>var versionList = []; </script>");
             }
         }
         catch
         {
             info.Text = "升级发生异常,请稍后再试……";
         }
     }
 }
Пример #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         try
         {
             this.MergeUpgradeInfo();
             AutoUpdate   autoUpdate   = new AutoUpdate();
             string       versionList  = autoUpdate.GetVersionList();
             StreamWriter streamWriter = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
             streamWriter.Write(versionList.Replace("\n", "\r\n"));
             streamWriter.Close();
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
             DateTime    t            = this.StrToDateTime(xmlDocument.SelectSingleNode("/localupgrade/requiredupgrade").InnerText);
             XmlDocument xmlDocument2 = new XmlDocument();
             xmlDocument2.LoadXml(versionList);
             XmlNodeList xmlNodeList = xmlDocument2.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/requiredupgrade/item");
             XmlNode     xmlNode     = xmlNodeList.Item(xmlNodeList.Count - 1);
             DateTime    t2          = this.StrToDateTime(xmlNode["version"].InnerText);
             this.isNew = (t2 > t);
             if (this.isNew)
             {
                 this.info.Text = "<span style='font-size:20px;padding:0px 0px 15px 0px;display:block;'>检测到最新版本:" + xmlNode["versiondescription"].InnerText + "</span><div style='border: 1px dotted rgb(219, 221, 211);background: #FFFFCC'>" + xmlNode["description"].InnerText + "</div>";
                 string text = "var versionList = [";
                 foreach (XmlNode xmlNode2 in xmlNodeList)
                 {
                     if (this.StrToDateTime(xmlNode2.FirstChild.InnerText) > t)
                     {
                         string text2 = text;
                         text = text2 + "{\"version\":\"" + xmlNode2["version"].InnerText + "\",\"versiondescription\":\"" + xmlNode2["versiondescription"].InnerText + "\",\"link\":\"" + xmlNode2["link"].InnerText + "\"},";
                     }
                 }
                 text = text.TrimEnd(',') + "];";
                 base.RegisterStartupScript("", "<script>" + text + "</script>");
             }
             else
             {
                 this.info.Text = "暂无新版本可更新!";
                 base.RegisterStartupScript("", "<script>var versionList = []; </script>");
             }
         }
         catch
         {
             this.info.Text = "升级发生异常,请稍后再试……";
         }
     }
 }
Пример #6
0
        private void LoadUpgradeInfo()
        {
            if (!IsPostBack)
            {
                try
                {
                    //合并升级信息
                    MergeUpgradeInfo();
                    //获取官方升级版本列表,并存放到本地upgrade/versionlist.config中
                    AutoUpdate   autoUpdate  = new AutoUpdate();
                    string       fileContnet = autoUpdate.GetVersionList();
                    StreamWriter writer      = new StreamWriter(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/upgradeini.config"));
                    writer.Write(fileContnet.Replace("\n", "\r\n"));
                    writer.Close();
                    //取本地更新版本号与官方的最新版本号比较,如果官方有更新,则提示有升级
                    XmlDocument lastupdate = new XmlDocument();
                    lastupdate.Load(Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"));
                    DateTime    build         = StrToDateTime(lastupdate.SelectSingleNode("/localupgrade/requiredupgrade").InnerText);
                    XmlDocument currentupdate = new XmlDocument();
                    currentupdate.LoadXml(fileContnet);
                    XmlNodeList items    = currentupdate.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/requiredupgrade/item");
                    XmlNode     lastItem = items.Item(items.Count - 1);
                    //DateTime version = StrToDateTime(items.Item(items.Count - 1).FirstChild.InnerText);
                    DateTime version = StrToDateTime(lastItem["version"].InnerText);
                    isNew = version > build;
                    if (isNew)
                    {
                        //upgradeInfo = "检测到最新版本:" + version.ToShortDateString() + "<br />" + items.Item(items.Count - 1).LastChild.InnerText + "<br />";
                        upgradeInfo = "<span style='font-size:16px;'>检测到最新版本:" + lastItem["versiondescription"].InnerText + "</span><br /><span style='padding:3px 0px 3px 10px;display:block;'>" + lastItem["description"].InnerText + "</span>";
                    }

                    XmlNodeList local   = lastupdate.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item");
                    XmlNodeList service = currentupdate.SelectNodes("/versionlist/" + BaseConfigs.GetDbType.ToLower() + "/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item");
                    string      hotfix  = "";
                    foreach (XmlNode serviceitem in service)
                    {
                        bool exist = false;
                        foreach (XmlNode localitem in local)
                        {
                            if (serviceitem.FirstChild.InnerText == localitem.InnerText)
                            {
                                exist = true;
                                break;
                            }
                        }
                        if (!exist)
                        {
                            isHotFix = true;
                            hotfix  += serviceitem["versiondescription"].InnerText + "<br />";
                        }
                    }

                    if (hotfix != "")
                    {
                        upgradeInfo += "<span style='font-size:16px;'>检测到最新补丁:</span><br /><span style='padding:3px 0px 3px 10px;display:block;'>" + hotfix + "</span>";
                    }

                    if (isNew || isHotFix)
                    {
                        base.RegisterStartupScript("", "<script type='text/javascript'>\r\nshowInfo();\r\n</script>\r\n");
                    }
                }
                catch
                {
                    ;
                }
            }
        }