internal void ExecuteCommand() { var disk = new Disk { Name = this.DiskName, Label = this.Label }; ExecuteClientActionInOCS( disk, CommandRuntime.ToString(), s => this.Channel.UpdateDisk(s, this.DiskName, disk), (op, responseDisk) => new DiskContext { DiskName = responseDisk.Name, Label = responseDisk.Label, IsCorrupted = responseDisk.IsCorrupted, AffinityGroup = responseDisk.AffinityGroup, OS = responseDisk.OS, Location = responseDisk.Location, MediaLink = responseDisk.MediaLink, DiskSizeInGB = responseDisk.LogicalDiskSizeInGB, SourceImageName = responseDisk.SourceImageName, AttachedTo = CreateRoleReference(responseDisk.AttachedTo), OperationDescription = CommandRuntime.ToString(), OperationId = op.OperationTrackingId, OperationStatus = op.Status }); }
public Sound(Mixer mixer, Disk disk, byte volume) { _skyDisk = disk; _mixer = mixer; SaveSounds[0] = SaveSounds[1] = 0xFFFF; _mainSfxVolume = volume; }
public void addDisk(Disk newDisk) { disks.Push(newDisk); Debug.Log("There is/are " + disks.Count + " disk(s) on column: " + this); checkWinningCondition(); }
public ISO9660Directory(ISO9660FileSystem fileSystem, ISO9660Directory parent, Disk.ISO9660.DirectoryRecord record) : base(fileSystem, parent, record.FileIdentifier.length > 0 ? (FOS_System.String)record.FileIdentifier.Split(';')[0] : "") { TheDirectoryRecord = record; _theFile = new ISO9660File(fileSystem, parent, record) { IsDirectoryFile = true }; }
public ISO9660FileSystem(Disk.ISO9660.PrimaryVolumeDescriptor primaryVolume) : base(primaryVolume) { isValid = true; RootDirectory = new ISO9660Directory(this, null, primaryVolume.RootDirectory); }
protected MusicBase(Mixer mixer, Disk disk) { _mixer = mixer; _skyDisk = disk; _currentMusic = 0; _musicVolume = 127; _numberOfChannels = _currentMusic = 0; }
/// <summary> /// Main method: builds a stippled representation from a source image /// </summary> /// <param name="source">Source image</param> /// <param name="K">Meassure of darkness on the result. The lower the value, the darker the image. Sensible range around 256 to 1024</param> /// <param name="result">Resulting stippled image</param> public static void Stipple(Image source, int K, Bitmap result ) { Graphics g = Graphics.FromImage(result); g.Clear(Color.White); Random r = new Random(); Queue<Disk> q = new Queue<Disk>(); Bitmap diskBuffer = new Bitmap(source.Width, source.Height); Graphics dgb = Graphics.FromImage(diskBuffer); dgb.Clear(Color.Black); Bitmap sourceBmp = new Bitmap(source.Width, source.Height); { Graphics srcg = Graphics.FromImage(sourceBmp); srcg.DrawImage(source, new Rectangle(0, 0, source.Width, source.Height)); } int totalDensity = TotalDensity(sourceBmp); float r1 = (float)Math.Sqrt((float)(result.Width * result.Height) / (totalDensity / K)); { Disk Q = new Disk(new PointF((float)r.Next(result.Width), (float)r.Next(result.Height)), r1); q.Enqueue(Q); AddStipple(Q, result); DrawDisk(Q, dgb); } int steps = 0; while (q.Count > 0) { steps++; if (steps == 100) { // Graphics g2 = Graphics.FromImage(result); // g2.DrawImage(diskBuffer, new Rectangle(0, 0, result.Width, result.Height)); if (OnAISDebugStep != null) OnAISDebugStep(result); steps = 0; } Disk Q = q.Dequeue(); int attempts = 0; while (Q.HasAvailableRange && attempts < 5) { attempts++; // avoid getting stuck float alpha = Q.AvailableAngle(); Disk P = new Disk(new PointF(Q.center.X + (Q.radius + r1) * (float)Math.Cos(alpha), Q.center.Y + (Q.radius + r1) * (float)Math.Sin(alpha)), r1); Disk D; bool insideImage = P.center.X >= 0 && P.center.X < sourceBmp.Width && P.center.Y >= 0 && P.center.Y < sourceBmp.Height; if ( insideImage && ChangeRadiusBasedOnLocalDensity(Q, P, alpha, sourceBmp, K, out D) && !Overlaps(D, diskBuffer)) { q.Enqueue(D); AddStipple(D, result); DrawDisk(D, dgb); Q.SubstractFromAvailableRange(D); } } } }
public MBR(Disk bd) { this.blockdevice = bd; Partition = new IBMPartitionInformation[4]; Partition[0] = new IBMPartitionInformation(this, 0); Partition[1] = new IBMPartitionInformation(this, 1); Partition[2] = new IBMPartitionInformation(this, 2); Partition[3] = new IBMPartitionInformation(this, 3); Refresh(); }
private void AddFileSystemEntry(Disk disk, FileSystemDiskEntry fs, ref int maxOffset) { int offset = maxOffset; var data = disk.GetData(); Array.Copy(fs.Words, 0, data, offset, fs.Words.Length); disk.SetData(data); offset += fs.Words.Length; maxOffset = Math.Max(offset, maxOffset); }
public Mt32Music(MidiDriver midiDrv, Mixer mixer, Disk disk) : base(mixer, disk) { _driverFileBase = 60200; _midiDrv = midiDrv; var midiRes = _midiDrv.Open(); if (midiRes != 0) throw new InvalidOperationException(string.Format("Can't open midi device. Errorcode: {0}", midiRes)); _timerCount = 0; _midiDrv.SetTimerCallback(this, TimerCall); _midiDrv.SendMt32Reset(); }
public AdLibMusic(Mixer mixer, Disk disk) : base(mixer, disk) { _driverFileBase = 60202; _sampleRate = mixer.OutputRate; _opl = new DosBoxOPL(OplType.Opl2); _opl.Init(_sampleRate); _soundHandle = _mixer.PlayStream(SoundType.Music, this, -1, Mixer.MaxChannelVolume, 0, false, true); }
private void AddSectorEntry(Disk disk, SpecificSectorDiskEntry ss, ref int maxOffset) { int offset = disk.WordsPerSector * ss.Sector; var data = disk.GetData(); Array.Copy(ss.Words, 0, data, offset, ss.Words.Length); disk.SetData(data); offset += ss.Words.Length; maxOffset = Math.Max(offset, maxOffset); }
private void AddOffsetEntry(Disk disk, SpecificOffsetDiskEntry so, ref int maxOffset) { int offset = so.Offset; var data = disk.GetData(); Array.Copy(so.Words, 0, data, offset, so.Words.Length); disk.SetData(data); offset += so.Words.Length; maxOffset = Math.Max(offset, maxOffset); }
public VirtualMachineOperation(Mapping.VirtualMachineOperation operation, VirtualMachine virtualMachine, Disk disk = null, Interface iface = null) : base(operation) { this.VirtualMachineId = operation.VirtualMachineId; this.VirtualMachine = virtualMachine; this.DiskId = operation.DiskId; this.Disk = disk; this.IntefaceId = operation.InterfaceId; this.Interface = iface; }
public Intro(Disk disk, Screen screen, MusicBase music, Sound sound, Text skyText, Mixer mixer, SkySystem system) { _skyDisk = disk; _skyScreen = screen; _skyMusic = music; _skySound = sound; _skyText = skyText; _mixer = mixer; _system = system; _textBuf = new byte[10000]; _saveBuf = new byte[10000]; }
public static Disk getDisk(string driveLetter) { var disks = new ManagementObject("Win32_LogicalDisk.DeviceID='" + driveLetter + ":'"); foreach (ManagementObject diskPart in disks.GetRelated("Win32_DiskPartition")) { foreach (ManagementObject diskDrive in diskPart.GetRelated("Win32_DiskDrive")) { Disk disk = new Disk(); disk.driveLetter = driveLetter; disk.productName = diskDrive["Caption"].ToString().Replace(" ATA Device", ""); disk.pnpId = diskDrive["PnPDeviceID"].ToString(); return disk; } } return null; }
public void BuildDisk(Disk blankDisk, IEnumerable<DiskEntry> entries) { int maxOffset = 0; foreach (var ss in entries.OfType<SpecificSectorDiskEntry>()) { AddSectorEntry(blankDisk, ss, ref maxOffset); } foreach (var so in entries.OfType<SpecificOffsetDiskEntry>()) { AddOffsetEntry(blankDisk, so, ref maxOffset); } foreach (var fs in entries.OfType<FileSystemDiskEntry>()) { AddFileSystemEntry(blankDisk, fs, ref maxOffset); } }
public Screen(ISystem system, Disk disk, SkyCompact skyCompact) { _system = system; _skyDisk = disk; _skyCompact = skyCompact; _gameGrid = new byte[GridX * GridY * 2]; ForceRefresh(); //blank the first 240 colors of the palette var tmpPal = new Color[VgaColors]; //set the remaining colors for (var i = 0; i < VgaColors - GameColors; i++) { tmpPal[GameColors + i] = Color.FromRgb( (Top16Colors[i].R << 2) + (Top16Colors[i].R >> 4) , (Top16Colors[i].G << 2) + (Top16Colors[i].G >> 4) , (Top16Colors[i].B << 2) + (Top16Colors[i].B >> 4)); } //set the palette _system.GraphicsManager.SetPalette(tmpPal, 0, VgaColors); }
public void placeDisk( Disk lastPlacedDisk ) { //Form1.testc(); }
public static Disk UpdateDisk(this IServiceManagement proxy, string subscriptionID, string diskName, Disk disk) { return proxy.EndUpdateDisk(proxy.BeginUpdateDisk(subscriptionID, diskName, disk, null, null)); }
private static void ProcessISO9660(Disk.ISO9660 aISO9660, DiskDevice aDiskDevice) { for (int i = 0; i < aISO9660.VolumeDescriptors.Count; i++) { Disk.ISO9660.VolumeDescriptor volDescrip = (Disk.ISO9660.VolumeDescriptor)aISO9660.VolumeDescriptors[i]; if (volDescrip is Disk.ISO9660.PrimaryVolumeDescriptor) { Partitions.Add(volDescrip); } } }
/// <summary> /// Creates or updates a disk. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='diskName'> /// The name of the managed disk that is being created. The name can't be /// changed after the disk is created. Supported characters for the name are /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// </param> /// <param name='disk'> /// Disk object supplied in the body of the Put disk operation. /// </param> public static Disk CreateOrUpdate(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk) { return(operations.CreateOrUpdateAsync(resourceGroupName, diskName, disk).GetAwaiter().GetResult()); }
private void btnStart_Click(object sender, EventArgs e) { if (m_isBusy) { btnStart.Enabled = false; btnStart.Text = "Stopping"; groupOptions.Enabled = false; Thread thread = new Thread(delegate() { m_diskCopier.Abort = true; while (m_isBusy) { Thread.Sleep(100); } if (!m_isClosing) { this.Invoke((MethodInvoker) delegate { EnableUI(); btnStart.Enabled = true; }); } }); thread.Start(); } else { if (comboSourceDisk.SelectedItem == null) { return; } int sourceDiskIndex = ((KeyValuePair <int, string>)comboSourceDisk.SelectedItem).Key; int targetDiskIndex = ((KeyValuePair <int, string>)comboTargetDisk.SelectedItem).Key; Disk sourceDisk = null; Disk targetDisk = null; if (sourceDiskIndex == -1) { string path = openVirtualDiskFileDialog.FileName; try { sourceDisk = new VirtualHardDisk(path, true); } catch (IOException ex) { MessageBox.Show("Failed to open the virtual disk: " + ex.Message, "Error"); return; } } else { try { sourceDisk = new PhysicalDisk(sourceDiskIndex); } catch (DriveNotFoundException) { MessageBox.Show("Source disk not found", "Error"); return; } } if (targetDiskIndex == -1) { string path = saveVirtualDiskFileDialog.FileName;; try { if (chkWriteZeros.Checked) { targetDisk = VirtualHardDisk.CreateFixedDisk(path, sourceDisk.Size); } else { targetDisk = VirtualHardDisk.CreateDynamicDisk(path, sourceDisk.Size); } } catch (IOException ex) { MessageBox.Show("Failed to create the virtual disk: " + ex.Message, "Error"); return; } } else { try { targetDisk = new PhysicalDisk(targetDiskIndex); } catch (DriveNotFoundException) { MessageBox.Show("Target disk not found", "Error"); return; } } DisableUI(); Thread thread = new Thread(delegate() { m_isBusy = true; CopyDisk(sourceDisk, targetDisk); m_isBusy = false; if (m_isClosing) { this.Invoke((MethodInvoker) delegate { this.Close(); }); } else { this.Invoke((MethodInvoker) delegate { EnableUI(); }); } }); thread.Start(); } }
protected override void ResetState() { disk = null; }
Expression GetProgram(Draw draw) { _obfuscator.Minify(draw.State); var src = draw.Source; var vsSource = GlslWriter.BuildString(_backend, draw.State.VertexShader, !Environment.Debug); var fsSource = GlslWriter.BuildString(_backend, draw.State.PixelShader, !Environment.Debug); var key = vsSource + ":" + fsSource; foreach (var e in _programs.GetList(key)) { if (e.Source.Package.IsAccessibleFrom(draw.Source.Package)) { return(e); } } int constCount = draw.State.RuntimeConstants.Count; int attribCount = draw.State.VertexAttributes.Count; int uniformCount = draw.State.Uniforms.Count; int samplerCount = draw.State.PixelSamplers.Count; var array = new Expression[constCount + attribCount + uniformCount + samplerCount]; var index = 0; foreach (var v in draw.State.RuntimeConstants) { array[index++] = new Constant(src, Essentials.String, v.Name); } foreach (var v in draw.State.VertexAttributes) { array[index++] = new Constant(src, Essentials.String, v.Name); } foreach (var v in draw.State.Uniforms) { array[index++] = new Constant(src, Essentials.String, v.Name); } foreach (var v in draw.State.PixelSamplers) { array[index++] = new Constant(src, Essentials.String, v.Name); } var prog = ILFactory.CallMethod(src, "Uno.Graphics.OpenGL.GLProgram", "Create", new Constant(src, Essentials.String, vsSource), new Constant(src, Essentials.String, fsSource), new Constant(src, Essentials.Int, constCount), new Constant(src, Essentials.Int, attribCount), new NewArray(src, _stringArray, array)); var result = _bundle.AddProgram(draw.State.Path.DrawBlock, prog); _programs.Add(key, result); if (_dumpShaders) { var prefix = Environment.Combine("shaders", Type.QualifiedName + "." + key.GetHashCode().ToString("x8")); Disk.WriteAllText(prefix + ".vert", vsSource); Disk.WriteAllText(prefix + ".frag", fsSource); } return(result); }
public override void Run() { // Login VapiAuthHelper = new VapiAuthenticationHelper(); SessionStubConfiguration = VapiAuthHelper.LoginByUsernameAndPassword( Server, UserName, Password); this.diskService = VapiAuthHelper.StubFactory.CreateStub <Disk>( SessionStubConfiguration); this.ethernetService = VapiAuthHelper.StubFactory.CreateStub <Ethernet>( SessionStubConfiguration); this.bootDeviceService = VapiAuthHelper.StubFactory.CreateStub <Device>( SessionStubConfiguration); Console.WriteLine("\n\n#### Setup: Get the virtual machine id"); this.vmId = VmHelper.GetVm(VapiAuthHelper.StubFactory, SessionStubConfiguration, VmName); Console.WriteLine("\nUsing VM: " + VmName + " (vmId=" + this.vmId + " ) for boot device configuration sample"); Console.WriteLine("\nValidate whether the VM has the required " + "minimum number of devices"); VM vmService = VapiAuthHelper.StubFactory.CreateStub <VM>( SessionStubConfiguration); VMTypes.Info vmInfo = vmService.Get(this.vmId); if (vmInfo.GetCdroms().Count < 1 || vmInfo.GetFloppies().Count < 1 || vmInfo.GetDisks().Count < 1 || vmInfo.GetNics().Count < 1) { throw new Exception("\n Selected VM does not have the required " + "minimum number of devices: i.e. 1 Ethernet adapter, " + "1 CD-ROM, 1 Floppy drive, 3 disks"); } Console.WriteLine("\n\n#### Example: Print the current boot device" + " configuration"); List <DeviceTypes.Entry> bootDeviceEntries = this.bootDeviceService.Get(this.vmId); bootDeviceEntries.ForEach(i => Console.WriteLine(i)); // Save the current boot info to revert it during cleanup this.orginalBootDeviceEntries = bootDeviceEntries; Console.WriteLine("\n\n#### Example: Set boot order to be Floppy, " + "Disk1, Disk2, Disk3, Ethernet NIC, CD-ROM"); // Get the device identifiers for disks List <DiskTypes.Summary> diskSummaries = this.diskService.List(this.vmId); Console.WriteLine("\nList of disks attached to the VM: \n"); diskSummaries.ForEach(i => Console.WriteLine(i)); List <String> diskIds = new List <String>(); foreach (DiskTypes.Summary diskSummary in diskSummaries) { diskIds.Add(diskSummary.GetDisk()); } // Get device identifiers for Ethernet NICs List <EthernetTypes.Summary> ethernetSummaries = this.ethernetService.List(this.vmId); Console.WriteLine("\nList of Ethernet NICs attached to the VM:\n"); ethernetSummaries.ForEach(i => Console.WriteLine(i)); List <String> ethernetIds = new List <String>(); foreach (EthernetTypes.Summary ethernetSummary in ethernetSummaries) { ethernetIds.Add(ethernetSummary.GetNic()); } List <DeviceTypes.Entry> devices = new List <DeviceTypes.Entry>(4); devices.Add(new DeviceTypes.Entry()); devices[0].SetType(DeviceTypes.Type.FLOPPY); devices.Add(new DeviceTypes.Entry()); devices[1].SetDisks(diskIds); devices[1].SetType(DeviceTypes.Type.DISK); devices.Add(new DeviceTypes.Entry()); devices[2].SetNic(ethernetIds[0]); devices[2].SetType(DeviceTypes.Type.ETHERNET); devices.Add(new DeviceTypes.Entry()); devices[3].SetType(DeviceTypes.Type.CDROM); this.bootDeviceService.Set(this.vmId, devices); bootDeviceEntries = this.bootDeviceService.Get(this.vmId); Console.WriteLine("\nNew boot device configuration"); bootDeviceEntries.ForEach(i => Console.WriteLine(i)); }
/// <summary> /// Creates a persistent disk in the specified project using the data in the request. You can create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property. /// Documentation https://developers.google.com/compute/alpha/reference/disks/insert /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Compute service.</param> /// <param name="project">Project ID for this request.</param> /// <param name="zone">The name of the zone for this request.</param> /// <param name="body">A valid Compute alpha body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>OperationResponse</returns> public static Operation Insert(ComputeService service, string project, string zone, Disk body, DisksInsertOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } if (body == null) { throw new ArgumentNullException("body"); } if (project == null) { throw new ArgumentNullException(project); } if (zone == null) { throw new ArgumentNullException(zone); } // Building the initial request. var request = service.Disks.Insert(body, project, zone); // Applying optional parameters to the request. request = (DisksResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Disks.Insert failed.", ex); } }
public DynamicDiskExtent(Disk disk, long firstSector, long size, ulong extentID) : base(disk, firstSector, size) { m_extentID = extentID; }
/// <summary> /// Parse a character-separated value DAT and return all found games and roms within /// </summary> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> public override void ParseFile( // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { // Open a file reader Encoding enc = Utilities.GetEncoding(filename); StreamReader sr = new StreamReader(Utilities.TryOpenRead(filename), enc); // Create an empty list of columns to parse though List <string> columns = new List <string>(); long linenum = -1; while (!sr.EndOfStream) { string line = sr.ReadLine(); linenum++; // Parse the first line, getting types from the column names if (linenum == 0) { string[] parsedColumns = line.Split(_delim); foreach (string parsed in parsedColumns) { switch (parsed.ToLowerInvariant().Trim('"')) { case "file": case "filename": case "file name": columns.Add("DatFile.FileName"); break; case "internal name": columns.Add("DatFile.Name"); break; case "description": case "dat description": columns.Add("DatFile.Description"); break; case "game name": case "game": case "machine": columns.Add("Machine.Name"); break; case "game description": columns.Add("Description"); break; case "type": columns.Add("DatItem.Type"); break; case "rom": case "romname": case "rom name": case "name": columns.Add("Rom.Name"); break; case "disk": case "diskname": case "disk name": columns.Add("Disk.Name"); break; case "size": columns.Add("DatItem.Size"); break; case "crc": case "crc hash": columns.Add("DatItem.CRC"); break; case "md5": case "md5 hash": columns.Add("DatItem.MD5"); break; case "sha1": case "sha-1": case "sha1 hash": case "sha-1 hash": columns.Add("DatItem.SHA1"); break; case "sha256": case "sha-256": case "sha256 hash": case "sha-256 hash": columns.Add("DatItem.SHA256"); break; case "sha384": case "sha-384": case "sha384 hash": case "sha-384 hash": columns.Add("DatItem.SHA384"); break; case "sha512": case "sha-512": case "sha512 hash": case "sha-512 hash": columns.Add("DatItem.SHA512"); break; case "nodump": case "no dump": case "status": case "item status": columns.Add("DatItem.Nodump"); break; case "date": columns.Add("DatItem.Date"); break; default: columns.Add("INVALID"); break; } } continue; } // Otherwise, we want to split the line and parse string[] parsedLine = line.Split(_delim); // If the line doesn't have the correct number of columns, we log and skip if (parsedLine.Length != columns.Count) { Globals.Logger.Warning("Malformed line found in '{0}' at line {1}", filename, linenum); continue; } // Set the output item information string machineName = null, machineDesc = null, name = null, crc = null, md5 = null, sha1 = null, sha256 = null, sha384 = null, sha512 = null, date = null; long size = -1; ItemType itemType = ItemType.Rom; ItemStatus status = ItemStatus.None; // Now we loop through and get values for everything for (int i = 0; i < columns.Count; i++) { string value = parsedLine[i].Trim('"'); switch (columns[i]) { case "DatFile.FileName": FileName = (String.IsNullOrWhiteSpace(FileName) ? value : FileName); break; case "DatFile.Name": Name = (String.IsNullOrWhiteSpace(Name) ? value : Name); break; case "DatFile.Description": Description = (String.IsNullOrWhiteSpace(Description) ? value : Description); break; case "Machine.Name": machineName = value; break; case "Description": machineDesc = value; break; case "DatItem.Type": itemType = Utilities.GetItemType(value) ?? ItemType.Rom; break; case "Rom.Name": case "Disk.Name": name = String.IsNullOrWhiteSpace(value) ? name : value; break; case "DatItem.Size": if (!Int64.TryParse(value, out size)) { size = -1; } break; case "DatItem.CRC": crc = Utilities.CleanHashData(value, Constants.CRCLength); break; case "DatItem.MD5": md5 = Utilities.CleanHashData(value, Constants.MD5Length); break; case "DatItem.SHA1": sha1 = Utilities.CleanHashData(value, Constants.SHA1Length); break; case "DatItem.SHA256": sha256 = Utilities.CleanHashData(value, Constants.SHA256Length); break; case "DatItem.SHA384": sha384 = Utilities.CleanHashData(value, Constants.SHA384Length); break; case "DatItem.SHA512": sha512 = Utilities.CleanHashData(value, Constants.SHA512Length); break; case "DatItem.Nodump": status = Utilities.GetItemStatus(value); break; case "DatItem.Date": date = value; break; } } // And now we populate and add the new item switch (itemType) { case ItemType.Archive: Archive archive = new Archive() { Name = name, MachineName = machineName, MachineDescription = machineDesc, }; ParseAddHelper(archive, clean, remUnicode); break; case ItemType.BiosSet: BiosSet biosset = new BiosSet() { Name = name, MachineName = machineName, Description = machineDesc, }; ParseAddHelper(biosset, clean, remUnicode); break; case ItemType.Disk: Disk disk = new Disk() { Name = name, MD5 = md5, SHA1 = sha1, SHA256 = sha256, SHA384 = sha384, SHA512 = sha512, MachineName = machineName, MachineDescription = machineDesc, ItemStatus = status, }; ParseAddHelper(disk, clean, remUnicode); break; case ItemType.Release: Release release = new Release() { Name = name, MachineName = machineName, MachineDescription = machineDesc, }; ParseAddHelper(release, clean, remUnicode); break; case ItemType.Rom: Rom rom = new Rom() { Name = name, Size = size, CRC = crc, MD5 = md5, SHA1 = sha1, SHA256 = sha256, SHA384 = sha384, SHA512 = sha512, Date = date, MachineName = machineName, MachineDescription = machineDesc, ItemStatus = status, }; ParseAddHelper(rom, clean, remUnicode); break; case ItemType.Sample: Sample sample = new Sample() { Name = name, MachineName = machineName, MachineDescription = machineDesc, }; ParseAddHelper(sample, clean, remUnicode); break; } } }
private void Disk_Click(object sender, RoutedEventArgs e) { DataContext = new Disk(); }
public Scan(Disk disk) { _disk = disk; }
/// <summary> /// Read game/machine information /// </summary> /// <param name="reader">XmlReader to use to parse the machine</param> /// <param name="dirs">List of dirs to prepend to the game name</param> /// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="indexId">Index ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> private void ReadMachine( XmlReader reader, List <string> dirs, bool statsOnly, // Standard Dat parsing string filename, int indexId, // Miscellaneous bool keep) { // If we have an empty machine, skip it if (reader == null) { return; } // Otherwise, add what is possible reader.MoveToContent(); bool containsItems = false; // Create a new machine MachineType machineType = 0x0; if (reader.GetAttribute("isbios").AsYesNo() == true) { machineType |= MachineType.Bios; } if (reader.GetAttribute("isdevice").AsYesNo() == true) // Listxml-specific, used by older DATs { machineType |= MachineType.Device; } if (reader.GetAttribute("ismechanical").AsYesNo() == true) // Listxml-specific, used by older DATs { machineType |= MachineType.Mechanical; } string dirsString = (dirs != null && dirs.Count() > 0 ? string.Join("/", dirs) + "/" : string.Empty); Machine machine = new Machine { Name = dirsString + reader.GetAttribute("name"), Description = dirsString + reader.GetAttribute("name"), SourceFile = reader.GetAttribute("sourcefile"), Board = reader.GetAttribute("board"), RebuildTo = reader.GetAttribute("rebuildto"), Runnable = reader.GetAttribute("runnable").AsRunnable(), // Used by older DATs CloneOf = reader.GetAttribute("cloneof"), RomOf = reader.GetAttribute("romof"), SampleOf = reader.GetAttribute("sampleof"), MachineType = (machineType == 0x0 ? MachineType.NULL : machineType), }; if (Header.Type == "SuperDAT" && !keep) { string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value; if (!string.IsNullOrWhiteSpace(tempout)) { machine.Name = tempout; } } while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { reader.Read(); continue; } // Get the roms from the machine switch (reader.Name) { case "comment": // There can be multiple comments by spec machine.Comment += reader.ReadElementContentAsString(); break; case "description": machine.Description = reader.ReadElementContentAsString(); break; case "year": machine.Year = reader.ReadElementContentAsString(); break; case "manufacturer": machine.Manufacturer = reader.ReadElementContentAsString(); break; case "publisher": // Not technically supported but used by some legacy DATs machine.Publisher = reader.ReadElementContentAsString(); break; case "category": // Not technically supported but used by some legacy DATs machine.Category = reader.ReadElementContentAsString(); break; case "trurip": // This is special metadata unique to EmuArc ReadTruRip(reader.ReadSubtree(), machine); // Skip the trurip node now that we've processed it reader.Skip(); break; case "archive": containsItems = true; DatItem archive = new Archive { Name = reader.GetAttribute("name"), Source = new Source { Index = indexId, Name = filename, }, }; archive.CopyMachineInformation(machine); // Now process and add the archive ParseAddHelper(archive, statsOnly); reader.Read(); break; case "biosset": containsItems = true; DatItem biosSet = new BiosSet { Name = reader.GetAttribute("name"), Description = reader.GetAttribute("description"), Default = reader.GetAttribute("default").AsYesNo(), Source = new Source { Index = indexId, Name = filename, }, }; biosSet.CopyMachineInformation(machine); // Now process and add the biosSet ParseAddHelper(biosSet, statsOnly); reader.Read(); break; case "disk": containsItems = true; DatItem disk = new Disk { Name = reader.GetAttribute("name"), MD5 = reader.GetAttribute("md5"), SHA1 = reader.GetAttribute("sha1"), MergeTag = reader.GetAttribute("merge"), ItemStatus = reader.GetAttribute("status").AsItemStatus(), Source = new Source { Index = indexId, Name = filename, }, }; disk.CopyMachineInformation(machine); // Now process and add the disk ParseAddHelper(disk, statsOnly); reader.Read(); break; case "media": containsItems = true; DatItem media = new Media { Name = reader.GetAttribute("name"), MD5 = reader.GetAttribute("md5"), SHA1 = reader.GetAttribute("sha1"), SHA256 = reader.GetAttribute("sha256"), SpamSum = reader.GetAttribute("spamsum"), Source = new Source { Index = indexId, Name = filename, }, }; media.CopyMachineInformation(machine); // Now process and add the media ParseAddHelper(media, statsOnly); reader.Read(); break; case "release": containsItems = true; DatItem release = new Release { Name = reader.GetAttribute("name"), Region = reader.GetAttribute("region"), Language = reader.GetAttribute("language"), Date = reader.GetAttribute("date"), Default = reader.GetAttribute("default").AsYesNo(), }; release.CopyMachineInformation(machine); // Now process and add the release ParseAddHelper(release, statsOnly); reader.Read(); break; case "rom": containsItems = true; DatItem rom = new Rom { Name = reader.GetAttribute("name"), Size = Utilities.CleanLong(reader.GetAttribute("size")), CRC = reader.GetAttribute("crc"), MD5 = reader.GetAttribute("md5"), SHA1 = reader.GetAttribute("sha1"), SHA256 = reader.GetAttribute("sha256"), SHA384 = reader.GetAttribute("sha384"), SHA512 = reader.GetAttribute("sha512"), SpamSum = reader.GetAttribute("spamsum"), MergeTag = reader.GetAttribute("merge"), ItemStatus = reader.GetAttribute("status").AsItemStatus(), Date = CleanDate(reader.GetAttribute("date")), Inverted = reader.GetAttribute("inverted").AsYesNo(), Source = new Source { Index = indexId, Name = filename, }, }; rom.CopyMachineInformation(machine); // Now process and add the rom ParseAddHelper(rom, statsOnly); reader.Read(); break; case "sample": containsItems = true; DatItem sample = new Sample { Name = reader.GetAttribute("name"), Source = new Source { Index = indexId, Name = filename, }, }; sample.CopyMachineInformation(machine); // Now process and add the sample ParseAddHelper(sample, statsOnly); reader.Read(); break; default: reader.Read(); break; } } // If no items were found for this machine, add a Blank placeholder if (!containsItems) { Blank blank = new Blank() { Source = new Source { Index = indexId, Name = filename, }, }; blank.CopyMachineInformation(machine); // Now process and add the rom ParseAddHelper(blank, statsOnly); } }
public Control(Screen screen, Disk disk, Mouse mouse, Text text, MusicBase music, Logic logic, Sound sound, SkyCompact skyCompact, ISystem system) { _saveFileMan = system.SaveFileManager; _skyScreen = screen; _skyDisk = disk; _skyMouse = mouse; _skyText = text; _skyMusic = music; _skyLogic = logic; _skySound = sound; _skyCompact = skyCompact; _system = system; }
public IActionResult Delete(Disk disk) { context.Disk.Remove(disk); context.SaveChanges(); return(RedirectToAction("List", "Disk")); }
public void placeDisk(Disk lastPlacedDisk) { }
protected async Task Snapshot_CRUD_Execute(string diskCreateOption, string methodName, int?diskSizeGB = null, string location = null, bool incremental = false) { EnsureClientsInitialized(DefaultLocation); DiskRPLocation = location ?? DiskRPLocation; // Data var rgName = Recording.GenerateAssetName(TestPrefix); var diskName = Recording.GenerateAssetName(DiskNamePrefix); var snapshotName = Recording.GenerateAssetName(DiskNamePrefix); Disk sourceDisk = await GenerateDefaultDisk(diskCreateOption, rgName, diskSizeGB); // ********** // SETUP // ********** // Create resource group await ResourceGroupsOperations.CreateOrUpdateAsync(rgName, new ResourceGroup(DiskRPLocation)); // Put disk Disk diskOut = await WaitForCompletionAsync(await DisksOperations.StartCreateOrUpdateAsync(rgName, diskName, sourceDisk)); Validate(sourceDisk, diskOut, DiskRPLocation); // Generate snapshot using disk info Snapshot snapshot = GenerateDefaultSnapshot(diskOut.Id, incremental: incremental); // ********** // TEST // ********** // Put Snapshot snapshotOut = await WaitForCompletionAsync(await SnapshotsOperations.StartCreateOrUpdateAsync(rgName, snapshotName, snapshot)); Validate(snapshot, snapshotOut, incremental: incremental); // Get snapshotOut = (await SnapshotsOperations.GetAsync(rgName, snapshotName)).Value; Validate(snapshot, snapshotOut, incremental: incremental); // Get access AccessUri accessUri = await WaitForCompletionAsync((await SnapshotsOperations.StartGrantAccessAsync(rgName, snapshotName, new GrantAccessData(AccessDataDefault.Access, AccessDataDefault.DurationInSeconds)))); Assert.NotNull(accessUri.AccessSAS); // Get snapshotOut = (await SnapshotsOperations.GetAsync(rgName, snapshotName)).Value; Validate(snapshot, snapshotOut, incremental: incremental); const string tagKey = "tageKey"; // Patch var updatesnapshot = new SnapshotUpdate() { Tags = { { tagKey, "tagvalue" } } }; snapshotOut = await WaitForCompletionAsync(await SnapshotsOperations.StartUpdateAsync(rgName, snapshotName, updatesnapshot)); Validate(snapshot, snapshotOut, incremental: incremental); // Get snapshotOut = (await SnapshotsOperations.GetAsync(rgName, snapshotName)).Value; Validate(snapshot, snapshotOut, incremental: incremental); // End access await WaitForCompletionAsync(await SnapshotsOperations.StartRevokeAccessAsync(rgName, snapshotName)); // Delete await WaitForCompletionAsync(await SnapshotsOperations.StartDeleteAsync(rgName, snapshotName)); try { // Ensure it was really deleted await SnapshotsOperations.GetAsync(rgName, snapshotName); Assert.False(true); } catch (Exception ex) { Assert.NotNull(ex); //Assert.AreEqual(HttpStatusCode.NotFound, ex.Response.StatusCode); } }
public void RemoveMedia() { _disk = null; _trackImageData = null; _diskBits = 0; }
Plugin( Disk disk ) { _disk = disk ; }
/// <summary> /// Creates or updates a disk. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. /// </param> /// <param name='diskName'> /// The name of the managed disk that is being created. The name can't be /// changed after the disk is created. Supported characters for the name are /// a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters. /// </param> /// <param name='disk'> /// Disk object supplied in the body of the Put disk operation. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Disk> CreateOrUpdateAsync(this IDisksOperations operations, string resourceGroupName, string diskName, Disk disk, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, diskName, disk, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public RenderContext(RenderConfig config) { m_config = config; float aspectRatio = config.width * 1.0f / config.height; viewPlane = new ViewPlane(config.width, config.height, 1f, 2); viewPlane.SAMPLES = config.samples; viewPlane.SetSampler(new JitteredSampler()); ToneMapping.type = ToneMapping.ToneMappingType.Reinhard; camera = new PerspectiveCamera(new Vector3(0, 0, -5f), Vector3.Forward, Vector3.Up, viewPlane, 60f); //tracer = new Tracer(this); tracer = new TracerAreaLigting(this); MatAmbientOccluder matao = new MatAmbientOccluder(); MatPhong matphong = new MatPhong(0.25f, 0.7f, 0.3f, ColourF.White, ColourF.Red, ColourF.White, 100F); MatPhong matphongW = new MatPhong(0.25f, 0.7f, 0.3f, ColourF.White, ColourF.White, ColourF.White, 10F); Plane p1 = new Plane(new Vector3(0, 0, 4), Vector3.Backward); p1.SetMaterial(matphongW); Plane pup = new Plane(new Vector3(0, -1f, 0f), new Vector3(0, 1f, 0f)); pup.SetMaterial(matphongW); Sphere spr1 = new Sphere(new Vector3(0.5f, 0f, 0f), 1.3f); spr1.SetMaterial(matphongW); Sphere spr2 = new Sphere(new Vector3(-0.8f, -0.3f, -0.5f), 0.75f); spr2.SetMaterial(matphong); //Disk disk1 = new Disk(new Vector3(3.0f, 0f, 0f), new Vector3(-0.5f, 0f, -0.1f), 0.7f); //disk1.SetMaterial(matphongW); objects.Add(pup); objects.Add(spr1); objects.Add(spr2); //objects.Add(disk1); AmbientOccluder ao = new AmbientOccluder(Vector3.One * 0.5f, Vector3.One, 0.3f); ao.SetSampler(new JitteredSampler(), config.samples, 5); ambientLight = ao; lights = new List <LightBase>(); PointLight pl = new PointLight(Vector3.Ctor(-1f, 2.5f, 2.3f), ColourF.White, 1f, 5f); pl.CAST_SHADOW = true; PointLight pl2 = new PointLight(Vector3.Ctor(0, 0f, -2.3f), Vector3.Ctor(1.0f, 0.3f, 0.1f), 1.0f, 1f); pl2.CAST_SHADOW = true; AreaLight areaLit = new AreaLight(); areaLit.CAST_SHADOW = true; Disk areaLitGeom = new Disk(new Vector3(3.0f, 0.5f, 0f), new Vector3(-0.5f, 0f, -0.1f), 0.7f, false); areaLitGeom.SetSampler(new JitteredSampler(), config.samples, 10); areaLit.GEOMETRY = areaLitGeom; MaterialEmissive areaLitMat = new MaterialEmissive(Vector3.Ctor(1.0f, 1.0f, 1.0f), 20f); areaLit.MATERIAL = areaLitMat; areaLitGeom.SetMaterial(areaLitMat); objects.Add(areaLitGeom); //DirectionalLight dl = new DirectionalLight(Vector3.Ctor(0f,-1f,0.2f), ColourF.White, 5.0f); //dl.CAST_SHADOW = true; //lights.Add(dl); lights.Add(pl); lights.Add(pl2); lights.Add(areaLit); }
public DiskReader(Disk disk) { m_disk = disk; }
/// <summary> /// Read game/machine information /// </summary> /// <param name="reader">XmlReader to use to parse the machine</param> /// <param name="dirs">List of dirs to prepend to the game name</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> private void ReadMachine( XmlReader reader, List <string> dirs, // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { // If we have an empty machine, skip it if (reader == null) { return; } // Otherwise, add what is possible reader.MoveToContent(); string key = ""; string temptype = reader.Name; bool containsItems = false; // Create a new machine MachineType machineType = MachineType.NULL; if (Utilities.GetYesNo(reader.GetAttribute("isbios")) == true) { machineType |= MachineType.Bios; } if (Utilities.GetYesNo(reader.GetAttribute("isdevice")) == true) // Listxml-specific, used by older DATs { machineType |= MachineType.Device; } if (Utilities.GetYesNo(reader.GetAttribute("ismechanical")) == true) // Listxml-specific, used by older DATs { machineType |= MachineType.Mechanical; } string dirsString = (dirs != null && dirs.Count() > 0 ? string.Join("/", dirs) + "/" : ""); Machine machine = new Machine { Name = dirsString + reader.GetAttribute("name"), Description = dirsString + reader.GetAttribute("name"), SourceFile = reader.GetAttribute("sourcefile"), Board = reader.GetAttribute("board"), RebuildTo = reader.GetAttribute("rebuildto"), Runnable = Utilities.GetYesNo(reader.GetAttribute("runnable")), // Listxml-specific, used by older DATs Comment = "", CloneOf = reader.GetAttribute("cloneof") ?? "", RomOf = reader.GetAttribute("romof") ?? "", SampleOf = reader.GetAttribute("sampleof") ?? "", MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType), }; if (Type == "SuperDAT" && !keep) { string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value; if (!String.IsNullOrWhiteSpace(tempout)) { machine.Name = tempout; } } while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { reader.Read(); continue; } // Get the roms from the machine switch (reader.Name) { case "comment": // There can be multiple comments by spec machine.Comment += reader.ReadElementContentAsString(); break; case "description": machine.Description = reader.ReadElementContentAsString(); break; case "year": machine.Year = reader.ReadElementContentAsString(); break; case "manufacturer": machine.Manufacturer = reader.ReadElementContentAsString(); break; case "publisher": // Not technically supported but used by some legacy DATs machine.Publisher = reader.ReadElementContentAsString(); break; case "trurip": // This is special metadata unique to TruRip ReadTruRip(reader.ReadSubtree(), machine); // Skip the trurip node now that we've processed it reader.Skip(); break; case "release": containsItems = true; DatItem release = new Release { Name = reader.GetAttribute("name"), Region = reader.GetAttribute("region"), Language = reader.GetAttribute("language"), Date = reader.GetAttribute("date"), Default = Utilities.GetYesNo(reader.GetAttribute("default")), }; release.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(release, clean, remUnicode); reader.Read(); break; case "biosset": containsItems = true; DatItem biosset = new BiosSet { Name = reader.GetAttribute("name"), Description = reader.GetAttribute("description"), Default = Utilities.GetYesNo(reader.GetAttribute("default")), SystemID = sysid, System = filename, SourceID = srcid, }; biosset.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(biosset, clean, remUnicode); reader.Read(); break; case "rom": containsItems = true; DatItem rom = new Rom { Name = reader.GetAttribute("name"), Size = Utilities.GetSize(reader.GetAttribute("size")), CRC = Utilities.CleanHashData(reader.GetAttribute("crc"), Constants.CRCLength), MD5 = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length), SHA1 = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length), SHA256 = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length), SHA384 = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length), SHA512 = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length), MergeTag = reader.GetAttribute("merge"), ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")), Date = Utilities.GetDate(reader.GetAttribute("date")), SystemID = sysid, System = filename, SourceID = srcid, }; rom.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(rom, clean, remUnicode); reader.Read(); break; case "disk": containsItems = true; DatItem disk = new Disk { Name = reader.GetAttribute("name"), MD5 = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length), SHA1 = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length), SHA256 = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length), SHA384 = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length), SHA512 = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length), MergeTag = reader.GetAttribute("merge"), ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")), SystemID = sysid, System = filename, SourceID = srcid, }; disk.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(disk, clean, remUnicode); reader.Read(); break; case "sample": containsItems = true; DatItem samplerom = new Sample { Name = reader.GetAttribute("name"), SystemID = sysid, System = filename, SourceID = srcid, }; samplerom.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(samplerom, clean, remUnicode); reader.Read(); break; case "archive": containsItems = true; DatItem archiverom = new Archive { Name = reader.GetAttribute("name"), SystemID = sysid, System = filename, SourceID = srcid, }; archiverom.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(archiverom, clean, remUnicode); reader.Read(); break; default: reader.Read(); break; } } // If no items were found for this machine, add a Blank placeholder if (!containsItems) { Blank blank = new Blank() { SystemID = sysid, System = filename, SourceID = srcid, }; blank.CopyMachineInformation(machine); // Now process and add the rom ParseAddHelper(blank, clean, remUnicode); } }
public static Disk CreateDisk(this IServiceManagement proxy, string subscriptionID, Disk disk) { return proxy.EndCreateDisk(proxy.BeginCreateDisk(subscriptionID, disk, null, null)); }
public NewDisk(Disk disk) { Disk = disk; }
public LinkedList(string fileName) { MemoryEnv = new Memory(); DiskEnv = new Disk(fileName); }
/// <summary> /// Read machine information /// </summary> /// <param name="reader">XmlReader representing a machine block</param> /// <param name="filename">Name of the file to be parsed</param> /// <param name="sysid">System ID for the DAT</param> /// <param name="srcid">Source ID for the DAT</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="clean">True if game names are sanitized, false otherwise (default)</param> /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param> private void ReadMachine( XmlReader reader, // Standard Dat parsing string filename, int sysid, int srcid, // Miscellaneous bool keep, bool clean, bool remUnicode) { // If we have an empty machine, skip it if (reader == null) { return; } // Otherwise, add what is possible reader.MoveToContent(); string key = ""; string temptype = reader.Name; bool containsItems = false; // Create a new machine MachineType machineType = MachineType.NULL; if (Utilities.GetYesNo(reader.GetAttribute("isbios")) == true) { machineType |= MachineType.Bios; } if (Utilities.GetYesNo(reader.GetAttribute("isdevice")) == true) { machineType |= MachineType.Device; } if (Utilities.GetYesNo(reader.GetAttribute("ismechanical")) == true) { machineType |= MachineType.Mechanical; } Machine machine = new Machine { Name = reader.GetAttribute("name"), Description = reader.GetAttribute("name"), SourceFile = reader.GetAttribute("sourcefile"), Runnable = Utilities.GetYesNo(reader.GetAttribute("runnable")), Comment = "", CloneOf = reader.GetAttribute("cloneof") ?? "", RomOf = reader.GetAttribute("romof") ?? "", SampleOf = reader.GetAttribute("sampleof") ?? "", Devices = new List <string>(), SlotOptions = new List <string>(), MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType), }; while (!reader.EOF) { // We only want elements if (reader.NodeType != XmlNodeType.Element) { reader.Read(); continue; } // Get the roms from the machine switch (reader.Name) { case "description": machine.Description = reader.ReadElementContentAsString(); break; case "year": machine.Year = reader.ReadElementContentAsString(); break; case "manufacturer": machine.Manufacturer = reader.ReadElementContentAsString(); break; case "biosset": containsItems = true; DatItem biosset = new BiosSet { Name = reader.GetAttribute("name"), Description = reader.GetAttribute("description"), Default = Utilities.GetYesNo(reader.GetAttribute("default")), SystemID = sysid, System = filename, SourceID = srcid, }; biosset.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(biosset, clean, remUnicode); reader.Read(); break; case "rom": containsItems = true; DatItem rom = new Rom { Name = reader.GetAttribute("name"), Bios = reader.GetAttribute("bios"), Size = Utilities.GetSize(reader.GetAttribute("size")), CRC = Utilities.CleanHashData(reader.GetAttribute("crc"), Constants.CRCLength), MD5 = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length), SHA1 = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length), SHA256 = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length), SHA384 = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length), SHA512 = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length), MergeTag = reader.GetAttribute("merge"), Region = reader.GetAttribute("region"), Offset = reader.GetAttribute("offset"), ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")), Optional = Utilities.GetYesNo(reader.GetAttribute("optional")), SystemID = sysid, System = filename, SourceID = srcid, }; rom.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(rom, clean, remUnicode); reader.Read(); break; case "disk": containsItems = true; DatItem disk = new Disk { Name = reader.GetAttribute("name"), MD5 = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length), SHA1 = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length), SHA256 = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length), SHA384 = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length), SHA512 = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length), MergeTag = reader.GetAttribute("merge"), Region = reader.GetAttribute("region"), Index = reader.GetAttribute("index"), Writable = Utilities.GetYesNo(reader.GetAttribute("writable")), ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")), Optional = Utilities.GetYesNo(reader.GetAttribute("optional")), SystemID = sysid, System = filename, SourceID = srcid, }; disk.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(disk, clean, remUnicode); reader.Read(); break; case "device_ref": string device_ref_name = reader.GetAttribute("name"); if (!machine.Devices.Contains(device_ref_name)) { machine.Devices.Add(device_ref_name); } reader.Read(); break; case "sample": containsItems = true; DatItem samplerom = new Sample { Name = reader.GetAttribute("name"), SystemID = sysid, System = filename, SourceID = srcid, }; samplerom.CopyMachineInformation(machine); // Now process and add the rom key = ParseAddHelper(samplerom, clean, remUnicode); reader.Read(); break; case "chip": // string chip_name = reader.GetAttribute("name"); // string chip_tag = reader.GetAttribute("tag"); // string chip_type = reader.GetAttribute("type"); // (cpu|audio) // string chip_clock = reader.GetAttribute("clock"); reader.Read(); break; case "display": // string display_tag = reader.GetAttribute("tag"); // string display_type = reader.GetAttribute("type"); // (raster|vector|lcd|svg|unknown) // string display_rotate = reader.GetAttribute("rotate"); // (0|90|180|270) // bool? display_flipx = Utilities.GetYesNo(reader.GetAttribute("flipx")); // string display_width = reader.GetAttribute("width"); // string display_height = reader.GetAttribute("height"); // string display_refresh = reader.GetAttribute("refresh"); // string display_pixclock = reader.GetAttribute("pixclock"); // string display_htotal = reader.GetAttribute("htotal"); // string display_hbend = reader.GetAttribute("hbend"); // string display_hbstart = reader.GetAttribute("hbstart"); // string display_vtotal = reader.GetAttribute("vtotal"); // string display_vbend = reader.GetAttribute("vbend"); // string display_vbstart = reader.GetAttribute("vbstart"); reader.Read(); break; case "sound": // string sound_channels = reader.GetAttribute("channels"); reader.Read(); break; case "condition": // string condition_tag = reader.GetAttribute("tag"); // string condition_mask = reader.GetAttribute("mask"); // string condition_relation = reader.GetAttribute("relation"); // (eq|ne|gt|le|lt|ge) // string condition_value = reader.GetAttribute("value"); reader.Read(); break; case "input": // bool? input_service = Utilities.GetYesNo(reader.GetAttribute("service")); // bool? input_tilt = Utilities.GetYesNo(reader.GetAttribute("tilt")); // string input_players = reader.GetAttribute("players"); // string input_coins = reader.GetAttribute("coins"); // // While the subtree contains <control> elements... // string control_type = reader.GetAttribute("type"); // string control_player = reader.GetAttribute("player"); // string control_buttons = reader.GetAttribute("buttons"); // string control_regbuttons = reader.GetAttribute("regbuttons"); // string control_minimum = reader.GetAttribute("minimum"); // string control_maximum = reader.GetAttribute("maximum"); // string control_sensitivity = reader.GetAttribute("sensitivity"); // string control_keydelta = reader.GetAttribute("keydelta"); // bool? control_reverse = Utilities.GetYesNo(reader.GetAttribute("reverse")); // string control_ways = reader.GetAttribute("ways"); // string control_ways2 = reader.GetAttribute("ways2"); // string control_ways3 = reader.GetAttribute("ways3"); reader.Skip(); break; case "dipswitch": // string dipswitch_name = reader.GetAttribute("name"); // string dipswitch_tag = reader.GetAttribute("tag"); // string dipswitch_mask = reader.GetAttribute("mask"); // // While the subtree contains <diplocation> elements... // string diplocation_name = reader.GetAttribute("name"); // string diplocation_number = reader.GetAttribute("number"); // bool? diplocation_inverted = Utilities.GetYesNo(reader.GetAttribute("inverted")); // // While the subtree contains <dipvalue> elements... // string dipvalue_name = reader.GetAttribute("name"); // string dipvalue_value = reader.GetAttribute("value"); // bool? dipvalue_default = Utilities.GetYesNo(reader.GetAttribute("default")); reader.Skip(); break; case "configuration": // string configuration_name = reader.GetAttribute("name"); // string configuration_tag = reader.GetAttribute("tag"); // string configuration_mask = reader.GetAttribute("mask"); // // While the subtree contains <conflocation> elements... // string conflocation_name = reader.GetAttribute("name"); // string conflocation_number = reader.GetAttribute("number"); // bool? conflocation_inverted = Utilities.GetYesNo(reader.GetAttribute("inverted")); // // While the subtree contains <confsetting> elements... // string confsetting_name = reader.GetAttribute("name"); // string confsetting_value = reader.GetAttribute("value"); // bool? confsetting_default = Utilities.GetYesNo(reader.GetAttribute("default")); reader.Skip(); break; case "port": // string port_tag = reader.GetAttribute("tag"); // // While the subtree contains <analog> elements... // string analog_mask = reader.GetAttribute("mask"); reader.Skip(); break; case "adjuster": // string adjuster_name = reader.GetAttribute("name"); // bool? adjuster_default = Utilities.GetYesNo(reader.GetAttribute("default")); // // For the one possible <condition> element... // string condition_tag = reader.GetAttribute("tag"); // string condition_mask = reader.GetAttribute("mask"); // string condition_relation = reader.GetAttribute("relation"); // (eq|ne|gt|le|lt|ge) // string condition_value = reader.GetAttribute("value"); reader.Skip(); break; case "driver": // string driver_status = reader.GetAttribute("status"); // (good|imperfect|preliminary) // string driver_emulation = reader.GetAttribute("emulation"); // (good|imperfect|preliminary) // string driver_cocktail = reader.GetAttribute("cocktail"); // (good|imperfect|preliminary) // string driver_savestate = reader.GetAttribute("savestate"); // (supported|unsupported) reader.Read(); break; case "feature": // string feature_type = reader.GetAttribute("type"); // (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing) // string feature_status = reader.GetAttribute("status"); // (unemulated|imperfect) // string feature_overall = reader.GetAttribute("overall"); // (unemulated|imperfect) reader.Read(); break; case "device": // string device_type = reader.GetAttribute("type"); // string device_tag = reader.GetAttribute("tag"); // string device_fixed_image = reader.GetAttribute("fixed_image"); // string device_mandatory = reader.GetAttribute("mandatory"); // string device_interface = reader.GetAttribute("interface"); // // For the one possible <instance> element... // string instance_name = reader.GetAttribute("name"); // string instance_briefname = reader.GetAttribute("briefname"); // // While the subtree contains <extension> elements... // string extension_name = reader.GetAttribute("name"); reader.Skip(); break; case "slot": // string slot_name = reader.GetAttribute("name"); ReadSlot(reader.ReadSubtree(), machine); // Skip the slot now that we've processed it reader.Skip(); break; case "softwarelist": // string softwarelist_name = reader.GetAttribute("name"); // string softwarelist_status = reader.GetAttribute("status"); // (original|compatible) // string softwarelist_filter = reader.GetAttribute("filter"); reader.Read(); break; case "ramoption": // string ramoption_default = reader.GetAttribute("default"); reader.Read(); break; default: reader.Read(); break; } } // If no items were found for this machine, add a Blank placeholder if (!containsItems) { Blank blank = new Blank() { SystemID = sysid, System = filename, SourceID = srcid, }; blank.CopyMachineInformation(machine); // Now process and add the rom ParseAddHelper(blank, clean, remUnicode); } }
public async Task<Status> DeployServerWithDiskSpeedImageTask( string name, string description, string networkId, string privateIp, string imageId, string adminPassword, bool start, Disk[] disk) { return await ServerManagementLegacy.Server.DeployServerWithDiskSpeedImageTask( name, description, networkId, privateIp, imageId, adminPassword, start, disk); }
public RaspberryPi(ILowLevelApi lowLevelApi, Disk disk) : base(lowLevelApi) { this.disk = disk; }
public DiskDriveDevice(string description) { m_description = description; m_disk = null; }
public T RMA() { Disk<T> newDisk = RMAService.Exchange(this) return (T)newDisk; //Ugly explicit cast }
static void Main(string[] args) { Console.WriteLine("Zadania05 - Marcin Ptak"); Console.Write("Podaj wysokość wieży: "); UserHeight = CheckRangeFromKB(3, 9); Console.Clear(); InitializeTowers(UserHeight); while (true) { DrawTowers(); DrawScore(); if (Towers[2].Height == UserHeight) { break; } Console.CursorTop = UserHeight; Console.Write("Przenieś z: "); From = CheckRangeFromKB(1, 3); try { CurrentDisk = Towers[From - 1].Pop(); } catch (EmptyTowerException) { Console.Write("(Pusto!)"); continue; } finally { Console.Write(" "); } Console.CursorLeft = 0; Console.Write("Przenieś do: "); To = CheckRangeFromKB(1, 3); try { Towers[To - 1].Push(CurrentDisk); } catch (LargerOnSmallerElementException) { Console.Write("(Źle!)"); Towers[From - 1].Push(CurrentDisk); continue; } Score++; Console.Clear(); } Console.Write("Udało się! Naciśnij dowolny klawisz, by wyjść."); Console.ReadKey(); }
public MBRPartition(byte partitionType, Disk disk, long firstSector, long size) : base(disk, firstSector, size) { m_partitionType = partitionType; }
public SkyEngine(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager, IAudioOutput output, ISaveFileManager saveFileManager, bool debugMode = false) { _system = new SkySystem(gfxManager, inputManager, saveFileManager); _mixer = new Mixer(44100); // HACK: _mixer.Read(new byte[0], 0); output.SetSampleProvider(_mixer); var directory = ServiceLocator.FileStorage.GetDirectoryName(settings.Game.Path); _skyDisk = new Disk(directory); _skySound = new Sound(_mixer, _skyDisk, Mixer.MaxChannelVolume); SystemVars.Instance.GameVersion = _skyDisk.DetermineGameVersion(); // TODO: music var dev = MidiDriver.DetectDevice(MusicDriverTypes.AdLib | MusicDriverTypes.Midi /*| MDT_PREFER_MT32*/, settings.AudioDevice); if (MidiDriver.GetMusicType(dev) == MusicType.AdLib) { SystemVars.Instance.SystemFlags |= SystemFlags.Sblaster; _skyMusic = new AdLibMusic(_mixer, _skyDisk); } else { SystemVars.Instance.SystemFlags |= SystemFlags.Roland; if ((MidiDriver.GetMusicType(dev) == MusicType.MT32)/* || ConfMan.getBool("native_mt32")*/) _skyMusic = new Mt32Music((MidiDriver)MidiDriver.CreateMidi(_mixer, dev), _mixer, _skyDisk); else _skyMusic = new GmMusic((MidiDriver)MidiDriver.CreateMidi(_mixer, dev), _mixer, _skyDisk); } if (IsCDVersion) { // TODO: configuration //if (ConfMan.hasKey("nosubtitles")) //{ // warning("Configuration key 'nosubtitles' is deprecated. Use 'subtitles' instead"); // if (!ConfMan.getBool("nosubtitles")) // _systemVars.systemFlags |= SF_ALLOW_TEXT; //} //if (ConfMan.getBool("subtitles")) // _systemVars.systemFlags |= SF_ALLOW_TEXT; //if (!ConfMan.getBool("speech_mute")) // _systemVars.systemFlags |= SF_ALLOW_SPEECH; } else SystemVars.Instance.SystemFlags |= SystemFlags.AllowText; SystemVars.Instance.SystemFlags |= SystemFlags.PlayVocs; SystemVars.Instance.GameSpeed = 80; _skyCompact = new SkyCompact(); _skyText = new Text(_skyDisk, _skyCompact); _skyMouse = new Mouse(_system, _skyDisk, _skyCompact); _skyScreen = new Screen(_system, _skyDisk, _skyCompact); InitVirgin(); InitItemList(); LoadFixedItems(); _skyLogic = new Logic(_skyCompact, _skyScreen, _skyDisk, _skyText, _skyMusic, _skyMouse, _skySound); _skyMouse.Logic = _skyLogic; _skyScreen.Logic = _skyLogic; _skySound.Logic = _skyLogic; _skyText.Logic = _skyLogic; _skyControl = new Control(_skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _skyCompact, _system); _skyLogic.Control = _skyControl; // TODO: language // TODO: Setup mixer //SyncSoundSettings(); // TODO: debugger //_debugger = new Debugger(_skyLogic, _skyMouse, _skyScreen, _skyCompact); }
public void InsertMedia(Disk disk) { _disk = disk; UpdateMediaData(); }
protected async Task Snapshot_List_Execute(string diskCreateOption, string methodName, int?diskSizeGB = null) { EnsureClientsInitialized(DefaultLocation); // Data var rgName1 = Recording.GenerateAssetName(TestPrefix); var rgName2 = Recording.GenerateAssetName(TestPrefix); var diskName1 = Recording.GenerateAssetName(DiskNamePrefix); var diskName2 = Recording.GenerateAssetName(DiskNamePrefix); var snapshotName1 = Recording.GenerateAssetName(DiskNamePrefix); var snapshotName2 = Recording.GenerateAssetName(DiskNamePrefix); Disk disk1 = await GenerateDefaultDisk(diskCreateOption, rgName1, diskSizeGB); Disk disk2 = await GenerateDefaultDisk(diskCreateOption, rgName2, diskSizeGB); // ********** // SETUP // ********** // Create resource groups await ResourceGroupsOperations.CreateOrUpdateAsync(rgName1, new ResourceGroup(DiskRPLocation)); await ResourceGroupsOperations.CreateOrUpdateAsync(rgName2, new ResourceGroup(DiskRPLocation)); // Put 4 disks, 2 in each resource group Disk diskOut11 = await WaitForCompletionAsync(await DisksOperations.StartCreateOrUpdateAsync(rgName1, diskName1, disk1)); Disk diskOut12 = await WaitForCompletionAsync(await DisksOperations.StartCreateOrUpdateAsync(rgName1, diskName2, disk2)); Disk diskOut21 = await WaitForCompletionAsync(await DisksOperations.StartCreateOrUpdateAsync(rgName2, diskName1, disk1)); Disk diskOut22 = await WaitForCompletionAsync(await DisksOperations.StartCreateOrUpdateAsync(rgName2, diskName2, disk2)); // Generate 4 snapshots using disks info Snapshot snapshot11 = GenerateDefaultSnapshot(diskOut11.Id); Snapshot snapshot12 = GenerateDefaultSnapshot(diskOut12.Id, SnapshotStorageAccountTypes.StandardZRS.ToString()); Snapshot snapshot21 = GenerateDefaultSnapshot(diskOut21.Id); Snapshot snapshot22 = GenerateDefaultSnapshot(diskOut22.Id); // Put 4 snapshots, 2 in each resource group await WaitForCompletionAsync(await SnapshotsOperations.StartCreateOrUpdateAsync(rgName1, snapshotName1, snapshot11)); await WaitForCompletionAsync(await SnapshotsOperations.StartCreateOrUpdateAsync(rgName1, snapshotName2, snapshot12)); await WaitForCompletionAsync(await SnapshotsOperations.StartCreateOrUpdateAsync(rgName2, snapshotName1, snapshot21)); await WaitForCompletionAsync(await SnapshotsOperations.StartCreateOrUpdateAsync(rgName2, snapshotName2, snapshot22)); // ********** // TEST // ********** // List snapshots under resource group //IPage<Snapshot> snapshotsOut = await SnapshotsClient.ListByResourceGroupAsync(rgName1); var snapshotsOut = await SnapshotsOperations.ListByResourceGroupAsync(rgName1).ToEnumerableAsync(); Assert.AreEqual(2, snapshotsOut.Count()); //Assert.Null(snapshotsOut.NextPageLink); snapshotsOut = await SnapshotsOperations.ListByResourceGroupAsync(rgName2).ToEnumerableAsync(); Assert.AreEqual(2, snapshotsOut.Count()); //Assert.Null(snapshotsOut.NextPageLink); // List snapshots under subscription snapshotsOut = await SnapshotsOperations.ListAsync().ToEnumerableAsync(); Assert.True(snapshotsOut.Count() >= 4); //if (snapshotsOut.NextPageLink != null) //{ // snapshotsOut = await SnapshotsClient.ListNext(snapshotsOut.NextPageLink); // Assert.True(snapshotsOut.Any()); //} }
protected override void LoadState() { disk = new(FileContents); }
public Grid(Logic logic, Disk disk, SkyCompact skyCompact) { _skyLogic = logic; _skyDisk = disk; _skyCompact = skyCompact; }
protected async Task Disk_CRUD_Execute(string diskCreateOption, string methodName, int?diskSizeGB = null, string location = null, IList <string> zones = null) { EnsureClientsInitialized(DefaultLocation); DiskRPLocation = location ?? DiskRPLocation; // Data var rgName = Recording.GenerateAssetName(TestPrefix); var diskName = Recording.GenerateAssetName(DiskNamePrefix); Disk disk = await GenerateDefaultDisk(diskCreateOption, rgName, diskSizeGB, zones, location); // ********** // SETUP // ********** // Create resource group, unless create option is import in which case resource group will be created with vm, // or copy in which casethe resource group will be created with the original disk. if (diskCreateOption != DiskCreateOption.Import && diskCreateOption != DiskCreateOption.Copy) { await ResourceGroupsOperations.CreateOrUpdateAsync(rgName, new ResourceGroup(DiskRPLocation)); } // ********** // TEST // ********** // Put Disk diskOut = await WaitForCompletionAsync((await DisksOperations.StartCreateOrUpdateAsync(rgName, diskName, disk))); Validate(disk, diskOut, DiskRPLocation); // Get diskOut = await DisksOperations.GetAsync(rgName, diskName); Validate(disk, diskOut, DiskRPLocation); //string resourceGroupName, string diskName, AccessLevel access, int durationInSeconds, CancellationToken cancellationToken = default // Get disk access AccessUri accessUri = await WaitForCompletionAsync(await DisksOperations.StartGrantAccessAsync(rgName, diskName, new GrantAccessData(AccessDataDefault.Access, AccessDataDefault.DurationInSeconds))); Assert.NotNull(accessUri.AccessSAS); // Get diskOut = await DisksOperations.GetAsync(rgName, diskName); Validate(disk, diskOut, DiskRPLocation); // Patch // TODO: Bug 9865640 - DiskRP doesn't follow patch semantics for zones: skip this for zones if (zones == null) { const string tagKey = "tageKey"; var updatedisk = new DiskUpdate() { Tags = { { tagKey, "tagvalue" } } }; diskOut = await WaitForCompletionAsync(await DisksOperations.StartUpdateAsync(rgName, diskName, updatedisk)); Validate(disk, diskOut, DiskRPLocation); } // Get diskOut = await DisksOperations.GetAsync(rgName, diskName); Validate(disk, diskOut, DiskRPLocation); // End disk access await WaitForCompletionAsync(await DisksOperations.StartRevokeAccessAsync(rgName, diskName)); // Delete await WaitForCompletionAsync(await DisksOperations.StartDeleteAsync(rgName, diskName)); try { // Ensure it was really deleted await DisksOperations.GetAsync(rgName, diskName); Assert.False(true); } catch (Exception ex) { Assert.NotNull(ex); //Assert.AreEqual(HttpStatusCode.NotFound, ex.Response.StatusCode); } }
/// <summary> /// The deploy server with disk speed image task. /// </summary> /// <param name="name"> /// The name. /// </param> /// <param name="description"> /// The description. /// </param> /// <param name="networkId"> /// The network id. /// </param> /// <param name="privateIp"> /// The private ip. /// </param> /// <param name="imageId"> /// The image id. /// </param> /// <param name="adminPassword"> /// The admin password. /// </param> /// <param name="start"> /// The start. /// </param> /// <param name="disk"> /// The disk. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task<Status> DeployServerWithDiskSpeedImageTask(string name, string description, string networkId, string privateIp, string imageId, string adminPassword, bool start, Disk[] disk) { return await WebApi.ApiPostAsync<NewServerToDeployWithDiskSpeed, Status>( ApiUris.DeployServerWithDiskSpeed(Account.OrganizationId), new NewServerToDeployWithDiskSpeed { name = name, description = description, imageId = imageId, networkId = networkId, privateIp = privateIp, administratorPassword = adminPassword, start = start, disk = disk }); }
protected void Validate(Disk diskExpected, Disk diskActual, string location, bool diskHydrated = false, bool update = false) { // disk resource Assert.AreEqual(string.Format("{0}/{1}", ApiConstants.ResourceProviderNamespace, "disks"), diskActual.Type); Assert.NotNull(diskActual.Name); Assert.AreEqual(location, diskActual.Location); // disk properties Assert.AreEqual(diskExpected.Sku.Name, diskActual.Sku.Name); Assert.NotNull(diskActual.ProvisioningState); Assert.AreEqual(diskExpected.OsType, diskActual.OsType); Assert.NotNull(diskActual.UniqueId); if (diskExpected.DiskSizeGB != null) { // Disk resizing Assert.AreEqual(diskExpected.DiskSizeGB, diskActual.DiskSizeGB); Assert.NotNull(diskActual.DiskSizeBytes); } if (!update) { if (diskExpected.DiskIopsReadWrite != null) { Assert.AreEqual(diskExpected.DiskIopsReadWrite, diskActual.DiskIopsReadWrite); } if (diskExpected.DiskMBpsReadWrite != null) { Assert.AreEqual(diskExpected.DiskMBpsReadWrite, diskActual.DiskMBpsReadWrite); } if (diskExpected.DiskIopsReadOnly != null) { Assert.AreEqual(diskExpected.DiskIopsReadOnly, diskActual.DiskIopsReadOnly); } if (diskExpected.DiskMBpsReadOnly != null) { Assert.AreEqual(diskExpected.DiskMBpsReadOnly, diskActual.DiskMBpsReadOnly); } if (diskExpected.MaxShares != null) { Assert.AreEqual(diskExpected.MaxShares, diskActual.MaxShares); } } // Creation data CreationData creationDataExp = diskExpected.CreationData; CreationData creationDataAct = diskActual.CreationData; Assert.AreEqual(creationDataExp.CreateOption, creationDataAct.CreateOption); Assert.AreEqual(creationDataExp.SourceUri, creationDataAct.SourceUri); Assert.AreEqual(creationDataExp.SourceResourceId, creationDataAct.SourceResourceId); Assert.AreEqual(creationDataExp.StorageAccountId, creationDataAct.StorageAccountId); // Image reference ImageDiskReference imgRefExp = creationDataExp.GalleryImageReference ?? creationDataExp.ImageReference; ImageDiskReference imgRefAct = creationDataAct.GalleryImageReference ?? creationDataAct.ImageReference; if (imgRefExp != null) { Assert.AreEqual(imgRefExp.Id, imgRefAct.Id); Assert.AreEqual(imgRefExp.Lun, imgRefAct.Lun); } else { Assert.Null(imgRefAct); } // Zones IList <string> zonesExp = diskExpected.Zones; IList <string> zonesAct = diskActual.Zones; if (zonesExp != null) { Assert.AreEqual(zonesExp.Count, zonesAct.Count); foreach (string zone in zonesExp) { ////TODO //Assert.Contains(zone, zonesAct.First()); //Assert.Contains(zone, zonesAct, StringComparer.OrdinalIgnoreCase); } } else { Assert.Null(zonesAct); } }