Пример #1
0
        private static RawDataManager InitializeNewDrive(Drive.VirtualDrive drive, VirtualDriveParameters parameters)
        {
            var synchronizer = new DriveAccessSynchronizer(drive);
            var retv         = new RawDataManager(synchronizer);

            retv.writeVirtualDriveParameters(parameters);

            retv._sectorInfoWriter = new SectorInfoRawWriter(parameters, synchronizer);
            retv.inititalizeSectors(parameters);

            retv.writeAvailableContentBlocks();

            synchronizer.DriveAccess.Wait();//wait for writing before initializing

            try
            {
                retv.init();
            }
            catch (Exception)
            {
                synchronizer.Dispose();
                throw;
            }

            var rootEntry = new DirectoryEntry
            {
                Id          = 0,
                DirectoryId = -1,
                Name        = string.Empty
            };

            retv.Write(rootEntry).Task.Wait(); //make sure that root is created

            return(retv);
        }
Пример #2
0
        private static RawDataManager Initialize(Drive.VirtualDrive drive)
        {
            var synchronizer = new DriveAccessSynchronizer(drive);
            var retv         = new RawDataManager(synchronizer);

            try
            {
                retv.init();
            }
            catch (Exception e)
            {
                synchronizer.Dispose();
                throw;
            }

            return(retv);
        }