public static void RemoveFolder(string name, string folderPath) { using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(name), true)) { library.RemoveFolder(folderPath); } }
public static void RenameLibrary(string oldName, string newName) { using (ShellLibrary library = ShellLibrary.Load(ShellLibrary.CreateLibraryFullName(oldName), true)) { library.Name = newName; } }
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); } } }
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; } } }
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; } } }
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; } } }
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 "); } } }
public static void DeleteLibrary(string name) { ShellLibrary.Delete(ShellLibrary.CreateLibraryFullName(name)); }
public static void ManageUI(string name) { ShellLibrary.ShowManageLibraryUI(ShellLibrary.CreateLibraryFullName(name), IntPtr.Zero, null, null, true); }