Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
Fix for interval not being set properly on boot, sorry folks ;) teehee
  • Loading branch information
RedDot-3ND7355 committed Dec 1, 2023
1 parent c947613 commit 0f9dc16
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
48 changes: 27 additions & 21 deletions MemoryCleaner/Form1.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
using IWshRuntimeLibrary;
using MaterialSkin;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace MemoryCleaner
{
Expand All @@ -21,6 +13,7 @@ public partial class Form1 : MaterialSkin.Controls.MaterialForm
public _MemoryCleaner MemoryCleaner = new _MemoryCleaner();
public static Form1 CurrentForm;
private bool AppStarted = false;
private bool bypass = false;

// Ini Form
public Form1()
Expand All @@ -39,6 +32,15 @@ public Form1()
SettingsHandler.ReadSettings();
// App Started Boolean
AppStarted = true;
// Set Timer if any at start
CheckForExistingTimer();
}

// Completely forgot about it, teehee. Function is pretty self explanatory.
private void CheckForExistingTimer()
{
bypass = true;
materialComboBox1_SelectedIndexChanged(this, null);
}

// Manual Clean Button
Expand All @@ -55,18 +57,21 @@ private void materialComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (AppStarted)
{
// Save Setting
SettingsHandler.SaveSettings();

// Proceed
if (materialComboBox1.SelectedItem.ToString() != "OFF")
{
int milliseconds = Int32.Parse(materialComboBox1.SelectedItem.ToString()) * 60000;
CleanerTimer.Interval = milliseconds;
CleanerTimer.Start();
}
else
CleanerTimer.Stop();
if (!bypass)
// Save Setting
SettingsHandler.SaveSettings();
else
// Reset save settings bypass
bypass = false;
// Proceed
if (materialComboBox1.SelectedItem.ToString() != "OFF")
{
int milliseconds = Int32.Parse(materialComboBox1.SelectedItem.ToString()) * 60000;
CleanerTimer.Interval = milliseconds;
CleanerTimer.Start();
}
else
CleanerTimer.Stop();
}
}

Expand All @@ -79,6 +84,7 @@ private void CleanerTimer_Tick(object sender, EventArgs e)
thread1.Start();
}

// Start MemClean Routine
private void StartClean() =>
MemoryCleaner.CleanMem(materialCheckbox2.Checked);

Expand Down Expand Up @@ -158,7 +164,7 @@ private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
// About
private void materialButton3_Click(object sender, EventArgs e)
{
MaterialSkin.Controls.MaterialMessageBox.Show($"Made by Endless (Kogaruh){Environment.NewLine}Version: 1.0{Environment.NewLine}Run as admin for best results!");
MaterialSkin.Controls.MaterialMessageBox.Show($"Made by Endless (Kogaruh){Environment.NewLine}Version: 1.1{Environment.NewLine}Run as admin for best results!");
}
}
}
3 changes: 3 additions & 0 deletions MemoryCleaner/MemoryCleaner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<PropertyGroup>
<StartupObject>MemoryCleaner.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="MaterialSkin, Version=2.3.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialSkin.2.2.3.1\lib\net48\MaterialSkin.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion MemoryCleaner/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

0 comments on commit 0f9dc16

Please sign in to comment.