Exemplo n.º 1
0
 public DirEntry GetDirEntry(uint dirIndex)
 {
     try
     {
         DirEntry d      = new DirEntry();
         IntPtr   buffer = Marshal.AllocHGlobal(Marshal.SizeOf(d.GetType()));
         // ... send buffer to dll
         cppToCsharpAdapter.getDirEntry(this.myDiskPointer, buffer, dirIndex);
         Marshal.PtrToStructure(buffer, d);
         // free allocate
         Marshal.FreeHGlobal(buffer);
         return(d);
     }
     catch (SEHException)
     {
         IntPtr cString = cppToCsharpAdapter.getLastDiskErrorMessage(this.myDiskPointer);
         throw new Exception(Marshal.PtrToStringAnsi(cString));
     }
 }
Exemplo n.º 2
0
 public List <DirEntry> GetDirRoot()
 {
     try
     {
         List <DirEntry> list = new List <DirEntry>();
         for (uint i = 0; i < 28; i++)
         {
             DirEntry idir = this.GetDirEntry(i);
             if (idir.EntryStatus == '1')
             {
                 list.Add(this.GetDirEntry(i));
             }
         }
         return(list);
     }
     catch (SEHException)
     {
         IntPtr cString = cppToCsharpAdapter.getLastDiskErrorMessage(this.myDiskPointer);
         throw new Exception(Marshal.PtrToStringAnsi(cString));
     }
 }
Exemplo n.º 3
0
 public DirEntry GetFileDescription()
 {
     try
     {
         DirEntry d      = new DirEntry();
         IntPtr   buffer = Marshal.AllocHGlobal(Marshal.SizeOf(d.GetType()));
         // ... send buffer to dll
         cppToCsharpAdapter.getFileDesctription(this.myFCBpointer, buffer);
         Marshal.PtrToStructure(buffer, d);
         // free allocate
         Marshal.FreeHGlobal(buffer);
         return(d);
     }
     catch (SEHException)
     {
         IntPtr cString = cppToCsharpAdapter.getLastFcbErrorMessage(this.myFCBpointer);
         string message = Marshal.PtrToStringAnsi(cString);
         throw new Exception(message);
     }
     catch
     {
         throw;
     }
 }