예제 #1
0
        public static RegKey GetWallKeys()
        {
            var key = new RegKey();

            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);

                //set to style:fit and tile:no by default if no keys are set
                if (style == null)
                {
                    style = 6;
                }
                if (tile == null)
                {
                    tile = 0;
                }

                key.Values.Add(KeyNames.WallpaperPath, path.ToString());
                key.Values.Add(KeyNames.WallpaperStyle, style.ToString());
                key.Values.Add(KeyNames.TileWallpaper, tile.ToString());
            }

            return(key);
        }
예제 #2
0
 /// <summary>
 ///     backup the current wallpaper registry keys
 /// </summary>
 private void Backup()
 {
     backupWallKey = Wallpaper.GetWallKeys();
     Logger.Info("wallpaper backup successful");
 }