private void PreencherForm(PC_MonitorColecao mon, PC_Processor_Windows proc, PC_RamColecao ram, PC_StorageColecao sto, PC_Specification spec, PC_VideoColecao video) { textBoxProcModelo.Text = proc.Processor; textBoxProcSocket.Text = proc.Socket; textBoxCache.Text = proc.Cache; textBoxPcCategoria.Text = spec.TipoMaquina; if (spec.TipoMaquina == "Notebook") { this.pictureBoxPrincipal.BackgroundImage = Properties.Resources.notebook; } else { this.pictureBoxPrincipal.BackgroundImage = Properties.Resources.computer; } textBoxPcFab.Text = spec.Fabricante; textBoxPcModelo.Text = spec.Produto; textBoxPcNome.Text = Path.GetFileNameWithoutExtension(path); textBoxPcSerial.Text = spec.SerialMaquina; textBoxPcVersao.Text = proc.Windows; textBoxPlacaFab.Text = spec.Fornecedor; textBoxPlacaModelo.Text = spec.Modelo; textBoxPlacaSerial.Text = spec.SerialPlaca; textBoxPlacaData.Text = spec.Data; textBoxPlacaMax.Text = spec.MemoryMax; textBoxPlacaSlot.Text = spec.SlotQuant == "N/A" ? "N/A" : string.Format("{0:00}", Convert.ToInt32(spec.SlotQuant)); textBoxPlacaTotalMem.Text = spec.MemoryFormat; textBoxPlacaMod.Text = spec.MemoryModulo; //for (int i = 0; i < dataGridViewVideo.Columns.Count; i++) // dataGridViewVideo.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; dataGridViewVideo.AutoGenerateColumns = false; dataGridViewVideo.DataSource = video; dataGridViewVideo.ClearSelection(); dataGridViewStorage.AutoGenerateColumns = false; dataGridViewStorage.DataSource = sto; dataGridViewStorage.ClearSelection(); dataGridViewMonitor.AutoGenerateColumns = false; dataGridViewMonitor.DataSource = mon; dataGridViewMonitor.ClearSelection(); dataGridViewMemory.AutoGenerateColumns = false; dataGridViewMemory.DataSource = ram; dataGridViewMemory.ClearSelection(); }
private PC_Processor_Windows ConsultaProcessor() { string[] processor; processor = new string[3]; string ler = string.Empty; using (StreamReader sr = new StreamReader(path)) { while ((ler = sr.ReadLine()) != null) { if (ler.Contains("L4 cache")) { processor[2] = ler; labelCache.Text = "Cache L4:"; goto str; } } } using (StreamReader sr = new StreamReader(path)) { while ((ler = sr.ReadLine()) != null) { if (ler.Contains("L3 cache")) { processor[2] = ler; labelCache.Text = "Cache L3:"; goto str; } } } using (StreamReader sr = new StreamReader(path)) { while ((ler = sr.ReadLine()) != null) { if (ler.Contains("L2 cache")) { processor[2] = ler; labelCache.Text = "Cache L2:"; goto str; } } } str: using (StreamReader sr = new StreamReader(path)) { string[] result = new string[3]; while ((ler = sr.ReadLine()) != null) { if (ler.Contains("Codename")) { while ((ler = sr.ReadLine()) != null) { if (ler.Contains("Specification")) { processor[0] = ler; } if (ler.Contains("Package")) { processor[1] = ler; break; } } result = TratarArray(processor); break; } } PC_Processor_Windows ProcessorWin = new PC_Processor_Windows { Processor = result[0], Socket = result[1].Replace("Socket ", ""), Cache = result[2].Length > 0 ? result[2].Substring(0, result[2].IndexOf(',')) : "", Windows = ConsultarWinVersion() }; return(ProcessorWin); } }