Add mod author column to the mods list, add a few hardcoded author names

This commit is contained in:
Nikolay Kuznetsov 2021-05-26 22:46:04 +02:00
parent 6cc5510c5d
commit 29ebdd82f9
5 changed files with 42 additions and 9 deletions

View file

@ -97,5 +97,26 @@ namespace VRCMelonAssistant
{
return CategoryDescriptions.TryGetValue(category, out var result) ? result : "";
}
private static List<(string Original, string Replace)> ourAuthorReplaces =
new()
{
("<@!170953680718266369>", "ImTiara"),
("<@!286669951987613706>", "Rafa"),
("<@!168795588366696450>", "Grummus"),
("<@!167335587488071682>", "KortyBoi/Lily"),
("<@!127978642981650432>", "tetra"),
("<@!155396491853168640>", "Dawn/arion")
};
public static string FixupAuthor(string authorName)
{
if (string.IsNullOrEmpty(authorName) || !authorName.Contains("@")) return authorName;
foreach (var authorReplace in ourAuthorReplaces)
authorName = authorName.Replace(authorReplace.Original, authorReplace.Replace);
return authorName;
}
}
}

View file

@ -88,6 +88,7 @@
<!-- Mods Page -->
<sys:String x:Key="Mods:Title">Mods</sys:String>
<sys:String x:Key="Mods:Header:Name">Name</sys:String>
<sys:String x:Key="Mods:Header:Author">Author</sys:String>
<sys:String x:Key="Mods:Header:Installed">Installed</sys:String>
<sys:String x:Key="Mods:Header:Latest">Latest</sys:String>
<sys:String x:Key="Mods:Header:Description">Description</sys:String>

View file

@ -80,6 +80,16 @@
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding ModName}" Header="{DynamicResource Mods:Header:Name}" />
<GridViewColumn Header="{DynamicResource Mods:Header:Author}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock
Text="{Binding ModAuthor}"
MaxWidth="150" TextWrapping="NoWrap" TextTrimming="WordEllipsis"
/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn x:Name="InstalledColumn" Header="{DynamicResource Mods:Header:Installed}">
<GridViewColumn.CellTemplate>

View file

@ -209,7 +209,8 @@ namespace VRCMelonAssistant.Pages
{
name = modInfo.ModName,
modversion = modInfo.ModVersion,
description = "",
author = modInfo.ModAuthor,
description = ""
}
}
};
@ -219,7 +220,7 @@ namespace VRCMelonAssistant.Pages
}
}
private (string ModName, string ModVersion) ExtractModVersions(string dllPath)
private (string ModName, string ModVersion, string ModAuthor) ExtractModVersions(string dllPath)
{
try
{
@ -228,9 +229,7 @@ namespace VRCMelonAssistant.Pages
if (attr.AttributeType.Name == "MelonInfoAttribute" ||
attr.AttributeType.Name == "MelonModInfoAttribute")
return ((string) attr.ConstructorArguments[1].Value,
(string) attr.ConstructorArguments[2].Value);
return (null, null);
(string) attr.ConstructorArguments[2].Value, (string) attr.ConstructorArguments[3].Value);
}
catch (Exception ex)
{
@ -249,9 +248,9 @@ namespace VRCMelonAssistant.Pages
Utils.ShowErrorMessageBox($"Unable to delete file {dllPath}", ex2);
}
}
return (null, null);
}
return (null, null, null);
}
public async Task PopulateModsList()
@ -287,6 +286,7 @@ namespace VRCMelonAssistant.Pages
IsEnabled = true,
ModName = latestVersion.name,
ModVersion = latestVersion.modversion,
ModAuthor = HardcodedCategories.FixupAuthor(latestVersion.author),
ModDescription = latestVersion.description.Replace("\r\n", " ").Replace("\n", " "),
ModInfo = mod,
IsInstalled = mod.installedFilePath != null,
@ -356,6 +356,7 @@ namespace VRCMelonAssistant.Pages
{
public string ModName { get; set; }
public string ModVersion { get; set; }
public string ModAuthor { get; set; }
public string ModDescription { get; set; }
public bool PreviousState { get; set; }

View file

@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.19.1029")]
[assembly: AssemblyFileVersion("1.1.19.1029+vrc")]
[assembly: AssemblyVersion("1.1.20.1029")]
[assembly: AssemblyFileVersion("1.1.20.1029+vrc")]