예제 #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;
     }
 }