Skip to content

Commit

Permalink
Major update to v15.9
Browse files Browse the repository at this point in the history
  • Loading branch information
hellzerg committed Oct 14, 2023
1 parent 71355b5 commit 3131d1a
Show file tree
Hide file tree
Showing 80 changed files with 2,075 additions and 1,618 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [15.9] - 2023-10-14
- New: Disable CoPilot AI (in Windows 11)
- New: Fully translated into Bulgarian
- New: 'Reinforce policies' in Options re-applies your current enabled tweaks (#389)
- Hotfix: Crash on localized versions of Windows (#383)
- Hotfix: Various UI bugs
- Improved: Optimized images and assets
- Improved: Startup items detection

## [15.8] - 2023-08-26
- New: Fully translated into Nepali (thanks to chapagetti)
- New: You can now set custom DNS in Pinger, as well as from template
Expand Down
5 changes: 4 additions & 1 deletion Optimizer/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
internal static class Constants
{
internal static string DOWNLOADS_FOLDER = "OptimizerDownloads";
internal static string InternalDNS = "1.1.1.1";
internal static string INTERNAL_DNS = "1.1.1.1";
internal static string THEME_FLAG = "themeable";
internal static int CONTRAST_THRESHOLD = 149;

internal static string INDICIUM_TOOL = "indicium";
internal static string UWP_TOOL = "uwp";
Expand Down Expand Up @@ -37,6 +39,7 @@ internal static class Constants
internal static string JAPANESE = "日本語";
internal static string PERSIAN = "فارسی";
internal static string NEPALI = "नेपाली";
internal static string BULGARIAN = "български";

internal static string CloudflareDNS = "Cloudflare";
internal static string OpenDNS = "OpenDNS";
Expand Down
2 changes: 1 addition & 1 deletion Optimizer/Controls/MoonCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected override void OnCheckedChanged(EventArgs e)
this.Tag = "themeable";
this.Font = new Font(this.Font, FontStyle.Underline);

this.ForeColor = Options.ForegroundColor;
this.ForeColor = OptionsHelper.ForegroundColor;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Optimizer/Controls/MoonCheckList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public MoonCheckList()
protected override void OnDrawItem(DrawItemEventArgs e)
{
Color foreColor = Color.White;
Color accentColor = Options.ForegroundColor;
Color accentColor = OptionsHelper.ForegroundColor;

if (this.Items.Count > 0)
{
Expand Down
20 changes: 10 additions & 10 deletions Optimizer/Controls/MoonMenuRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,77 +51,77 @@ public override Color ToolStripDropDownBackground
{
get
{
return Options.BackgroundColor;
return OptionsHelper.BackgroundColor;
}
}

public override Color ImageMarginGradientBegin
{
get
{
return Options.BackgroundColor;
return OptionsHelper.BackgroundColor;
}
}
public override Color ImageMarginGradientMiddle
{
get
{
return Options.BackgroundColor;
return OptionsHelper.BackgroundColor;
}
}
public override Color ImageMarginGradientEnd
{
get
{
return Options.BackgroundColor;
return OptionsHelper.BackgroundColor;
}
}

public override Color ToolStripBorder
{
get
{
return Options.BackgroundColor;
return OptionsHelper.BackgroundColor;
}
}

public override Color MenuBorder
{
get
{
return Options.BackAccentColor;
return OptionsHelper.BackAccentColor;
}
}

public override Color MenuItemSelected
{
get
{
return Options.BackAccentColor;
return OptionsHelper.BackAccentColor;
}
}

public override Color MenuItemSelectedGradientBegin
{
get
{
return Options.BackAccentColor;
return OptionsHelper.BackAccentColor;
}
}

public override Color MenuItemSelectedGradientEnd
{
get
{
return Options.BackAccentColor;
return OptionsHelper.BackAccentColor;
}
}

public override Color MenuItemBorder
{
get
{
return Options.BackAccentColor;
return OptionsHelper.BackAccentColor;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Optimizer/Controls/MoonProgress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected override void OnPaint(PaintEventArgs e)

rec.Width = (int)(rec.Width * ((double)base.Value / Maximum)) - 4;
rec.Height -= 4;
brush = new LinearGradientBrush(rec, Options.ForegroundAccentColor, Options.ForegroundColor, LinearGradientMode.Vertical);
brush = new LinearGradientBrush(rec, OptionsHelper.ForegroundAccentColor, OptionsHelper.ForegroundColor, LinearGradientMode.Vertical);
e.Graphics.FillRectangle(brush, 2, 2, rec.Width, rec.Height);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Optimizer/Controls/MoonRadio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected override void OnCheckedChanged(EventArgs e)
this.Tag = "themeable";
this.Font = new Font(this.Font, FontStyle.Underline);

this.ForeColor = Options.ForegroundColor;
this.ForeColor = OptionsHelper.ForegroundColor;
}
else
{
Expand Down
16 changes: 8 additions & 8 deletions Optimizer/Controls/MoonTabs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected override void OnPaint(PaintEventArgs e)
if (TabCount > 0)
{
using (SolidBrush brushBackgroundTab = new SolidBrush(Color.FromArgb(40, 40, 40)))
using (SolidBrush brushDivider = new SolidBrush(Options.ForegroundColor))
using (SolidBrush brushDivider = new SolidBrush(OptionsHelper.ForegroundColor))
{
{
e.Graphics.FillRectangle(brushBackgroundTab, DisplayRectangle);
Expand Down Expand Up @@ -206,16 +206,16 @@ protected override void OnPaint(PaintEventArgs e)

SolidBrush brushActiveText;

using (Pen penActive = new Pen(Options.ForegroundColor))
using (Pen penActive = new Pen(OptionsHelper.ForegroundColor))
using (Pen penBorder = new Pen(Color.FromArgb(40, 40, 40), 0))
using (SolidBrush brushActive = new SolidBrush(Options.ForegroundColor))
using (SolidBrush brushActive = new SolidBrush(OptionsHelper.ForegroundColor))
using (SolidBrush brushInActive = new SolidBrush(Color.FromArgb(40, 40, 40)))
using (SolidBrush brushAlternative = new SolidBrush(Options.ForegroundColor))
using (SolidBrush brushActiveIndicator = new SolidBrush(ControlPaint.Light(Options.ForegroundColor)))
using (SolidBrush brushInActiveIndicator = new SolidBrush(Options.ForegroundColor))
using (brushActiveText = new SolidBrush(Options.TextColor))
using (SolidBrush brushAlternative = new SolidBrush(OptionsHelper.ForegroundColor))
using (SolidBrush brushActiveIndicator = new SolidBrush(ControlPaint.Light(OptionsHelper.ForegroundColor)))
using (SolidBrush brushInActiveIndicator = new SolidBrush(OptionsHelper.ForegroundColor))
using (brushActiveText = new SolidBrush(OptionsHelper.TextColor))
using (SolidBrush brushInActiveText = new SolidBrush(Color.White))
using (SolidBrush brushDrag = new SolidBrush(ControlPaint.Dark(Options.ForegroundColor)))
using (SolidBrush brushDrag = new SolidBrush(ControlPaint.Dark(OptionsHelper.ForegroundColor)))
{
//if (MoonManager.THEME_PREFERENCE == THEME.LIGHT) brushActiveText = new SolidBrush(Color.White);

Expand Down
10 changes: 5 additions & 5 deletions Optimizer/Controls/MoonToggle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ protected override void OnPaint(PaintEventArgs pevent)
if (this.Checked) //ON
{
if (solidStyle)
pevent.Graphics.FillPath(new SolidBrush(Options.ForegroundColor), GetFigurePath());
else pevent.Graphics.DrawPath(new Pen(Options.ForegroundColor, 2), GetFigurePath());
pevent.Graphics.FillPath(new SolidBrush(OptionsHelper.ForegroundColor), GetFigurePath());
else pevent.Graphics.DrawPath(new Pen(OptionsHelper.ForegroundColor, 2), GetFigurePath());
//Draw the toggle
pevent.Graphics.FillEllipse(new SolidBrush(Options.TextColor),
pevent.Graphics.FillEllipse(new SolidBrush(OptionsHelper.TextColor),
new Rectangle(this.Width - this.Height + 1, 2, toggleSize, toggleSize));
}
else //OFF
{
if (solidStyle)
pevent.Graphics.FillPath(new SolidBrush(Options.BackAccentColor), GetFigurePath());
else pevent.Graphics.DrawPath(new Pen(Options.BackAccentColor, 2), GetFigurePath());
pevent.Graphics.FillPath(new SolidBrush(OptionsHelper.BackAccentColor), GetFigurePath());
else pevent.Graphics.DrawPath(new Pen(OptionsHelper.BackAccentColor, 2), GetFigurePath());
//Draw the toggle
pevent.Graphics.FillEllipse(new SolidBrush(Color.White),
new Rectangle(2, 2, toggleSize, toggleSize));
Expand Down
2 changes: 1 addition & 1 deletion Optimizer/Controls/MoonTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override void OnDrawNode(DrawTreeNodeEventArgs e)
}

if (FindName(e.Node.Name)) TextRenderer.DrawText(e.Graphics, e.Node.Text, this.Font, e.Node.Bounds, Color.Silver);
else if (e.Node.Tag != null && e.Node.Tag.ToString() == _primaryItemTag) TextRenderer.DrawText(e.Graphics, e.Node.Text, this.Font, e.Node.Bounds, Options.ForegroundColor);
else if (e.Node.Tag != null && e.Node.Tag.ToString() == _primaryItemTag) TextRenderer.DrawText(e.Graphics, e.Node.Text, this.Font, e.Node.Bounds, OptionsHelper.ForegroundColor);
else TextRenderer.DrawText(e.Graphics, e.Node.Text, this.Font, e.Node.Bounds, Color.White);

if (this.ImageList != null && this.ImageList.Images.Count > 0 && e.Node.SelectedImageIndex > -1)
Expand Down
31 changes: 31 additions & 0 deletions Optimizer/DebugHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Optimizer
{
// Collection of useful debugging methods and utilities
internal sealed class DebugHelper
{
// For comparing and detecting missing properties in two translation JSON files
internal static void FindDifferenceInTwoJsons()
{
JObject file1 = JObject.Parse(Properties.Resources.EN);
JObject file2 = JObject.Parse(Properties.Resources.NE);

var p1 = file1.Properties().ToList();
var p2 = file2.Properties().ToList();

var missingProps = p1.Where(expected => p2.Where(actual => actual.Name == expected.Name).Count() == 0);

StringBuilder sb = new StringBuilder();
foreach (var x in missingProps)
{
sb.Append(x.Name + Environment.NewLine);
}
MessageBox.Show(sb.ToString());
}
}
}
5 changes: 1 addition & 4 deletions Optimizer/EmbeddedAssembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal static void Load(string embeddedResource, string fileName)

using (Stream stream = currentAssembly.GetManifestResourceStream(embeddedResource))
{
if (stream == null) throw new Exception(embeddedResource + " is not found in Embedded Resources.");
if (stream == null) throw new Exception($"{embeddedResource} is not found in Embedded Resources.");

bytes = new byte[(int)stream.Length];
stream.Read(bytes, 0, (int)stream.Length);
Expand Down Expand Up @@ -69,16 +69,13 @@ internal static void Load(string embeddedResource, string fileName)
}

assembly = Assembly.LoadFile(tempFile);

_dictionary.Add(assembly.FullName, assembly);
}

internal static Assembly Get(string assemblyFullName)
{
if (_dictionary == null || _dictionary.Count == 0) return null;

if (_dictionary.ContainsKey(assemblyFullName)) return _dictionary[assemblyFullName];

return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Optimizer/ErrorLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static void LogInfoSilent(string message)
_silentReportLog.AppendLine();
}

internal static void InitSilentReport()
internal static void InitializeSilentReport()
{
_silentReportLog = new StringBuilder();

Expand Down
4 changes: 2 additions & 2 deletions Optimizer/Forms/AboutForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ public sealed partial class AboutForm : Form
public AboutForm()
{
InitializeComponent();
Options.ApplyTheme(this);
OptionsHelper.ApplyTheme(this);

pictureBox1.BackColor = Options.CurrentOptions.Theme;
pictureBox1.BackColor = OptionsHelper.CurrentOptions.Theme;
}

private void About_Load(object sender, EventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions Optimizer/Forms/FileUnlockForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ public FileUnlockForm()
{
InitializeComponent();
CheckForIllegalCrossThreadCalls = false;
Options.ApplyTheme(this);
OptionsHelper.ApplyTheme(this);

radioFile.Text = Options.TranslationList["radioFile"].ToString();
btnKill.Text = Options.TranslationList["btnKill"].ToString();
radioFile.Text = OptionsHelper.TranslationList["radioFile"].ToString();
btnKill.Text = OptionsHelper.TranslationList["btnKill"].ToString();
}

private void FileUnlockForm_Load(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit 3131d1a

Please sign in to comment.