/// <summary> /// Read the Path dir and returns an ArrayList with all the Layouts found. /// Static because the list is Always the same. /// </summary> /// <returns></returns> public static ArrayList GetPublicLayouts() { // Jes1111 - 27-02-2005 - new version - correct caching ArrayList baseLayoutList; if (!CurrentCache.Exists(Key.LayoutList(Path))) { // initialize array baseLayoutList = new ArrayList(); string[] layouts; // Try to read directories from public Layout path if (Directory.Exists(Path)) { layouts = Directory.GetDirectories(Path); } else { layouts = new string[0]; } for (int i = 0; i < layouts.Length; i++) { LayoutItem t = new LayoutItem(); t.Name = layouts[i].Substring(Path.Length + 1); if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS { baseLayoutList.Add(t); } } CurrentCache.Insert(Key.LayoutList(Path), baseLayoutList, new CacheDependency(Path)); } else { baseLayoutList = (ArrayList)CurrentCache.Get(Key.LayoutList(Path)); } return(baseLayoutList); // Jes1111 - old version // if (LayoutManager.cachedLayoutsList == null) // { // //Initialize array // ArrayList layoutsList = new ArrayList(); // // string[] layouts; // // // Try to read directories from public Layout path // if (Directory.Exists(Path)) // { // layouts = Directory.GetDirectories(Path); // } // else // { // layouts = new string[0]; // } // // for (int i = 0; i < layouts.Length; i++) // { // LayoutItem t = new LayoutItem(); // t.Name = layouts[i].Substring(Path.Length + 1); // if(t.Name != "CVS") //Ignore CVS // layoutsList.Add(t); // } // // //store list in cache // lock (typeof(LayoutManager)) // { // if (LayoutManager.cachedLayoutsList == null) // { // LayoutManager.cachedLayoutsList = layoutsList; // } // } // } // // return LayoutManager.cachedLayoutsList; }