public void ClearTest() { var store = new ValueStore(); IniAdapter.Load(store, ini); var node = store.AddRoot("Superfluous", "Value"); node.AddChild("Child", "Value"); var profile = new RuntimeProfile(); profile.Store = store; profile.CleanStore(); Assert.IsNull(profile.GetOption("Superfluous/Child")); Assert.IsNull(profile.GetOption("Superfluous")); var option = profile.GetOption("ParentDummy"); Assert.IsNotNull(option); Assert.IsTrue(option.Save() == "no"); option = profile.GetOption("ParentDummy/Child2:Child2Variant2/Child3/Child4/Child5:Default1"); Assert.IsNotNull(option); Assert.IsNotNull(option.Save() == "Child5Default1Value"); }
/// <summary> /// Load an ini file from the given path. /// </summary> public void LoadIniFile(string path) { if (!File.Exists(path)) { Debug.LogError("Invalid path: Ini file '" + path + "' does not exist"); return; } Debug.Log("Loading ini file: " + path); var data = File.ReadAllText(path); IniAdapter.Load(RuntimeProfile.Main.Store, data); RuntimeProfile.Main.Load(); }
public void Test() { var store = new ValueStore(); IniAdapter.Load(store, ini); var node = store.AddRoot("Superfluous", "Value"); node.AddChild("Child", "Value"); var profile = new RuntimeProfile(); profile.Store = store; profile.SaveToStore(); var newIni = IniAdapter.Save(profile.Store); System.IO.File.WriteAllText("/Users/adrian/Desktop/orig.ini", SortAndTrim(ini)); System.IO.File.WriteAllText("/Users/adrian/Desktop/new.ini", SortAndTrim(newIni)); Assert.True(SortAndTrim(ini) == SortAndTrim(newIni)); }
public void PasteFromIniFile() { Undo.RecordObject(this, "Paste From Ini File"); IniAdapter.Load(Store, EditorGUIUtility.systemCopyBuffer); }