internal CascFoundFile(string fileName, IntPtr plainName, byte[] encodingKey, CascLocales locales, long fileSize, CascStorageContext ownerContext) { FileName = fileName; PlainFileName = Marshal.PtrToStringAnsi(plainName); EncodingKey = encodingKey; Locales = locales; FileSize = fileSize; _ownerContext = new WeakReference <CascStorageContext>(ownerContext); }
internal CascFoundFile(string fileName, IntPtr plainName, byte[] encodingKey, CascLocales locales, long fileSize, CascStorageContext ownerContext) { FileName = fileName; PlainFileName = Marshal.PtrToStringAnsi(plainName); EncodingKey = encodingKey; Locales = locales; FileSize = fileSize; _ownerContext = new WeakReference<CascStorageContext>(ownerContext); }
/// <summary> /// Opens a file by its fully-qualified name. /// </summary> /// <param name="fileName">The name of the file.</param> /// <param name="locale">The file's locale (defaults to English-United States).</param> /// <returns>A CascFileStream, which implements a Stream.</returns> /// <exception cref="ObjectDisposedException">Thrown if the CascStorageContext has been disposed.</exception> /// <exception cref="System.IO.FileNotFoundException">Thrown if the file does not exist within the CASC storage container.</exception> public CascFileStream OpenFile(string fileName, CascLocales locale = CascLocales.EnUs) { if (_handle == null || _handle.IsInvalid) { throw new ObjectDisposedException("CascStorageContext"); } CascStorageFileSafeHandle hFile; if (!_api.CascOpenFile(_handle, fileName, (uint)locale, 0, out hFile)) { throw new CascException(); } hFile.Api = _api; return(new CascFileStream(hFile, _api)); }
/// <summary> /// Opens a file by its fully-qualified name. /// </summary> /// <param name="fileName">The name of the file.</param> /// <param name="locale">The file's locale (defaults to English-United States).</param> /// <returns>A CascFileStream, which implements a Stream.</returns> /// <exception cref="ObjectDisposedException">Thrown if the CascStorageContext has been disposed.</exception> /// <exception cref="System.IO.FileNotFoundException">Thrown if the file does not exist within the CASC storage container.</exception> public CascFileStream OpenFile(string fileName, CascLocales locale = CascLocales.EnUs) { if (_handle == null || _handle.IsInvalid) throw new ObjectDisposedException("CascStorageContext"); CascStorageFileSafeHandle hFile; if (!_api.CascOpenFile(_handle, fileName, (uint)locale, 0, out hFile)) throw new CascException(); hFile.Api = _api; return new CascFileStream(hFile, _api); }