public override void Initialize() { base.Initialize(); if (firstLoad) { firstLoad = false; var modType = GetType(); RegistryLoader.LoadAllRegistries(modType); //WeaverLog.Log(modType.FullName + "___LOADED!!!"); ReflectionUtilities.ExecuteMethodsWithAttribute <AfterModLoadAttribute>((_, a) => a.ModType.IsAssignableFrom(modType)); //Load all global mod settings pertaining to this mod /*foreach (var registry in Registry.FindModRegistries(modType)) * { * var settingTypes = registry.GetFeatureTypes<GlobalWeaverSettings>(); * foreach (var settingsType in settingTypes) * { * settingsType.Load(); * } * }*/ } else { EnableRegistries(); } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { try { this.SaveLayout(); RegistryLoader.SaveValue(Name, "play", soundPlayerBar1.Playing); RegistryLoader.SaveValue(Name, "granularity", menuSizeSetting.Text); RegistryLoader.SaveValue(Name, "time", soundPlayerBar1.Position); RegistryLoader.SaveValue(Name, "showFPS", menuFps.Checked); RegistryLoader.SaveValue(Name, "compact", menuCompact.Checked); multiGraph.SaveLayout(); log.SaveLayout(); camera.SaveLayout(); // rename old DefaultFiles.RenameAutoSaveDemoFile(); // save new DemoLoader.SaveToFile(demo, DefaultFiles.GetAutoSaveDemoFilePath()); demo.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FormMain_Load(object sender, EventArgs e) { try { this.LoadLayout(); string granularity = Convert.ToString(RegistryLoader.LoadValue(Name, "granularity", menuSizeSetting.Text)); menuSizeSetting.SelectedIndex = menuSizeSetting.FindString(granularity); menuFps.Checked = Convert.ToBoolean(RegistryLoader.LoadValue(Name, "showFPS", false)); menuCompact.Checked = Convert.ToBoolean(RegistryLoader.LoadValue(Name, "compact", false)); menuOnTop.Checked = TopMost; String[] arguments = Environment.GetCommandLineArgs(); if (arguments.Length > 1) { AddShader(arguments[1]); } else { //no cmd arguments LoadDemo(DefaultFiles.GetAutoSaveDemoFilePath()); soundPlayerBar1.Position = (float)Convert.ToDouble(RegistryLoader.LoadValue(Name, "time", 0.0)); } soundPlayerBar1.Playing = Convert.ToBoolean(RegistryLoader.LoadValue(Name, "play", false)); } catch (Exception ex) { log.Append(ex.Message); } }
public override void Load() { Instance = this; // Initialize the loading funneler and subscribe this mod to the registry. LoadingFunneler.Load(); RegistryLoader.RegisterMod(this); }
public void SaveData() { try { this.SaveLayout(); RegistryLoader.SaveValue(Name, "fontSize", fontSize); } catch (Exception e) { Append(e.Message); } }
public FormMessages() { InitializeComponent(); errorLog.MouseWheel += ErrorLog_MouseWheel; try { this.LoadLayout(); checkBoxOnTop.Checked = TopMost; fontSize = (float)Convert.ToDouble(RegistryLoader.LoadValue(Name, "fontSize", 12.0f)); FontSize = fontSize; } catch (Exception e) { Append(e.Message); } }
/*public override IEnumerable<Registry> GetRegistries(Type ModType) * { * string[] guids = AssetDatabase.FindAssets("t:Registry"); * foreach (var guid in guids) * { * string path = AssetDatabase.GUIDToAssetPath(guid); * * ScriptableObject obj = AssetDatabase.LoadAssetAtPath<ScriptableObject>(path); * if (obj is Registry) * { * var reg = obj as Registry; * if (ModType.IsAssignableFrom(reg.ModType)) * { * yield return reg; * } * } * } * * foreach (var registry in RegistryLoader.GetEmbeddedRegistries(ModType)) * { * yield return registry; * } * }*/ public override void LoadRegistries(Assembly assembly) { var assemblyName = assembly.GetName().Name; string[] guids = AssetDatabase.FindAssets("t:Registry"); foreach (var guid in guids) { string path = AssetDatabase.GUIDToAssetPath(guid); Debug.Log("LOADING REGISTRY ITEM = " + path); Registry registry = AssetDatabase.LoadAssetAtPath <Registry>(path); //Debug.Log("Found Registry = " + registry.RegistryName); registry.Initialize(); } RegistryLoader.LoadEmbeddedRegistries(assembly); }
/*public override IEnumerable<Registry> GetRegistries(Type ModType) * { * return RegistryLoader.GetEmbeddedRegistries(ModType); * }*/ public override void LoadRegistries(Assembly assembly) { RegistryLoader.LoadEmbeddedRegistries(assembly); }