public override void CopyTo(ObjectModel where) { ThemeObjectModel clone = (where as ThemeObjectModel); if (clone == null) { throw new ObjectModelNotSupportedException(); } foreach (Theme theme in mvarThemes) { clone.Themes.Add(theme.Clone() as Theme); } }
public static Theme[] Get() { if (mvarAvailableThemes == null) { List<Theme> list = new List<Theme>(); string themeDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + System.IO.Path.DirectorySeparatorChar.ToString() + "Themes"; if (System.IO.Directory.Exists(themeDir)) { string[] themeFileNames = System.IO.Directory.GetFiles(themeDir, "*.xml", System.IO.SearchOption.AllDirectories); foreach (string themeFileName in themeFileNames) { if (System.IO.File.Exists(themeFileName)) { ThemeObjectModel theme = new ThemeObjectModel(); UniversalEditor.Document.Load(theme, new ThemeXMLDataFormat(), new FileAccessor(themeFileName)); foreach (Theme themeDefinition in theme.Themes) { list.Add(themeDefinition); } } } } mvarAvailableThemes = list.ToArray(); foreach (Theme theme in mvarAvailableThemes) { if (theme.InheritsThemeID != Guid.Empty) { Theme ct1 = GetByID(theme.InheritsThemeID); if (ct1 == null) { Console.WriteLine("ac-theme: custom theme with ID '" + theme.InheritsThemeID.ToString("B").ToUpper() + "' not found"); } else { theme.InheritsTheme = ct1; } } foreach (ThemeComponent tc in theme.Components) { if (tc.InheritsComponentID != Guid.Empty) { tc.InheritsComponent = theme.Components[tc.InheritsComponentID]; } } } } return mvarAvailableThemes; }