Пример #1
0
 /// <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
 public _OutStream(long Position, FileMemory File)
 {
     this._File = File;
     this._Position = Position;
     this._File._Users++;
 }
Пример #3
0
 /// <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;
     }
 }