public static OSTheme getThemeForDataString(string data) { if (!data.Contains(ThemeManager.CustomThemeIDSeperator)) { return(ThemeManager.fileData.FirstOrDefault <KeyValuePair <OSTheme, string> >((Func <KeyValuePair <OSTheme, string>, bool>)(x => x.Value == data)).Key); } string[] seperated = data.Split(new string[1] { ThemeManager.CustomThemeIDSeperator }, StringSplitOptions.RemoveEmptyEntries); OSTheme key = ThemeManager.fileData.FirstOrDefault <KeyValuePair <OSTheme, string> >((Func <KeyValuePair <OSTheme, string>, bool>)(x => x.Value == seperated[0])).Key; try { string str1 = FileEncrypter.DecryptString(seperated[1], "")[2]; string str2 = "Content/"; if (Settings.IsInExtensionMode) { str2 = ExtensionLoader.ActiveExtensionInfo.FolderPath + "/"; } ThemeManager.LastLoadedCustomTheme = CustomTheme.Deserialize(str2 + str1); } catch (Exception ex) { ThemeManager.LastLoadedCustomTheme = (CustomTheme)null; return(OSTheme.TerminalOnlyBlack); } return(key); }
public static void switchTheme(object osObject, string customThemePath) { string str = "Content/"; if (Settings.IsInExtensionMode) { str = ExtensionLoader.ActiveExtensionInfo.FolderPath + "/"; } if (File.Exists(str + customThemePath)) { ThemeManager.LastLoadedCustomTheme = CustomTheme.Deserialize(str + customThemePath); ThemeManager.LastLoadedCustomThemePath = customThemePath; } else if (File.Exists("Content/" + customThemePath)) { ThemeManager.LastLoadedCustomTheme = CustomTheme.Deserialize("Content/" + customThemePath); } ThemeManager.switchTheme(osObject, OSTheme.Custom); }