public override void Write(byte[] buffer, int offset, int count) { IntPtr buf = Marshal.AllocHGlobal(count); Marshal.Copy(buffer, offset, buf, count); FSNative.fs_file_write(buf, count, NativePtr); Marshal.FreeHGlobal(buf); }
public override int Read(byte[] buffer, int offset, int count) { IntPtr buf = Marshal.AllocHGlobal(count); int retsize = FSNative.fs_file_read(buf, count, NativePtr); Marshal.Copy(buf, buffer, offset, retsize); Marshal.FreeHGlobal(buf); return(retsize); }
public override void Delete() { if (Exists && FSNative.fs_file_writable(filename, pathid)) { FSNative.fs_file_delete(filename, pathid); } else { throw new FileNotFoundException(); } }
public SourceFileStream(string filename, string options, string pathid) { NativePtr = FSNative.fs_file_open(filename, options, pathid); // Check if something strange has happened if (!FSNative.fs_file_is_ok(NativePtr)) { Close(); throw new FileNotFoundException(); } // Test for writable file AND writable file mode writable = FSNative.fs_file_writable(filename, pathid) && (options.Contains("w") || options.Contains("+")); }
public string FindNext() { IntPtr strptr; if (first) { if (ex) { strptr = FSNative.fs_find_first_ex(wildcard, pathid, out handle); } else { strptr = FSNative.fs_find_first(wildcard, out handle); } first = false; } else { strptr = FSNative.fs_find_next(handle); } return(Marshal.PtrToStringAnsi(strptr)); }
public static void AddSearchPath(string path, string pathid) { FSNative.fs_add_search_path(path, pathid); }
public static void RemoveSearchPath(string path, string pathid) { FSNative.fs_remove_search_path(path, pathid); }
public override void SetLength(long value) { FSNative.fs_file_set_buffer_size(NativePtr, (uint)value); }
public override long Seek(long offset, SeekOrigin origin) { FSNative.fs_file_seek(NativePtr, (int)offset, origin); return(Position); }
public override void Flush() { FSNative.fs_file_flush(NativePtr); }
public override void Close() { FSNative.fs_file_close(NativePtr); base.Close(); }
public void Close() { FSNative.fs_find_close(handle); }