Пример #1
0
        /// <summary>Initializes a new instance of the <see cref="ShellLibrary"/> class.</summary>
        /// <param name="libraryName">Name of the library.</param>
        /// <param name="kf">The known folder identifier.</param>
        /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
        public ShellLibrary2(string libraryName, KNOWNFOLDERID kf = KNOWNFOLDERID.FOLDERID_Libraries, bool overwrite = false)
        {
            lib  = new IShellLibrary();
            name = libraryName;
            var item = lib.SaveInKnownFolder(kf.Guid(), libraryName, overwrite ? LIBRARYSAVEFLAGS.LSF_OVERRIDEEXISTING : LIBRARYSAVEFLAGS.LSF_FAILIFTHERE);

            Init(item);
        }
Пример #2
0
        /// <summary>Initializes a new instance of the <see cref="ShellLibrary"/> class.</summary>
        /// <param name="libraryName">Name of the library.</param>
        /// <param name="parent">The parent.</param>
        /// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
        public ShellLibrary2(string libraryName, ShellFolder parent, bool overwrite = false)
        {
            lib  = new IShellLibrary();
            name = libraryName;
            var item = lib.Save(parent.IShellItem, libraryName, overwrite ? LIBRARYSAVEFLAGS.LSF_OVERRIDEEXISTING : LIBRARYSAVEFLAGS.LSF_FAILIFTHERE);

            Init(item);
        }
Пример #3
0
 /// <summary>Initializes a new instance of the <see cref="ShellLibrary"/> class.</summary>
 /// <param name="iItem">The i item.</param>
 /// <param name="readOnly">if set to <c>true</c> [read only].</param>
 public ShellLibrary2(IShellItem iItem, bool readOnly = false)
 {
     lib = new IShellLibrary();
     lib.LoadLibraryFromItem(iItem, readOnly ? STGM.STGM_READ : STGM.STGM_READWRITE);
     Init(iItem);
 }
Пример #4
0
 /// <summary>Initializes a new instance of the <see cref="ShellLibrary"/> class.</summary>
 /// <param name="iItem">The i item.</param>
 /// <param name="readOnly">if set to <c>true</c> [read only].</param>
 internal ShellLibrary(IShellItem iItem, bool readOnly = false) : base(iItem)
 {
     lib = new IShellLibrary();
     lib.LoadLibraryFromItem(iItem, readOnly ? STGM.STGM_READ : STGM.STGM_READWRITE);
 }
Пример #5
0
 /// <summary>Initializes a new instance of the <see cref="ShellLibrary"/> class.</summary>
 /// <param name="knownFolderId">The known folder identifier.</param>
 /// <param name="readOnly">if set to <c>true</c> [read only].</param>
 public ShellLibrary2(KNOWNFOLDERID knownFolderId, bool readOnly = false)
 {
     lib = new IShellLibrary();
     lib.LoadLibraryFromKnownFolder(knownFolderId.Guid(), readOnly ? STGM.STGM_READ : STGM.STGM_READWRITE);
     Init(knownFolderId.GetIShellItem());
 }
Пример #6
0
 /// <summary>
 /// Relese the IShellLibrary COM object
 /// </summary>
 public void Dispose()
 {
     Marshal.ReleaseComObject(_shellLibrary);
     _shellLibrary = null;
     GC.SuppressFinalize(this);
 }
Пример #7
0
 internal ShellLibrary(IShellLibrary shellLibrary, string name)
 {
     _shellLibrary = shellLibrary;
     _name = name;
 }
Пример #8
0
 internal static extern HRESULT SHCreateLibrary(
     [In][MarshalAs(UnmanagedType.LPStruct)] Guid riid,
     [Out][MarshalAs(UnmanagedType.Interface)] out IShellLibrary ppvLibrary);
 /// <summary>
 /// Relese the IShellLibrary COM object
 /// </summary>
 public void Dispose()
 {
     Marshal.ReleaseComObject(_shellLibrary);
     _shellLibrary = null;
     GC.SuppressFinalize(this);
 }
 internal ShellLibrary(IShellLibrary shellLibrary, string name)
 {
     _shellLibrary = shellLibrary;
     _name         = name;
 }