Add third repo number and use it in the installer

This commit is contained in:
Aireil 2021-01-25 14:20:43 +01:00
parent 5f9191ff20
commit 348b8a5e3a
4 changed files with 30 additions and 11 deletions

View file

@ -79,9 +79,9 @@ namespace Dalamud.Plugin
public long LastUpdate { get; set; }
/// <summary>
/// Domain of the origin repo
/// Number of the repo.
/// </summary>
public string FromRepo { get; set; }
public int RepoNumber { get; set; }
/// <summary>
/// Download link used to install the plugin.

View file

@ -365,9 +365,8 @@ namespace Dalamud.Plugin
info += pluginDefinition.DownloadCount != 0
? $", {pluginDefinition.DownloadCount} downloads"
: ", download count unavailable";
if (pluginDefinition.FromRepo != "goatcorp.github.io" &&
!string.IsNullOrWhiteSpace(pluginDefinition.FromRepo))
info += $", from {pluginDefinition.FromRepo}";
if (pluginDefinition.RepoNumber != 0)
info += $", from custom plugin repository #{pluginDefinition.RepoNumber}";
ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1.0f), info);
if (!string.IsNullOrWhiteSpace(pluginDefinition.Description))

View file

@ -51,19 +51,21 @@ namespace Dalamud.Plugin
try {
using var client = new WebClient();
var repoNumber = 0;
foreach (var repo in repos) {
Log.Information("[PLUGINR] Fetching repo: {0}", repo);
var data = client.DownloadString(repo);
var unsortedPluginMaster = JsonConvert.DeserializeObject<List<PluginDefinition>>(data);
var host = new Uri(repo).Host;
foreach (var pluginDefinition in unsortedPluginMaster) {
pluginDefinition.FromRepo = host;
pluginDefinition.RepoNumber = repoNumber;
}
allPlugins.AddRange(unsortedPluginMaster);
repoNumber++;
}
this.PluginMaster = allPlugins.AsReadOnly();