Skip to content

Commit 9dbc683

Browse files
committed
* Added ability to change language
* Added Dutch language * Cleaned up Log classes
1 parent be434aa commit 9dbc683

24 files changed

+563
-239
lines changed

MemPlus/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<setting name="StartupMemoryClear" serializeAs="String">
121121
<value>False</value>
122122
</setting>
123+
<setting name="SelectedLanguage" serializeAs="String">
124+
<value>0</value>
125+
</setting>
123126
</MemPlus.Properties.Settings>
124127
</userSettings>
125128
</configuration>

MemPlus/App.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
StartupUri="Views/Windows/MainWindow.xaml">
5-
<Application.Resources>
6-
7-
</Application.Resources>
5+
<Application.Resources />
6+
87
</Application>

MemPlus/Business/LOG/ILogMethods.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

MemPlus/Business/LOG/Log.cs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
namespace MemPlus.Business.LOG
44
{
5-
/// <inheritdoc />
65
/// <summary>
76
/// Abstract class containing logging information
87
/// </summary>
9-
public abstract class Log : ILogMethods
8+
public abstract class Log
109
{
1110
/// <summary>
1211
/// The type of log
@@ -20,37 +19,6 @@ public abstract class Log : ILogMethods
2019
/// The data inside the Log object
2120
/// </summary>
2221
public string Data { get; set; }
23-
24-
/// <inheritdoc />
25-
/// <summary>
26-
/// Retrieve the data of the Log object
27-
/// </summary>
28-
/// <returns>The data of the Log object</returns>
29-
public DateTime GetDate()
30-
{
31-
return Time;
32-
}
33-
34-
/// <inheritdoc />
35-
/// <summary>
36-
/// Add data to the Log object
37-
/// </summary>
38-
/// <param name="data">The data that needs to be added to the log</param>
39-
public void AddData(string data)
40-
{
41-
Time = DateTime.Now;
42-
Data = data;
43-
}
44-
45-
/// <inheritdoc />
46-
/// <summary>
47-
/// Retrieve the data from the Log object
48-
/// </summary>
49-
/// <returns>The data from the Log object</returns>
50-
public string GetData()
51-
{
52-
return Data;
53-
}
5422
}
5523

5624
/// <summary>

MemPlus/Business/RAM/RamController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace MemPlus.Business.RAM
1111
{
12+
/// <inheritdoc />
1213
/// <summary>
1314
/// Sealed class containing methods and interaction logic in terms of RAM
1415
/// </summary>

MemPlus/Business/RAM/RamOptimizer.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ internal void EmptyWorkingSetFunction(List<string> processExceptions)
120120
if (processExceptions == null || processExceptions.Count == 0 || !processExceptions.Contains(process.MainModule.FileName.ToLower()))
121121
{
122122
_logController.AddLog(new RamLog("Emptying working set for process: " + process.ProcessName));
123-
// Empty the working set of the process
124123
NativeMethods.EmptyWorkingSet(process.Handle);
125124
_logController.AddLog(new RamLog("Successfully emptied working set for process " + process.ProcessName));
126125
}
@@ -145,9 +144,7 @@ internal void EmptyWorkingSetFunction(List<string> processExceptions)
145144
private bool Is64BitMode()
146145
{
147146
_logController.AddLog(new RamLog("Checking if 64 bit mode is enabled"));
148-
149147
bool is64Bit = Marshal.SizeOf(typeof(IntPtr)) == 8;
150-
151148
_logController.AddLog(is64Bit ? new RamLog("64 bit mode is enabled") : new RamLog("64 bit mode is disabled"));
152149

153150
return is64Bit;

MemPlus/Business/UTILS/Utils.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,16 @@ internal static List<RamStick> GetRamSticks()
104104
/// Export all RamStick objects
105105
/// </summary>
106106
/// <param name="logController">The LogController object that can be used to add logs</param>
107-
internal static void ExportRamSticks(LogController logController)
107+
internal static bool ExportRamSticks(LogController logController)
108108
{
109109
List<RamStick> ramSticks = GetRamSticks();
110-
if (ramSticks == null || ramSticks.Count == 0) return;
110+
if (ramSticks == null || ramSticks.Count == 0) return false;
111111

112112
SaveFileDialog sfd = new SaveFileDialog
113113
{
114114
Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
115115
};
116-
if (sfd.ShowDialog() != true) return;
116+
if (sfd.ShowDialog() != true) return false;
117117
try
118118
{
119119
// ReSharper disable once SwitchStatementMissingSomeCases
@@ -133,33 +133,36 @@ internal static void ExportRamSticks(LogController logController)
133133
RamDataExporter.ExportExcel(sfd.FileName, ramSticks);
134134
break;
135135
}
136-
MessageBox.Show("Exported all data!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
136+
137+
return true;
137138
}
138139
catch (Exception ex)
139140
{
140141
logController.AddLog(new ApplicationLog(ex.Message));
141142
MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
142143
}
144+
145+
return false;
143146
}
144147

145148
/// <summary>
146149
/// Export logs to the disk
147150
/// </summary>
148151
/// <param name="logType">The LogType that should be exported (can be null to export all logs)</param>
149152
/// <param name="logController">The LogController object that can be used to export logs</param>
150-
internal static void ExportLogs(LogType? logType, LogController logController)
153+
internal static bool ExportLogs(LogType? logType, LogController logController)
151154
{
152155
if (logType != null)
153156
{
154-
if (logController.GetLogs(logType).Count == 0) return;
157+
if (logController.GetLogs(logType).Count == 0) return false;
155158
}
156159

157160
SaveFileDialog sfd = new SaveFileDialog
158161
{
159162
Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
160163
};
161164

162-
if (sfd.ShowDialog() != true) return;
165+
if (sfd.ShowDialog() != true) return false;
163166
ExportTypes.ExportType type;
164167
switch (sfd.FilterIndex)
165168
{
@@ -180,26 +183,27 @@ internal static void ExportLogs(LogType? logType, LogController logController)
180183
try
181184
{
182185
logController.Export(sfd.FileName, logType, type);
183-
MessageBox.Show("All logs have been exported!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
186+
return true;
184187
}
185188
catch (Exception ex)
186189
{
187190
logController.AddLog(new ApplicationLog(ex.Message));
188191
MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
189192
}
193+
return false;
190194
}
191195

192196
/// <summary>
193197
/// Export all ProcessDetail objects
194198
/// </summary>
195199
/// <param name="logController">The LogController object that can be used to add logs</param>
196-
internal static async void ExportProcessDetails(LogController logController)
200+
internal static async Task<bool> ExportProcessDetails(LogController logController)
197201
{
198202
SaveFileDialog sfd = new SaveFileDialog
199203
{
200204
Filter = "Text file (*.txt)|*.txt|HTML file (*.html)|*.html|CSV file (*.csv)|*.csv|Excel file (*.csv)|*.csv"
201205
};
202-
if (sfd.ShowDialog() != true) return;
206+
if (sfd.ShowDialog() != true) return false;
203207
try
204208
{
205209
// ReSharper disable once SwitchStatementMissingSomeCases
@@ -219,13 +223,16 @@ internal static async void ExportProcessDetails(LogController logController)
219223
ProcessDetailExporter.ExportExcel(sfd.FileName, await GetProcessDetails(logController));
220224
break;
221225
}
222-
MessageBox.Show("All data has been exported!", "MemPlus", MessageBoxButton.OK, MessageBoxImage.Information);
226+
227+
return true;
223228
}
224229
catch (Exception ex)
225230
{
226231
logController.AddLog(new ApplicationLog(ex.Message));
227232
MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
228233
}
234+
235+
return false;
229236
}
230237

231238
/// <summary>

MemPlus/MemPlus.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@
105105
<Compile Include="Views\Windows\SettingsWindow.xaml.cs">
106106
<DependentUpon>SettingsWindow.xaml</DependentUpon>
107107
</Compile>
108+
<Page Include="Resources\Languages\en.xaml">
109+
<SubType>Designer</SubType>
110+
<Generator>MSBuild:Compile</Generator>
111+
</Page>
112+
<Page Include="Resources\Languages\nl.xaml">
113+
<SubType>Designer</SubType>
114+
<Generator>MSBuild:Compile</Generator>
115+
</Page>
108116
<Page Include="Views\Windows\AboutWindow.xaml">
109117
<SubType>Designer</SubType>
110118
<Generator>MSBuild:Compile</Generator>
@@ -126,7 +134,6 @@
126134
<SubType>Code</SubType>
127135
</Compile>
128136
<Compile Include="Business\LOG\ApplicationLog.cs" />
129-
<Compile Include="Business\LOG\ILogMethods.cs" />
130137
<Compile Include="Business\LOG\Log.cs" />
131138
<Compile Include="Business\LOG\LogController.cs" />
132139
<Compile Include="Business\EXPORT\LogExporter.cs" />

MemPlus/Properties/Settings.Designer.cs

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MemPlus/Properties/Settings.settings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,8 @@
114114
<Setting Name="StartupMemoryClear" Type="System.Boolean" Scope="User">
115115
<Value Profile="(Default)">False</Value>
116116
</Setting>
117+
<Setting Name="SelectedLanguage" Type="System.Int32" Scope="User">
118+
<Value Profile="(Default)">0</Value>
119+
</Setting>
117120
</Settings>
118121
</SettingsFile>

0 commit comments

Comments
 (0)