Skip to content

Commit 2b4b22d

Browse files
committed
Initial Commit
1 parent f8431ae commit 2b4b22d

6 files changed

Lines changed: 35 additions & 30 deletions

File tree

Controls/CRNewsPanel.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ private async Task<NewsStorage> ParseLink(NewsStorage newsStorage)
7474

7575
if (!String.IsNullOrEmpty(pageBody))
7676
{
77-
Match titleMatch = Regex.Match(pageBody, "page-title\">(.*)<", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
78-
Match calendarMatch = Regex.Match(pageBody, "fa fa-calendar\"><\\/i> (.*)", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
79-
Match userMatch = Regex.Match(pageBody, "fa fa-user\"><\\/i>(.*) ", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
80-
Match categoryMatch = Regex.Match(pageBody, "category tag\">(.*)<", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
77+
Match titleMatch = Regex.Match(pageBody, "page-title\">(.*)<", RegexOptions.RightToLeft);
78+
Match calendarMatch = Regex.Match(pageBody, "fa fa-calendar\"><\\/i> (.*)",RegexOptions.RightToLeft);
79+
Match userMatch = Regex.Match(pageBody, "fa fa-user\"><\\/i>(.*) ", RegexOptions.RightToLeft);
80+
Match categoryMatch = Regex.Match(pageBody, "category tag\">(.*)<", RegexOptions.RightToLeft);
8181

8282
if (titleMatch.Success && titleMatch.Groups[1].Success)
8383
{
@@ -117,24 +117,24 @@ private async Task<NewsStorage> ParseLink(NewsStorage newsStorage)
117117

118118
if (String.IsNullOrEmpty(newsStorage.ThumbnailUrl))
119119
{
120-
Match thumbnailMatchOne = Regex.Match(pageBody, "\" src=\"(.*)\" class=\"attachment", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
120+
Match thumbnailMatchOne = Regex.Match(pageBody, "\" src=\"(.*)\" class=\"attachment", RegexOptions.RightToLeft);
121121

122-
if (thumbnailMatchOne.Success && thumbnailMatchOne.Groups[1].Success)
122+
if (pageBody.Contains("blog-video-player")) // This usually happens when there is a video link instead of a thumbnail.
123123
{
124-
newsStorage.ThumbnailUrl = thumbnailMatchOne.Groups[1].Value;
125-
}
126-
else if (pageBody.Contains("blog-video-player")) // This usually happens when there is a video link instead of a thumbnail.
127-
{
128-
Match thumbnailMatchAlt = Regex.Match(pageBody, "<img src=\"(.*)\" alt=\"[^article]", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
124+
Match thumbnailMatchAlt = Regex.Match(pageBody, "<img src=\"(.*)\" data-id", RegexOptions.RightToLeft);
129125

130126
if (thumbnailMatchAlt.Success && thumbnailMatchAlt.Groups[1].Success)
131127
{
132128
newsStorage.ThumbnailUrl = thumbnailMatchAlt.Groups[1].Value;
133129
}
134130
}
131+
else if (thumbnailMatchOne.Success && thumbnailMatchOne.Groups[1].Success)
132+
{
133+
newsStorage.ThumbnailUrl = thumbnailMatchOne.Groups[1].Value;
134+
}
135135
else if (newsStorage.Category.ToLower().Contains("community")) // This usually happens with community spotlights.
136136
{
137-
Match thumbnailMatchAlt = Regex.Match(pageBody, "<p dir=\"ltr\"><img src=\"(.*)\" data-id=\"", RegexOptions.IgnoreCase | RegexOptions.RightToLeft);
137+
Match thumbnailMatchAlt = Regex.Match(pageBody, "<p dir=\"ltr\"><img src=\"(.*)\" data-id=\"", RegexOptions.RightToLeft);
138138

139139
if (thumbnailMatchAlt.Success && thumbnailMatchAlt.Groups[1].Success)
140140
{

Forms/MainFrm.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ private void StorageToInterface()
745745
{
746746
if (Storage.CheckInitialized())
747747
{
748-
LauncherVersionText.Text = "v" + Assembly.GetVersion();
749-
ModuleVersionText.Text = "v" + Storage.GetModuleVersion();
748+
LauncherVersionText.Text = Assembly.GetVersion();
749+
ModuleVersionText.Text = Storage.GetModuleVersion();
750750
PsyonixVersionText.Text = Storage.GetPsyonixVersion();
751751
NetBuildText.Text = Storage.GetNetBuild().ToString();
752752
PlatformText.Text = Storage.GetPlatformString(false);
@@ -779,6 +779,7 @@ private async Task<bool> CheckForUpdates(bool bInvalidate)
779779
{
780780
if (!Configuration.OfflineMode.GetBoolValue() || bInvalidate)
781781
{
782+
Logger.Write("Checking for updates...");
782783
UpdateCtrl.Status = CRUpdatePanel.StatusTypes.TYPE_CHECKING;
783784

784785
if (await Retrievers.CheckInitialized())
@@ -860,6 +861,11 @@ private async Task<bool> CheckForUpdates(bool bInvalidate)
860861
ProcessTmr.Start();
861862
}
862863
}
864+
else
865+
{
866+
Logger.Write("No updates found!");
867+
UpdateCtrl.Status = CRUpdatePanel.StatusTypes.TYPE_UPDATED;
868+
}
863869
}
864870
}
865871
else

Framework/Logger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private async static void CreateLogFile()
4545

4646
if (modPath.Exists())
4747
{
48-
LogFile.Set(modPath / "Injector.log");
48+
LogFile.Set(modPath / "Launcher.log");
4949

5050
if (!LogFile.Exists())
5151
{

Framework/Retrievers.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static class Retrievers
100100
{
101101
new InternalSetting("000000.000000.000000", "PsyonixVersion"),
102102
new InternalSetting("0.0.0", "LauncherVersion"),
103-
new InternalSetting("0.0f", "ModuleVersion"),
103+
new InternalSetting("0.0.0", "ModuleVersion"),
104104
new InternalSetting(null, "UninstallerUrl"),
105105
new InternalSetting(null, "LauncherUrl"),
106106
new InternalSetting(null, "DropperUrl"),
@@ -140,6 +140,7 @@ private static async Task<bool> DownloadRemote()
140140
if (mappedBody.ContainsKey(RemoteSettings[i].Name))
141141
{
142142
RemoteSettings[i].SetValue(mappedBody[RemoteSettings[i].Name]);
143+
Logger.Write("Retrieved remote value: " + RemoteSettings[i].GetStringValue());
143144
}
144145
}
145146

@@ -180,7 +181,7 @@ public static async Task<string> GetPsyonixVersion()
180181
return GetStoredSetting("PsyonixVersion").GetStringValue(true);
181182
}
182183

183-
// The first six numbers in the Psyonix version string is actually a date timestamp.
184+
// The first twelve numbers in the Psyonix version string is a date timestamp, with the remaining six being the perforce changelist.
184185
// First two numbers are the year, second two are the month, and last two are the day.
185186
public static async Task<UInt32> GetPsyonixDate()
186187
{
@@ -198,22 +199,16 @@ public static async Task<UInt32> GetPsyonixDate()
198199
return 0;
199200
}
200201

201-
public static async Task<float> GetInstallerVersion()
202-
{
203-
if (await CheckInitialized()) { return GetStoredSetting("InstallerVersion").GetFloatValue(); }
204-
return GetStoredSetting("InstallerVersion").GetFloatValue(true);
205-
}
206-
207202
public static async Task<string> GetLauncherVersion()
208203
{
209204
if (await CheckInitialized()) { return GetStoredSetting("LauncherVersion").GetStringValue(); }
210205
return GetStoredSetting("LauncherVersion").GetStringValue(true);
211206
}
212207

213-
public static async Task<float> GetModuleVersion()
208+
public static async Task<string> GetModuleVersion()
214209
{
215-
if (await CheckInitialized()) { return GetStoredSetting("ModuleVersion").GetFloatValue(); }
216-
return GetStoredSetting("ModuleVersion").GetFloatValue(true);
210+
if (await CheckInitialized()) { return GetStoredSetting("ModuleVersion").GetStringValue(); }
211+
return GetStoredSetting("ModuleVersion").GetStringValue(true);
217212
}
218213

219214
public static async Task<string> GetUninstallerUrl()

Framework/Storage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class Storage
2929
private static PrivateSetting CurrentPlatform = new PrivateSetting(PlatformTypes.TYPE_UNKNOWN.ToString());
3030
private static PrivateSetting PsyonixVersion = new PrivateSetting("000000.000000.000000");
3131
private static PrivateSetting NetBuild = new PrivateSetting("0");
32-
private static PrivateSetting ModuleVersion = new PrivateSetting("0.0f");
32+
private static PrivateSetting ModuleVersion = new PrivateSetting("0.0.0");
3333

3434
public static void Invalidate(bool bForceReset = false)
3535
{
@@ -380,10 +380,10 @@ public static Int32 GetNetBuild()
380380
return NetBuild.GetInt32Value(true);
381381
}
382382

383-
public static float GetModuleVersion()
383+
public static string GetModuleVersion()
384384
{
385-
if (CheckInitialized()) { return ModuleVersion.GetFloatValue(); }
386-
return ModuleVersion.GetFloatValue(true);
385+
if (CheckInitialized()) { return ModuleVersion.GetStringValue(); }
386+
return ModuleVersion.GetStringValue(true);
387387
}
388388
}
389389
}

Framework/Updator.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ public static async Task<bool> IsModuleOutdated(bool bInvalidate)
3838
{
3939
if (Storage.GetModuleVersion() != await Retrievers.GetModuleVersion())
4040
{
41+
Logger.Write("Module detected as outdated!");
4142
Status |= UpdatorStatus.STATUS_MODULE;
4243
return true;
4344
}
4445
}
4546

47+
Logger.Write("Module is up to date!");
4648
Status &= ~UpdatorStatus.STATUS_MODULE;
4749
return false;
4850
}
@@ -59,11 +61,13 @@ public static async Task<bool> IsLauncherOutdated(bool bInvalidate)
5961
{
6062
if (Assembly.GetVersion() != await Retrievers.GetLauncherVersion())
6163
{
64+
Logger.Write("Launcher detected as outdated!");
6265
Status |= UpdatorStatus.STATUS_LAUNCHER;
6366
return true;
6467
}
6568
}
6669

70+
Logger.Write("Launcher is up to date!");
6771
Status &= ~UpdatorStatus.STATUS_LAUNCHER;
6872
return false;
6973
}

0 commit comments

Comments
 (0)