uploaded full backend brains, no face yet

This commit is contained in:
Belim
2025-05-04 16:24:02 +02:00
parent deb9e1ba5c
commit 32b5351bcb
11 changed files with 666 additions and 2 deletions
+2
View File
@@ -97,6 +97,7 @@ namespace Settings.Personalization
try
{
Registry.SetValue(keyName, valueName, 0, RegistryValueKind.DWord);
Utils.RestartExplorer(); // Restart Explorer to apply changes
return Task.FromResult(true);
}
catch (Exception ex)
@@ -112,6 +113,7 @@ namespace Settings.Personalization
try
{
Registry.SetValue(keyName, valueName, 1, RegistryValueKind.DWord);
Utils.RestartExplorer(); // Restart Explorer to apply changes
return true;
}
catch (Exception ex)
+23
View File
@@ -0,0 +1,23 @@
using System.IO;
using System.Windows.Forms;
namespace HelperTool
{
internal class Utils
{
public static class Data
{
public static string DataRootDir = Application.StartupPath +
@"\app\";
}
// Create data directory if non present
public static void CreateDataDir()
{
bool dirExists = Directory.Exists(@"app");
if (!dirExists)
Directory.CreateDirectory(@"app");
}
}
}
+73
View File
@@ -0,0 +1,73 @@
using System;
using System.Drawing;
using System.Windows.Forms;
/// <summary>
/// A simple logger class to log messages to a RichTextBox.
/// </summary>
public static class Logger
{
public static RichTextBox OutputBox;
private static readonly Font DefaultFont = new Font("Consolas", 8.25f, FontStyle.Regular);
public static void Log(string message, LogLevel level = LogLevel.Info)
{
if (OutputBox == null) return;
if (OutputBox.InvokeRequired)
{
OutputBox.Invoke(new Action(() => LogInternal(message, level)));
}
else
{
LogInternal(message, level);
}
}
private static void LogInternal(string message, LogLevel level)
{
// string prefix = $"[{DateTime.Now:HH:mm:ss}] [{level}] ";
string fullMessage = message + Environment.NewLine;
// Set color based on log level
Color color;
switch (level)
{
case LogLevel.Warning:
color = Color.OrangeRed;
break;
case LogLevel.Error:
color = Color.Red;
break;
case LogLevel.Custom:
color = Color.Magenta; // for plugins and other custom messages
break;
default:
color = Color.Black;
break;
}
// Append text with color
OutputBox.SelectionStart = OutputBox.TextLength;
OutputBox.SelectionLength = 0;
OutputBox.SelectionColor = color;
OutputBox.AppendText(fullMessage);
// Reset selection to default
OutputBox.SelectionColor = OutputBox.ForeColor; // reset color
OutputBox.SelectionFont = DefaultFont; // reset font
OutputBox.ScrollToCaret(); // scroll to the end
}
}
public enum LogLevel
{
Info,
Warning,
Error,
Custom
}
+52
View File
@@ -0,0 +1,52 @@
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Threading.Tasks;
using Microsoft.Win32;
// This file is part of MSCFixer.
namespace OSHelper
{
internal class OSHelper
{
public static async Task<string> GetWindowsVersion()
{
return await Task.Run(() =>
{
try
{
using (PowerShell powerShellInstance = PowerShell.Create())
{
powerShellInstance.AddScript("Get-CimInstance -ClassName Win32_OperatingSystem");
Collection<PSObject> psOutput = powerShellInstance.Invoke();
foreach (PSObject outputItem in psOutput)
{
if (outputItem != null)
{
string productName = outputItem.Properties["Caption"]?.Value?.ToString();
if (!string.IsNullOrEmpty(productName))
{
string osVersion = productName.Contains("Windows 10") ? "Windows 10" : "Windows 11";
using (RegistryKey displayVersionKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"))
{
if (displayVersionKey != null)
{
string displayVersion = displayVersionKey.GetValue("DisplayVersion")?.ToString();
return $"{osVersion} ({displayVersion})";
}
}
return osVersion;
}
}
}
}
}
catch
{
}
return "OS not supported";
});
}
}
}
+83
View File
@@ -0,0 +1,83 @@
using Microsoft.Win32;
using System.Windows.Forms;
using System;
using System.Diagnostics;
// This file is part of MSCFixer.
namespace Crapfixer
{
internal class Utils
{
/// <summary>
/// Checks if a registry value is equal to a specified integer.
/// </summary>
/// <param name="keyName"></param>
/// <param name="valueName"></param>
/// <param name="expectedValue"></param>
/// <returns></returns>
public static bool IntEquals(string keyName, string valueName, int expectedValue)
{
try
{
var value = Registry.GetValue(keyName, valueName, null);
return (value != null && (int)value == expectedValue);
}
catch (Exception ex)
{
MessageBox.Show(keyName, ex.Message, MessageBoxButtons.OK);
return false;
}
}
/// <summary>
/// Checks if a registry value is equal to a specified string.
/// </summary>
/// <param name="keyName"></param>
/// <param name="valueName"></param>
/// <param name="expectedValue"></param>
/// <returns></returns>
public static bool StringEquals(string keyName, string valueName, string expectedValue)
{
try
{
var value = Registry.GetValue(keyName, valueName, null);
return (value != null && (string)value == expectedValue);
}
catch (Exception ex)
{
MessageBox.Show(keyName, ex.Message, MessageBoxButtons.OK);
return false;
}
}
/// <summary>
/// Restarts Windows Explorer to apply UI changes.
/// </summary>
public static void RestartExplorer()
{
try
{
Logger.Log("Restarting Windows Explorer to apply UI changes...", LogLevel.Info);
// Kill all explorer instances
foreach (var process in Process.GetProcessesByName("explorer"))
{
process.Kill();
process.WaitForExit();
}
// Restart explorer
Process.Start("explorer.exe");
Logger.Log("Explorer restarted successfully. Changes should now be visible.", LogLevel.Info);
}
catch (Exception ex)
{
Logger.Log("Failed to restart Explorer: " + ex.Message, LogLevel.Error);
}
}
}
}
+54
View File
@@ -0,0 +1,54 @@
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace MSCFixer
{
/// <summary>
/// Handles navigation button highlighting for a set of UI buttons.
/// </summary>
public class NavigationHandler
{
// List of all buttons managed by the navigation handler
private readonly List<Button> _buttons;
// Color used for the active (selected) button
private readonly Color _activeColor = Color.FromArgb(76, 145, 235);
// Color used for inactive (non-selected) buttons
private readonly Color _inactiveColor = Color.FromArgb(104, 104, 104);
// Border color for inactive buttons
private readonly Color _inactiveBorderColor = Color.FromArgb(114, 114, 114);
/// <summary>
/// Initializes the handler with the buttons that should be managed.
/// </summary>
/// <param name="buttons">The buttons to include in the navigation group.</param>
public NavigationHandler(params Button[] buttons)
{
_buttons = new List<Button>(buttons);
}
/// <summary>
/// Sets the specified button as active, changing colors accordingly.
/// </summary>
/// <param name="activeButton">The button to highlight as active.</param>
public void SetActive(Button activeButton)
{
foreach (var button in _buttons)
{
bool isActive = button == activeButton;
// Set the background color for the button (active or inactive)
button.BackColor = isActive ? _activeColor : _inactiveColor;
// Set the border color for the button (active or inactive)
button.FlatAppearance.BorderColor = isActive ? _activeColor : _inactiveBorderColor;
// Set the text color to white for both active and inactive
button.ForeColor = Color.White;
}
}
}
}
+18
View File
@@ -1,6 +1,9 @@
using System.Collections.Generic;
using System.Windows.Forms;
/// <summary>
/// Manages navigation between different views.
/// </summary>
public class NavigationManager
{
private Stack<Control> navigationHistory = new Stack<Control>(); // Holds previous views
@@ -71,4 +74,19 @@ public class NavigationManager
{
navigationHistory.Clear();
}
/// <summary>
/// Switches directly to the main panel, clearing the navigation history.
/// </summary>
public void GoToMain()
{
if (mainPanel != null)
{
navigationHistory.Clear(); // Clear the navigation history
panelContainer.Controls.Clear();
panelContainer.Controls.Add(mainPanel);
mainPanel.Dock = DockStyle.Fill;
mainPanel.BringToFront();
}
}
}
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.23.60")]
[assembly: AssemblyFileVersion("0.23.60")]
[assembly: AssemblyVersion("0.31.101")]
[assembly: AssemblyFileVersion("0.31.101")]
+190
View File
@@ -0,0 +1,190 @@
namespace Views
{
partial class SettingsView
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.lblHeader = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.lblVersionInfo = new System.Windows.Forms.Label();
this.linkGitHub = new System.Windows.Forms.LinkLabel();
this.btnDonate = new System.Windows.Forms.Button();
this.panelSettings = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panelSettings.SuspendLayout();
this.SuspendLayout();
//
// lblHeader
//
this.lblHeader.AutoEllipsis = true;
this.lblHeader.AutoSize = true;
this.lblHeader.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Bold);
this.lblHeader.ForeColor = System.Drawing.Color.Black;
this.lblHeader.Location = new System.Drawing.Point(195, 16);
this.lblHeader.Name = "lblHeader";
this.lblHeader.Size = new System.Drawing.Size(69, 21);
this.lblHeader.TabIndex = 235;
this.lblHeader.Text = "Crapfixer";
this.lblHeader.UseCompatibleTextRendering = true;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoEllipsis = true;
this.label1.Location = new System.Drawing.Point(168, 118);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(454, 26);
this.label1.TabIndex = 236;
this.label1.Text = "You can download the latest version, report bugs and submit feature requests at t" +
"he following GitHub page.";
//
// pictureBox1
//
this.pictureBox1.Image = global::MSCFixer.Properties.Resources.AppIcon32;
this.pictureBox1.Location = new System.Drawing.Point(152, 16);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(37, 34);
this.pictureBox1.TabIndex = 237;
this.pictureBox1.TabStop = false;
//
// lblVersionInfo
//
this.lblVersionInfo.AutoSize = true;
this.lblVersionInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F);
this.lblVersionInfo.ForeColor = System.Drawing.Color.Black;
this.lblVersionInfo.Location = new System.Drawing.Point(195, 37);
this.lblVersionInfo.Name = "lblVersionInfo";
this.lblVersionInfo.Size = new System.Drawing.Size(13, 13);
this.lblVersionInfo.TabIndex = 238;
this.lblVersionInfo.Text = "v";
//
// linkGitHub
//
this.linkGitHub.AutoSize = true;
this.linkGitHub.Location = new System.Drawing.Point(183, 156);
this.linkGitHub.Name = "linkGitHub";
this.linkGitHub.Size = new System.Drawing.Size(190, 13);
this.linkGitHub.TabIndex = 239;
this.linkGitHub.TabStop = true;
this.linkGitHub.Text = "https://github.com/builtbybel/Crapfixer";
this.linkGitHub.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkGitHub_LinkClicked);
//
// btnDonate
//
this.btnDonate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(131)))), ((int)(((byte)(222)))));
this.btnDonate.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDonate.FlatAppearance.BorderSize = 0;
this.btnDonate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDonate.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDonate.ForeColor = System.Drawing.Color.White;
this.btnDonate.Location = new System.Drawing.Point(194, 65);
this.btnDonate.Name = "btnDonate";
this.btnDonate.Size = new System.Drawing.Size(179, 31);
this.btnDonate.TabIndex = 240;
this.btnDonate.Text = "Help me Launch Version 1.0 🚀";
this.btnDonate.UseVisualStyleBackColor = false;
this.btnDonate.Click += new System.EventHandler(this.btnDonate_Click);
//
// panelSettings
//
this.panelSettings.Controls.Add(this.button1);
this.panelSettings.Controls.Add(this.btnDonate);
this.panelSettings.Controls.Add(this.lblHeader);
this.panelSettings.Controls.Add(this.linkGitHub);
this.panelSettings.Controls.Add(this.label1);
this.panelSettings.Controls.Add(this.lblVersionInfo);
this.panelSettings.Controls.Add(this.pictureBox1);
this.panelSettings.Controls.Add(this.button2);
this.panelSettings.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelSettings.Location = new System.Drawing.Point(0, 0);
this.panelSettings.Name = "panelSettings";
this.panelSettings.Size = new System.Drawing.Size(625, 395);
this.panelSettings.TabIndex = 242;
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
this.button1.Enabled = false;
this.button1.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Tahoma", 8F);
this.button1.Location = new System.Drawing.Point(10, 49);
this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(20, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(127, 30);
this.button1.TabIndex = 241;
this.button1.Text = "Settings";
this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.UseVisualStyleBackColor = false;
//
// button2
//
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(242)))), ((int)(((byte)(242)))));
this.button2.FlatAppearance.BorderColor = System.Drawing.Color.Gainsboro;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Tahoma", 8F);
this.button2.Location = new System.Drawing.Point(10, 13);
this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(20, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(127, 30);
this.button2.TabIndex = 242;
this.button2.Text = "About";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.UseVisualStyleBackColor = false;
//
// SettingsView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoScroll = true;
this.BackColor = System.Drawing.Color.White;
this.Controls.Add(this.panelSettings);
this.Name = "SettingsView";
this.Size = new System.Drawing.Size(625, 395);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panelSettings.ResumeLayout(false);
this.panelSettings.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label lblHeader;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label lblVersionInfo;
private System.Windows.Forms.LinkLabel linkGitHub;
private System.Windows.Forms.Button btnDonate;
private System.Windows.Forms.Panel panelSettings;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}
+49
View File
@@ -0,0 +1,49 @@
using Crapfixer;
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace Views
{
public partial class SettingsView : UserControl
{
private NavigationManager navigationManager;
public SettingsView(NavigationManager navigationManager)
{
InitializeComponent();
this.navigationManager = navigationManager;
InitializeUI();
}
private void InitializeUI()
{
// Update version label
this.lblVersionInfo.Text = $"v{Program.GetCurrentVersionTostring()} ";
}
private void linkGitHub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start("https://github.com/builtbybel/Crapfixer/releases");
}
private void btnDonate_Click(object sender, EventArgs e)
{
var result = MessageBox.Show(
"Hi! I'm building Crapfixer solo. Want to support me and help launch Version 1.0?",
"Support Crapfixer ❤️",
MessageBoxButtons.YesNo,
MessageBoxIcon.Information);
if (result == DialogResult.Yes)
{
System.Diagnostics.Process.Start(new ProcessStartInfo
{
FileName = "https://paypal.com/donate?hosted_button_id=MY7HX4QLYR4KG",
UseShellExecute = true
});
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>