public static void Load() { MacroHandler.RegisterMacro("DataLocation", ".\\"); try { Settings = new Settings(); Settings.Structures.Add(typeof(GlobalSettings)); Settings.Load(GetDataURI("settings.ini")); for (var i = 0; i < SkinDirectories.Length; ++i) { var dir = SkinDirectories[i]; if (!dir.EndsWith("\\") && !dir.EndsWith("/")) { dir += "\\"; } SkinDirectories[i] = dir; } Loaded = true; } catch { Settings.LoadDefaults(); Loaded = false; } MacroHandler.RegisterMacro("DefaultSkinFolder", MacroHandler.ReplaceMacros(SkinDirectories[0])); }
public static Language LoadDefault() { Directory.CreateDirectory(GlobalSettings.GetDataURI("Languages")); using (var writer = new FileStream(MacroHandler.ReplaceMacros(GlobalSettings.GetDataURI("Languages\\English.lang")), FileMode.Create)) writer.Write(Resources.English, 0, Resources.English.Length); using (var reader = new StreamReader(new MemoryStream(Resources.English), Encoding.Unicode)) { Language lang = Language.Parse(reader); Languages.Add(lang); return(lang); } }
public static void LoadSkins() { var skins = new List <Skin>(); var rootNodes = new List <TreeNode>(); if (Editor.HasOneRoot) { RecurseAddDirectories(Editor.RootFolderString, rootNodes, skins); } else { foreach (string x in GlobalSettings.SkinDirectories) { var expanded = MacroHandler.ReplaceMacros(x); var folder = new FolderNode(new DirectoryInfo(expanded).Name); RecurseAddDirectories(expanded, folder.Nodes, skins); rootNodes.Add(folder); } } Program.Context.SplashForm.Invoke((Action <List <TreeNode> >)Editor.MainForm.BeginFinishedLoadingSkins, rootNodes); var invalidSkins = new List <Skin>(); foreach (Skin s in skins) { if (!s.SetImages()) { invalidSkins.Add(s); } } skins.RemoveAll((s) => invalidSkins.Contains(s)); Program.Context.SplashForm.Invoke((Action <List <Skin>, TreeNode>)Editor.MainForm.FinishedLoadingSkins, skins, _tempToSelect); }
public static void Load() { if (File.Exists("installData.ini")) { var installData = new Settings(); installData.Structures.Add(typeof(InstallData)); installData.Load("installData.ini"); } else { InstallData.DataLocation = ".\\"; } if (!InstallData.DataLocation.EndsWith("\\")) { InstallData.DataLocation += '\\'; } MacroHandler.RegisterMacro("DataLocation", InstallData.DataLocation); try { Settings = new Settings(); Settings.Structures.Add(typeof(GlobalSettings)); Settings.Load(GetDataURI("settings.ini")); Loaded = true; } catch { Settings.LoadDefaults(); Loaded = false; } MacroHandler.RegisterMacro("DefaultSkinFolder", MacroHandler.ReplaceMacros(GlobalSettings.SkinDirectories[0])); }