예제 #1
0
        public MemoryMappedFile(ChunkDescriptor ChunkDescriptor, MemoryMappedFileRepository Repo, string Path, Stream Stream)
            : base(ChunkDescriptor)
        {
            if (ChunkDescriptor == null)
            {
                throw new ArgumentNullException("ChunkDescriptor");
            }
            if (Path == null)
            {
                throw new ArgumentNullException("Path");
            }
            if (Repo == null)
            {
                throw new ArgumentNullException("Repo");
            }
            repo = Repo;
            path = Path;
            Stream OStream = System.IO.File.OpenWrite(path);
            long   Count   = ((Stream.Length - 1) >> 20) + 1;

            for (long n = 0; n != Count; n++)
            {
                byte[] Bytes = new byte[1 << 20];
                Stream.Read(Bytes, 0, 1 << 20);
                OStream.Write(Bytes, 0, 1 << 20);
            }
            Init();
        }
예제 #2
0
 public MemoryMappedFile(ChunkDescriptor ChunkDescriptor, MemoryMappedFileRepository Repo, string Path)
     : base(ChunkDescriptor)
 {
     if (ChunkDescriptor == null)
         throw new ArgumentNullException ("ChunkDescriptor");
     if (Repo == null)
         throw new ArgumentNullException ("Repo");
     if (Path == null)
         throw new ArgumentNullException ("Path");
     repo = Repo;
     path = Path;
 }
예제 #3
0
 public MemoryMappedFile(ChunkDescriptor ChunkDescriptor, MemoryMappedFileRepository Repo, string Path, byte[] Data)
     : base(ChunkDescriptor)
 {
     if (ChunkDescriptor == null)
         throw new ArgumentNullException ("ChunkDescriptor");
     if (Data == null)
         throw new ArgumentNullException ("Data");
     if (Path == null)
         throw new ArgumentNullException ("Path");
     if (Repo == null)
         throw new ArgumentNullException ("Repo");
     repo = Repo;
     path = Path;
     System.IO.File.WriteAllBytes (Path, Data);
     Init ();
 }
예제 #4
0
 public MemoryMappedFile(ChunkDescriptor ChunkDescriptor, MemoryMappedFileRepository Repo, string Path)
     : base(ChunkDescriptor)
 {
     if (ChunkDescriptor == null)
     {
         throw new ArgumentNullException("ChunkDescriptor");
     }
     if (Repo == null)
     {
         throw new ArgumentNullException("Repo");
     }
     if (Path == null)
     {
         throw new ArgumentNullException("Path");
     }
     repo = Repo;
     path = Path;
 }
예제 #5
0
 public MemoryMappedFile(ChunkDescriptor ChunkDescriptor, MemoryMappedFileRepository Repo, string Path, Stream Stream)
     : base(ChunkDescriptor)
 {
     if (ChunkDescriptor == null)
         throw new ArgumentNullException ("ChunkDescriptor");
     if (Path == null)
         throw new ArgumentNullException ("Path");
     if (Repo == null)
         throw new ArgumentNullException ("Repo");
     repo = Repo;
     path = Path;
     Stream OStream = System.IO.File.OpenWrite (path);
     long Count = ((Stream.Length - 1) >> 20) + 1;
     for (long n = 0; n != Count; n++) {
         byte[] Bytes = new byte[1 << 20];
         Stream.Read (Bytes, 0, 1 << 20);
         OStream.Write (Bytes, 0, 1 << 20);
     }
     Init ();
 }
예제 #6
0
 public MemoryMappedFile(ChunkDescriptor ChunkDescriptor, MemoryMappedFileRepository Repo, string Path, byte[] Data)
     : base(ChunkDescriptor)
 {
     if (ChunkDescriptor == null)
     {
         throw new ArgumentNullException("ChunkDescriptor");
     }
     if (Data == null)
     {
         throw new ArgumentNullException("Data");
     }
     if (Path == null)
     {
         throw new ArgumentNullException("Path");
     }
     if (Repo == null)
     {
         throw new ArgumentNullException("Repo");
     }
     repo = Repo;
     path = Path;
     System.IO.File.WriteAllBytes(Path, Data);
     Init();
 }