public void Flash([NotNull] IMotherboard motherboard, [NotNull] IBios bios, [NotNull] ITool tool, bool autoExecuteScript) { if (motherboard == null) { throw new ArgumentNullException(nameof(motherboard)); } if (bios == null) { throw new ArgumentNullException(nameof(bios)); } if (tool == null) { throw new ArgumentNullException(nameof(tool)); } string path = GetTempFolderPath(); FileInfo toolFi = new FileInfo(tool.FileName); FileInfo tempBatFi = new FileInfo(Path.Combine(path, "flash.bat")); string flashFileName = Path.GetFileNameWithoutExtension(bios.FileName); ZipFile.ExtractToDirectory(toolFi.FullName, path); ZipFile.ExtractToDirectory(bios.FileName, path); using TextWriter writer = new StreamWriter(tempBatFi.FullName); WriteScriptHeader(motherboard, bios, tool, writer); writer.WriteLine(string.Format(tool.FlashCommand, flashFileName)); WriteScriptFooter(writer); ProcessStart(path); if (autoExecuteScript) { ProcessStart(tempBatFi.FullName); } }
public AsrockH87(ICpu cpu, IRam ram, IFan cpuFan, ISolidStateDrive solidStateDrive, IGpu gpu, IBios bios) { Cpu = cpu; Ram = ram; CpuFan = cpuFan; SolidStateDrive = solidStateDrive; Gpu = gpu; Bios = bios; }
public void Destroy() { Debug.Assert(_isCreated == true); if (_isCreated == false) { return; } // Destroy thread _shutDown = true; _stateChangeEvent.Set(); _thread.Interrupt(); _cpu.Stop(); if (_thread.Join(1000) == false) { // Failed to wait, so kill _thread.Abort(); } while (_thread.IsAlive == true) { Thread.Sleep(10); } _thread = null; #if XMB // Destroy XMB _xmb.Cleanup(); _xmb = null; #else #endif // Destroy all the components foreach (IComponentInstance component in _instances) { if (component != null) { component.Cleanup(); } } _instances.Clear(); _audio = null; _bios = null; _cpu = null; _io.Clear(); _video = null; _isCreated = false; _state = InstanceState.Idle; this.OnStateChanged(); }
private void WriteScriptHeader(IMotherboard motherboard, IBios bios, ITool tool, TextWriter writer) { writer.WriteLine("@echo off"); writer.WriteLine($":: {nameof(Mi899)} - {DateTime.Now:yyyy.MM.dd} {DateTime.Now:HH:mm:ss}"); writer.WriteLine($":: Motherboard: {motherboard.Name} {motherboard.Version}"); if (bios != null) { writer.WriteLine($":: BIOS: {bios.Name}"); } writer.WriteLine($":: Tool: {tool.Name} {tool.Version}"); writer.WriteLine(); writer.WriteLine("cd /d %~dp0"); }
private void btnSelectBiosFile_Click(object sender, EventArgs e) { DialogResult dr = ofdBiosFile.ShowDialog(); if (dr != DialogResult.OK) { return; } FileInfo fi = new FileInfo(ofdBiosFile.FileName); if (!fi.Exists) { MessageBox.Show("File not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IBios bios = _model.AddBiosFromFile(_motherboard, fi.FullName); LoadData(_motherboard, _tool, bios); }
public Computer(IBios bios, IOs os) { this.bios = bios; this.os = os; }
public void Destroy() { Debug.Assert( _isCreated == true ); if( _isCreated == false ) return; // Destroy thread _shutDown = true; _stateChangeEvent.Set(); _thread.Interrupt(); _cpu.Stop(); if( _thread.Join( 1000 ) == false ) { // Failed to wait, so kill _thread.Abort(); } while( _thread.IsAlive == true ) Thread.Sleep( 10 ); _thread = null; #if XMB // Destroy XMB _xmb.Cleanup(); _xmb = null; #else #endif // Destroy all the components foreach( IComponentInstance component in _instances ) { if( component != null ) component.Cleanup(); } _instances.Clear(); _audio = null; _bios = null; _cpu = null; _io.Clear(); _video = null; _isCreated = false; _state = InstanceState.Idle; this.OnStateChanged(); }
public bool Create() { Debug.Assert( _isCreated == false ); if( _isCreated == true ) return true; _shutDown = false; _state = InstanceState.Idle; // Try to create all the components Debug.Assert( _params.BiosComponent != null ); Debug.Assert( _params.CpuComponent != null ); if( _params.AudioComponent != null ) { _audio = _params.AudioComponent.CreateInstance( this, _params[ _params.AudioComponent ] ) as IAudioDriver; _instances.Add( ( IComponentInstance )_audio ); } _cpu = _params.CpuComponent.CreateInstance( this, _params[ _params.CpuComponent ] ) as ICpu; _instances.Add( ( IComponentInstance )_cpu ); _bios = _params.BiosComponent.CreateInstance( this, _params[ _params.BiosComponent ] ) as IBios; _instances.Add( ( IComponentInstance )_bios ); foreach( IComponent component in _params.IOComponents ) { IIODriver driver = component.CreateInstance( this, _params[ component ] ) as IIODriver; _io.Add( driver ); _instances.Add( ( IComponentInstance )driver ); } if( _params.InputComponent != null ) { _input = _params.InputComponent.CreateInstance( this, _params[ _params.InputComponent ] ) as IInputDevice; _instances.Add( _input ); _input.WindowHandle = _host.Player.Handle; } if( _params.UmdComponent != null ) { _umd = _params.UmdComponent.CreateInstance( this, _params[ _params.UmdComponent ] ) as IUmdDevice; _instances.Add( _umd ); } if( _params.MemoryStickComponent != null ) { _memoryStick = _params.MemoryStickComponent.CreateInstance( this, _params[ _params.MemoryStickComponent ] ) as IMemoryStickDevice; _instances.Add( _memoryStick ); } if( _params.VideoComponent != null ) { _video = _params.VideoComponent.CreateInstance( this, _params[ _params.VideoComponent ] ) as IVideoDriver; _video.ControlHandle = _host.Player.ControlHandle; _instances.Add( ( IComponentInstance )_video ); } #if XMB _xmb = new CrossMediaBar.Manager( this, _host.Player.Handle, _host.Player.ControlHandle ); #else #endif // Create thread _thread = new Thread( new ThreadStart( this.RuntimeThread ) ); _thread.Name = "Host runtime thread"; _thread.IsBackground = true; _thread.Start(); _isCreated = true; return true; }
//--------------------------------------------------------------------- public Cpu(StackMemory stackMemory, IBios bios, double[] args) { this.Stack = stackMemory; this.Bios = bios; this.Args = args; }
public bool Create() { Debug.Assert(_isCreated == false); if (_isCreated == true) { return(true); } _shutDown = false; _state = InstanceState.Idle; // Try to create all the components Debug.Assert(_params.BiosComponent != null); Debug.Assert(_params.CpuComponent != null); if (_params.AudioComponent != null) { _audio = _params.AudioComponent.CreateInstance(this, _params[_params.AudioComponent]) as IAudioDriver; _instances.Add(( IComponentInstance )_audio); } _cpu = _params.CpuComponent.CreateInstance(this, _params[_params.CpuComponent]) as ICpu; _instances.Add(( IComponentInstance )_cpu); _bios = _params.BiosComponent.CreateInstance(this, _params[_params.BiosComponent]) as IBios; _instances.Add(( IComponentInstance )_bios); foreach (IComponent component in _params.IOComponents) { IIODriver driver = component.CreateInstance(this, _params[component]) as IIODriver; _io.Add(driver); _instances.Add(( IComponentInstance )driver); } if (_params.InputComponent != null) { _input = _params.InputComponent.CreateInstance(this, _params[_params.InputComponent]) as IInputDevice; _instances.Add(_input); //_input.WindowHandle = _host.Player.Handle; } if (_params.UmdComponent != null) { _umd = _params.UmdComponent.CreateInstance(this, _params[_params.UmdComponent]) as IUmdDevice; _instances.Add(_umd); } if (_params.MemoryStickComponent != null) { _memoryStick = _params.MemoryStickComponent.CreateInstance(this, _params[_params.MemoryStickComponent]) as IMemoryStickDevice; _instances.Add(_memoryStick); } if (_params.VideoComponent != null) { _video = _params.VideoComponent.CreateInstance(this, _params[_params.VideoComponent]) as IVideoDriver; //_video.ControlHandle = _host.Player.ControlHandle; _instances.Add(( IComponentInstance )_video); } // Create thread _thread = new Thread(new ThreadStart(this.RuntimeThread)); _thread.Name = "Host runtime thread"; _thread.IsBackground = true; _thread.Start(); _isCreated = true; return(true); }
public BiosRowData([NotNull] IBios source) { Source = source ?? throw new ArgumentNullException(nameof(source)); }
public void LoadData([NotNull] IMotherboard motherboard, [NotNull] ITool tool, IBios selectedBios = null) { _motherboard = motherboard ?? throw new ArgumentNullException(nameof(motherboard));; _tool = tool ?? throw new ArgumentNullException(nameof(tool)); txtMotherboard.Text = motherboard.Name; txtMotherboardVersion.Text = motherboard.Version; txtMotherboardDescription.Text = motherboard.Description; txtTool.Text = tool.Name; txtToolVersion.Text = tool.Version; { BiosRowData[] bioses = _model .Bioses .Where(x => x.MotherboardIds.Contains(motherboard.Id)) .OrderBy(x => x.Name) .Select(x => new BiosRowData(x)) .ToArray(); ddlBioses.Items.Clear(); ddlBioses.Items.AddRange(bioses); if (selectedBios == null) { ddlBioses.SelectedItem = bioses.FirstOrDefault(); } else { ddlBioses.SelectedItem = bioses.First(x => x.Source.Equals(selectedBios)); } } }
//--------------------------------------------------------------------- public VirtualMachine(IBios bios = null, int stackSize = 1024, params double[] args) { var stack = new StackMemory(stackSize); this.Cpu = new Cpu(stack, bios ?? new ConsoleBios(), args); }