示例#1
0
        /// <summary>
        /// Returns all themes that have been imported earlier from user hard drive.
        /// </summary>
        /// <returns>Themes.</returns>
        public UserThemeResult GetImportedThemes()
        {
            int userId = GetUserId();

            return(userId > 0 ? ThemeSource.GetImportedThemes <UserTheme, UserThemeResult>(
                       string.Format("~/App_Data/Themes/{0}", userId)) : new UserThemeResult());
        }
示例#2
0
        /// <summary>
        /// Returns all themes that have been imported earlier from GitHub repository.
        /// </summary>
        /// <param name="ensureOnlyFiles">A list of theme file names (without directory information) to treat as white-list - all other files will be deleted.</param>
        /// <returns>Themes.</returns>
        private GitHubThemeResult GetImportedThemesInternal(IEnumerable <string> ensureOnlyFiles = null)
        {
            GitHubThemeResult   ret           = null;
            GitHubInMemoryTheme inMemoryTheme = null;

            inMemoryTheme = GetUrlSpecifiedTheme();

            if (inMemoryTheme != null)
            {
                ret = new GitHubThemeResult()
                {
                    Themes = new List <GitHubTheme>()
                    {
                        new GitHubTheme()
                        {
                            Id   = inMemoryTheme.Id,
                            Name = inMemoryTheme.Name
                        }
                    },
                    Checksum = CalculateChecksum(inMemoryTheme)
                };
            }
            else
            {
                ret = ThemeSource.GetImportedThemes <GitHubTheme, GitHubThemeResult>("~/Assets/css/Themes/", ensureOnlyFiles);
            }

            return(ret);
        }