private async void btnSeeLog_Click(object sender, EventArgs e) { //Sistema Operacional OsInfo osInfo = new OsInfo(); string infoOsString = await Task.Run(() => osInfo.SeeOsInfo()); string logOsString = "===Sistema Operacional========================\n" + $"{infoOsString}\n"; pgbSeeLog.Value = 16; //Processador ProcessorInfo processorInfo = new ProcessorInfo(); string infoProcessorString = await Task.Run(() => processorInfo.SeeProcessorInfo()); string logProcessorString = "\n===Processador=============================\n" + $"{infoProcessorString}\n"; pgbSeeLog.Value = 32; //GPU GpuInfo gpuInfo = new GpuInfo(); string infoGpu = await Task.Run(() => gpuInfo.SeeGpuInfo()); string logGpuString = "\n===GPU==================================\n" + $"{infoGpu}\n"; pgbSeeLog.Value = 48; //Sound Device SoundInfo soundInfo = new SoundInfo(); string infoSound = await Task.Run(() => soundInfo.SeeSoundDevice()); string logSoundString = "\n===Dispositivo de Som========================\n" + $"{infoSound}\n"; pgbSeeLog.Value = 64; //Printers PrinterInfo printerInfo = new PrinterInfo(); string infoPrinter = await Task.Run(() => printerInfo.SeePrinterInfo()); string logPrinterString = "\n===Impressoras========================\n" + $"{infoPrinter}\n"; pgbSeeLog.Value = 80; //RAM RamInfo ramInfo = new RamInfo(); string infoRam = await Task.Run(() => ramInfo.SeeRam()); string logRamString = "\n===RAM==================================\n" + $"{infoRam}"; pgbSeeLog.Value = 100; MessageBox.Show(logOsString + logProcessorString + logGpuString + logSoundString + logPrinterString + logRamString, "Informações", MessageBoxButtons.OK); pgbSeeLog.Value = 0; }
public void GenerateLog(string dirName) { log = File.CreateText(dirName + logName); //Sistema Operacional OsInfo osInfo = new OsInfo(); string logOsString = "===Sistema Operacional========================\n" + $"{osInfo.SeeOsInfo()}\n"; //Processador ProcessorInfo processorInfo = new ProcessorInfo(); string logProcessorString = "\n===Processador=============================\n" + $"{processorInfo.SeeProcessorInfo()}\n"; //GPU GpuInfo gpuInfo = new GpuInfo(); string logGpuString = "\n===GPU==================================\n" + $"{gpuInfo.SeeGpuInfo()}"; //Sound Device SoundInfo soundInfo = new SoundInfo(); string logSoundString = "\n===Dispositivo de Som========================\n" + $"{soundInfo.SeeSoundDevice()}\n"; //Printers PrinterInfo printerInfo = new PrinterInfo(); string logPrinterString = "\n===Impressoras========================\n" + $"{printerInfo.SeePrinterInfo()}\n"; //RAM RamInfo ramInfo = new RamInfo(); string logRamString = "\n===RAM==================================\n" + $"{ramInfo.SeeRam()}"; log.Write(logOsString + logProcessorString + logGpuString + logSoundString + logPrinterString + logRamString); log.Close(); MessageBox.Show($"Arquivo gerado com sucesos em {dirName}", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }