Skip to content

Commit 6c082fa

Browse files
committed
v1.1.3
- Fixed the manual injection mode in the launcher sometimes not appearing. - Fixed scaling issues in the launcher on high dpi displays, also improved some custom controls. - Improved the updater popup in the launcher to indicate an update is in progress. - Improved the news tabs caching system when downloading articles.
1 parent 5cedb7c commit 6c082fa

14 files changed

Lines changed: 280 additions & 262 deletions

CodeRedLauncher.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<ApplicationIcon>Icon.ico</ApplicationIcon>
99
<StartupObject>CodeRedLauncher.Program</StartupObject>
1010
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
11+
<ApplicationManifest>app.manifest</ApplicationManifest>
1112
</PropertyGroup>
1213

1314
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

Controls/CRButton.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,15 @@ public enum ButtonStyles : byte
3434
STYLE_DARK
3535
}
3636

37+
private bool IsEnabled = true;
3738
private ButtonStyles ButtonStyle = ButtonStyles.STYLE_COLORED;
3839

40+
public bool ButtonEnabled
41+
{
42+
get { return IsEnabled; }
43+
set { IsEnabled = value; }
44+
}
45+
3946
public ButtonStyles DisplayStyle
4047
{
4148
get { return ButtonStyle; }
@@ -216,7 +223,10 @@ private void ButtonImg_Click(object sender, EventArgs e)
216223
public event EventHandler OnButtonClick;
217224
protected void CRButton_OnClick(EventArgs e)
218225
{
219-
OnButtonClick?.Invoke(this, e);
226+
if (ButtonEnabled)
227+
{
228+
OnButtonClick?.Invoke(this, e);
229+
}
220230
}
221231

222232
private void BackgroundPnl_SizeChanged(object sender, EventArgs e)

Controls/CRNewsPanel.cs

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public async void ParseArticles(string url)
180180
}
181181
}
182182

183+
LoadAllIndexes(); // Parse and download everything in the background.
183184
LoadNextArticle();
184185
}
185186
else
@@ -189,6 +190,43 @@ public async void ParseArticles(string url)
189190
}
190191
}
191192

193+
public async void LoadAllIndexes()
194+
{
195+
for (Int32 i = 0; i < NewsArticles.Count; i++)
196+
{
197+
NewsStorage newsStorage = NewsArticles[i];
198+
199+
if (!newsStorage.Parsed)
200+
{
201+
NewsArticles[i] = await ParseLink(NewsArticles[i]);
202+
newsStorage = NewsArticles[i];
203+
}
204+
205+
if (newsStorage.ThumbnailImage == null)
206+
{
207+
if (!String.IsNullOrEmpty(newsStorage.ThumbnailUrl_Main))
208+
{
209+
newsStorage.ThumbnailImage = await Downloaders.DownloadImage(newsStorage.ThumbnailUrl_Main);
210+
211+
if ((newsStorage.ThumbnailImage == null) && !String.IsNullOrEmpty(newsStorage.ThumbnailUrl_Alt))
212+
{
213+
newsStorage.ThumbnailImage = await Downloaders.DownloadImage(newsStorage.ThumbnailUrl_Alt);
214+
}
215+
216+
// If no thumbnail was found we gotta use our own image.
217+
if (newsStorage.ThumbnailImage == null)
218+
{
219+
newsStorage.ThumbnailUrl_Main = "https://i.imgur.com/dmpY0zQ.png";
220+
newsStorage.ThumbnailUrl_Alt = "";
221+
newsStorage.ThumbnailImage = await Downloaders.DownloadImage(newsStorage.ThumbnailUrl_Main);
222+
}
223+
}
224+
}
225+
226+
NewsArticles[i] = newsStorage;
227+
}
228+
}
229+
192230
private async void LoadCurrentIndex()
193231
{
194232
if (NewsArticles.Count > 0)
@@ -223,7 +261,6 @@ private async void LoadCurrentIndex()
223261
// If no thumbnail was found we gotta use our own image.
224262
if (newsStorage.ThumbnailImage == null)
225263
{
226-
// https://i.imgur.com/dmpY0zQ.png
227264
newsStorage.ThumbnailUrl_Main = "https://i.imgur.com/dmpY0zQ.png";
228265
newsStorage.ThumbnailUrl_Alt = "";
229266
newsStorage.ThumbnailImage = await Downloaders.DownloadImage(newsStorage.ThumbnailUrl_Main);
@@ -335,9 +372,12 @@ private void NextBtn_DoubleClick(object sender, EventArgs e)
335372

336373
private void ThumbnailImg_Click(object sender, EventArgs e)
337374
{
338-
if (!String.IsNullOrEmpty(NewsArticles[CurrentIndex].NewsUrl))
375+
if ((CurrentIndex > 0) && (CurrentIndex < NewsArticles.Count))
339376
{
340-
Process.Start(new ProcessStartInfo(NewsArticles[CurrentIndex].NewsUrl) { UseShellExecute = true });
377+
if (!String.IsNullOrEmpty(NewsArticles[CurrentIndex].NewsUrl))
378+
{
379+
Process.Start(new ProcessStartInfo(NewsArticles[CurrentIndex].NewsUrl) { UseShellExecute = true });
380+
}
341381
}
342382
}
343383

Controls/CRPopup.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.

Controls/CRPopup.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public enum ButtonLayouts : byte
1414

1515
private Form? InternalForm = null;
1616
private ButtonLayouts CurrentLayout = ButtonLayouts.TYPE_SINGLE;
17+
private bool AreButtonsEnabled = true;
1718

1819
public Form BoundForm
1920
{
@@ -27,6 +28,12 @@ public ButtonLayouts ButtonLayout
2728
set { CurrentLayout = value; UpdateLayout(); Invalidate(); }
2829
}
2930

31+
public bool ButtonsEnabled
32+
{
33+
get { return AreButtonsEnabled; }
34+
set { AreButtonsEnabled = value; UpdateLayout(); Invalidate(); }
35+
}
36+
3037
public string DisplayTitle
3138
{
3239
get { return TitleLbl.Text; }
@@ -87,6 +94,10 @@ private void UpdateLayout()
8794
SinglePnl.Visible = false;
8895
DoublePnl.Visible = true;
8996
}
97+
98+
SingleBtn.Enabled = ButtonsEnabled;
99+
DoubleFirstBtn.Enabled = ButtonsEnabled;
100+
DoubleSecondBtn.Enabled = ButtonsEnabled;
90101
}
91102

92103
public CRPopup()

Controls/CRTab.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
<metadata name="TintPnl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
6161
<value>True</value>
6262
</metadata>
63+
<metadata name="TabImg.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
64+
<value>True</value>
65+
</metadata>
6366
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
6467
<value>True</value>
6568
</metadata>

Controls/CRUpdatePanel.Designer.cs

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

Controls/CRUpdatePanel.resx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@
5757
<resheader name="writer">
5858
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
5959
</resheader>
60-
<metadata name="DescriptionLbl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
61-
<value>True</value>
62-
</metadata>
63-
<metadata name="TitleLbl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
64-
<value>True</value>
65-
</metadata>
66-
<metadata name="DescriptionImg.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
67-
<value>True</value>
68-
</metadata>
69-
<metadata name="TitleImg.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
70-
<value>True</value>
71-
</metadata>
7260
<metadata name="BackgroundPnl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
7361
<value>True</value>
7462
</metadata>

0 commit comments

Comments
 (0)