Exemple #1
0
        internal static void GetWallpaper()
        {
            byte[] path      = (byte[])Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop").GetValue("TranscodedImageCache");
            string wallpaper = Encoding.Unicode.GetString(SliceMe(path, 24)).TrimEnd("\0".ToCharArray());

            StartProcess.StartInfo("explorer.exe", "/select, \"" + wallpaper + "\"");
        }
Exemple #2
0
 internal static void GetFileAttributes(string folderPath)
 {
     try
     {
         if (Directory.Exists(folderPath) || File.Exists(folderPath))
         {
             // Get : Set Attributes
             FileAttributes attributes = File.GetAttributes(folderPath);
             if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
             {
                 hidden = true;
             }
             if ((attributes & FileAttributes.System) == FileAttributes.System)
             {
                 system = true;
             }
             if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
             {
                 readOnly = true;
             }
             if ((attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
             {
                 hidden = false;
             }
             if ((attributes & FileAttributes.System) != FileAttributes.System)
             {
                 system = false;
             }
             if ((attributes & FileAttributes.ReadOnly) != FileAttributes.ReadOnly)
             {
                 readOnly = false;
             }
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler");
     }
     // Get Attributes
     try
     {
         using (RegistryKey key = Registry.CurrentUser.OpenSubKey(ExplorerAdvanced))
         {
             Trace.Assert(key != null);
             object hidden = key.GetValue("Hidden");
             Trace.Assert(hidden != null);
             if (hidden.ToString() == "1")
             {
                 HiddenFilesShowing = true;
             }
             if (hidden.ToString() == "2")
             {
                 HiddenFilesShowing = false;
             }
             object system = key.GetValue("ShowSuperHidden");
             Trace.Assert(system != null);
             if (system.ToString() == "1")
             {
                 SystemFilesShowing = true;
             }
             if (system.ToString() == "2")
             {
                 SystemFilesShowing = false;
             }
         }
     }
     catch (Win32Exception wex)
     {
         StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + wex.Message + Environment.NewLine + wex.StackTrace + Environment.NewLine + wex.Source + Environment.NewLine + wex.GetBaseException() + Environment.NewLine + wex.TargetSite + "\"" + " -catchhandler");
     }
     catch (Exception ex)
     {
         StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\xMenuTools.exe", "\"" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source + Environment.NewLine + ex.GetBaseException() + Environment.NewLine + ex.TargetSite + "\"" + " -catchhandler");
     }
 }