Skip to content

Commit 263e1cc

Browse files
committed
Bump version number. Close #5
1 parent 63bdf9d commit 263e1cc

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

NX_Game_Info/Common.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Common
2929
public static readonly string LOG_FILE = "debug.log";
3030

3131
public static readonly string USER_SETTINGS = "user.settings";
32-
public static readonly int CACHE_SIZE = 10;
32+
public static readonly int HISTORY_SIZE = 10;
3333

3434
public static readonly string PROD_KEYS = "prod.keys";
3535
public static readonly string TITLE_KEYS = "title.keys";
@@ -88,7 +88,7 @@ public Size WindowSize
8888
public static Settings Default = (Settings)Synchronized(new Settings());
8989
}
9090

91-
public class Cache : ApplicationSettingsBase
91+
public class History : ApplicationSettingsBase
9292
{
9393
[UserScopedSetting()]
9494
[DefaultSettingValue("")]
@@ -99,7 +99,7 @@ public List<List<Title>> Titles
9999
set { this["Titles"] = value; }
100100
}
101101

102-
public static Cache Default = (Cache)Synchronized(new Cache());
102+
public static History Default = (History)Synchronized(new History());
103103
}
104104

105105
[Serializable]

NX_Game_Info/Process.cs

+24
Original file line numberDiff line numberDiff line change
@@ -985,5 +985,29 @@ private static void processTik(IStorage tik, byte[] rightsId, ref Keyset keyset)
985985
keyset.TitleKeys[rightsId] = titleKey;
986986
}
987987
}
988+
989+
public static List<Title> processHistory()
990+
{
991+
List<Title> titles = Common.History.Default.Titles.LastOrDefault()?.ToList() ?? new List<Title>();
992+
993+
foreach (var title in titles)
994+
{
995+
string titleID = title.type == TitleType.AddOnContent ? title.titleID : title.titleIDApplication;
996+
997+
if (latestVersions.TryGetValue(titleID, out uint version))
998+
{
999+
if (title.version > version)
1000+
{
1001+
latestVersions[titleID] = title.version;
1002+
}
1003+
}
1004+
else
1005+
{
1006+
latestVersions.Add(titleID, title.version);
1007+
}
1008+
}
1009+
1010+
return titles;
1011+
}
9881012
}
9891013
}

Windows/Main.cs

+14-29
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
using System.Runtime.InteropServices;
99
using System.Windows.Forms;
1010
using Application = System.Windows.Forms.Application;
11+
using Bluegrams.Application;
1112
using BrightIdeasSoftware;
1213
using LibHac;
1314
using FsTitle = LibHac.Title;
1415
using Title = NX_Game_Info.Common.Title;
15-
using Bluegrams.Application;
1616

1717
#pragma warning disable IDE1006 // Naming rule violation: These words must begin with upper case characters
1818

@@ -39,10 +39,10 @@ public Main()
3939

4040
PortableSettingsProvider.SettingsFileName = Common.USER_SETTINGS;
4141
PortableSettingsProviderBase.SettingsDirectory = Process.path_prefix;
42-
PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.Cache.Default);
42+
PortableSettingsProvider.ApplyProvider(Common.Settings.Default, Common.History.Default);
4343

4444
Common.Settings.Default.Upgrade();
45-
Common.Cache.Default.Upgrade();
45+
Common.History.Default.Upgrade();
4646

4747
debugLogToolStripMenuItem.Checked = Common.Settings.Default.DebugLog;
4848

@@ -60,26 +60,11 @@ public Main()
6060
Environment.Exit(-1);
6161
}
6262

63-
titles = Common.Cache.Default.Titles.LastOrDefault()?.ToList() ?? titles;
64-
65-
foreach (var title in titles)
66-
{
67-
string titleID = title.type == TitleType.AddOnContent ? title.titleID : title.titleIDApplication;
68-
69-
if (Process.latestVersions.TryGetValue(titleID, out uint version))
70-
{
71-
if (title.version > version)
72-
{
73-
Process.latestVersions[titleID] = title.version;
74-
}
75-
}
76-
else
77-
{
78-
Process.latestVersions.Add(titleID, title.version);
79-
}
80-
}
63+
titles = Process.processHistory();
8164

8265
reloadData();
66+
67+
toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
8368
}
8469

8570
public void reloadData()
@@ -355,12 +340,12 @@ private void updateVersionListToolStripMenuItem_Click(object sender, EventArgs e
355340
{
356341
reloadData();
357342

358-
Common.Cache.Default.Titles.Add(titles.ToList());
359-
if (Common.Cache.Default.Titles.Count > Common.CACHE_SIZE)
343+
Common.History.Default.Titles.Add(titles.ToList());
344+
if (Common.History.Default.Titles.Count > Common.HISTORY_SIZE)
360345
{
361-
Common.Cache.Default.Titles.RemoveRange(0, Common.Cache.Default.Titles.Count - Common.CACHE_SIZE);
346+
Common.History.Default.Titles.RemoveRange(0, Common.History.Default.Titles.Count - Common.HISTORY_SIZE);
362347
}
363-
Common.Cache.Default.Save();
348+
Common.History.Default.Save();
364349
}
365350

366351
Process.log?.WriteLine("\n{0} titles have updated version", count);
@@ -550,12 +535,12 @@ private void backgroundWorkerProcess_RunWorkerCompleted(object sender, System.Co
550535
{
551536
reloadData();
552537

553-
Common.Cache.Default.Titles.Add(titles.ToList());
554-
if (Common.Cache.Default.Titles.Count > Common.CACHE_SIZE)
538+
Common.History.Default.Titles.Add(titles.ToList());
539+
if (Common.History.Default.Titles.Count > Common.HISTORY_SIZE)
555540
{
556-
Common.Cache.Default.Titles.RemoveRange(0, Common.Cache.Default.Titles.Count - Common.CACHE_SIZE);
541+
Common.History.Default.Titles.RemoveRange(0, Common.History.Default.Titles.Count - Common.HISTORY_SIZE);
557542
}
558-
Common.Cache.Default.Save();
543+
Common.History.Default.Save();
559544

560545
toolStripStatusLabel.Text = String.Format("{0} files", titles.Count);
561546

Windows/Properties/AssemblyInfo.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
//
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("0.4.*")]
35-
[assembly: AssemblyVersion("0.4.2.0")]
36-
[assembly: AssemblyFileVersion("0.4.2.0")]
34+
// [assembly: AssemblyVersion("0.5.*")]
35+
[assembly: AssemblyVersion("0.5.0.0")]
36+
[assembly: AssemblyFileVersion("0.5.0.0")]

macOS/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>CFBundleIdentifier</key>
88
<string>com.garoxas.NX_Game_Info</string>
99
<key>CFBundleShortVersionString</key>
10-
<string>0.4.2</string>
10+
<string>0.5</string>
1111
<key>CFBundleVersion</key>
1212
<string>10</string>
1313
<key>LSMinimumSystemVersion</key>

0 commit comments

Comments
 (0)