This repository has been archived by the owner on Mar 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathShellSettings.cs
97 lines (93 loc) · 3.65 KB
/
ShellSettings.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
using static System.Environment;
using System.Management;
using Microsoft.VisualBasic.Devices;
namespace DatShell
{
public partial class ShellSettings : Form
{
public ShellSettings()
{
InitializeComponent();
}
private void ShellSettings_Load(object sender, EventArgs e)
{
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey checkthemeing = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", true);
string lighttheme = "0";
try
{
lighttheme = checkthemeing.GetValue("SystemUsesLightTheme").ToString();
}
catch { }
if (lighttheme == "0")
{
this.BackColor = Color.FromArgb(49, 49, 49);
label1.ForeColor = Color.FromArgb(255, 255, 255);
label2.ForeColor = Color.FromArgb(255, 255, 255);
label3.ForeColor = Color.FromArgb(255, 255, 255);
tabPage1.BackColor = Color.FromArgb(49, 49, 49);
tabPage2.BackColor = Color.FromArgb(49, 49, 49);
}
else
{
this.BackColor = Color.FromArgb(255, 255, 255);
label1.ForeColor = Color.FromArgb(0, 0, 0);
label2.ForeColor = Color.FromArgb(0, 0, 0);
label3.ForeColor = Color.FromArgb(0, 0, 0);
tabPage1.BackColor = Color.FromArgb(255, 255, 255);
tabPage2.BackColor = Color.FromArgb(255, 255, 255);
}
RegistryKey hklm = Registry.LocalMachine;
RegistryKey cpuidentifierhklm = hklm.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", true);
string cpuidentifier = cpuidentifierhklm.GetValue("ProcessorNameString").ToString();
ulong ram = (new ComputerInfo().TotalPhysicalMemory) / (1024 * 1024);
label3.Text = "System Specs:\nCPU: " + cpuidentifier + "\nRAM: " + ram.ToString() + "MB\nCurrent User: " + Environment.UserName.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey checkthemeing = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", true);
try
{
string lighttheme = checkthemeing.GetValue("SystemUsesLightTheme").ToString();
if (lighttheme == "0")
{
checkthemeing.SetValue("SystemUsesLightTheme", "1");
}
else
{
MessageBox.Show("Light theme is already set.");
}
}
catch { }
}
private void button2_Click(object sender, EventArgs e)
{
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey checkthemeing = hkcu.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", true);
try
{
string lighttheme = checkthemeing.GetValue("SystemUsesLightTheme").ToString();
if (lighttheme == "1")
{
checkthemeing.SetValue("SystemUsesLightTheme", "0");
}
else
{
MessageBox.Show("Dark theme is already set.");
}
}
catch { }
}
}
}