Пример #1
0
 public static void RemoveFolder(string name, string folderPath)
 {
     using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))
     {
         library.RemoveFolder(folderPath);
     }
 }
Пример #2
0
 public static void RenameLibrary(string oldName, string newName)
 {
     using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(oldName), true))
     {
         library.Name = newName;
     }
 }
Пример #3
0
 public static void ShowInfo(string name)
 {
     if (string.IsNullOrEmpty(name))
     {
         foreach (string libraryName in Directory.GetFiles(KnownFolders.Libraries))
         {
             try
             {
                 using (ShellLibrary library = ShellLibrary.Load(libraryName, true))
                 {
                     ShowInformation(library);
                 }
             }
             catch (Exception ex)
             {
                 System.Diagnostics.Trace.WriteLine(libraryName + " is probably not a library, Error: " + ex.Message);
             }
         }
     }
     else
     {
         using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))
         {
             ShowInformation(library);
         }
     }
 }
Пример #4
0
 public static void FolderType(string name, string folderType)
 {
     using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))
     {
         if (string.IsNullOrEmpty(folderType))
         {
             Guid   folderTypeId   = library.FolderTypeId;
             string folderTypeName = folderTypeId.ToString();
             try
             {
                 folderTypeName = FolderTypes.GetFolderType(folderTypeId);
             }
             catch
             {
             }
             Console.WriteLine("Folder type: {0}", folderTypeName);
         }
         else
         {
             Guid folderTypeId;
             try
             {
                 folderTypeId = FolderTypes.GetFolderType(folderType);
             }
             catch
             {
                 folderTypeId = new Guid(folderType);
             }
             library.FolderTypeId = folderTypeId;
         }
     }
 }
Пример #5
0
 public static void SaveFolder(string name, string folderPath)
 {
     using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))
     {
         if (string.IsNullOrEmpty(folderPath))
         {
             Console.WriteLine("Save folder: {0}", library.DefaultSaveFolder);
         }
         else
         {
             library.DefaultSaveFolder = folderPath;
         }
     }
 }
Пример #6
0
 public static void Icon(string name, string icon)
 {
     using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))
     {
         if (string.IsNullOrEmpty(icon))
         {
             Console.WriteLine("Icon: {0}", library.Icon);
         }
         else
         {
             library.Icon = icon;
         }
     }
 }
Пример #7
0
        public static void NavPanePinnedState(string name, string stateText)
        {
            using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true))
            {
                bool state;

                if (bool.TryParse(stateText, out state))
                {
                    library.IsPinnedToNavigationPane = state;
                }
                else
                {
                    Console.WriteLine("The library {0} is{1}pinned to the navigation pane.", name, library.IsPinnedToNavigationPane ? " " : " not ");
                }
            }
        }
Пример #8
0
 public static void DeleteLibrary(string name)
 {
     ShellLibrary.Delete(ShellLibrary.CreateLibraryFullName(name));
 }
Пример #9
0
 public static void ManageUI(string name)
 {
     ShellLibrary.ShowManageLibraryUI(ShellLibrary.CreateLibraryFullName(name), IntPtr.Zero, null, null, true);
 }