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);
        }
示例#3
0
 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("+"));
        }
示例#5
0
        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));
        }
示例#6
0
 public static void AddSearchPath(string path, string pathid)
 {
     FSNative.fs_add_search_path(path, pathid);
 }
示例#7
0
 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();
 }
示例#12
0
 public void Close()
 {
     FSNative.fs_find_close(handle);
 }