private static RegKey GetKeyValue(RegistryKey parentKey, string keyName) { var result = new RegKey(keyName); using (var key = parentKey.OpenSubKey(keyName)) { foreach (var valueName in key.GetValueNames()) { var val = key.GetValue(valueName); result.Values.Add(valueName, val.ToString()); } } return(result); }
public static RegKey GetWallKeys() { var key = new RegKey("Wallpaper"); using (var userWallpaper = Registry.CurrentUser.OpenSubKey(KeyNames.WallpaperParentKey, false)) { if (userWallpaper == null) { return(null); } var path = userWallpaper.GetValue(KeyNames.WallpaperPath); var style = userWallpaper.GetValue(KeyNames.WallpaperStyle); var tile = userWallpaper.GetValue(KeyNames.TileWallpaper); key.Values.Add(KeyNames.WallpaperPath, path.ToString()); key.Values.Add(KeyNames.WallpaperStyle, style.ToString()); key.Values.Add(KeyNames.TileWallpaper, tile.ToString()); } return(key); }
private void BackupWallpaper() { _backupWallKey = Wallpaper.GetWallKeys(); }