Esempio n. 1
0
        private PC_StorageColecao ConsultarStorage()
        {
            List <string[]> listStorage = new List <string[]>();
            string          ler         = string.Empty;

            using (StreamReader sr = new StreamReader(path))
            {
                while ((ler = sr.ReadLine()) != null)
                {
                    if (ler.Contains("Storage"))
                    {
                        string[] storage = new string[5];
                        while ((ler = sr.ReadLine()) != null)
                        {
                            if (ler.Contains("Name"))
                            {
                                storage[0] = ler;
                            }

                            if (ler.Contains("Serial"))
                            {
                                storage[1] = ler;
                            }

                            if (ler.Contains("Capacity"))
                            {
                                storage[2] = ler;
                            }

                            if (ler.Contains("Type") && !ler.Contains("RAID") && !ler.Contains("Bus"))
                            {
                                storage[3] = ler.Replace("Fixed", "Interno");
                            }

                            if (ler.Contains("Volume"))
                            {
                                storage[4] = ler.Replace(" percent available", "% disponível");

                                string[] novo = TratarArray(storage);
                                listStorage.Add(novo);
                            }

                            if (ler.Contains("USB"))
                            {
                                goto Hd;
                            }
                        }
                    }
                }
Hd:
                PC_StorageColecao colecaoStorage = new PC_StorageColecao();
                foreach (string[] storage in listStorage)
                {
                    PC_Storage Storage = new PC_Storage
                    {
                        Capacidade = storage[2],
                        Nome       = storage[0],
                        Serial     = storage[1],
                        Tipo       = storage[3],
                        Volume     = storage[4]
                    };

                    colecaoStorage.Add(Storage);
                }

                return(colecaoStorage);
            }
        }
Esempio n. 2
0
        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();
        }