public void Dispose() { if (this.unmanagedBuffer != null) this.unmanagedBuffer.Dispose(); this.unmanagedBuffer = null; if (this.tables != null) this.tables.Dispose(); //this.tables = null; if (this.debugReader != null) Marshal.ReleaseComObject(this.debugReader); this.debugReader = null; }
private unsafe void ReadFileIntoUnmanagedBuffer(System.IO.FileStream/*!*/ inputStream) { long size = inputStream.Seek(0, System.IO.SeekOrigin.End); if (size > int.MaxValue) throw new System.IO.FileLoadException(); inputStream.Seek(0, System.IO.SeekOrigin.Begin); int n = (int)size; this.bufferLength = n; this.unmanagedBuffer = new UnmanagedBuffer(n); byte* pb = (byte*)this.unmanagedBuffer.Pointer; if(!Reader.ReadFile(inputStream.SafeFileHandle.DangerousGetHandle(), pb, n, &n, IntPtr.Zero)) throw new System.IO.FileLoadException(); }
internal unsafe Reader(byte[]/*!*/ buffer, IDictionary localAssemblyCache, bool doNotLockFile, bool getDebugInfo, bool useStaticCache, bool preserveShortBranches) { Debug.Assert(buffer != null); if (localAssemblyCache == null) localAssemblyCache = new Hashtable(); this.localAssemblyCache = localAssemblyCache; this.getDebugSymbols = getDebugInfo; this.doNotLockFile = false; this.useStaticCache = useStaticCache; this.preserveShortBranches = preserveShortBranches; int n = this.bufferLength = buffer.Length; this.unmanagedBuffer = new UnmanagedBuffer(n); //^ base(); byte* pb = (byte*)this.unmanagedBuffer.Pointer; for (int i = 0; i < n; i++) *pb++ = buffer[i]; }