Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Fixed launcher messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Jan 7, 2023
1 parent 6afc0f6 commit e5ae9f8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<!--Development Variables-->
<PropertyGroup>
<Version>1.20.2</Version>
<Version>1.20.3</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<BUTRSharedVersion>3.0.0.126</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.166</BUTRModuleManagerVersion>
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---------------------------------------------------------------------------------------------------
Version: 1.20.3
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3
* Fixed launcher messages
---------------------------------------------------------------------------------------------------
Version: 1.20.2
Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3
* Fixed the Russian language issue?
Expand Down
22 changes: 12 additions & 10 deletions src/Bannerlord.BUTRLoader.LauncherEx/Helpers/ModuleIssueRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ internal static class ModuleIssueRenderer
{
public static string Render(ModuleIssue issue) => RenderTextObject(issue).ToString();

private static string Version(ApplicationVersionRange version) => version == ApplicationVersionRange.Empty
? version.ToString()
: version.Min == version.Max
? version.Min.ToString()
: "";

public static BUTRTextObject RenderTextObject(ModuleIssue issue) => issue.Type switch
{
ModuleIssueType.Missing => new BUTRTextObject("{=J3Uh6MV4}Missing '{ID}' {VERSION} in modules list")
.SetTextVariable("ID", issue.SourceId)
.SetTextVariable("VERSION", issue.SourceVersion.Min.ToString()),

ModuleIssueType.MissingDependencies => new BUTRTextObject("{=3eQSr6wt}Missing '{ID}' {VERSION}")
.SetTextVariable("ID", issue.Target.Id)
.SetTextVariable("VERSION", issue.SourceVersion == ApplicationVersionRange.Empty
? issue.SourceVersion.ToString()
: issue.SourceVersion.Min == issue.SourceVersion.Max
? issue.SourceVersion.Min.ToString()
: ""),
.SetTextVariable("ID", issue.SourceId)
.SetTextVariable("VERSION", Version(issue.SourceVersion)),
ModuleIssueType.DependencyMissingDependencies => new BUTRTextObject("{=U858vdQX}'{ID}' is missing it's dependencies!")
.SetTextVariable("ID", issue.SourceId),

Expand All @@ -30,13 +32,13 @@ internal static class ModuleIssueRenderer

ModuleIssueType.VersionMismatchLessThanOrEqual => new BUTRTextObject("{=Vjz9HQ41}'{ID}' wrong version <= {VERSION}")
.SetTextVariable("ID", issue.SourceId)
.SetTextVariable("VERSION", issue.SourceVersion.ToString()),
.SetTextVariable("VERSION", Version(issue.SourceVersion)),
ModuleIssueType.VersionMismatchLessThan => new BUTRTextObject("{=ZvnlL7VE}'{ID}' wrong version < [{VERSION}]")
.SetTextVariable("ID", issue.SourceId)
.SetTextVariable("VERSION", issue.SourceVersion.ToString()),
.SetTextVariable("VERSION", Version(issue.SourceVersion)),
ModuleIssueType.VersionMismatchGreaterThan => new BUTRTextObject("{=EfNuH2bG}'{ID}' wrong version > [{VERSION}]")
.SetTextVariable("ID", issue.SourceId)
.SetTextVariable("VERSION", issue.SourceVersion.ToString()),
.SetTextVariable("VERSION", Version(issue.SourceVersion)),

ModuleIssueType.Incompatible => new BUTRTextObject("{=zXDidmpQ}'{ID}' is incompatible with this module")
.SetTextVariable("ID", issue.SourceId),
Expand All @@ -54,7 +56,7 @@ internal static class ModuleIssueRenderer
.SetTextVariable("SOURCEID", issue.SourceId),

ModuleIssueType.DependencyNotLoadedAfterThis => new BUTRTextObject("{=2ALJB7z2}'{TARGETID}' should be loaded after '{SOURCEID}'")
.SetTextVariable("ID", issue.Target.Id),
.SetTextVariable("ID", issue.SourceId),

_ => throw new ArgumentOutOfRangeException()
};
Expand Down

0 comments on commit e5ae9f8

Please sign in to comment.