-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
98 lines (73 loc) · 3.62 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Management;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace InfOS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
CPU.Text = ObtainDeviceProperty("Win32_Processor", "name");
CPUFAMILY.Text = Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");
GPU.Text= ObtainDeviceProperty("Win32_VideoController", "name");
NICS.Text= ObtainDeviceProperty("Win32_NetworkAdapter", "Name");
TRACKPAD.Text= ObtainDeviceProperty("Win32_PointingDevice", "DeviceID");
TRACKPAD.Text += ObtainDeviceProperty("Win32_PointingDevice", "Description");
KEYBOARD.Text = ObtainDeviceProperty("Win32_Keyboard", "DeviceID");
KEYBOARD.Text += ObtainDeviceProperty("Win32_Keyboard", "Description");
MODEL.Text = ObtainDeviceProperty("Win32_ComputerSystem", "Manufacturer");
MODEL.Text += ObtainDeviceProperty("Win32_ComputerSystem", "Model");
MODEL.Text += ObtainDeviceProperty("Win32_ComputerSystem", "SystemType");
MOBO.Text = ObtainDeviceProperty("Win32_MotherboardDevice", "Name");
MOBO.Text += ObtainDeviceProperty("Win32_MotherboardDevice", "DeviceID");
MOBO.Text += ObtainDeviceProperty("Win32_MotherboardDevice", "Description");
if ( (System.Environment.Is64BitOperatingSystem)== true){
sixtyfour.Checked = sixtyfour.Enabled = true;
}else
{
thirtytwo.Checked = thirtytwo.Enabled = true;
}
}
public string ObtainDeviceProperty(string HWDevice, string Property)
{
string result = "";
ManagementObjectSearcher infos = new ManagementObjectSearcher("SELECT * FROM " + HWDevice);
foreach (ManagementObject prop in infos.Get())
{
if ((result+=prop[Property].ToString())=="")
{
return "null";
}
result += "\t";
}
return result;
}
private void Salva_Click(object sender, EventArgs e)
{
SaveFileDialog savesettings = new SaveFileDialog();
savesettings.FileName = "MyPCInfos";
savesettings.DefaultExt = ".txt";
savesettings.Filter = "Text File (*.txt)|";
if (savesettings.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(savesettings.FileName,label1.Text + CPU.Text + "\n\n" + label2.Text + GPU.Text + "\n\n" + label3.Text + CPUFAMILY.Text + "\n\n" + label4.Text + NICS.Text + "\n\n" + label5.Text + TRACKPAD.Text + "\n\n" + label6.Text + KEYBOARD.Text + "\n\n" + label7.Text + MODEL.Text + "\n\n" + label8.Text + MOBO.Text + "\n\n" + "32 Bit:" + thirtytwo.Checked + "\n\n" + "64 Bit:" + sixtyfour.Checked);
}
}
private void HelpButtonEvent(object sender, CancelEventArgs e)
{
MessageBox.Show("xReB3L\nGitHub: https://github.com/xReB3L \n Fonts used: Evolution Font by PaulW (https://www.fontspace.com/evolution-font-f9365) \n \"Save\" icon made by xnimrodx from www.flaticon.com", "Credits:");
}
}
}