示例#1
0
        /// <summary>
        /// Parse skin package.
        /// </summary>
        /// <param name="portalSettings"></param>
        /// <param name="theme"></param>
        /// <param name="parseType"></param>
        public void ParseTheme(PortalSettings portalSettings, ThemeInfo theme, ParseType parseType)
        {
            var strRootPath = Null.NullString;

            switch (theme.Level)
            {
            case ThemeLevel.Global:     //global
                strRootPath = Globals.HostMapPath;
                break;

            case ThemeLevel.Site:     //local
                strRootPath = portalSettings.HomeDirectoryMapPath;
                break;
            }
            var objSkinFiles = new SkinFileProcessor(strRootPath, theme.Type == ThemeType.Container ? SkinController.RootContainer : SkinController.RootSkin, theme.PackageName);
            var arrSkinFiles = new ArrayList();

            var strFolder = Path.Combine(Globals.ApplicationMapPath, theme.Path);

            if (Directory.Exists(strFolder))
            {
                var arrFiles = Directory.GetFiles(strFolder);
                foreach (var strFile in arrFiles)
                {
                    switch (Path.GetExtension(strFile))
                    {
                    case ".htm":
                    case ".html":
                    case ".css":
                        if (strFile.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                        {
                            arrSkinFiles.Add(strFile);
                        }
                        break;

                    case ".ascx":
                        if (File.Exists(strFile.Replace(".ascx", ".htm")) == false && File.Exists(strFile.Replace(".ascx", ".html")) == false)
                        {
                            arrSkinFiles.Add(strFile);
                        }
                        break;
                    }
                }
            }
            switch (parseType)
            {
            case ParseType.Localized:     //localized
                objSkinFiles.ProcessList(arrSkinFiles, SkinParser.Localized);
                break;

            case ParseType.Portable:     //portable
                objSkinFiles.ProcessList(arrSkinFiles, SkinParser.Portable);
                break;
            }
        }
        private string ParseSkinPackage(string strType, string strRoot, string strName, string strFolder, string strParse)
        {
            var strRootPath = Null.NullString;

            switch (strType)
            {
            case "G":                     //global
                strRootPath = Request.MapPath(Globals.HostPath);
                break;

            case "L":                     //local
                strRootPath = Request.MapPath(PortalSettings.HomeDirectory);
                break;
            }
            var objSkinFiles = new SkinFileProcessor(strRootPath, strRoot, strName);
            var arrSkinFiles = new ArrayList();

            if (Directory.Exists(strFolder))
            {
                var arrFiles = Directory.GetFiles(strFolder);
                foreach (var strFile in arrFiles)
                {
                    switch (Path.GetExtension(strFile))
                    {
                    case ".htm":
                    case ".html":
                    case ".css":
                        if (strFile.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                        {
                            arrSkinFiles.Add(strFile);
                        }
                        break;

                    case ".ascx":
                        if (File.Exists(strFile.Replace(".ascx", ".htm")) == false && File.Exists(strFile.Replace(".ascx", ".html")) == false)
                        {
                            arrSkinFiles.Add(strFile);
                        }
                        break;
                    }
                }
            }
            switch (strParse)
            {
            case "L":                     //localized
                return(objSkinFiles.ProcessList(arrSkinFiles, SkinParser.Localized));

            case "P":                     //portable
                return(objSkinFiles.ProcessList(arrSkinFiles, SkinParser.Portable));
            }
            return(Null.NullString);
        }