Пример #1
0
        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);
        }
Пример #2
0
        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();
     }
 }
Пример #4
0
        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);
 }
Пример #8
0
 public override void SetLength(long value)
 {
     FSNative.fs_file_set_buffer_size(NativePtr, (uint)value);
 }
Пример #9
0
 public override long Seek(long offset, SeekOrigin origin)
 {
     FSNative.fs_file_seek(NativePtr, (int)offset, origin);
     return(Position);
 }
Пример #10
0
 public override void Flush()
 {
     FSNative.fs_file_flush(NativePtr);
 }
Пример #11
0
 public override void Close()
 {
     FSNative.fs_file_close(NativePtr);
     base.Close();
 }
Пример #12
0
 public void Close()
 {
     FSNative.fs_find_close(handle);
 }