Skip to content

Commit 0c87b85

Browse files
committedJun 15, 2023
+ Remember last selected category per profile
* Other small fixes
1 parent 3fb308c commit 0c87b85

14 files changed

+36
-16
lines changed
 

‎Hg.SaveHistory.sln

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.28803.352
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.6.33723.286
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hg.SaveHistory", "Hg.SaveHistory\Hg.SaveHistory.csproj", "{FEA44985-2A16-4626-87DD-CF9C5E27A686}"
77
ProjectSection(ProjectDependencies) = postProject
@@ -12,6 +12,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hash", "Hash\Hash.csproj",
1212
EndProject
1313
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{B8FCD930-CBF4-4330-A06A-0ED5C6DE090E}"
1414
EndProject
15+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Info", "Info", "{3506CE02-ED35-440B-BA0F-8CA22F4ED2DC}"
16+
ProjectSection(SolutionItems) = preProject
17+
LICENSE = LICENSE
18+
README.md = README.md
19+
EndProjectSection
20+
EndProject
1521
Global
1622
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1723
Debug|Any CPU = Debug|Any CPU

‎Hg.SaveHistory/Forms/FormMain.cs

+15-13
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,9 @@ internal void RefreshSnapshotsListView(ListView listView, EngineSnapshotStatus s
458458

459459
listView.Items.Clear();
460460

461-
foreach (var snapshot in _luaManager.ActiveEngine.Snapshots)
461+
foreach (var snapshot in _luaManager.ActiveEngine.Snapshots.Where(snapshot =>
462+
category == null || category.Id == 0 || snapshot.CategoryId == category.Id))
462463
{
463-
if (category != null && category.Id != 0 && snapshot.CategoryId != category.Id)
464-
{
465-
continue;
466-
}
467-
468464
var listViewItem = new ListViewItem();
469465
bool first = true;
470466

@@ -1214,7 +1210,6 @@ private void CleanSnapshots()
12141210
}
12151211

12161212
SetProgressBarVisibility(true);
1217-
Thread.Sleep(100);
12181213

12191214
// Oldest first
12201215
var comparer = GetSnapshotComparer("SavedAt", SortOrder.Ascending);
@@ -1234,9 +1229,6 @@ private void CleanSnapshots()
12341229
EngineSnapshotStatus.Nuked);
12351230

12361231
SetProgressBarVisibility(false);
1237-
Thread.Sleep(100);
1238-
1239-
SortSnapshots();
12401232
}
12411233

12421234
private void CleanupSnapshotsCore(SettingsAutoCleanupBackup settings, EngineSnapshotStatus statusLookup,
@@ -1508,6 +1500,11 @@ private void closeProfileToolStripMenuItem_Click(object sender, EventArgs e)
15081500

15091501
private void comboBoxCategories_SelectionChangeCommitted(object sender, EventArgs e)
15101502
{
1503+
if (comboBoxCategories.SelectedItem is EngineSnapshotCategory selection)
1504+
{
1505+
_activeProfileFile.LastSelectedCategory = selection.Id;
1506+
}
1507+
15111508
RefreshSnapshotLists();
15121509
}
15131510

@@ -2674,6 +2671,10 @@ private void RefreshCategories()
26742671
id = selection.Id;
26752672
selection = null;
26762673
}
2674+
else if (_activeProfileFile.LastSelectedCategory != -1)
2675+
{
2676+
id = _activeProfileFile.LastSelectedCategory;
2677+
}
26772678

26782679
comboBoxCategories.Items.Clear();
26792680
foreach (var category in _luaManager.ActiveEngine.Categories)
@@ -2706,6 +2707,7 @@ private void RefreshCategories()
27062707
if (category != null && comboBoxCategories.Items.Contains(category))
27072708
{
27082709
comboBoxCategories.SelectedItem = category;
2710+
_activeProfileFile.LastSelectedCategory = category.Id;
27092711
}
27102712
}
27112713

@@ -2828,7 +2830,7 @@ private void RefreshSnapshotLists()
28282830
int archived = 0;
28292831
int deleted = 0;
28302832

2831-
foreach (var snapshot in _activeProfileFile.Snapshots.Where(snapshot =>
2833+
foreach (var snapshot in _luaManager.ActiveEngine.Snapshots.Where(snapshot =>
28322834
category == null || category.Id == 0 || snapshot.CategoryId == category.Id))
28332835
{
28342836
switch (snapshot.Status)
@@ -2992,8 +2994,8 @@ private void SetProgressBarVisibility(bool visible)
29922994
{
29932995
Invoke(new Action(() => { SetProgressBarVisibility(visible); }));
29942996
}
2995-
2996-
toolStripProgressBar.Visible = visible;
2997+
else
2998+
toolStripProgressBar.Visible = visible;
29972999
}
29983000

29993001
private void SetSnapshotInfo(EngineSnapshot snapshot)

‎Hg.SaveHistory/Forms/FormMain.resx

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
141141
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
142142
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA+
143-
SQAAAk1TRnQBSQFMAgEBBAEAAbABAgGwAQIBIAEAASABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAGA
143+
SQAAAk1TRnQBSQFMAgEBBAEAAcABAgHAAQIBIAEAASABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAGA
144144
AwABQAMAAQEBAAEYBgABYP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
145145
/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AEIAIfsB1AHY
146146
AesBdAF/AcgBVwFkAb0BLQE+Aa0BLQE+Aa0BLQE+Aa0BLQE+Aa0BWwFnAb0BdgGAAckB2gHdAfAe+wP6

‎Hg.SaveHistory/Hg.SaveHistory.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@
407407
<PropertyGroup>
408408
<PostBuildEvent>copy /Y "$(SolutionDir)LICENSE" "$(TargetDir)"
409409
copy /Y "$(SolutionDir)README.md" "$(TargetDir)"
410+
del /q "$(TargetDir)\$(ProjectName).log"
410411
rmdir /s /q "$(TargetDir)\de"
411412
rmdir /s /q "$(TargetDir)\es"
412413
rmdir /s /q "$(TargetDir)\fr"

‎Hg.SaveHistory/Types/ProfileFile.cs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public class ProfileFile
2727

2828
public bool FirstTimeRun = true;
2929

30+
public int LastSelectedCategory = -1;
31+
3032
// Display name of profile
3133
public string Name;
3234

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ Alpha testers:
168168

169169
- \+ Added Auto Cleanup Snapshots feature
170170
- \+ Added window to forget Nuked snapshots
171+
- \+ Remember last selected category per profile
171172
- \* Updated NuGet packages
172173
- \* Other small improvements
173174

‎Tests/Data/DOOM2016/Original/DOOM2016_Create.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "DOOM2016",
3131
"FilePath": "%SOURCEFOLDER%\\DOOM2016_Create.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "DOOM2016",
3435
"RootFolder": null,
3536
"Settings": [

‎Tests/Data/DOOM2016/Original/DOOM2016_Open.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "DOOM2016",
3131
"FilePath": "%SOURCEFOLDER%\\DOOM2016_Open.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "DOOM2016",
3435
"RootFolder": "%SOURCEFOLDER%",
3536
"Settings": [

‎Tests/Data/DOOMEternal/Bethesda/Original/DOOMEternal_Bethesda_Create.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "DOOMEternal",
3131
"FilePath": "%SOURCEFOLDER%\\DOOMEternal_Bethesda_Create.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "DOOMEternal_Bethesda",
3435
"RootFolder": null,
3536
"Settings": [

‎Tests/Data/DOOMEternal/Bethesda/Original/DOOMEternal_Bethesda_Open.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "DOOMEternal",
3131
"FilePath": "%SOURCEFOLDER%\\DOOMEternal_Bethesda_Open.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "DOOMEternal_Bethesda",
3435
"RootFolder": "%SOURCEFOLDER%",
3536
"Settings": [

‎Tests/Data/DOOMEternal/Steam/Original/DOOMEternal_Steam_Create.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "DOOMEternal",
3131
"FilePath": "%SOURCEFOLDER%\\DOOMEternal_Steam_Create.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "DOOMEternal_Steam",
3435
"RootFolder": null,
3536
"Settings": [

‎Tests/Data/DOOMEternal/Steam/Original/DOOMEternal_Steam_Open.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "DOOMEternal",
3131
"FilePath": "%SOURCEFOLDER%\\DOOMEternal_Steam_Open.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "DOOMEternal_Steam",
3435
"RootFolder": "%SOURCEFOLDER%",
3536
"Settings": [

‎Tests/Data/Satisfactory/Original/Satisfactory_Create.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "Satisfactory",
3131
"FilePath": "%SOURCEFOLDER%\\Satisfactory_Create.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "Satisfactory",
3435
"RootFolder": null,
3536
"Settings": [

‎Tests/Data/Satisfactory/Original/Satisfactory_Open.shp

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"EngineScriptName": "Satisfactory",
3131
"FilePath": "%SOURCEFOLDER%\\Satisfactory_Open.shp",
3232
"FirstTimeRun": true,
33+
"LastSelectedCategory": -1,
3334
"Name": "Satisfactory",
3435
"RootFolder": "%SOURCEFOLDER%",
3536
"Settings": [

0 commit comments

Comments
 (0)
Please sign in to comment.