Skip to content

Commit d749101

Browse files
committed
* Simplified ExportType
* Minor class modifier changes * Extracted LogType * Added ability to view all logs * Removed unused property from ProcessDetail * Added a setting to invoke .NET GC * Fixed an issue with clearing the clipboard causing the application to crash * Some settings are now using a SettingsBinder * Removed unused control names from Windows * Removed unused translation keys * Applied NuGet packages to make cloning the repository easier
1 parent 361f0cc commit d749101

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+339
-258
lines changed

MemPlus/App.config

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<value>True</value>
8181
</setting>
8282
<setting name="WindowOpacity" serializeAs="String">
83-
<value>1</value>
83+
<value>100</value>
8484
</setting>
8585
<setting name="WindowResizeBorder" serializeAs="String">
8686
<value>3</value>
@@ -141,6 +141,9 @@
141141
<setting name="DragDropClear" serializeAs="String">
142142
<value>True</value>
143143
</setting>
144+
<setting name="InvokeGarbageCollector" serializeAs="String">
145+
<value>True</value>
146+
</setting>
144147
</MemPlus.Properties.Settings>
145148
</userSettings>
146149
</configuration>

MemPlus/App.xaml.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Configuration;
4-
using System.Threading.Tasks;
5-
using System.Windows;
6-
7-
namespace MemPlus
1+
namespace MemPlus
82
{
3+
/// <inheritdoc />
94
/// <summary>
105
/// Interaction logic for App.xaml
116
/// </summary>
12-
public partial class App : Application
7+
public partial class App
138
{
9+
/// <inheritdoc />
10+
/// <summary>
11+
/// Initialize a new App
12+
/// </summary>
13+
public App()
14+
{
15+
// Enter your Syncfusion license key here
16+
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY HERE");
17+
}
1418
}
1519
}
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
namespace MemPlus.Business.EXPORT
22
{
33
/// <summary>
4-
/// Sealed class containing all different export types that MemPlus supports
4+
/// Enumeration containing all the different export types
55
/// </summary>
6-
internal sealed class ExportTypes
6+
internal enum ExportType
77
{
8-
/// <summary>
9-
/// Enumeration containing all the different export types
10-
/// </summary>
11-
internal enum ExportType
12-
{
13-
Html,
14-
Text,
15-
Csv,
16-
Excel
17-
}
8+
Html,
9+
Text,
10+
Csv,
11+
Excel
1812
}
1913
}

MemPlus/Business/GUI/GuiManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ internal static void ChangeStyle(DependencyObject o)
2424
if (!(o is ChromelessWindow window)) return;
2525
window.BorderThickness = new Thickness(Properties.Settings.Default.BorderThickness);
2626
window.CornerRadius = new CornerRadius(0, 0, 0, 0);
27-
window.Opacity = Properties.Settings.Default.WindowOpacity;
27+
window.Opacity = Properties.Settings.Default.WindowOpacity / 100;
2828
window.ResizeBorderThickness = new Thickness(Properties.Settings.Default.WindowResizeBorder);
2929
}
3030
catch (Exception ex)

MemPlus/Business/LOG/ApplicationLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace MemPlus.Business.LOG
66
/// <summary>
77
/// A class that represent a change in the application
88
/// </summary>
9-
internal class ApplicationLog : Log
9+
internal sealed class ApplicationLog : Log
1010
{
1111
/// <summary>
1212
/// Initialize a new ApplicationLog object

MemPlus/Business/LOG/Log.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace MemPlus.Business.LOG
66
/// <summary>
77
/// Abstract class containing logging information
88
/// </summary>
9-
public abstract class Log
9+
internal abstract class Log
1010
{
1111
/// <summary>
1212
/// The type of log
@@ -21,14 +21,4 @@ public abstract class Log
2121
/// </summary>
2222
public string Data { get; set; }
2323
}
24-
25-
/// <summary>
26-
/// An enumeration of all available log types
27-
/// </summary>
28-
public enum LogType
29-
{
30-
Application,
31-
Ram,
32-
Process
33-
}
3424
}

MemPlus/Business/LOG/LogController.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace MemPlus.Business.LOG
1010
{
1111
/// <inheritdoc />
1212
/// <summary>
13-
/// Class containing methods to control logs
13+
/// Internal class containing methods to control logs
1414
/// </summary>
1515
// ReSharper disable once InconsistentNaming
16-
public class LogController : IDisposable
16+
internal sealed class LogController : IDisposable
1717
{
1818
#region Variables
1919
/// <summary>
@@ -159,7 +159,8 @@ internal void SetAutoClearInterval(int clearInterval)
159159
/// <param name="saveToFile">True if logs should be saved to a file, otherwise false</param>
160160
internal void SetSaveToFile(bool saveToFile)
161161
{
162-
if (_saveToFile)
162+
if (_saveToFile == saveToFile) return;
163+
if (_saveToFile && !saveToFile)
163164
{
164165
// Make sure the contents of the log file is written before disabling this function
165166
DisposeFileResources();
@@ -169,7 +170,7 @@ internal void SetSaveToFile(bool saveToFile)
169170
{
170171
// Generate a new FileStream that allows other handles to access the file
171172
_fileStream = new FileStream(_logPath,
172-
FileMode.OpenOrCreate,
173+
FileMode.Append,
173174
FileAccess.Write,
174175
FileShare.ReadWrite);
175176
_streamWriter = new StreamWriter(_fileStream) {AutoFlush = true};
@@ -194,8 +195,8 @@ internal void SetSaveDirectory(string saveDirectory)
194195

195196
// Generate a new file path for the logs using the starting time of the LogController instance
196197
// ReSharper disable once StringLiteralTypo
197-
_logPath = saveDirectory + "memplus_" + _startTime.Year + _startTime.Month + _startTime.Day + "_" +
198-
_startTime.Hour + _startTime.Minute + _startTime.Second + ".log";
198+
_logPath = saveDirectory + "memplus_" + _startTime.Year + "-" + _startTime.Month + "-" + _startTime.Day + "_" +
199+
_startTime.Hour + "-" + _startTime.Minute + "-" + _startTime.Second + ".log";
199200
}
200201

201202
/// <summary>
@@ -251,8 +252,14 @@ internal void RemoveLog(Log l)
251252
/// Clear all Log objects that have a specific LogType
252253
/// </summary>
253254
/// <param name="logType">The LogType that Log objects need to contain in order to be removed</param>
254-
internal void ClearLogs(LogType logType)
255+
internal void ClearLogs(LogType? logType)
255256
{
257+
if (logType == null)
258+
{
259+
ClearLogs();
260+
return;
261+
}
262+
256263
List<Log> deleted = new List<Log>();
257264

258265
for (int i = _logList.Count - 1; i >= 0; i--)
@@ -302,7 +309,7 @@ internal List<Log> GetLogs(LogType? logType)
302309
/// <param name="path">The path where logs should be stored</param>
303310
/// <param name="logType">The type of logs that should be saved. Can be null if all logs should be saved</param>
304311
/// <param name="exportType">The type of export that should be performed</param>
305-
internal void Export(string path, LogType? logType, ExportTypes.ExportType exportType)
312+
internal void Export(string path, LogType? logType, ExportType exportType)
306313
{
307314
List<Log> exportList;
308315

@@ -327,16 +334,16 @@ internal void Export(string path, LogType? logType, ExportTypes.ExportType expor
327334
// ReSharper disable once SwitchStatementMissingSomeCases
328335
switch (exportType)
329336
{
330-
case ExportTypes.ExportType.Html:
337+
case ExportType.Html:
331338
LogExporter.ExportHtml(path, exportList);
332339
break;
333340
default:
334341
LogExporter.ExportTxt(path, exportList);
335342
break;
336-
case ExportTypes.ExportType.Csv:
343+
case ExportType.Csv:
337344
LogExporter.ExportCsv(path, exportList);
338345
break;
339-
case ExportTypes.ExportType.Excel:
346+
case ExportType.Excel:
340347
LogExporter.ExportExcel(path, exportList);
341348
break;
342349
}

MemPlus/Business/LOG/ProcessLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace MemPlus.Business.LOG
77
/// A class that represent a change in the ProcessAnalyzer
88
/// </summary>
99
// ReSharper disable once InconsistentNaming
10-
internal class ProcessLog : Log
10+
internal sealed class ProcessLog : Log
1111
{
1212
/// <summary>
1313
/// Initialize a new ProcessLog object

MemPlus/Business/LOG/RamLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace MemPlus.Business.LOG
66
/// <summary>
77
/// A class that represent a change in the RAM Optimizer
88
/// </summary>
9-
internal class RamLog : Log
9+
internal sealed class RamLog : Log
1010
{
1111
/// <summary>
1212
/// Initialize a new RamLog object

MemPlus/Business/PROCESS/ProcessDetail.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,5 @@ internal class ProcessDetail
2222
/// The current memory usage of the Process in MB
2323
/// </summary>
2424
public string MemoryUsage { get; set; }
25-
/// <summary>
26-
/// The current memory usage of the Process
27-
/// </summary>
28-
public long MemoryUsageLong { get; set; }
2925
}
3026
}

0 commit comments

Comments
 (0)