Skip to content

Commit 8bd0727

Browse files
committed
v1.4.0
Splash screen added. Cache feature added for Discord Images. [Bugfix] Fast game restarting memory crash fixed.
1 parent 1c586d7 commit 8bd0727

File tree

90 files changed

+13727
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+13727
-119
lines changed

.vs/SF-Client/v16/.suo

25.5 KB
Binary file not shown.

SF-Client/FlashPlayer.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ private void FlashPlayer_Load(object sender, EventArgs e)
2727

2828
private void RestartFlashPlayer()
2929
{
30-
//try
31-
//{
30+
try
31+
{
3232
this.Controls.Remove(axShockwaveFlash1);
3333
axShockwaveFlash1.Dispose();
3434
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlashPlayer));
@@ -40,8 +40,7 @@ private void RestartFlashPlayer()
4040
this.axShockwaveFlash1.Location = new System.Drawing.Point(0, 0);
4141
this.axShockwaveFlash1.Margin = new Padding(10);
4242
this.axShockwaveFlash1.Name = "axShockwaveFlash1";
43-
//this.axShockwaveFlash1.OcxState = ((AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState")));
44-
this.axShockwaveFlash1.OcxState = new AxHost.State(new MemoryStream(1024 * 1024), 2, true, "");
43+
this.axShockwaveFlash1.OcxState = ((AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState")));
4544
this.axShockwaveFlash1.CtlScale = "ShowAll";
4645
this.axShockwaveFlash1.DeviceFont = true;
4746
this.axShockwaveFlash1.WMode = "cpu";
@@ -57,18 +56,18 @@ private void RestartFlashPlayer()
5756
this.axShockwaveFlash1.FlashVars = FlashVariables;
5857
this.axShockwaveFlash1.LoadMovie(0, SwfClient);
5958
this.axShockwaveFlash1.GotoFrame(0);
60-
//}
61-
//catch (Exception ex)
62-
//{
63-
// MessageBox.Show(ex.Message);
64-
//}
59+
}
60+
catch (Exception ex)
61+
{
62+
MessageBox.Show(ex.Message);
63+
}
6564
}
6665

6766
private void axShockwaveFlash1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
6867
{
6968
if (e.KeyData == Keys.F5)
7069
{
71-
if (MessageBox.Show("Do you want to restart flash player ?","Confirmation",MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.Yes)
70+
if (MessageBox.Show("Do you want to restart flash player ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
7271
{
7372
RestartFlashPlayer();
7473
}

SF-Client/Main.cs

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
using MetroFramework.Forms;
22
using DiscordRpcNet;
3-
using Newtonsoft.Json;
43
using System;
54
using System.Diagnostics;
65
using System.Windows.Forms;
7-
using System.Drawing;
8-
using System.Net.Http;
9-
using System.Net.Http.Headers;
10-
using System.Net;
11-
using System.IO;
126
using SF_Client.DiscordRPC;
13-
using SF_Client.DiscordRPC.APIDatas;
14-
using System.Collections.Generic;
157

168
namespace SF_Client
179
{
@@ -20,36 +12,13 @@ public partial class Main : MetroForm
2012
public Main()
2113
{
2214
InitializeComponent();
23-
LoadRPCImages();
15+
new SplashScreen().ShowDialog();
2416
language.SelectedIndex = 0;
2517
Main.CheckForIllegalCrossThreadCalls = false;
2618
}
2719

2820
private string Username { get; set; }
2921

30-
private void LoadRPCImages()
31-
{
32-
using (HttpClient _ = new HttpClient())
33-
{
34-
_.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
35-
HttpResponseMessage message = _.GetAsync("https://discord.com/api/v6/oauth2/applications/738137354589437972/assets").Result;
36-
message.EnsureSuccessStatusCode();
37-
string ResponseBody = message.Content.ReadAsStringAsync().Result;
38-
39-
Root DeserializedData = JsonConvert.DeserializeObject<Root>(ResponseBody.Replace("[", "{ Main : [").Replace("]", "]}"));
40-
41-
for (int i = 0; i < DeserializedData.Main.Count; i++)
42-
{
43-
using (WebClient webClient = new WebClient())
44-
{
45-
byte[] data = webClient.DownloadData($"https://cdn.discordapp.com/app-assets/738137354589437972/{DeserializedData.Main[i].id}.png");
46-
MemoryStream ms = new MemoryStream(data);
47-
Images.ImageList.Add(DeserializedData.Main[i].name, (Bitmap)Image.FromStream(ms));
48-
}
49-
}
50-
}
51-
}
52-
5322
private void Discord_Click(object sender, EventArgs e)
5423
{
5524
Process.Start("https://discord.gg/vkYs2Xx");
@@ -149,6 +118,8 @@ private void Main_FormClosing(object sender, FormClosingEventArgs e)
149118
Properties.Settings.Default.Save();
150119

151120
DiscordRpc.Shutdown();
121+
122+
Application.Exit();
152123
}
153124

154125
private void Main_Load(object sender, EventArgs e)
@@ -171,6 +142,7 @@ void UpdatePresence()
171142
presence.details = DiscordRPC_Description.Text;
172143
presence.largeImageKey = Properties.Settings.Default.DiscordRPC_Image;
173144
presence.largeImageText = "Seafight";
145+
presence.startTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
174146
DiscordRpc.UpdatePresence(ref presence);
175147
}
176148
else

SF-Client/Properties/Resources.Designer.cs

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

SF-Client/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,7 @@
121121
<data name="discord" type="System.Resources.ResXFileRef, System.Windows.Forms">
122122
<value>..\Resources\discord.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
123123
</data>
124+
<data name="Deathbull_Logo1" type="System.Resources.ResXFileRef, System.Windows.Forms">
125+
<value>..\Resources\Deathbull_Logo.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126+
</data>
124127
</root>
25.4 KB
Loading

SF-Client/SF-Client.csproj

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
</PropertyGroup>
2020
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2121
<PlatformTarget>AnyCPU</PlatformTarget>
22-
<DebugSymbols>true</DebugSymbols>
23-
<DebugType>full</DebugType>
22+
<DebugSymbols>false</DebugSymbols>
23+
<DebugType>none</DebugType>
2424
<Optimize>false</Optimize>
2525
<OutputPath>bin\Debug\</OutputPath>
2626
<DefineConstants>DEBUG;TRACE</DefineConstants>
2727
<ErrorReport>prompt</ErrorReport>
2828
<WarningLevel>0</WarningLevel>
29-
<Prefer32Bit>false</Prefer32Bit>
29+
<Prefer32Bit>true</Prefer32Bit>
3030
</PropertyGroup>
3131
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3232
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -58,7 +58,7 @@
5858
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
5959
<OutputPath>bin\x86\Release\</OutputPath>
6060
<DefineConstants>TRACE</DefineConstants>
61-
<Optimize>true</Optimize>
61+
<Optimize>false</Optimize>
6262
<DebugType>none</DebugType>
6363
<PlatformTarget>x86</PlatformTarget>
6464
<LangVersion>7.3</LangVersion>
@@ -67,9 +67,8 @@
6767
<Prefer32Bit>true</Prefer32Bit>
6868
</PropertyGroup>
6969
<ItemGroup>
70-
<Reference Include="AxInterop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
71-
<SpecificVersion>False</SpecificVersion>
72-
<HintPath>bin\Debug\AxInterop.ShockwaveFlashObjects.dll</HintPath>
70+
<Reference Include="AxInterop.ShockwaveFlashObjects">
71+
<HintPath>bin\x86\Release\AxInterop.ShockwaveFlashObjects.dll</HintPath>
7372
</Reference>
7473
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
7574
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
@@ -78,10 +77,9 @@
7877
<SpecificVersion>False</SpecificVersion>
7978
<HintPath>bin\Release\DiscordRpcNet.dll</HintPath>
8079
</Reference>
81-
<Reference Include="Interop.ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
82-
<SpecificVersion>False</SpecificVersion>
80+
<Reference Include="Interop.ShockwaveFlashObjects">
81+
<HintPath>bin\x86\Release\Interop.ShockwaveFlashObjects.dll</HintPath>
8382
<EmbedInteropTypes>True</EmbedInteropTypes>
84-
<HintPath>bin\Debug\Interop.ShockwaveFlashObjects.dll</HintPath>
8583
</Reference>
8684
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
8785
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
@@ -139,6 +137,12 @@
139137
<Compile Include="SelectImage.Designer.cs">
140138
<DependentUpon>SelectImage.cs</DependentUpon>
141139
</Compile>
140+
<Compile Include="SplashScreen.cs">
141+
<SubType>Form</SubType>
142+
</Compile>
143+
<Compile Include="SplashScreen.Designer.cs">
144+
<DependentUpon>SplashScreen.cs</DependentUpon>
145+
</Compile>
142146
<Compile Include="Tools.cs" />
143147
<EmbeddedResource Include="FlashPlayer.resx">
144148
<DependentUpon>FlashPlayer.cs</DependentUpon>
@@ -155,6 +159,9 @@
155159
<EmbeddedResource Include="SelectImage.resx">
156160
<DependentUpon>SelectImage.cs</DependentUpon>
157161
</EmbeddedResource>
162+
<EmbeddedResource Include="SplashScreen.resx">
163+
<DependentUpon>SplashScreen.cs</DependentUpon>
164+
</EmbeddedResource>
158165
<None Include="packages.config" />
159166
<None Include="Properties\Settings.settings">
160167
<Generator>SettingsSingleFileGenerator</Generator>
@@ -174,6 +181,7 @@
174181
</ItemGroup>
175182
<ItemGroup>
176183
<Content Include="Deathbull.ico" />
184+
<None Include="Resources\Deathbull_Logo.jpg" />
177185
</ItemGroup>
178186
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
179187
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

SF-Client/SplashScreen.Designer.cs

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

SF-Client/SplashScreen.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Threading;
2+
using System.Threading.Tasks;
3+
using System.Windows.Forms;
4+
5+
namespace SF_Client
6+
{
7+
public partial class SplashScreen : Form
8+
{
9+
public SplashScreen()
10+
{
11+
InitializeComponent();
12+
}
13+
14+
protected override CreateParams CreateParams
15+
{
16+
get
17+
{
18+
CreateParams handleparam = base.CreateParams;
19+
handleparam.ExStyle |= 0x02000000;
20+
return handleparam;
21+
}
22+
}
23+
24+
private async void SplashScreen_Load(object sender, System.EventArgs e)
25+
{
26+
this.Show();
27+
Description.Text = "Downloading avatars for Discord";
28+
Tools.LoadRPCImages();
29+
Description.Text = "Finished";
30+
this.Close();
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)