public IDisk Disk(string name = null) { IDisk disk = null; string service = typeof(IDisk).ToString(); Hashtable cloudConfig = null; if (Config != null && Config.IsExists(name)) { cloudConfig = Config.Get <Hashtable>(name); if (cloudConfig.ContainsKey("driver")) { service = cloudConfig["driver"].ToString(); } } if (disk == null) { disk = App.Make <IDisk>(service); if (disk == null) { throw new Exception("undefind disk : " + name); } } if (cloudConfig != null) { disk.SetConfig(cloudConfig); } return(disk); }
public override void Register() { App.Singleton <CsvStore>().Alias <ICsvStore>().Alias("csv.store").Resolving((app, bind, obj) => { CsvStore store = obj as CsvStore; IConfigStore confStore = app.Make <IConfigStore>(); string root = confStore.Get(typeof(CsvStore), "root", null); if (root != null) { IEnv env = app.Make <IEnv>(); IIOFactory io = app.Make <IIOFactory>(); IDisk disk = io.Disk(); #if UNITY_EDITOR if (env.DebugLevel == DebugLevels.Auto || env.DebugLevel == DebugLevels.Dev) { disk.SetConfig(new Hashtable() { { "root", env.AssetPath + env.ResourcesNoBuildPath } }); } #endif store.SetDirctory(disk.Directory(root)); } return(store); });; }
/// <summary> /// Create an IDiskFilesystem object for accessing the filesystem on a disk. /// </summary> /// <param name="fsid">Identifies the filesystem type to create.</param> /// <param name="disk">Disk containing the filesystem.</param> /// <param name="iswriteable">Returns a writeable filesystem if <value>true</value>.</param> /// <returns>A IDiskFilesystem object for accessing the file system on the disk, or <value>null</value> if no filesystem can be created.</returns> public static IDiskFilesystem OpenFilesystem(DiskFilesystemIdentifier fsid, IDisk disk, bool iswriteable) { if (disk == null) { throw new ArgumentNullException("disk"); } if (iswriteable && !disk.IsWriteable) { throw new ArgumentException("Cannot support write operations against a write-protected disk"); } switch (fsid) { case DiskFilesystemIdentifier.DragonDos: return(new DragonDos.DragonDos(disk, iswriteable)); case DiskFilesystemIdentifier.RsDos: return(new RsDos.RsDos(disk, iswriteable)); case DiskFilesystemIdentifier.Flex: return(new Flex.Flex(disk, iswriteable)); case DiskFilesystemIdentifier.OS9: return(new OS9.OS9(disk, iswriteable)); default: return(null); } }
private void SnapshotListRetrieve() { var credentials = SdkContext.AzureCredentialsFactory.FromFile("servicePrincipleInformation.json"); IAzure azure = Microsoft.Azure.Management.Fluent.Azure .Configure() .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic) .Authenticate(credentials) .WithDefaultSubscription(); Utilities.Log("Selected subscription: " + azure.SubscriptionId); this.lblCurrentStatus.Text = "Selected subscription's ID: " + azure.SubscriptionId; ISnapshot snapshotFstElement = listResourceGroupSnapshot(azure); string infoMessage = String.Format("1st Snapshot image {0} was obtained", snapshotFstElement.Name); Utilities.Log(infoMessage); this.lblCurrentStatus.Text = infoMessage; IDisk newlyCreatedDisk = null; newlyCreatedDisk = createDiskFromSnapshot(snapshotFstElement, azure); string logMessage = String.Format("New disk image : \"{0}\", OSType : \"{1}\" from Snapshot has been made!", newlyCreatedDisk.Name, newlyCreatedDisk.OSType); Utilities.Log(logMessage); this.lblCurrentStatus.Text = logMessage; }
private IDisk createDiskFromSnapshot(ISnapshot diskSnapshotInfo, IAzure azureContext) { IDisk dataDisk = null; string resourceGroupName = this.txtBxResourceGroupName.Text; string theSnapshotName = diskSnapshotInfo.Name.Split(new char[] { '-' })[0]; var region = this.cmbBxRegionData.SelectedItem as Microsoft.Azure.Management.ResourceManager.Fluent.Core.Region; string logMessage = String.Format("Pure snapshot name \"{0}\" was obtained ", theSnapshotName); Utilities.Log(logMessage); this.lblCurrentStatus.Text = logMessage; try { logMessage = String.Format("New disk image from Snapshot is being made!"); Utilities.Log(logMessage); this.lblCurrentStatus.Text = logMessage; dataDisk = azureContext.Disks.Define(theSnapshotName + "-" + Guid.NewGuid()) .WithRegion(region) .WithExistingResourceGroup(resourceGroupName) .WithData() .FromSnapshot(diskSnapshotInfo) .Create(); } catch (Exception ex) { logMessage = String.Format("Error occurred {0}", ex.ToString()); Utilities.Log(logMessage); this.lblCurrentStatus.Text = logMessage; } return(dataDisk); }
private static void GoogleChromeTest(IDisk disk, string userName) { var googleChromeReader = disk.GetGoogleChromeReader(userName); var historyEntries = googleChromeReader.GetHistoryEntries(); PrintHistoryEntries(historyEntries); var downloadEntries = googleChromeReader.GetDownloadEntries(); Console.WriteLine($"{"URL".PadRight(70)} {"PATH".PadRight(70)} {"DOWNLOADED SIZE".PadRight(SPad)} {"TOTAL SIZE".PadRight(SPad)} {"STATE".PadRight(SPad)} {"START TIME".PadRight(25)} {"END TIME".PadRight(25)}"); foreach (var entry in downloadEntries) { Console.WriteLine($"{entry.Url.PadRight(70)} {entry.Path.PadRight(70)} {entry.DownloadedSizeKb.ToString().PadRight(SPad)} {entry.TotalSizeKb.ToString().PadRight(SPad)} {entry.State.ToString().PadRight(SPad)} {entry.StartTime.ToString().PadRight(25)} {entry.EndTime.ToString().PadRight(25)}"); } var searchEntries = googleChromeReader.GetSearchTermEntries(); Console.WriteLine($"{"TERM".PadRight(80)} {"LAST SEARCH TIME".PadRight(25)} {"COUNT".PadRight(10)}"); foreach (var entry in searchEntries) { Console.WriteLine($"{entry.Term.PadRight(80)} {entry.LastSearchTime.ToString().PadRight(25)} {entry.Count.ToString().PadRight(10)}"); } }
private static void FirefoxTest(IDisk disk, string userName) { var firefoxReader = disk.GetFirefoxReader(userName); Console.WriteLine("What do you want to display? h - history, b - bookmarks, c - cookies, d - downloads"); var choice = Console.ReadLine()?.Trim(); switch (choice) { case "h": var historyEntries = firefoxReader.GetHistoryEntries(); PrintHistoryEntries(historyEntries); break; case "b": var bookmarksEntries = firefoxReader.GetBookmarkEntries(); PrintEntries(bookmarksEntries, $"{"URL".PadRight(70)} {"TITLE".PadRight(40)} {"LAST MODIFIED".PadRight(25)} {"LAST VISITED".PadRight(25)} {"VISITS COUNT".PadRight(15)}", bookmarkEntry => Console.WriteLine($"{bookmarkEntry.Url.PadRight(70)} {bookmarkEntry.Title.PadRight(40)} {bookmarkEntry.LastModified.ToString().PadRight(25)} {bookmarkEntry.LastVisited.ToString().PadRight(25)} {bookmarkEntry.VisitCount.ToString().PadRight(15)} ")); break; case "c": var cookies = firefoxReader.GetCookies(); PrintEntries(cookies, $"{"DOMAIN".PadRight(30)} {"NAME".PadRight(30)}", cookie => Console.WriteLine($"{cookie.Url.PadRight(30)} {cookie.Name.PadRight(30)}")); break; case "d": var downloads = firefoxReader.GetDownloadEntries(); PrintEntries(downloads, $"{"URL".PadRight(100)} {"PATH".PadRight(80)} {"START TIME".PadRight(25)}", download => Console.WriteLine($"{download.Url.PadRight(100)} {download.Path.PadRight(80)} {download.StartTime.ToString().PadRight(25)}")); break; } }
internal FileTree(IDisk disk, DiskInformation info) { this.Disk = disk; this.Root = new Folder(disk.Index.ToString()); this.ProcessDirectory(info.files, this.Root as IFolder); }
private static void GoogleDriveTest(IDisk disk, string userName) { var googleDriveReader = disk.GetGoogleDriverReader(userName); Console.WriteLine("What do you want to display? h - history, b - bookmarks, c - cookies, d - downloads"); var choice = Console.ReadLine()?.Trim(); switch (choice) { case "h": break; case "b": break; case "c": break; case "d": break; } var fileActions = googleDriveReader.GetEntries(Action.CREATE); //var metadata = googleDriveReader.GetMetadata(); PrintEntries(fileActions, "FILENAME".PadRight(SPad) + "ACTION".PadRight(10) + "DIRECTION".PadRight(10) + "TIME".PadRight(25) + "PATH", log => Console.WriteLine(log.FileName.PadRight(SPad) + log.Action.ToString().PadRight(10) + log.Direction.ToString().PadRight(10) + log.Date.ToString().PadRight(25) + log.Path)); }
private static void GoogleChromeTest(IDisk disk, string userName) { var googleChromeReader = disk.GetGoogleChromeReader(userName); Console.WriteLine("What do you want to display? h - history, s - search terms, d - downloads"); var choice = Console.ReadLine()?.Trim(); switch (choice) { case "h": var historyEntries = googleChromeReader.GetHistoryEntries(); PrintHistoryEntries(historyEntries); break; case "s": var searchEntries = googleChromeReader.GetSearchTermEntries(); PrintEntries(searchEntries, $"{"TERM".PadRight(80)} {"LAST SEARCH TIME".PadRight(25)} {"COUNT".PadRight(10)}", entry => Console.WriteLine($"{entry.Term.PadRight(80)} {entry.LastSearchTime.ToString().PadRight(25)} {entry.Count.ToString().PadRight(10)}")); break; case "d": var downloadEntries = googleChromeReader.GetDownloadEntries(); PrintEntries(downloadEntries, $"{"URL".PadRight(70)} {"PATH".PadRight(70)} {"DOWNLOADED SIZE".PadRight(SPad)} {"TOTAL SIZE".PadRight(SPad)} {"STATE".PadRight(SPad)} {"START TIME".PadRight(25)} {"END TIME".PadRight(25)}", entry => Console.WriteLine($"{entry.Url.PadRight(70)} {entry.Path.PadRight(70)} {entry.DownloadedSizeKb.ToString().PadRight(SPad)} {entry.TotalSizeKb.ToString().PadRight(SPad)} {entry.State.ToString().PadRight(SPad)} {entry.StartTime.ToString().PadRight(25)} {entry.EndTime.ToString().PadRight(25)}")); break; } }
public Serial(SerialPortSettings serialPortSettings, IDisk disk, ILogger log, CancellationTokenSource cancelTokenSource, bool compressionIsEnabled) { _localDisk = disk; _logger = log; _listenTokenSource = cancelTokenSource; _compressionIsEnabled = compressionIsEnabled; _isRLERun = false; try { _serialPort = InitializeSerialPort(serialPortSettings); _serialPort.Open(); _serialPort.DiscardOutBuffer(); _serialPort.DiscardInBuffer(); } catch (Exception portException) when(portException is IOException || portException is UnauthorizedAccessException) { _logger.LogException(portException, $"Error opening serial port {serialPortSettings.PortName}"); throw; } _state = ReceiverState.ReceiveStartMagic; StartListening(); }
public ManagedDiskStorage(IDisk sourceDisk) { if (sourceDisk != null) { _StorageAccountType = sourceDisk.StorageAccountType; } }
public VirtualMachineScaleSetVM.Update.IUpdate WithExistingDataDisk(IDisk dataDisk, int lun, CachingTypes cachingType, StorageAccountTypes storageAccountType) { if (!IsManagedDiskEnabled()) { throw new System.InvalidOperationException(ManagedUnmanagedDiskErrors.VM_Both_Unmanaged_And_Managed_Disk_Not_Allowed); } if (dataDisk.Inner.DiskState != DiskState.Unattached) { throw new System.InvalidOperationException("Disk need to be in unattached state"); } DataDisk attachDataDisk = new DataDisk { CreateOption = DiskCreateOptionTypes.Attach, Lun = lun, Caching = cachingType, ManagedDisk = new ManagedDiskParametersInner { StorageAccountType = storageAccountType, Id = dataDisk.Id } }; WithExistingDataDisk(attachDataDisk, lun); return(this); }
private static bool HasCorrectSize(IDisk disk) { var moreThanMinimum = disk.Size > MinimumPhoneDiskSize; var lessThanMaximum = disk.Size < MaximumPhoneDiskSize; return(moreThanMinimum && lessThanMaximum); }
///GENMHASH:19379144AF0027E31705C491BF01DE93:BE96FC435877454BE586D579141E15DA public CustomImageDataDiskImpl FromManagedDisk(IDisk sourceManagedDisk) { Inner.ManagedDisk = new SubResource() { Id = sourceManagedDisk.Id }; return(this); }
public void WriteViolation(IRule <IDisk> violatedRule, Severity severity, IDisk disk) { //add violation for all of the disk's directories foreach (var directory in m_MetadataMapper.GetDirectories(disk)) { AddRuleViolation(directory, violatedRule); } }
public DiskViewModel(IDisk disk, SelectedVolumeViewModelNotifier selectedVolumeObserver) { Title = disk.Title; Type = disk.Type; SizeInBytes = disk.SizeInBytes; Status = disk.Status; Volumes = new VolumeViewModelCollection(disk.Volumes, selectedVolumeObserver); Icon = IconType.DriveIcon; }
private void GenerateFiles(string namespce, string baseUrl, IDisk disk) { var aspNetCoreGenerator = new AspNetCoreGenerator(disk); aspNetCoreGenerator.NameSpace = namespce; aspNetCoreGenerator.TemplateRoot = TemplateRoot; var pivotResources = ResourceCollection.NestedResources.Where(r => r.Pivot != null).ToList(); var pivotClasses = pivotResources.Select(r => r.Pivot).Distinct().ToList(); var oasGenerator = new OASGenerator(disk); oasGenerator.TemplateRoot = TemplateRoot; oasGenerator.Render("", "restapi.yml", "oas3template.sbn", new Dictionary <string, object> { { "resources", ResourceCollection.RootResources }, { "classes", DataModel.CommonClasses }, { "project_title", namespce }, { "base_url", baseUrl } }); aspNetCoreGenerator.RenderResources(ControllerFolder, r => $"{FullName(r)}Controller.cs", "server/resourceController.sbn", ResourceCollection.RootResources.ToList()); aspNetCoreGenerator.RenderResources(ControllerFolder, r => $"{FullName(r)}Controller.cs", "server/nestedResourceController.sbn", ResourceCollection.NestedResources.Where(r => r.Pivot == null).ToList()); aspNetCoreGenerator.RenderResources($"{ServiceFolder}/Interfaces", r => $"I{FullName(r)}Service.cs", "server/resourceServiceInterface.sbn", ResourceCollection.RootResources.ToList()); aspNetCoreGenerator.RenderResources(ServiceFolder, r => $"{FullName(r)}Service.cs", "server/resourceService.sbn", ResourceCollection.RootResources.ToList()); aspNetCoreGenerator.RenderResources(ControllerFolder, r => $"{FullName(r)}Controller.cs", "server/pivotController.sbn", pivotResources); aspNetCoreGenerator.RenderClasses(EntityFolder, s => $"{s.Name}.cs", "server/entity.sbn", DataModel.Classes.Where(c => !c.IsPivot)); aspNetCoreGenerator.Render("", "ApplicationDbContext.cs", "server/applicationDbContext.sbn", new Dictionary <string, object> { { "classes", DataModel.Classes }, { "seedList", SeedStore.All() }, { "name_space", namespce } }); aspNetCoreGenerator.Render("", "Startup.cs", "server/startup.sbn", new Dictionary <string, object> { { "resources", ResourceCollection.RootResources } }); var typeScriptGenerator = new TypeScriptGenerator(disk); typeScriptGenerator.TemplateRoot = TemplateRoot; typeScriptGenerator.RenderClasses($"{ClientFolder}/models", s => $"{s.Name}.{ClientExtension}", "client/model.sbn", DataModel.CommonClasses); typeScriptGenerator.RenderClasses($"{ClientFolder}/views", s => $"{s.Name}List.{ClientComponentExtension}", "client/model_list.sbn", DataModel.CommonClasses); typeScriptGenerator.RenderClasses($"{ClientFolder}/components", s => $"{s.Name}View.{ClientComponentExtension}", "client/model_view.sbn", DataModel.CommonClasses); typeScriptGenerator.RenderClasses($"{ClientFolder}/components", s => $"{s.Name}Edit.{ClientComponentExtension}", "client/model_edit.sbn", DataModel.CommonClasses); typeScriptGenerator.RenderResources($"{ClientFolder}/store", s => $"{s.Name}Module.{ClientExtension}", "client/store_module.sbn", ResourceCollection.RootResources); typeScriptGenerator.Render($"{ClientFolder}/router", $"index.{ClientExtension}", "client/router.sbn", new Dictionary <string, object> { { "classes", DataModel.CommonClasses } }); typeScriptGenerator.Render(ClientFolder, $"App.{ClientComponentExtension}", "client/app.sbn", new Dictionary <string, object> { { "classes", DataModel.CommonClasses } }); typeScriptGenerator.Render($"{ClientFolder}/api", $"index.{ClientExtension}", "client/api_client.sbn", new Dictionary <string, object> { { "resources", ResourceCollection.RootResources }, { "classes", DataModel.CommonClasses } }); typeScriptGenerator.Render($"{ClientFolder}/store", $"index.{ClientExtension}", "client/store.sbn", new Dictionary <string, object> { { "classes", DataModel.CommonClasses }, { "base_url", baseUrl } }); }
/// <summary> /// Instantiate a FLEX filesystem representation associated with a virtual disk. /// </summary> /// <param name="disk">Disk to associate the filesystem to.</param> /// <param name="isWriteable">If set write operations will be permitted to the filesystem.</param> public Flex(IDisk disk, bool isWriteable) { if (disk == null) throw new ArgumentNullException("disk"); //TODO Validate that the disk geometry is valid for a FLEX disk Disk = disk; IsWriteable = isWriteable; IsDisposed = false; }
public static async Task <IPartition> GetPartitionByVolumeLabel(this IDisk disk, string label) { var volumes = await disk.GetVolumes(); var matching = from v in volumes where string.Equals(v.Label, label, StringComparison.InvariantCultureIgnoreCase) select v.Partition; return(matching.FirstOrDefault()); }
public static FileTree CreateFileTree(IDisk disk, DirectoryInfo directory) { var result = new FileTree { Disk = disk, Root = new Folder(disk.Index.ToString()) }; ProcessDirectory(directory, result.Root as IFolder); return(result); }
public static async Task <IPartition> GetPartitionByName(this IDisk disk, string name) { var partitions = await disk.GetPartitions(); var matching = from p in partitions where string.Equals(p.Name, name, StringComparison.InvariantCultureIgnoreCase) select p; return(matching.FirstOrDefault()); }
///GENMHASH:2F60AEDC3637C02CE6A3AD7DD7020FCF:5A86C9FEF29C8DD39335BC3E23501E52 public SnapshotImpl WithLinuxFromDisk(IDisk sourceDisk) { WithLinuxFromDisk(sourceDisk.Id); if (sourceDisk.OSType != null && sourceDisk.OSType.HasValue) { WithOSType(sourceDisk.OSType.Value); } WithSku(sourceDisk.Sku); return(this); }
/// <summary> /// Constructs a memory-based virtual disk as a sector by sector clone of another disk. /// </summary> /// <param name="source">Disk to clone.</param> public MemoryDisk(IDisk source) { Heads = source.Heads; Tracks = source.Tracks; DiskSectors = new Dictionary <SectorId, ISector>(); foreach (var sector in source) { DiskSectors.Add(new SectorId(sector.Head, sector.Track, sector.Sector), new BasicSector(sector.Head, sector.Track, sector.Sector, sector.Data)); } }
public Plugin( IEmailServer emailServer, IEmailMessage emailMessage, IStaticSettings staticSettings, IDisk disk) { _emailServer = emailServer; _emailMessage = emailMessage; _staticSettings = staticSettings; _disk = disk; }
public Plugin( IEmailServer emailServer, IEmailMessage emailMessage, IStaticSettings staticSettings, IDisk disk) { _emailServer = emailServer ; _emailMessage = emailMessage ; _staticSettings = staticSettings ; _disk = disk ; }
public static async Task <IList <IVolume> > GetVolumes(this IDisk self) { var partitions = await self.GetPartitions(); return(await partitions .ToObservable() .Select(x => Observable.FromAsync(x.GetVolume)) .Merge(1) .Where(x => x != null) .ToList()); }
internal DiskContent (IDisk disk, DiskInformation info) : this (disk) { foreach (var item in info.content) { var _item = new ContentItem (item.name, disk); foreach (var link in item.file_links) _item.Add (link.reference); this.items.Add (_item); } }
/// <summary> /// Creates a disk /// </summary> /// <param name="name">Name of the disk</param> /// <param name="resourceGroup">Name of resource group</param> /// <param name="region">Region where the disk resides</param> /// <param name="gbytes">Disk size in giga bytes</param> /// <returns></returns> public IDisk Create( string name, string resourceGroup, Region region, int gbytes ) { IDisk d = azure.Disks.Define(name).WithRegion(region).WithExistingResourceGroup(resourceGroup).WithData().WithSizeInGB(gbytes).Create(); Thread.Sleep(60000); return(d); }
public void AddTrack(IDisk tracks) { if (Tracks.Count < counter) { Tracks.Add(tracks); Console.WriteLine("On disk {0} tracks.", Tracks.Count); } else { Console.WriteLine("The disk is full, capacity {0} tracks!", counter); } }
private const int Sectors = 18; //TODO Validate that this is correct for all FLEX filesystems. It probably isn't... /// <summary> /// Instantiate a FLEX filesystem representation associated with a virtual disk. /// </summary> /// <param name="disk">Disk to associate the filesystem to.</param> /// <param name="isWriteable">If set write operations will be permitted to the filesystem.</param> public Flex(IDisk disk, bool isWriteable) { if (disk == null) { throw new ArgumentNullException("disk"); } //TODO Validate that the disk geometry is valid for a FLEX disk Disk = disk; IsWriteable = isWriteable; IsDisposed = false; }
public OS9(IDisk disk, bool iswriteable) { if (disk == null) throw new ArgumentNullException(); Disk = disk; IsWriteable = iswriteable; DiskInfo = new OS9DiskInfo(Disk.ReadSector(0, 0, 1)); Tracks = Disk.Tracks; Sectors = DiskInfo.Sectors * Disk.Heads; Disk.SectorWritten += SectorWrittenHandler; }
internal DiskContent(IDisk disk, DiskInformation info) : this(disk) { foreach (var item in info.content) { var _item = new ContentItem(item.name, disk); foreach (var link in item.file_links) { _item.Add(link.reference); } this.items.Add(_item); } }
///GENMHASH:677041EE7B045118782B0F039AD8F8C2:E22D7D9513E288182D42BE3859574904 public SnapshotImpl WithDataFromDisk(IDisk managedDisk) { if (managedDisk.OSType != null && managedDisk.OSType.HasValue) { return(WithDataFromDisk(managedDisk.Id) .WithOSType(managedDisk.OSType.Value) .WithSku(managedDisk.Sku)); } else { return(WithDataFromDisk(managedDisk.Id) .WithSku(managedDisk.Sku)); } }
/// <summary> /// Create an IDiskFilesystem object for accessing the filesystem on a disk. /// </summary> /// <param name="fsid">Identifies the filesystem type to create.</param> /// <param name="disk">Disk containing the filesystem.</param> /// <param name="iswriteable">Returns a writeable filesystem if <value>true</value>.</param> /// <returns>A IDiskFilesystem object for accessing the file system on the disk, or <value>null</value> if no filesystem can be created.</returns> public static IDiskFilesystem OpenFilesystem(DiskFilesystemIdentifier fsid, IDisk disk, bool iswriteable) { if (disk == null) throw new ArgumentNullException("disk"); if (iswriteable && !disk.IsWriteable) throw new ArgumentException("Cannot support write operations against a write-protected disk"); switch (fsid) { case DiskFilesystemIdentifier.DragonDos: return new DragonDos.DragonDos(disk, iswriteable); case DiskFilesystemIdentifier.RsDos: return new RsDos.RsDos(disk, iswriteable); case DiskFilesystemIdentifier.Flex: return new Flex.Flex(disk, iswriteable); case DiskFilesystemIdentifier.OS9: return new OS9.OS9(disk, iswriteable); default: return null; } }
public ContentItem (string name, IDisk disk) : this () { this.Name = name; this.Disk = disk; }
/// <summary> /// Instantiate an RSDos filesystem representation associated with a virtual disk. /// </summary> /// <param name="disk">Disk to associate the filesystem to.</param> /// <param name="isWriteable">If set write operations will be permitted to the filesystem.</param> public RsDos(IDisk disk, bool isWriteable) { if (disk == null) throw new ArgumentNullException("disk"); if (disk.Heads != 1 || disk.Tracks != 35) throw new DiskImageFormatException(string.Format("Invalid disk geometry {0} heads {1} tracks", disk.Heads, disk.Tracks)); Disk = disk; IsWriteable = isWriteable; IsDisposed = false; IsCaseSensitive = false; }
public FileListBuilder(IDisk disk) { this.disk = disk; }
Plugin( IDisk disk ) { _disk = disk ; }
/// <summary> /// Initialize an empty DragonDos filesystem on a disk. /// </summary> /// <param name="disk">Disk to initialize filesystem on.</param> /// <returns>DragonDos filesystem.</returns> /// <exception cref="DiskNotWriteableException">The disk does not support write operations.</exception> /// <exception cref="UnsupportedGeometryException">The disk geometry is not supported by DragonDos.</exception> public static DragonDos Initialize(IDisk disk) { if (disk == null) throw new ArgumentNullException("disk"); if (!disk.IsWriteable) throw new DiskNotWriteableException(); if (disk.Tracks != 40 && disk.Tracks != 80) throw new UnsupportedGeometryException(String.Format("DragonDos only supports 40 or 80 tracks while this disk has {0} tracks", disk.Tracks)); if (disk.Heads != 1 && disk.Heads != 2) throw new UnsupportedGeometryException(String.Format("DragonDos only supports single or double sided disks while this disk has {0} sides", disk.Heads)); /* Write blank data to all sectors. */ var sectorData = new byte[SectorSize]; for (int t = 0; t < disk.Tracks; t++) { for (int h = 0; h < disk.Heads; h++) { for (int s = 1; s < SectorsPerHead; s++) { disk.WriteSector(h, t, s, sectorData); } } } /* Write empty directory entries to the directory track. */ var emptyDirEntry = DragonDosDirectoryEntry.GetEmptyEntry(); var emptyEncodedEntry = new byte[DirectoryEntrySize]; emptyDirEntry.Encode(emptyEncodedEntry, 0); for (int i = 0; i < DirectoryEntryCount; i++) { Array.Copy(emptyEncodedEntry, 0, sectorData, i*DirectoryEntrySize, DirectoryEntrySize); } for (int s = DirectoryEntryOffset+1; s <= SectorsPerHead; s++) { disk.WriteSector(0, DirectoryTrackPrimary, s, sectorData); disk.WriteSector(0, DirectoryTrackBackup, s, sectorData); } /* Write the sector allocation map. */ var allocationmap = new byte[2][]; allocationmap[0] = new byte[SectorSize]; allocationmap[1] = new byte[SectorSize]; int sectors = SectorsPerHead*disk.Heads; allocationmap[0][252] = (byte) disk.Tracks; // encode disk geometry allocationmap[0][253] = (byte) sectors; allocationmap[0][254] = (byte) (~disk.Tracks & 0xff); allocationmap[0][255] = (byte) (~sectors & 0xff); for (var i=0; i<disk.Tracks*disk.Heads*SectorsPerHead; i++) // mark all sectors as unallocated SetSectorAllocated(i, false, allocationmap); int lsnPrimaryDirectory = DirectoryTrackPrimary*disk.Heads*SectorsPerHead; // mark directory track as allocated int lsnBackupDirectory = DirectoryTrackBackup*disk.Heads*SectorsPerHead; for (var i = 0; i < SectorsPerHead; i++) { SetSectorAllocated(lsnPrimaryDirectory++, true, allocationmap); SetSectorAllocated(lsnBackupDirectory++, true, allocationmap); } for (var i = 0; i < 2; i++) { disk.WriteSector(0, DirectoryTrackPrimary, i+1, allocationmap[i]); disk.WriteSector(0, DirectoryTrackBackup, i+1, allocationmap[i]); } return new DragonDos(disk, true); }
/// <summary> /// Create a DragonDos filesystem interface to a virtual diskette. /// </summary> /// <param name="disk">Virtual diskette holding the filesystem.</param> /// <param name="isWriteable">Set if the filesystem will permit write operations.</param> /// <exception cref="UnsupportedGeometryException">The disk geometry is not supported by DragonDos.</exception> public DragonDos(IDisk disk, bool isWriteable) { if (disk == null) throw new ArgumentNullException("disk"); if (disk.Heads > 2) throw new UnsupportedGeometryException("DragonDos only supports single or double sided disks"); if (disk.Tracks != 40 && disk.Tracks != 80) throw new UnsupportedGeometryException("DragonDos only supports 40 or 80 track disks"); IsCaseSensitive = false; Disk = disk; Tracks = disk.Tracks; Sectors = disk.Heads*SectorsPerHead; IsWriteable = isWriteable; IsDisposed = false; Disk.SectorWritten += SectorWrittenHandler; ReadDirectoryTrack(); int tracks = directoryTrack[0][252]; int sectors = directoryTrack[0][253]; if (tracks != Tracks) throw new FilesystemConsistencyException(String.Format("Unexpected number of tracks {0}", tracks)); if (sectors != SectorsPerHead*disk.Heads) throw new FilesystemConsistencyException(String.Format("Unexpected number of sectors per track {0}", sectors)); }
public CoverController(Settings settings, FileListBuilder fileListBuilder, IDisk diskIo) { this.settings = settings; this.fileListBuilder = fileListBuilder; this.diskIo = diskIo; }
public void Setup() { fileInstrumenter = Substitute.For<FileInstrumenter>(false); fileListBuilder = Substitute.For<FileListBuilder>(); diskIo = Substitute.For<IDisk>(); settings = new Settings(); controller = new CoverController(settings, fileListBuilder, diskIo); }
public DiskContent (IDisk disk) { this.Disk = disk; this.items = new List <IContentItem> (); }