mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-14 03:47:43 +01:00
Merge branch 'master' into Network_Monitor
This commit is contained in:
commit
6753cdb4e7
23 changed files with 360 additions and 193 deletions
|
|
@ -11,6 +11,7 @@ using Dalamud.Game;
|
|||
using Dalamud.Networking.Http;
|
||||
using Dalamud.Plugin.Internal;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Plugin.Internal.Types.Manifest;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiScene;
|
||||
using Serilog;
|
||||
|
|
@ -232,7 +233,7 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
/// <param name="isThirdParty">If the plugin was third party sourced.</param>
|
||||
/// <param name="iconTexture">Cached image textures, or an empty array.</param>
|
||||
/// <returns>True if an entry exists, may be null if currently downloading.</returns>
|
||||
public bool TryGetIcon(LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, out TextureWrap? iconTexture)
|
||||
public bool TryGetIcon(LocalPlugin? plugin, IPluginManifest manifest, bool isThirdParty, out TextureWrap? iconTexture)
|
||||
{
|
||||
iconTexture = null;
|
||||
|
||||
|
|
@ -274,7 +275,7 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
/// <param name="isThirdParty">If the plugin was third party sourced.</param>
|
||||
/// <param name="imageTextures">Cached image textures, or an empty array.</param>
|
||||
/// <returns>True if the image array exists, may be empty if currently downloading.</returns>
|
||||
public bool TryGetImages(LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, out TextureWrap?[] imageTextures)
|
||||
public bool TryGetImages(LocalPlugin? plugin, IPluginManifest manifest, bool isThirdParty, out TextureWrap?[] imageTextures)
|
||||
{
|
||||
if (!this.pluginImagesMap.TryAdd(manifest.InternalName, null))
|
||||
{
|
||||
|
|
@ -307,7 +308,7 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
byte[]? bytes,
|
||||
string name,
|
||||
string? loc,
|
||||
PluginManifest manifest,
|
||||
IPluginManifest manifest,
|
||||
int maxWidth,
|
||||
int maxHeight,
|
||||
bool requireSquare)
|
||||
|
|
@ -491,7 +492,7 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
Log.Debug("Plugin image loader has shutdown");
|
||||
}
|
||||
|
||||
private async Task<TextureWrap?> DownloadPluginIconAsync(LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, ulong requestedFrame)
|
||||
private async Task<TextureWrap?> DownloadPluginIconAsync(LocalPlugin? plugin, IPluginManifest manifest, bool isThirdParty, ulong requestedFrame)
|
||||
{
|
||||
if (plugin is { IsDev: true })
|
||||
{
|
||||
|
|
@ -558,7 +559,7 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
return icon;
|
||||
}
|
||||
|
||||
private async Task DownloadPluginImagesAsync(TextureWrap?[] pluginImages, LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, ulong requestedFrame)
|
||||
private async Task DownloadPluginImagesAsync(TextureWrap?[] pluginImages, LocalPlugin? plugin, IPluginManifest manifest, bool isThirdParty, ulong requestedFrame)
|
||||
{
|
||||
if (plugin is { IsDev: true })
|
||||
{
|
||||
|
|
@ -671,18 +672,15 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
}
|
||||
}
|
||||
|
||||
private string? GetPluginIconUrl(PluginManifest manifest, bool isThirdParty, bool isTesting)
|
||||
private string? GetPluginIconUrl(IPluginManifest manifest, bool isThirdParty, bool isTesting)
|
||||
{
|
||||
if (isThirdParty)
|
||||
return manifest.IconUrl;
|
||||
|
||||
if (manifest.IsDip17Plugin)
|
||||
return MainRepoDip17ImageUrl.Format(manifest.Dip17Channel!, manifest.InternalName, "icon.png");
|
||||
|
||||
return MainRepoImageUrl.Format(isTesting ? "testing" : "plugins", manifest.InternalName, "icon.png");
|
||||
return MainRepoDip17ImageUrl.Format(manifest.Dip17Channel!, manifest.InternalName, "icon.png");
|
||||
}
|
||||
|
||||
private List<string?>? GetPluginImageUrls(PluginManifest manifest, bool isThirdParty, bool isTesting)
|
||||
private List<string?>? GetPluginImageUrls(IPluginManifest manifest, bool isThirdParty, bool isTesting)
|
||||
{
|
||||
if (isThirdParty)
|
||||
{
|
||||
|
|
@ -698,14 +696,7 @@ internal class PluginImageCache : IDisposable, IServiceType
|
|||
var output = new List<string>();
|
||||
for (var i = 1; i <= 5; i++)
|
||||
{
|
||||
if (manifest.IsDip17Plugin)
|
||||
{
|
||||
output.Add(MainRepoDip17ImageUrl.Format(manifest.Dip17Channel!, manifest.InternalName, $"image{i}.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Add(MainRepoImageUrl.Format(isTesting ? "testing" : "plugins", manifest.InternalName, $"image{i}.png"));
|
||||
}
|
||||
output.Add(MainRepoDip17ImageUrl.Format(manifest.Dip17Channel!, manifest.InternalName, $"image{i}.png"));
|
||||
}
|
||||
|
||||
return output;
|
||||
|
|
|
|||
|
|
@ -48,15 +48,12 @@ internal class DalamudChangelogManager
|
|||
|
||||
foreach (var plugin in this.manager.InstalledPlugins)
|
||||
{
|
||||
if (!plugin.Manifest.IsThirdParty)
|
||||
if (!plugin.IsThirdParty)
|
||||
{
|
||||
if (!plugin.Manifest.IsDip17Plugin)
|
||||
continue;
|
||||
|
||||
var pluginChangelogs = await client.GetFromJsonAsync<PluginHistory>(string.Format(
|
||||
PluginChangelogUrl,
|
||||
plugin.Manifest.InternalName,
|
||||
plugin.Manifest.Dip17Channel));
|
||||
PluginChangelogUrl,
|
||||
plugin.Manifest.InternalName,
|
||||
plugin.Manifest.Dip17Channel));
|
||||
|
||||
changelogs = changelogs.Concat(pluginChangelogs.Versions
|
||||
.Where(x => x.Dip17Track == plugin.Manifest.Dip17Channel)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ internal class PluginChangelogEntry : IChangelogEntry
|
|||
{
|
||||
this.Plugin = plugin;
|
||||
|
||||
this.Version = plugin.Manifest.EffectiveVersion.ToString();
|
||||
this.Version = plugin.EffectiveVersion.ToString();
|
||||
this.Text = plugin.Manifest.Changelog ?? Loc.Localize("ChangelogNoText", "No changelog for this version.");
|
||||
this.Author = plugin.Manifest.Author;
|
||||
this.Date = DateTimeOffset.FromUnixTimeSeconds(this.Plugin.Manifest.LastUpdate).DateTime;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ using Dalamud.Plugin.Internal;
|
|||
using Dalamud.Plugin.Internal.Exceptions;
|
||||
using Dalamud.Plugin.Internal.Profiles;
|
||||
using Dalamud.Plugin.Internal.Types;
|
||||
using Dalamud.Plugin.Internal.Types.Manifest;
|
||||
using Dalamud.Support;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiNET;
|
||||
|
|
@ -88,7 +89,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
private string feedbackModalBody = string.Empty;
|
||||
private string feedbackModalContact = string.Empty;
|
||||
private bool feedbackModalIncludeException = false;
|
||||
private PluginManifest? feedbackPlugin = null;
|
||||
private IPluginManifest? feedbackPlugin = null;
|
||||
private bool feedbackIsTesting = false;
|
||||
|
||||
private int updatePluginCount = 0;
|
||||
|
|
@ -1606,7 +1607,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
return ready;
|
||||
}
|
||||
|
||||
private bool DrawPluginCollapsingHeader(string label, LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, bool trouble, bool updateAvailable, bool isNew, bool installableOutdated, bool isOrphan, Action drawContextMenuAction, int index)
|
||||
private bool DrawPluginCollapsingHeader(string label, LocalPlugin? plugin, IPluginManifest manifest, bool isThirdParty, bool trouble, bool updateAvailable, bool isNew, bool installableOutdated, bool isOrphan, Action drawContextMenuAction, int index)
|
||||
{
|
||||
ImGui.Separator();
|
||||
|
||||
|
|
@ -1741,13 +1742,13 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.TextWrapped(Locs.PluginBody_Orphaned);
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
else if (plugin is { IsDecommissioned: true } && !plugin.Manifest.IsThirdParty)
|
||||
else if (plugin is { IsDecommissioned: true, IsThirdParty: false })
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
ImGui.TextWrapped(Locs.PluginBody_NoServiceOfficial);
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
else if (plugin is { IsDecommissioned: true } && plugin.Manifest.IsThirdParty)
|
||||
else if (plugin is { IsDecommissioned: true, IsThirdParty: true })
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
ImGui.TextWrapped(Locs.PluginBody_NoServiceThird);
|
||||
|
|
@ -1808,7 +1809,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
if (log is PluginChangelogEntry pluginLog)
|
||||
{
|
||||
icon = this.imageCache.DefaultIcon;
|
||||
var hasIcon = this.imageCache.TryGetIcon(pluginLog.Plugin, pluginLog.Plugin.Manifest, pluginLog.Plugin.Manifest.IsThirdParty, out var cachedIconTex);
|
||||
var hasIcon = this.imageCache.TryGetIcon(pluginLog.Plugin, pluginLog.Plugin.Manifest, pluginLog.Plugin.IsThirdParty, out var cachedIconTex);
|
||||
if (hasIcon && cachedIconTex != null)
|
||||
{
|
||||
icon = cachedIconTex;
|
||||
|
|
@ -2031,12 +2032,14 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
|
||||
// Testing
|
||||
if (plugin.Manifest.Testing)
|
||||
if (plugin.IsTesting)
|
||||
{
|
||||
label += Locs.PluginTitleMod_TestingVersion;
|
||||
}
|
||||
|
||||
if (plugin.Manifest.IsAvailableForTesting && configuration.DoPluginTest && testingOptIn == null)
|
||||
var hasTestingAvailable = this.pluginListAvailable.Any(x => x.InternalName == plugin.InternalName &&
|
||||
x.IsAvailableForTesting);
|
||||
if (hasTestingAvailable && configuration.DoPluginTest && testingOptIn == null)
|
||||
{
|
||||
label += Locs.PluginTitleMod_TestingAvailable;
|
||||
}
|
||||
|
|
@ -2132,7 +2135,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.PushID($"installed{index}{plugin.Manifest.InternalName}");
|
||||
var hasChangelog = !plugin.Manifest.Changelog.IsNullOrEmpty();
|
||||
|
||||
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.Manifest.IsThirdParty, trouble, availablePluginUpdate != default, false, false, plugin.IsOrphaned, () => this.DrawInstalledPluginContextMenu(plugin, testingOptIn), index))
|
||||
if (this.DrawPluginCollapsingHeader(label, plugin, plugin.Manifest, plugin.IsThirdParty, trouble, availablePluginUpdate != default, false, false, plugin.IsOrphaned, () => this.DrawInstalledPluginContextMenu(plugin, testingOptIn), index))
|
||||
{
|
||||
if (!this.WasPluginSeen(plugin.Manifest.InternalName))
|
||||
configuration.SeenPluginInternalName.Add(plugin.Manifest.InternalName);
|
||||
|
|
@ -2154,12 +2157,15 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.SameLine();
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey3, downloadText);
|
||||
|
||||
var isThirdParty = manifest.IsThirdParty;
|
||||
var acceptsFeedback =
|
||||
this.pluginListAvailable.Any(x => x.InternalName == plugin.InternalName && x.AcceptsFeedback);
|
||||
|
||||
var isThirdParty = plugin.IsThirdParty;
|
||||
var canFeedback = !isThirdParty &&
|
||||
!plugin.IsDev &&
|
||||
!plugin.IsOrphaned &&
|
||||
plugin.Manifest.DalamudApiLevel == PluginManager.DalamudApiLevel &&
|
||||
plugin.Manifest.AcceptsFeedback &&
|
||||
acceptsFeedback &&
|
||||
availablePluginUpdate == default;
|
||||
|
||||
// Installed from
|
||||
|
|
@ -2215,7 +2221,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
this.DrawUpdateSinglePluginButton(availablePluginUpdate);
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{plugin.Manifest.EffectiveVersion}");
|
||||
ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{plugin.EffectiveVersion}");
|
||||
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
|
|
@ -2226,7 +2232,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
if (hasChangelog)
|
||||
{
|
||||
if (ImGui.TreeNode(Locs.PluginBody_CurrentChangeLog(plugin.Manifest.EffectiveVersion)))
|
||||
if (ImGui.TreeNode(Locs.PluginBody_CurrentChangeLog(plugin.EffectiveVersion)))
|
||||
{
|
||||
this.DrawInstalledPluginChangelog(plugin.Manifest);
|
||||
ImGui.TreePop();
|
||||
|
|
@ -2252,7 +2258,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
ImGui.PopID();
|
||||
}
|
||||
|
||||
private void DrawInstalledPluginChangelog(PluginManifest manifest)
|
||||
private void DrawInstalledPluginChangelog(IPluginManifest manifest)
|
||||
{
|
||||
ImGuiHelpers.ScaledDummy(5);
|
||||
|
||||
|
|
@ -2265,7 +2271,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
{
|
||||
ImGui.Text("Changelog:");
|
||||
ImGuiHelpers.ScaledDummy(2);
|
||||
ImGuiHelpers.SafeTextWrapped(manifest.Changelog);
|
||||
ImGuiHelpers.SafeTextWrapped(manifest.Changelog!);
|
||||
}
|
||||
|
||||
ImGui.EndChild();
|
||||
|
|
@ -2363,7 +2369,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
var isLoadedAndUnloadable = plugin.State == PluginState.Loaded ||
|
||||
plugin.State == PluginState.DependencyResolutionFailed;
|
||||
|
||||
//StyleModelV1.DalamudStandard.Push();
|
||||
// StyleModelV1.DalamudStandard.Push();
|
||||
|
||||
var profileChooserPopupName = $"###pluginProfileChooser{plugin.Manifest.InternalName}";
|
||||
if (ImGui.BeginPopup(profileChooserPopupName))
|
||||
|
|
@ -2526,7 +2532,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
//StyleModelV1.DalamudStandard.Pop();
|
||||
// StyleModelV1.DalamudStandard.Pop();
|
||||
|
||||
ImGui.SameLine();
|
||||
ImGuiHelpers.ScaledDummy(15, 0);
|
||||
|
|
@ -2621,7 +2627,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private void DrawSendFeedbackButton(PluginManifest manifest, bool isTesting)
|
||||
private void DrawSendFeedbackButton(IPluginManifest manifest, bool isTesting)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (ImGuiComponents.IconButton(FontAwesomeIcon.Comment))
|
||||
|
|
@ -2796,7 +2802,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
}
|
||||
}
|
||||
|
||||
private bool DrawPluginImages(LocalPlugin? plugin, PluginManifest manifest, bool isThirdParty, int index)
|
||||
private bool DrawPluginImages(LocalPlugin? plugin, IPluginManifest manifest, bool isThirdParty, int index)
|
||||
{
|
||||
var hasImages = this.imageCache.TryGetImages(plugin, manifest, isThirdParty, out var imageTextures);
|
||||
if (!hasImages || imageTextures.All(x => x == null))
|
||||
|
|
@ -2871,7 +2877,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
return true;
|
||||
}
|
||||
|
||||
private bool IsManifestFiltered(PluginManifest manifest)
|
||||
private bool IsManifestFiltered(IPluginManifest manifest)
|
||||
{
|
||||
var searchString = this.searchText.ToLowerInvariant();
|
||||
var hasSearchString = !string.IsNullOrWhiteSpace(searchString);
|
||||
|
|
@ -2889,7 +2895,7 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
(manifest.Tags != null && manifest.Tags.Any(tag => tag.ToLowerInvariant().Contains(searchString))));
|
||||
}
|
||||
|
||||
private (bool IsInstalled, LocalPlugin Plugin) IsManifestInstalled(PluginManifest? manifest)
|
||||
private (bool IsInstalled, LocalPlugin Plugin) IsManifestInstalled(IPluginManifest? manifest)
|
||||
{
|
||||
if (manifest == null) return (false, default);
|
||||
|
||||
|
|
@ -3124,9 +3130,9 @@ internal class PluginInstallerWindow : Window, IDisposable
|
|||
|
||||
public static string PluginContext_HidePlugin => Loc.Localize("InstallerHidePlugin", "Hide from installer");
|
||||
|
||||
public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Reset plugin configuration");
|
||||
public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Reset plugin data");
|
||||
|
||||
public static string PluginContext_DeletePluginConfigReload => Loc.Localize("InstallerDeletePluginConfigReload", "Reset plugin configuration and reload");
|
||||
public static string PluginContext_DeletePluginConfigReload => Loc.Localize("InstallerDeletePluginConfigReload", "Reset plugin data and reload");
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ internal class ProfileManagerWidget
|
|||
|
||||
private void DrawTutorial(string modalTitle)
|
||||
{
|
||||
var _ = true;
|
||||
var open = true;
|
||||
ImGui.SetNextWindowSize(new Vector2(450, 350), ImGuiCond.Appearing);
|
||||
using (var popup = ImRaii.PopupModal(modalTitle, ref _))
|
||||
using (var popup = ImRaii.PopupModal(modalTitle, ref open))
|
||||
{
|
||||
if (popup)
|
||||
{
|
||||
|
|
@ -399,7 +399,7 @@ internal class ProfileManagerWidget
|
|||
|
||||
if (pmPlugin != null)
|
||||
{
|
||||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.Manifest.IsThirdParty, out var icon);
|
||||
pic.TryGetIcon(pmPlugin, pmPlugin.Manifest, pmPlugin.IsThirdParty, out var icon);
|
||||
icon ??= pic.DefaultIcon;
|
||||
|
||||
ImGui.Image(icon.ImGuiHandle, new Vector2(pluginLineHeight));
|
||||
|
|
@ -596,6 +596,5 @@ internal class ProfileManagerWidget
|
|||
|
||||
public static string TutorialCommandsEnd =>
|
||||
Loc.Localize("ProfileManagerTutorialCommandsEnd", "If you run multiple of these commands, they will be executed in order.");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue