Exemplo n.º 1
0
        /// <summary>
        /// Initialize permissions for the Windows 8/10 lock screen directory and return its path
        /// </summary>
        /// <returns>Windows 8/10 lock screen directory path</returns>
        private static string Win10_InitDir()
        {
            string lockscreenDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Web\Screen";

            FileSystemAdmin.GrantAll(lockscreenDir, true);
            return(lockscreenDir);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Clear the Windows 8/10 lock screen cache to force lock screen refresh
        /// </summary>
        private static void Win10_ClearCache()
        {
            string systemDataDir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\Microsoft\Windows\SystemData";

            FileSystemAdmin.GrantAll(systemDataDir, true);
            foreach (string cacheDir in Directory.EnumerateDirectories(systemDataDir, "LockScreen_*", SearchOption.AllDirectories))
            {
                foreach (string cacheFile in Directory.EnumerateFiles(cacheDir, "*.jpg", SearchOption.AllDirectories))
                {
                    File.Delete(cacheFile);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize permissions for the Windows 7 lock screen directory and return its path
        /// </summary>
        /// <returns>Windows 7 lock screen directory path</returns>
        private static string Win7_InitDir()
        {
            string systemDir     = Environment.GetFolderPath(Environment.SpecialFolder.Windows) + (Environment.Is64BitOperatingSystem ? @"\Sysnative\oobe\" : @"\System32\oobe\");
            string lockscreenDir = systemDir + @"info\backgrounds";

            if (!Directory.Exists(lockscreenDir))
            {
                FileSystemAdmin.GrantAll(systemDir, false);
                Directory.CreateDirectory(lockscreenDir);
            }

            FileSystemAdmin.GrantAll(lockscreenDir, true);
            return(lockscreenDir);
        }