コード例 #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);
 }