install reporting support, changed plugin subtext formatting, update registry url
MODIFY
HunterPie.Core/Core/Client/UserSettings.cs
HunterPie.Core/Core/Client/UserSettings.cs
@@ -209,7 +209,7 @@ namespace HunterPie.Core
public double PosX { get; set; } = 0;
public double PosY { get; set; } = 0;
public PluginProxyMode PluginProxyMode { get; set; } = PluginProxyMode.Auto;
- public string PluginRegistryUrl { get; set; } = "https://plugins.hunterpie.herokuapp.com/";
+ public string PluginRegistryUrl { get; set; } = "https://hunterpie-plugins.herokuapp.com/";
public bool MinimizeAfterGameStart { get; set; } = false;
public Update Update { get; set; } = new Update();
public Launch Launch { get; set; } = new Launch();

MODIFY
HunterPie/GUIControls/PluginListEntry.xaml
HunterPie/GUIControls/PluginListEntry.xaml
<StackPanel Grid.Column="1" Margin="5,0,0,0">
<TextBlock TextWrapping="Wrap" FontSize="16" FontFamily="Roboto, Segoe UI" FontWeight="Medium" Foreground="WhiteSmoke" Text="{Binding Name}" />
<TextBlock TextWrapping="Wrap" FontSize="13" FontFamily="Roboto, Segoe UI" Foreground="WhiteSmoke" Text="{Binding Description}"/>
- <TextBlock FontSize="12" VerticalAlignment="Bottom" FontFamily="Roboto, Segoe UI" FontWeight="Medium" Foreground="Gray" Margin="0,0,5,0" Text="{Binding SubText}" />
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
+ <Image Source="{StaticResource ICON_DOWNLOAD_GRAY}" Width="10" Height="10" Margin="0,1,2,0" />
+ <TextBlock FontSize="12" FontFamily="Roboto, Segoe UI" FontWeight="Medium" Foreground="Gray"
+ Text="{Binding SubText}"/>
+ </StackPanel>
</StackPanel>
<!-- buttons -->

MODIFY
HunterPie/HunterPie.Plugins/PluginRegistryService.cs
HunterPie/HunterPie.Plugins/PluginRegistryService.cs
@@ -37,11 +37,19 @@ namespace HunterPie.Plugins
return JsonConvert.DeserializeObject<List<PluginRegistryEntry>>(str);
}
+ public async Task<int> ReportInstall(string pluginName)
+ {
+ var url = BuildUrl(UserSettings.PlayerConfig.HunterPie.PluginRegistryUrl, "plugin", Uri.EscapeUriString(pluginName), "install");
+ var rsp = await client.PostAsync(url, new StringContent(""));
+ rsp.EnsureSuccessStatusCode();
+ return int.Parse(await rsp.Content.ReadAsStringAsync());
+ }
+
public async Task<string> GetModuleUpdateUrl(PluginInformation pInformation)
{
if (await ShouldUseProxy())
{
- return BuildUrl(UserSettings.PlayerConfig.HunterPie.PluginRegistryUrl, $"plugin/{pInformation.Name}/module");
+ return BuildUrl(UserSettings.PlayerConfig.HunterPie.PluginRegistryUrl, "plugin", Uri.EscapeUriString(pInformation.Name), "module");
}
return pInformation.Update.UpdateUrl;
@@ -108,5 +116,7 @@ namespace HunterPie.Plugins
public string Author { get; set; }
public string Version { get; set; }
+
+ public int Downloads { get; set; }
}
}

MODIFY
HunterPie/HunterPie.Plugins/ViewModel/LoadedPluginViewModel.cs
HunterPie/HunterPie.Plugins/ViewModel/LoadedPluginViewModel.cs
@@ -38,6 +38,8 @@ namespace HunterPie.Plugins
private void OnRegistryPluginsLoaded(object sender, EventArgs e)
{
GetImage();
+ // handle downloads count change
+ OnPropertyChanged(nameof(SubText));
}
public void Delete()
@@ -131,7 +133,19 @@ namespace HunterPie.Plugins
public string Description => plugin.PluginInformation.Description;
public string SubText => GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_SUBTITLE_ROW']")
.Replace("{version}", plugin.PluginInformation.Version)
- .Replace("{author}", plugin.PluginInformation.Author);
+ .Replace("{author}", plugin.PluginInformation.Author)
+ .Replace("{downloads}", GetDownloadsCount());
+
+ private string GetDownloadsCount()
+ {
+ var val = pluginList.TryGetRegistryEntry(plugin.PluginInformation.Name)?.Downloads;
+ if (val == null)
+ {
+ return "-";
+ }
+
+ return val.ToString();
+ }
public bool IsEnabled
{

MODIFY
HunterPie/HunterPie.Plugins/ViewModel/RegistryPluginViewModel.cs
HunterPie/HunterPie.Plugins/ViewModel/RegistryPluginViewModel.cs
@@ -59,6 +59,8 @@ namespace HunterPie.Plugins
var moduleContent = await http.GetStringAsync(entry.Module);
var modulePath = await Hunterpie.Instance.InstallPlugin(moduleContent);
+ // we don't actually care if this request is failed, nor interested in value, so we will not await it
+ _ = PluginRegistryService.Instance.ReportInstall(entry.InternalName);
DownloadReadme(modulePath);
pluginList.UpdatePluginsArrangement();
@@ -130,7 +132,7 @@ namespace HunterPie.Plugins
public bool IsVersionOk => PluginUpdate.IsVersionOk(entry.MinVersion);
public bool CanToggle => false;
- public bool CanDelete => !IsBusy && PluginManager.IsInstalled(entry.InternalName);
+ public bool CanDelete => !IsBusy && PluginManager.IsInstalled(entry.InternalName) && !PluginManager.IsMarkedForRemoval(entry.InternalName);
public bool CanInstall => !IsBusy && !PluginManager.IsInstalled(entry.InternalName);
public bool CanRestore => false;
public bool IsFailed => false;
@@ -146,7 +148,8 @@ namespace HunterPie.Plugins
public string Description => entry.Description;
public string SubText => GStrings.GetLocalizationByXPath("/Console/String[@ID='MESSAGE_PLUGIN_SUBTITLE_ROW']")
.Replace("{version}", entry.Version)
- .Replace("{author}", entry.Author);
+ .Replace("{author}", entry.Author)
+ .Replace("{downloads}", entry.Downloads.ToString());
public bool IsEnabled
{

MODIFY
HunterPie/Languages/en-us.xml
HunterPie/Languages/en-us.xml
<String ID="MESSAGE_FRESH_PLUGINS" Name="Will be enabled after restart"/>
<String ID="MESSAGE_AVAILABLE_PLUGINS" Name="Available Plugins"/>
<String ID="MESSAGE_TO_DELETE_PLUGINS" Name="Will be deleted after restart"/>
- <String ID="MESSAGE_PLUGIN_SUBTITLE_ROW" Name="ver: {version}; author: {author}"/>
+ <String ID="MESSAGE_PLUGIN_SUBTITLE_ROW" Name="{downloads} | v{version} | by {author}"/>
<String ID="MESSAGE_PLUGIN_INCOMPATIBLE_VERSION" Name="HunterPie version is incompatible with this plugin."/>
<String ID="MESSAGE_REFRESH" Name="Refresh" />
<String ID="MESSAGE_PLUGIN_DELETE" Name="Delete plugin" />

MODIFY
HunterPie/Resources/Resources.xaml
HunterPie/Resources/Resources.xaml
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
+ <DrawingImage x:Key="ICON_DOWNLOAD_GRAY">
+ <DrawingImage.Drawing>
+ <DrawingGroup>
+ <GeometryDrawing Brush="Gray" Geometry="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" />
+ </DrawingGroup>
+ </DrawingImage.Drawing>
+ </DrawingImage>
<DrawingImage x:Key="ICON_REMOVE">
<DrawingImage.Drawing>
<DrawingGroup>

install reporting support, changed plugin subtext formatting, update registry url