예제 #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 + "\"");
        }
예제 #2
0
        internal static void GetFileAttributes(string 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;
            }
            // 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 ex)
            {
                StartProcess.StartInfo(AttributesInfo.GetAssembly.AssemblyInformation("directory") + @"\MenuTools.exe", "\"" + ex.Message + "\"" + " -catchhandler");
            }
        }