private void PopulateConfig(MultiRenameForm dlg) { if (config != null && config.Count > 0) { dlg.Formula = config.GetString("Formula"); dlg.Counter = new StringHelper.CounterDetails(config.GetUInt("CounterStart", 1), config.GetUInt("CounterStep", 1), (int)config.GetUInt("CounterDigits", 3)); dlg.FormatIndex = (int)config.GetUInt("FormatIndex"); } }
/// <summary> /// Restores the stored state of the editor. /// </summary> public void RestoreState() { PersistentStorageData data = PersistentStorageHelper.Load(ToolName); if (data != null && data.Count > 0) { NavigateTo(data.GetString(Settings_Path)); ImportFavorites(data.GetMultiString(Settings_Favorites)); } navigator.Clear(); RefreshNavigationButtons(); RefreshFavoritesMenu(); }
/// <summary> /// Writes the particular data to the persistent storage area. /// </summary> public static bool Save(PersistentStorageData data) { try { RegistryKey key = OpenKey(data.Name, true); // store the data: if (key != null) { // remove deleted keys: foreach (string k in data.Removed) { key.DeleteValue(k, false); } // set values for the others: foreach (string k in data.KeysStrings) { key.SetValue(k, data.GetString(k), RegistryValueKind.String); } foreach (string k in data.KeysMultiString) { key.SetValue(k, data.GetMultiString(k), RegistryValueKind.MultiString); } foreach (string k in data.KeysBytes) { key.SetValue(k, data.GetByte(k), RegistryValueKind.Binary); } foreach (string k in data.KeysUInts) { key.SetValue(k, data.GetUInt(k), RegistryValueKind.DWord); } } CloseKey(key); return(true); } catch (Exception ex) { Trace.WriteLine(ex.Message); Trace.WriteLine(ex.StackTrace); return(false); } }
public void RestoreState() { PersistentStorageData data = PersistentStorageHelper.Load(ToolName); if (data != null && data.Count > 0) { string[] storedFilter = data.GetMultiString("Filter"); if (storedFilter == null) { string f = data.GetString("Filter"); if (f != null) { storedFilter = new string[] { f } } ; } FilterMessages = storedFilter; } }