Exemplo n.º 1
0
        /// <summary>
        /// Read the Path dir and returns
        /// an ArrayList with all the Themes found, public and privates
        /// </summary>
        /// <returns></returns>
        public ArrayList GetPrivateThemes()
        {
            ArrayList privateThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(PortalThemePath)))
            {
                privateThemeList = new ArrayList();
                string[] themes;

                // Try to read directories from private theme path
                if (Directory.Exists(PortalThemePath))
                {
                    themes = Directory.GetDirectories(PortalThemePath);
                }

                else
                {
                    themes = new string[0];
                }

                for (int i = 0; i <= themes.GetUpperBound(0); i++)
                {
                    ThemeItem t = new ThemeItem();
                    t.Name = themes[i].Substring(PortalThemePath.Length + 1);

                    if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS
                    {
                        privateThemeList.Add(t);
                    }
                }

                CurrentCache.Insert(Key.ThemeList(PortalThemePath), privateThemeList,
                                    new CacheDependency(PortalThemePath));
                //Debug.WriteLine("Storing privateThemeList in Cache: item count is " + privateThemeList.Count.ToString());
            }
            else
            {
                privateThemeList = (ArrayList)CurrentCache.Get(Key.ThemeList(PortalThemePath));
                //Debug.WriteLine("Retrieving privateThemeList from Cache: item count is " + privateThemeList.Count.ToString());
            }
            return(privateThemeList);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Read the Path dir and returns an ArrayList with all the Themes found.
        /// Static because the list is Always the same.
        /// </summary>
        /// <returns></returns>
        public static ArrayList GetPublicThemes()
        {
            ArrayList baseThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(Path)))
            {
                //Initialize array
                baseThemeList = new ArrayList();
                string[] themes;

                // Try to read directories from public theme path
                if (Directory.Exists(Path))
                {
                    themes = Directory.GetDirectories(Path);
                }

                else
                {
                    themes = new string[0];
                }

                for (int i = 0; i < themes.Length; i++)
                {
                    ThemeItem t = new ThemeItem();
                    t.Name = themes[i].Substring(Path.Length + 1);

                    if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS and _svn folders
                    {
                        baseThemeList.Add(t);
                    }
                }
                CurrentCache.Insert(Key.ThemeList(Path), baseThemeList, new CacheDependency(Path));
            }

            else
            {
                baseThemeList = (ArrayList)CurrentCache.Get(Key.ThemeList(Path));
            }
            return(baseThemeList);
        }