示例#1
0
文件: File.cs 项目: dzamkov/DUIP
 /// <summary>
 /// Gets the file memory for the file at the given path. Returns null if there is a problem opening the file.
 /// </summary>
 public static FileMemory Open(Path Path)
 {
     FileMemory fm;
     if (!_Files.TryGetValue(Path, out fm))
     {
         fm = new FileMemory(Path);
         if (!fm.Open())
         {
             return null;
         }
         _Files[Path] = fm;
     }
     return fm;
 }
示例#2
0
文件: File.cs 项目: dzamkov/DUIP
 public _OutStream(long Position, FileMemory File)
 {
     this._File = File;
     this._Position = Position;
     this._File._Users++;
 }
示例#3
0
文件: File.cs 项目: dzamkov/DUIP
 /// <summary>
 /// Creates a file at the given path and return file memory for it. Returns null if there is a problem creating the file.
 /// </summary>
 public static FileMemory Create(Path Path, long Size)
 {
     try
     {
         FileStream fs = System.IO.File.Open(Path, FileMode.Create, FileAccess.ReadWrite);
         try
         {
             fs.SetLength(Size);
             FileMemory fm = new FileMemory(Path);
             fm._FileStream = fs;
             return _Files[Path] = fm;
         }
         catch
         {
             fs.Close();
             fs.Dispose();
             return null;
         }
     }
     catch
     {
         return null;
     }
 }