Exemple #1
0
 protected override void Initialize()
 {
     if (!string.IsNullOrEmpty(FileName) && File.Exists(Path.Combine(TemplateHelper.TemplateGroupPath, FileName)))
     {
         string file = FileName;
         SkinData = TemplateHelper.GetSkinInfo(file);//若为新模板则跳转到新模板编辑
         ECompareRelut eCompareRelut = VersioncComparison.Compare(SkinData.Ver, "v2.2", true);
         if (!(eCompareRelut == ECompareRelut.Less))
         {
             Response.Redirect(String.Format("/admin/Template/TemplateGroupEdit.aspx?file={0}", file), false);
         }
         Data = TemplateHelper.GetTemplateGroup(file);
         foreach (TemplateGroup.Item it in Data.Items)
         {
             try
             {
                 Template t = TemplateHelper.GetTemplate(it.Template + ".xml");
                 if (t != null)
                 {
                     it.TemplateText = t.Name;
                 }
             }
             catch
             {
                 it.TemplateText = "";
             }
         }
         NameLabel.Text           = String.Format("编辑模板组 {0}", Data.Name);
         NameTextBox.Enabled      = false;
         NewHyperLink.NavigateUrl = String.Format("TemplateDetail.aspx?tgfile={0}", FileName);
         path = string.Format("{0}/{1}", Constants.TemplateBasePath, Path.GetFileNameWithoutExtension(FileName));
         ShowTempalteGroup();
     }
     else
     {
         Response.Redirect("/admin/TemplateGroups.aspx", false);
     }
 }
Exemple #2
0
        /// <summary>
        /// 比较版本大小
        /// </summary>
        /// <param name="verA">比较的版本号</param>
        /// <param name="verB">比较的依据版本号</param>
        /// <param name="agnoreCase">是不是忽略大小写</param>
        /// <returns></returns>
        public static ECompareRelut Compare(string verA, string verB, bool agnoreCase)
        {
            //默认为比较小的版本

            verA = verA.TrimStart("Vv".ToCharArray());
            verB = verB.TrimStart("Vv".ToCharArray());

            ECompareRelut cr = new ECompareRelut();
            int           r  = string.Compare(verA, verB, true);

            if (r > 0)
            {
                cr = ECompareRelut.Greater;
            }
            else if (r == 0)
            {
                cr = ECompareRelut.Equal;
            }
            else if (r < 0)
            {
                cr = ECompareRelut.Less;
            }
            return(cr);
        }