diff --git a/Giants.DataContract/Contracts/V1/CommunityStatus.cs b/Giants.DataContract/Contracts/V1/CommunityStatus.cs
new file mode 100644
index 0000000..667e708
--- /dev/null
+++ b/Giants.DataContract/Contracts/V1/CommunityStatus.cs
@@ -0,0 +1,9 @@
+namespace Giants.DataContract.V1
+{
+ public class CommunityStatus
+ {
+ public string CommunityAppName { get; set; }
+
+ public string CommunityAppUri { get; set; }
+ }
+}
diff --git a/Giants.DataContract/Contracts/V1/DiscordStatus.cs b/Giants.DataContract/Contracts/V1/DiscordStatus.cs
deleted file mode 100644
index 979f794..0000000
--- a/Giants.DataContract/Contracts/V1/DiscordStatus.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace Giants.DataContract.V1
-{
- public class DiscordStatus
- {
- public string DiscordUri { get; set; }
- }
-}
diff --git a/Giants.Launcher/LauncherForm.Designer.cs b/Giants.Launcher/LauncherForm.Designer.cs
index 5c358b0..695f2ac 100644
--- a/Giants.Launcher/LauncherForm.Designer.cs
+++ b/Giants.Launcher/LauncherForm.Designer.cs
@@ -34,7 +34,7 @@
this.btnPlay = new Giants.Launcher.ImageButton();
this.updateProgressBar = new System.Windows.Forms.ProgressBar();
this.txtProgress = new System.Windows.Forms.Label();
- this.DiscordLabel = new System.Windows.Forms.LinkLabel();
+ this.CommunityLabel = new System.Windows.Forms.LinkLabel();
((System.ComponentModel.ISupportInitialize)(this.btnExit)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.btnOptions)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.btnPlay)).BeginInit();
@@ -108,19 +108,21 @@
this.txtProgress.Text = "ProgressText";
this.txtProgress.Visible = false;
//
- // DiscordLabel
+ // CommunityLabel
//
- this.DiscordLabel.AutoSize = true;
- this.DiscordLabel.BackColor = System.Drawing.Color.Transparent;
- this.DiscordLabel.LinkColor = System.Drawing.Color.Aquamarine;
- this.DiscordLabel.Location = new System.Drawing.Point(12, 9);
- this.DiscordLabel.Name = "DiscordLabel";
- this.DiscordLabel.Size = new System.Drawing.Size(69, 13);
- this.DiscordLabel.TabIndex = 12;
- this.DiscordLabel.TabStop = true;
- this.DiscordLabel.Text = "DiscordLabel";
- this.DiscordLabel.Visible = false;
- this.DiscordLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DiscordLabel_LinkClicked);
+ this.CommunityLabel.ActiveLinkColor = System.Drawing.Color.DodgerBlue;
+ this.CommunityLabel.AutoSize = true;
+ this.CommunityLabel.BackColor = System.Drawing.Color.Transparent;
+ this.CommunityLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.CommunityLabel.LinkColor = System.Drawing.Color.DodgerBlue;
+ this.CommunityLabel.Location = new System.Drawing.Point(12, 9);
+ this.CommunityLabel.Name = "CommunityLabel";
+ this.CommunityLabel.Size = new System.Drawing.Size(112, 17);
+ this.CommunityLabel.TabIndex = 12;
+ this.CommunityLabel.TabStop = true;
+ this.CommunityLabel.Text = "CommunityLabel";
+ this.CommunityLabel.Visible = false;
+ this.CommunityLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.DiscordLabel_LinkClicked);
//
// LauncherForm
//
@@ -131,7 +133,7 @@
this.CancelButton = this.btnExit;
this.ClientSize = new System.Drawing.Size(800, 500);
this.ControlBox = false;
- this.Controls.Add(this.DiscordLabel);
+ this.Controls.Add(this.CommunityLabel);
this.Controls.Add(this.txtProgress);
this.Controls.Add(this.updateProgressBar);
this.Controls.Add(this.btnExit);
@@ -161,7 +163,7 @@
private ImageButton btnExit;
private System.Windows.Forms.ProgressBar updateProgressBar;
private System.Windows.Forms.Label txtProgress;
- private System.Windows.Forms.LinkLabel DiscordLabel;
+ private System.Windows.Forms.LinkLabel CommunityLabel;
}
}
diff --git a/Giants.Launcher/LauncherForm.cs b/Giants.Launcher/LauncherForm.cs
index 440d225..14af1f0 100644
--- a/Giants.Launcher/LauncherForm.cs
+++ b/Giants.Launcher/LauncherForm.cs
@@ -24,16 +24,18 @@ namespace Giants.Launcher
private readonly HttpClient httpClient;
private readonly VersionClient versionHttpClient;
- private readonly DiscordClient discordHttpClient;
+ private readonly CommunityClient communityHttpClient;
private string commandLine = String.Empty;
private string gamePath = null;
private Updater updater;
- private string discordUri;
+ private string communityAppUri;
public LauncherForm()
{
this.InitializeComponent();
+ this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
+ this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
// Set window title
this.Text = GameName;
@@ -42,8 +44,8 @@ namespace Giants.Launcher
this.versionHttpClient = new VersionClient(this.httpClient);
this.versionHttpClient.BaseUrl = BaseUrl;
- this.discordHttpClient = new DiscordClient(this.httpClient);
- this.discordHttpClient.BaseUrl = BaseUrl;
+ this.communityHttpClient = new CommunityClient(this.httpClient);
+ this.communityHttpClient.BaseUrl = BaseUrl;
}
private void btnExit_Click(object sender, EventArgs e)
@@ -138,11 +140,11 @@ namespace Giants.Launcher
{
try
{
- var status = await this.discordHttpClient.GetDiscordStatusAsync();
+ var status = await this.communityHttpClient.GetDiscordStatusAsync();
- this.discordUri = status.DiscordUri;
- this.DiscordLabel.Text = Resources.DiscordLabel;
- this.DiscordLabel.Visible = true;
+ this.communityAppUri = status.CommunityAppUri;
+ this.CommunityLabel.Text = string.Format(Resources.CommunityLabel, status.CommunityAppName);
+ this.CommunityLabel.Visible = true;
}
catch (Exception)
{
@@ -273,19 +275,19 @@ namespace Giants.Launcher
private void DiscordLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
- if (string.IsNullOrEmpty(this.discordUri))
+ if (string.IsNullOrEmpty(this.communityAppUri))
{
return;
}
- var uri = new Uri(this.discordUri);
+ var uri = new Uri(this.communityAppUri);
if (uri.Scheme != "https")
{
// For security, reject any non-HTTPS or local file system URIs
return;
}
- Process.Start(this.discordUri);
+ Process.Start(this.communityAppUri);
}
}
}
diff --git a/Giants.Launcher/Properties/Resources.Designer.cs b/Giants.Launcher/Properties/Resources.Designer.cs
index 2c03f5c..2bdf402 100644
--- a/Giants.Launcher/Properties/Resources.Designer.cs
+++ b/Giants.Launcher/Properties/Resources.Designer.cs
@@ -80,11 +80,11 @@ namespace Giants.Launcher {
}
///
- /// Looks up a localized string similar to Join the community on Discord!.
+ /// Looks up a localized string similar to Join the community on {0}!.
///
- internal static string DiscordLabel {
+ internal static string CommunityLabel {
get {
- return ResourceManager.GetString("DiscordLabel", resourceCulture);
+ return ResourceManager.GetString("CommunityLabel", resourceCulture);
}
}
diff --git a/Giants.Launcher/Properties/Resources.resx b/Giants.Launcher/Properties/Resources.resx
index 92921b2..d36cf7f 100644
--- a/Giants.Launcher/Properties/Resources.resx
+++ b/Giants.Launcher/Properties/Resources.resx
@@ -199,7 +199,7 @@
{0} Samples
-
- Join the community on Discord!
+
+ Join the community on {0}!
\ No newline at end of file
diff --git a/Giants.Services/Core/ServicesModule.cs b/Giants.Services/Core/ServicesModule.cs
index d438030..4800364 100644
--- a/Giants.Services/Core/ServicesModule.cs
+++ b/Giants.Services/Core/ServicesModule.cs
@@ -17,7 +17,7 @@
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
- services.AddSingleton();
+ services.AddSingleton();
services.AddHostedService();
services.AddHostedService();
diff --git a/Giants.Services/Services/DiscordService.cs b/Giants.Services/Services/CommunityService.cs
similarity index 74%
rename from Giants.Services/Services/DiscordService.cs
rename to Giants.Services/Services/CommunityService.cs
index 7e82786..9c4ec36 100644
--- a/Giants.Services/Services/DiscordService.cs
+++ b/Giants.Services/Services/CommunityService.cs
@@ -2,11 +2,11 @@
{
using Microsoft.Extensions.Configuration;
- public class DiscordService : IDiscordService
+ public class CommunityService : ICommunityService
{
private readonly IConfiguration configuration;
- public DiscordService(IConfiguration configuration)
+ public CommunityService(IConfiguration configuration)
{
this.configuration = configuration;
}
diff --git a/Giants.Services/Services/IDiscordService.cs b/Giants.Services/Services/ICommunityService.cs
similarity index 66%
rename from Giants.Services/Services/IDiscordService.cs
rename to Giants.Services/Services/ICommunityService.cs
index 3d80c3e..830b87f 100644
--- a/Giants.Services/Services/IDiscordService.cs
+++ b/Giants.Services/Services/ICommunityService.cs
@@ -1,6 +1,6 @@
namespace Giants.Services
{
- public interface IDiscordService
+ public interface ICommunityService
{
string GetDiscordUri();
}
diff --git a/Giants.WebApi.Clients/Clients.cs b/Giants.WebApi.Clients/Clients.cs
index 30b7162..ce53ca4 100644
--- a/Giants.WebApi.Clients/Clients.cs
+++ b/Giants.WebApi.Clients/Clients.cs
@@ -342,13 +342,13 @@ namespace Giants.WebApi.Clients
}
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.24.0 (Newtonsoft.Json v11.0.0.0))")]
- public partial class DiscordClient
+ public partial class CommunityClient
{
private string _baseUrl = "https://localhost:44304";
private System.Net.Http.HttpClient _httpClient;
private System.Lazy _settings;
- public DiscordClient(System.Net.Http.HttpClient httpClient)
+ public CommunityClient(System.Net.Http.HttpClient httpClient)
{
_httpClient = httpClient;
_settings = new System.Lazy(CreateSerializerSettings);
@@ -375,17 +375,17 @@ namespace Giants.WebApi.Clients
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);
/// A server side error occurred.
- public System.Threading.Tasks.Task GetDiscordStatusAsync()
+ public System.Threading.Tasks.Task GetDiscordStatusAsync()
{
return GetDiscordStatusAsync(System.Threading.CancellationToken.None);
}
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
/// A server side error occurred.
- public async System.Threading.Tasks.Task GetDiscordStatusAsync(System.Threading.CancellationToken cancellationToken)
+ public async System.Threading.Tasks.Task GetDiscordStatusAsync(System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
- urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Discord");
+ urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Community");
var client_ = _httpClient;
try
@@ -415,7 +415,7 @@ namespace Giants.WebApi.Clients
var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
- var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
+ var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
@@ -857,10 +857,13 @@ namespace Giants.WebApi.Clients
}
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.24.0 (Newtonsoft.Json v11.0.0.0)")]
- public partial class DiscordStatus
+ public partial class CommunityStatus
{
- [Newtonsoft.Json.JsonProperty("discordUri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
- public string DiscordUri { get; set; }
+ [Newtonsoft.Json.JsonProperty("communityAppName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string CommunityAppName { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("communityAppUri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string CommunityAppUri { get; set; }
}
diff --git a/Giants.WebApi.Clients/swagger.json b/Giants.WebApi.Clients/swagger.json
index ac96b8a..57efe45 100644
--- a/Giants.WebApi.Clients/swagger.json
+++ b/Giants.WebApi.Clients/swagger.json
@@ -68,19 +68,19 @@
}
}
},
- "/api/Discord": {
+ "/api/Community": {
"get": {
"tags": [
- "Discord"
+ "Community"
],
- "operationId": "Discord_GetDiscordStatus",
+ "operationId": "Community_GetDiscordStatus",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/DiscordStatus"
+ "$ref": "#/components/schemas/CommunityStatus"
}
}
}
@@ -281,11 +281,15 @@
}
}
},
- "DiscordStatus": {
+ "CommunityStatus": {
"type": "object",
"additionalProperties": false,
"properties": {
- "discordUri": {
+ "communityAppName": {
+ "type": "string",
+ "nullable": true
+ },
+ "communityAppUri": {
"type": "string",
"nullable": true
}
diff --git a/Giants.WebApi/Controllers/DiscordController.cs b/Giants.WebApi/Controllers/DiscordController.cs
index 9cd513b..e61a34f 100644
--- a/Giants.WebApi/Controllers/DiscordController.cs
+++ b/Giants.WebApi/Controllers/DiscordController.cs
@@ -6,22 +6,23 @@
[ApiController]
[Route("api/[controller]")]
- public class DiscordController : ControllerBase
+ public class CommunityController : ControllerBase
{
- private readonly IDiscordService discordService;
+ private readonly ICommunityService discordService;
- public DiscordController(
- IDiscordService discordService)
+ public CommunityController(
+ ICommunityService communityService)
{
- this.discordService = discordService;
+ this.discordService = communityService;
}
[HttpGet]
- public DiscordStatus GetDiscordStatus()
+ public CommunityStatus GetDiscordStatus()
{
- return new DiscordStatus
+ return new CommunityStatus
{
- DiscordUri = this.discordService.GetDiscordUri()
+ CommunityAppName = "Discord",
+ CommunityAppUri = this.discordService.GetDiscordUri()
};
}
}