public MediaCenterLibraryCache(string baseSearchPath, UnmanagedLibraryAccess mode) { if (baseSearchPath == null) throw new ArgumentNullException(); this.mode = mode; this.SearchPath = baseSearchPath; }
public UnmanagedLibrary(string file, UnmanagedLibraryAccess mode, ushort? languageID) { this.fileName = file; this.mode = mode; this.languageID = languageID; this.libraryInfo = (UnmanagedLibrary.LibraryInfo)null; lock (UnmanagedLibrary.librariesDict) { if (!UnmanagedLibrary.librariesDict.TryGetValue(file, out this.libraryInfo) && mode == UnmanagedLibraryAccess.Read) { this.libraryInfo = new UnmanagedLibrary.LibraryInfo(); this.libraryInfo.File = file; this.libraryInfo.Handle = NativeMethods.LoadLibraryEx(file, IntPtr.Zero, 2U); if (this.libraryInfo.Handle == IntPtr.Zero) throw new Win32Exception(); UnmanagedLibrary.librariesDict[file] = this.libraryInfo; } if (this.libraryInfo != null) { if (mode != UnmanagedLibraryAccess.Read) throw new InvalidOperationException(string.Format("Cannot open {0} for updating as it is already open for reading.", (object)file)); ++this.libraryInfo.ReferenceCount; } } if (mode != UnmanagedLibraryAccess.Write) return; this.stringTables = new Dictionary<int, UnmanagedLibrary.StringTable>(); this.resourceHandle = NativeMethods.BeginUpdateResource(file, false); if (this.resourceHandle == IntPtr.Zero) throw new Win32Exception(); }
public MediaCenterLibraryCache(string baseSearchPath, UnmanagedLibraryAccess mode) { if (baseSearchPath == null) { throw new ArgumentNullException(); } this.mode = mode; this.SearchPath = baseSearchPath; }
public MediaCenterUnmanagedLibrary(string file, UnmanagedLibraryAccess mode) : base(file, mode) { this.mode = mode; if (mode != UnmanagedLibraryAccess.Write) return; this.muiFile = this.GetMUIFile(); if (this.muiFile == null) return; this.GetMUI().Update((byte[])null, new ushort?((ushort)1033)); }
public MediaCenterUnmanagedLibrary(string file, UnmanagedLibraryAccess mode) : base(file, mode) { this.mode = mode; if (mode != UnmanagedLibraryAccess.Write) { return; } this.muiFile = this.GetMUIFile(); if (this.muiFile == null) { return; } this.GetMUI().Update((byte[])null, new ushort?((ushort)1033)); }
public UnmanagedLibrary(string file, UnmanagedLibraryAccess mode, ushort?languageID) { this.fileName = file; this.mode = mode; this.languageID = languageID; this.libraryInfo = (UnmanagedLibrary.LibraryInfo)null; lock (UnmanagedLibrary.librariesDict) { if (!UnmanagedLibrary.librariesDict.TryGetValue(file, out this.libraryInfo) && mode == UnmanagedLibraryAccess.Read) { this.libraryInfo = new UnmanagedLibrary.LibraryInfo(); this.libraryInfo.File = file; this.libraryInfo.Handle = NativeMethods.LoadLibraryEx(file, IntPtr.Zero, 2U); if (this.libraryInfo.Handle == IntPtr.Zero) { throw new Win32Exception(); } UnmanagedLibrary.librariesDict[file] = this.libraryInfo; } if (this.libraryInfo != null) { if (mode != UnmanagedLibraryAccess.Read) { throw new InvalidOperationException(string.Format("Cannot open {0} for updating as it is already open for reading.", (object)file)); } ++this.libraryInfo.ReferenceCount; } } if (mode != UnmanagedLibraryAccess.Write) { return; } this.stringTables = new Dictionary <int, UnmanagedLibrary.StringTable>(); this.resourceHandle = NativeMethods.BeginUpdateResource(file, false); if (this.resourceHandle == IntPtr.Zero) { throw new Win32Exception(); } }
public UnmanagedLibrary(string file, UnmanagedLibraryAccess mode) : this(file, mode, new ushort?()) { }
public UnmanagedLibrary(string file, UnmanagedLibraryAccess mode) : this(file, mode, new ushort?()) { }