public void HitObstacle(Ram ram) { if (!jumping.Active && !recovering.Active) { wiping.SwitchTo(); animator.Play ("Wipeout"); } }
internal AbstractComputer(Cpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard) { this.Cpu = cpu; this.Ram = ram; this.HardDrives = hardDrives; this.VideoCard = videoCard; }
public void Ram_Loads_Program_Correctly() { var ram = new Ram(0x05); ram.LoadProgram(0x04,new byte[] { 0xab } ); Assert.That(ram.ReadValue(0x04), Is.EqualTo(0xab)); }
internal Server( Cpu cpu, Ram ram, IEnumerable<HardDriver> hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { }
public Computer(Cpu cpu, Ram ram, VideoCard videoCard, HardDriver hdd, IEnumerable<HardDriver> hardDrives) { this.Cpu = cpu; this.Ram = ram; this.VideoCard = videoCard; this.HardDrive = hdd; this.HardDrives = hardDrives; }
public Server(Cpu cpu, Ram ram, IStorageDevice hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { if (videoCard.IsMonochrome == false) { throw new ArgumentException("Cannot initialise server with colourful video card"); } }
public PersonalComputer( Cpu cpu, Ram ram, IEnumerable<HardDriver> hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { }
// ReSharper disable InconsistentNaming public void Ram_Initalizes_To_Correct_Values() { var ram = new Ram(0xffff); for (int i = 0; i < 0xffff; i++) { Assert.That(ram.ReadValue(i), Is.EqualTo(0x00)); } }
internal Server( Cpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard) : base(cpu, ram, hardDrives, videoCard) { this.VideoCard.IsMonochrome = true; }
public Computer(Cpu cpu, Ram ram, IStorageDevice storage, VideoCard videoCard) { this.CPU = cpu; this.Ram = ram; this.StorageDevice = storage; this.VideoCard = videoCard; this.motherboard = new Motherboard(this.CPU, this.Ram, VideoCard); }
public void Ram_Writes_Correct_Values() { var ram = new Ram(0xffff); for (int i = 0; i < 0xffff; i++) { ram.WriteValue(i,0xff); Assert.That(ram.ReadValue(i), Is.EqualTo(0xff)); } }
internal Laptop( Cpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard, ILaptopBattery battery) : base(cpu, ram, hardDrives, videoCard) { this.battery = battery; }
public PC CreatePC() { var ram = new Ram(4); var videoCard = new VideoCard(true); var cpu = new Cpu(2, 64, ram, videoCard); var storage = new HardDrive(2000); var pc = new PC(cpu, ram, storage, videoCard); return pc; }
public Server CreateServer() { var ram = new Ram(64); var videoCard = new VideoCard(true); var cpu = new Cpu(8, 64, ram, videoCard); var storage = new RaidArray(2, 2000); var server = new Server(cpu, ram, storage, videoCard); return server; }
public PC CreatePC() { var ram = new Ram(8); var videoCard = new VideoCard(false); var cpu = new Cpu(4, 64, ram, videoCard); var storage = new HardDrive(1000); var pc = new PC(cpu, ram, storage, videoCard); return pc; }
public override PersonalComputer CreatePC() { var ram = new Ram((int)RamType.GB4); var videoCard = new VideoCard(); var motherBoard = new Motherboard(ram, videoCard); var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard); var hardDrive = new HardDrive(2000); var pc = new PersonalComputer(motherBoard, cpu, hardDrive); return pc; }
private IComputer ManufacturePC() { Ram ram = new Ram(4); HardDrive hardDrive = new HardDrive(2000, false, 0); IEnumerable<HardDrive> hardDrives = new List<HardDrive>() { hardDrive }; IVideoCard videoCard = new MonochromeVideoCard(); ICpu cpu = new Cpu(2, CpuType.Bits64, new Motherboard(ram, videoCard)); IComputer pc = new PersonalComputer(cpu, ram, hardDrives, videoCard); return pc; }
public override IPersonalComputer MakePersonalComputer() { var ram = new Ram(2); var videoCard = new ColorVideoCard(); var hardDrive = new[] { new HardDrive(500, false, 0) }; IMotherboard motherboard = new Motherboard(ram, videoCard); Cpu cpu = new Cpu32Bit(2, motherboard, this.Random); var result = new PersonalComputer(motherboard, cpu, ram, hardDrive, videoCard); return result; }
public Laptop CreateLaptop() { var ram = new Ram(4); var videoCard = new VideoCard(false); var cpu = new Cpu(4, 32, ram, videoCard); var storage = new HardDrive(1000); var battery = new LaptopBattery(); var laptop = new Laptop(cpu, ram, storage, videoCard, battery); return laptop; }
public override Laptop CreateLaptop() { var ram = new Ram((int)RamType.GB16); var videoCard = new VideoCard(false); var motherBoard = new Motherboard(ram, videoCard); var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard); var hardDrive = new HardDrive(1000); var laptopBattery = new LaptopBattery(); var laptop = new Laptop(motherBoard, cpu, hardDrive, laptopBattery); return laptop; }
private IComputer ManufactureServer() { Ram ram = new Ram(8); HardDrive firstHardDrive = new HardDrive(500, true, 2); HardDrive secondHardDrive = new HardDrive(500, true, 2); IEnumerable<HardDrive> hardDrives = new List<HardDrive>() { firstHardDrive, secondHardDrive }; IVideoCard videoCard = new MonochromeVideoCard(); ICpu cpu = new Cpu(8, CpuType.Bits128, new Motherboard(ram, videoCard)); IComputer server = new Server(cpu, ram, hardDrives, videoCard); return server; }
private IComputer ManufactureLaptop() { Ram ram = new Ram(16); HardDrive hardDrive = new HardDrive(1000, false, 0); IEnumerable<HardDrive> hardDrives = new List<HardDrive>() { hardDrive }; IVideoCard videoCard = new ColorfulVideoCard(); LaptopBatery battery = new LaptopBatery(); ICpu cpu = new Cpu(2, CpuType.Bits64, new Motherboard(ram, videoCard)); IComputer laptop = new Laptop(cpu, ram, hardDrives, videoCard, battery); return laptop; }
public override IPlayable CreatePc() { IRam ram = new Ram(InitialPcRam); VideoCardBase videoCard = new MonochromeVideoCard(); ICpu cpu = new Cpu(InitialPcCores, InitialPcCpuBits, ram, videoCard, new Cpu64BitsSquareNumberFinder()); IEnumerable<HardDrive> hardDrives = new[] { new HardDrive(InitialPcHardDriveSpace, InitialPcHardDriveInRaid, 0) }; return new Pc(cpu, ram, hardDrives, videoCard); }
public override IChargeable CreateLaptop() { IRam ram = new Ram(InitialLaptopRam); VideoCardBase videoCard = new ColorfulVideoCard(); ICpu cpu = new Cpu(InitialLaptopCores, InitialLaptopCpuBits, ram, videoCard, new Cpu64BitsSquareNumberFinder()); IEnumerable<HardDrive> hardDrives = new[] { new HardDrive(InitialLaptopHardDriveSpace, false, 0) }; var battery = new ComputerBuildingSystem.LaptopBattery(); return new Laptop(cpu, ram, hardDrives, videoCard, battery); }
public override ILaptopComputer MakeLaptopComputer() { IVideoCard videoCard = new ColorVideoCard(); Ram ram = new Ram(4); IMotherboard motherboard = new Motherboard(ram, videoCard); Cpu cpu = new Cpu64Bit(2, motherboard, this.Random); var hardDrive = new[] { new HardDrive(500, false, 0) }; Battery.LaptopBattery battery = new Battery.LaptopBattery(); ILaptopComputer laptop = new LaptopComputer(motherboard, cpu, ram, hardDrive, videoCard, battery); return laptop; }
public override Server CreateServer() { var ram = new Ram((int)RamType.GB8); var videoCard = new VideoCard(); var motherBoard = new Motherboard(ram, videoCard); var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits128, motherBoard); var hardDriveOne = new HardDrive(500); var hardDriveTwo = new HardDrive(500); var raid = new Raid(500); raid.Add(hardDriveOne); raid.Add(hardDriveTwo); var server = new Server(motherBoard, cpu, raid); return server; }
public override IServerComputer MakeSeverComputer() { Ram serverRam = new Ram(8); IVideoCard serverVideo = new MonochromeVideoCard(); IMotherboard motherboard = new Motherboard(serverRam, serverVideo); var hardDrive = new List<HardDrive> { new HardDrive(500, false, 0), new HardDrive(500, false, 0) }; Cpu cpu = new Cpu128Bit(2, motherboard, this.Random); IServerComputer server = new ServerComputer(motherboard, cpu, serverRam, hardDrive, serverVideo); return server; }
public void TestMethod1() { var computer = new Computer(); // composite var motherboard = new Motherboard(125); // composite var cpu = new Cpu(250); // leaf var ram = new Ram(160); // leaf var drive = new Ssd(250); // leaf motherboard.Add(cpu); motherboard.Add(ram); computer.Add(motherboard); computer.Add(drive); Assert.AreEqual(computer.Price, 785); }
public override IProcessable CreateServer() { IRam ram = new Ram(InitialServerRam); VideoCardBase videoCard = new MonochromeVideoCard(); ICpu cpu = new Cpu(InitialServerCores, InitialServerCpuBits, ram, videoCard, new Cpu128BitsSquareNumberFinder()); IEnumerable<HardDrive> hardDrives = new List<HardDrive> { new HardDrive( 0, InitialServerHardDriveInRaid, InitialServerHardDrivesInRaidCount, new List<HardDrive> { new HardDrive(InitialServerHardDriveSpace, false, 0), new HardDrive(InitialServerHardDriveSpace, false, 0) }) }; return new Server(cpu, ram, hardDrives, videoCard); }
/// <summary> /// Método para leer los datos en la BBDD /// </summary> /// <remarks> /// Usando una colección observable, rellenamos los datos /// obtenidos de la lista de pedidos. Pasamos como ItemsSource /// la colección. Esto hará que se muestre en la aplicación /// </remarks> private async Task LoadDataAsync() { List <Pedido> listPedidos = new List <Pedido>(); ObservableCollection <Order> orderList = new ObservableCollection <Order>(); //obtenemos la lista de los pedidos listPedidos = await App.DataRepo.GetAllPedidos(); //vamos creando por cada elemento de la lista de pedidos un objeto order foreach (Pedido p in listPedidos) { User user = await App.DataRepo.GetUserById(p.IdUser); PcBox pcBox = await App.DataRepo.GetPcBoxById(p.IdCase); CPU cpu = await App.DataRepo.GetCPUById(p.IdCpu); GPU gpu = await App.DataRepo.GetGPUById(p.IdCpu); MotherBoard motherBoard = await App.DataRepo.GetMotherBoardId(p.IdMotherBoard); Ram ram = await App.DataRepo.GetRamById(p.IdRam); double price = p.Price; //agregamos la información a el objeto Order orderList.Add(new Order { NomUser = user.Nick, NomCase = pcBox.Name, NomCpu = cpu.Name, NomGpu = gpu.Name, NomMotherBoard = motherBoard.Name, NomRam = ram.Name, FinalPrice = price }); } //Una vez agregamos todos los datos, pasamos los datos a la colección. lstPedidos.ItemsSource = orderList; }
public Server CreateServer() { Server server; var serverRam = new Ram(32); IVideoCard serverVideo = new MonochromeVideoCard(); server = new Server( new Cpu32( 4, serverRam, serverVideo), serverRam, new List <IHardDrive> { new RaidArray( new List <IHardDrive> { new HardDriver(1000), new HardDriver(1000) }) }); return(server); }
public bool Update(Ram newRam) { Ram dbram = db.Rams.SingleOrDefault(x => x.Code == newRam.Code); if (dbram != null) { dbram.Name = newRam.Name; dbram.Price = newRam.Price; dbram.Bus = newRam.Bus; dbram.Type = newRam.Type; try { db.SubmitChanges(); return(true); } catch { return(false); } } return(false); }
public SimCorpMobile() { _vCpu = new Cpu("Intel", new List <Core> { new Core(64, 2.1), new Core(64, 2.1) }); _vExternalStorage = new ExternalStorage(128); _vFrontalBasicCamera = new FrontalBasicCamera(1.5, 5); _vGraphCpu = new GraphCpu("AMD", new List <Core> { new Core(64, 2.1), new Core(64, 2.1), new Core(64, 2.1), new Core(64, 2.1) }); _vInternalStorage = new InternalStorage(64); _vKeyboard = new DigitalKeyboard(new List <char>(), new List <char>()); _vLiIonBattery = new LiIonBattery(5, 2200, true); _vMicrophone = new Microphone("Internal", 3.5, 2); _vMultiMainBasicCamera = new MultiMainBasicCamera(2.5, 12, new List <MainBasicCamera> { new MainBasicCamera(2.5, 12), new MainBasicCamera(2.5, 12), new MainBasicCamera(2.5, 12) }); _vMultiSimCardHolder = new MultiSimCardHolder("DoubleSim", new List <SimCardHolder> { new SimCardHolder("microSim"), new SimCardHolder("microSim") }); _vMultiTouchScreen = new MultiTouchScreen("Multi", 10); _vOLedBasicScreen = new OLedBasicScreen(1080, 1920, 7, 233); _vRam = new Ram(4); _vSpeaker = new Speaker(15, 15000, 4.5, 3, Output); }
public bool DeleteRam(Ram model) { decimal size = model.SizeRam; string sql = "select ID from RAM "; using (IDbConnection db = new SqlConnection(connectionString)) { IEnumerable <Ram> models = db.Query <Ram>(sql); if (models.Count(item => item.SizeRam == size) > 0) { return(false); } sql = "DELETE FROM RAM WHERE ID = @Id"; db.Execute(sql, new { model.Id }); } return(true); }
public void OnGetHit(Ram ram) { if (this._invincible) { return; } ram.GetComponent <Sheep>().GetFrightened(4); ram.GetComponent <WanderSheep>().ClearBehaviour(); this._health -= 25; this._invincible = true; AudioManager.instance.StopSound("Bark"); AudioManager.instance.PlaySound("Whine"); AudioManager.instance.PlaySound("Bonk"); this._animal.moveUp = false; this._animal.moveDown = false; this._animal.moveLeft = false; this._animal.moveRight = false; this._animal.controlsActive = false; this._jumpToggle = false; this._barkAction = false; this.barkTransform.gameObject.SetActive(false); this.wolfSprite.transform.localPosition = new Vector3(0, .15f, 0); //Start blinking CancelInvoke("Bark"); CancelInvoke("EndBlinking"); CancelInvoke("EnableControls"); Invoke("EnableControls", 2f); Invoke("EndBlinking", 4f); InvokeRepeating("Blink", .15f, .15f); }
public bool InsertRam(Ram model) { decimal size = model.SizeRam; string sql = "select SizeRam from Ram "; using (IDbConnection db = new SqlConnection(connectionString)) { IEnumerable <Ram> models = db.Query <Ram>(sql); if (models.Count(item => item.SizeRam == size) > 0) { return(false); } sql = "insert into Ram (SizeRam)" + "values (@SizeRam)"; db.Execute(sql, new { model.SizeRam }); } return(true); }
public void TestPrintProgram() { var cart = new Cartridge(); cart.LoadFromFile("../../../test_programs/print_test.rom"); var ram = new Ram(); var memoryController = new MemoryController(ram, cart); var cpu = new Cpu(memoryController); cpu.Init(); // Need to figure out halt... bool done = false; int iterations = 0; while (!done && iterations++ < 10000) { cpu.ExecuteNextInstruction(); } }
private void btnAdd_Click(object sender, EventArgs e) { Ram newRam = new Ram() { Name = txtName.Text.Trim(), Price = int.Parse(txtPrice.Text.Trim()), Bus = int.Parse(txtBus.Text.Trim()), Type = txtType.Text.Trim() }; bool result = new RamBUS().Insert(newRam); if (result) { List <Ram> rams = new RamBUS().getAll(); drvRam.DataSource = rams; } else { MessageBox.Show("Sorry! You can't Insert it"); } }
private List <Product> productPool; //the product list in the pool of a storage public string AddProduct(string type, double price) { //creating new Product Product newProduct; if (type == "Ram") //if the parameter "type" is Ram { newProduct = new Ram(); // we create new Ram newProduct.Price = price; //assign new price to Ram productPool.Add(newProduct); //add the new Ram to the pool of products return($"Added {type} to pool"); //print out the result } else if (type == "Gpu") //if the parameter type is Gpu and similar on the else if methods comming below { newProduct = new Gpu(); newProduct.Price = price; productPool.Add(newProduct); return($"Added {type} to pool"); } else if (type == "HardDrive") { newProduct = new HardDrive(); newProduct.Price = price; productPool.Add(newProduct); return($"Added {type} to pool"); } else if (type == "SolidstateDrive") { newProduct = new SolidStateDrive(); newProduct.Price = price; productPool.Add(newProduct); return($"Added {type} to pool"); } //when no matches with the "type" parameter with the is statements throw new NotImplementedException("Invalid product type!"); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.ApplyConfiguration(new GraphicCardEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new RamEntityTypeConfiguration()); modelBuilder.ApplyConfiguration(new VendorEntityTypeConfiguration()); #region seed-data var nvidiaVendor = new Vendor { Name = "Nvidia" }; var amdVendor = new Vendor { Name = "AMD" }; var gtx970 = new GraphicCard { Name = "GTX 970", Price = 330, ProcessorSpeed = "1753MHz", Wattage = 145, InterfaceType = "PCI Express 3.0", VendorId = nvidiaVendor.Id }; var rtx2070 = new GraphicCard { Name = "RTX 2070 Super", Price = 609, ProcessorSpeed = "1605Mhz + Boost", Wattage = 160, InterfaceType = "PCI Express 3.0", VendorId = nvidiaVendor.Id }; var gtx970Ram = new Ram { Capacity = 4, TypeOfRam = "GDDR5", GraphicCardId = gtx970.Id }; var rtx2070Ram = new Ram { Capacity = 8, TypeOfRam = "GDDR5", GraphicCardId = rtx2070.Id }; #endregion modelBuilder.Entity <Vendor>().HasData( nvidiaVendor, amdVendor ); modelBuilder.Entity <GraphicCard>().HasData( gtx970, rtx2070 ); modelBuilder.Entity <Ram>().HasData( gtx970Ram, rtx2070Ram ); base.OnModelCreating(modelBuilder); }
void Push(byte value) => Ram.Write((ushort)(0x100 + StackPointer--), value);
byte Pop() => Ram.Read((ushort)(0x100 + ++StackPointer));
void AAX(ushort address) => Ram.Write(address, (byte)(Accumulator & XRegister));
private void timer_Tick(object sender, EventArgs e) { string cpuName = "", gpuName = ""; float cpuLoad = 0, cpuTemp = 0; float gpuLoad = 0, gpuTemp = 0, gpuFan = 0, gpuFanLoad = 0; float ramLoad = 0, ramUse = 0, totalRam = 0, x, y; /*-------------------------------------Read Info-------------------------------------*/ foreach (var hardware in thisComputer.Hardware) { hardware.Update(); /*---------------------------------CPU---------------------------------*/ if (hardware.HardwareType == HardwareType.Cpu) { cpuName = hardware.Name; lblCPUName.Text = cpuName; foreach (var sensor in hardware.Sensors) { if (sensor.SensorType == SensorType.Load && sensor.Name == "CPU Total") { cpuLoad = sensor.Value.Value; int load = (int)cpuLoad; psCPULoad.Value = load; lblCPULoad.Text = load.ToString(); } if (sensor.SensorType == SensorType.Temperature && sensor.Name == "CPU Package") { cpuTemp = sensor.Value.GetValueOrDefault(); int temp = (int)cpuTemp; psCPUTemp.Value = temp; lblCpuTemp.Text = temp.ToString(); } } } /*---------------------------------RAM---------------------------------*/ if (hardware.HardwareType == HardwareType.Memory) { foreach (var sensor in hardware.Sensors) { if (sensor.SensorType == SensorType.Load && sensor.Name == "Memory") { ramLoad = sensor.Value.Value; int load = (int)ramLoad; psRamLoad.Value = load; lblRamLoad.Text = load.ToString(); } if (sensor.SensorType == SensorType.Data && sensor.Name == "Memory Used") { ramUse = sensor.Value.GetValueOrDefault(); double ram = Math.Round(ramUse, 2); lblRamUse.Text = ram.ToString(); } if (sensor.SensorType == SensorType.Data && sensor.Name == "Memory Available") { float ramAva = sensor.Value.GetValueOrDefault(); totalRam = ramAva + ramUse; double ram = Math.Round(totalRam); lblRamTotal.Text = ram.ToString() + " GB"; } } } /*---------------------------------GPU---------------------------------*/ if (hardware.HardwareType == HardwareType.GpuAmd || hardware.HardwareType == HardwareType.GpuNvidia) { gpuName = hardware.Name; lblGPUName.Text = gpuName; foreach (var sensor in hardware.Sensors) { if (sensor.SensorType == SensorType.Load && sensor.Name == "GPU Core") { gpuLoad = sensor.Value.Value; int load = (int)gpuLoad; psGPULoad.Value = load; lblGPULoad.Text = load.ToString(); } if (sensor.SensorType == SensorType.Temperature && sensor.Name == "GPU Core") { gpuTemp = sensor.Value.GetValueOrDefault(); psGPUTemp.Value = (int)gpuTemp; lblGPUTemp.Text = gpuTemp.ToString(); } if (sensor.SensorType == SensorType.Fan && sensor.Name == "GPU Fan") { gpuFan = sensor.Value.GetValueOrDefault(); lblGPUFan.Text = ((int)gpuFan).ToString(); } if (sensor.SensorType == SensorType.Control && sensor.Name == "GPU Fan") { gpuFanLoad = sensor.Value.GetValueOrDefault(); int fanLoad = (int)gpuFanLoad; psGPUFanLoad.Value = fanLoad; } } } } foreach (NetworkInterface inf in interfaces) { if (inf.OperationalStatus == OperationalStatus.Up && inf.NetworkInterfaceType != NetworkInterfaceType.Loopback && inf.NetworkInterfaceType != NetworkInterfaceType.Tunnel && inf.NetworkInterfaceType != NetworkInterfaceType.Unknown && !inf.IsReceiveOnly) { byteRec = inf.GetIPv4Statistics().BytesReceived; byteSent = inf.GetIPv4Statistics().BytesSent; } } x = byteRec - oldRec; y = byteSent - oldSent; oldRec = byteRec; oldSent = byteSent; string strNw = (x / 1048576).ToString("F2") + "/" + (y / 1048576).ToString("F2"); if (strNw.Length > 10) { strNw = "Connecting..."; } else { lblNet.Text = strNw + " Mb/s"; } Processor dataCPU = new Processor { Name = cpuName, Load = Math.Round(cpuLoad, 1), Temp = Math.Round(cpuTemp, 1) }; Graphic dataGPU = new Graphic { Name = gpuName, Load = Math.Round(gpuLoad, 1), Temp = Math.Round(gpuTemp, 1), FanLoad = Math.Round(gpuFan, 1), Fan = Math.Round(gpuFanLoad, 1) }; Ram dataRam = new Ram { Total = Math.Round(totalRam), Use = Math.Round(ramUse, 1), Load = Math.Round(ramLoad, 1) }; Net dataNet = new Net { net = strNw }; Infomation info = new Infomation { CPU = dataCPU, GPU = dataGPU, RAM = dataRam, Net = dataNet }; string obj = JsonConvert.SerializeObject(info); /*---------------------------------Send DATA---------------------------------*/ if (lblStatusWifi.Text == "Connected") { try { NetworkStream stream = client.GetStream(); byte[] data = Encoding.ASCII.GetBytes(obj + "\r\n"); stream.Write(data, 0, data.Length); } catch (Exception) { AppIcon.ShowBalloonTip(5000, "Mất kêt nối", "Kiểm tra lại server", ToolTipIcon.Warning); txtIP.Enabled = true; timer.Enabled = false; btnConnectWIFI.Text = "Connect"; lblStatusWifi.Text = "Disconnected"; lblStatusWifi.ForeColor = Color.Red; client.Close(); client.Close(); client = new TcpClient(); } } if (lblStatusWired.Text == "Connected") { serialPort1.Write(obj); } }
public void RamInheritance() { Ram ram = new Ram(2.5); Assert.IsInstanceOf <Product>(ram); }
void SBC(byte value) => ADC((byte)(value ^ 0xFF)); // SBC is the same as ADC with bits inverted? void SBC(ushort address) => SBC(Ram.Read(address));
void ADC(ushort address) => ADC(Ram.Read(address));
void EOR(ushort address) => EOR(Ram.Read(address));
void ORA(ushort address) => ORA(Ram.Read(address));
void CPY(ushort address) => CPY(Ram.Read(address));
void CMP(ushort address) => CMP(Ram.Read(address));
public Laptop(Cpu cpu, Ram ram, VideoCard videoCard, HardDriver hdd, IEnumerable<HardDriver> hardDrives, Battery battery) : base(cpu, ram, videoCard, hdd, hardDrives) { this.Battery = battery; }
void DCP(ushort address) => SetZN((byte)(Accumulator - Ram.Write(address, (byte)(Ram.Read(address) - 1))));
internal virtual byte ReadNext() => Ram.Read(ProgramCounter++);
public async Task <IActionResult> AddProduct(ProImgAndModelduct product, Rom rom, Ram ram) { if (product.NameProduct == null) { ModelState.AddModelError("NameProduct", "Vui lòng điền trường này"); } string uniqueFileName = await GetUniqueFileName(product, product.ImgFile.FileName); //Thêm hình var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "ProductImg"); var filePath = Path.Combine(uploads, uniqueFileName); product.ImgFile.CopyTo(new FileStream(filePath, FileMode.Create)); Product productNew = new Product(); productNew.NameProduct = product.NameProduct; productNew.ManufacturerId = product.ManufacturerId; productNew.RamId = product.RamId; productNew.RomId = product.RomId; productNew.ImgUrl = uniqueFileName; if (product.Discount != null) { productNew.DiscountId = product.DiscountId; } productNew.Note = product.Note; productNew.Price = product.Price; _context.Products.Update(productNew); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ListProduct))); }
public Order(Village village, string name, int quantity = 1) { id = GetId(); headquarters = new Headquarters(); timberCamp = new TimberCamp(); clayPit = new ClayPit(); ironMine = new IronMine(); farm = new Farm(); warehouse = new Warehouse(); rallyPoint = new RallyPoint(); barracks = new Barracks(); statue = new Statue(); wall = new Wall(); hospital = new Hospital(); market = new Market(); tavern = new Tavern(); academy = new Academy(); hallOfOrders = new HallOfOrders(); spearman = new Spearman(); swordsman = new Swordsman(); archer = new Archer(); heavyCavalry = new HeavyCavalry(); axeFighter = new AxeFighter(); lightCavalry = new LightCavalry(); mountedArcher = new MountedArcher(); ram = new Ram(); catapult = new Catapult(); barracksInfos = new List <PartialBarracksInfo>(); farmInfos = new List <PartialFarmInfo>(); waitInfos = new List <PartialWaitInfo>(); barracksToDateTime = new Dictionary <int, DateTime>(); stringToEntity = new Dictionary <string, Entity>() { { "Headquarters", headquarters }, { "TimberCamp", timberCamp }, { "ClayPit", clayPit }, { "IronMine", ironMine }, { "Farm", farm }, { "Warehouse", warehouse }, { "RallyPoint", rallyPoint }, { "Barracks", barracks }, { "Statue", statue }, { "Wall", wall }, { "Hospital", hospital }, { "Market", market }, { "Tavern", tavern }, { "Academy", academy }, { "HallOfOrders", hallOfOrders }, { "Spearman", spearman }, { "Swordsman", swordsman }, { "Archer", archer }, { "HeavyCavalry", heavyCavalry }, { "AxeFighter", axeFighter }, { "LightCavalry", lightCavalry }, { "MountedArcher", mountedArcher }, { "Ram", ram }, { "Catapult", catapult }, { "init", null } }; barracksToLimit = new Dictionary <int, int>() { { 1, 5 }, { 2, 10 }, { 3, 15 } }; for (int i = 4; i <= 25; i++) { barracksToLimit.Add(i, int.MaxValue); } this.name = name; this.quantity = quantity; entity = stringToEntity[name]; bar = new OrderBar(this.village = village); }
public void TestRamFields() { Ram ram = new Ram(5); Assert.AreEqual(0.1, ram.Weight); }
public void GetPartsInfo() { Console.WriteLine($"CPU: {Cpu.Name}"); Console.WriteLine($"HDD: {Hdd.Name}"); Console.WriteLine($"RAM: {Ram.Name}"); Console.WriteLine($"VGA: {Vga.Name}"); Console.WriteLine($"Performance factor: {Cpu.PerformanceFactor() + Hdd.PerformanceFactor() + Ram.PerformanceFactor() + Vga.PerformanceFactor()}"); }
public void Enter(Ram ram) { _ram = ram; _ram.isPatrolState = true; _ram._navMeshAgent.speed = _ram.animalStats.patrolSpeed; }
void AND(ushort address) => AND(Ram.Read(address));