mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
fix: don't try to reload pluginmaster when it already is being reloaded
This commit is contained in:
parent
07a0b3903f
commit
9752ac493d
3 changed files with 27 additions and 22 deletions
|
|
@ -77,7 +77,7 @@ namespace Dalamud.Interface
|
|||
ImGui.Text(Loc.Localize("DalamudSettingsChannel", "General Chat Channel"));
|
||||
ImGui.Combo("##XlChatTypeCombo", ref this.dalamudMessagesChatType, this.chatTypes,
|
||||
this.chatTypes.Length);
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general XIVLauncher messages."));
|
||||
ImGui.TextColored(this.hintTextColor, Loc.Localize("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general Dalamud messages."));
|
||||
|
||||
ImGui.Dummy(new Vector2(5f, 5f));
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ namespace Dalamud.Plugin
|
|||
this.dalamud = dalamud;
|
||||
this.gameVersion = gameVersion;
|
||||
|
||||
this.dalamud.PluginRepository.ReloadPluginMaster();
|
||||
if (this.dalamud.PluginRepository.State != PluginRepository.InitializationState.InProgress)
|
||||
this.dalamud.PluginRepository.ReloadPluginMasterAsync();
|
||||
}
|
||||
|
||||
public bool Draw() {
|
||||
|
|
|
|||
|
|
@ -34,31 +34,35 @@ namespace Dalamud.Plugin
|
|||
this.dalamud = dalamud;
|
||||
this.pluginDirectory = pluginDirectory;
|
||||
|
||||
State = InitializationState.InProgress;
|
||||
Task.Run(ReloadPluginMaster).ContinueWith(t => {
|
||||
ReloadPluginMasterAsync();
|
||||
}
|
||||
|
||||
public void ReloadPluginMasterAsync()
|
||||
{
|
||||
Task.Run(() => {
|
||||
State = InitializationState.InProgress;
|
||||
|
||||
try
|
||||
{
|
||||
using var client = new WebClient();
|
||||
|
||||
var data = client.DownloadString(PluginRepoBaseUrl + "pluginmaster.json");
|
||||
|
||||
this.PluginMaster = JsonConvert.DeserializeObject<ReadOnlyCollection<PluginDefinition>>(data);
|
||||
|
||||
State = InitializationState.Success;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Could not download PluginMaster");
|
||||
State = InitializationState.Fail;
|
||||
}
|
||||
}).ContinueWith(t => {
|
||||
if (t.IsFaulted)
|
||||
State = InitializationState.Fail;
|
||||
});
|
||||
}
|
||||
|
||||
public void ReloadPluginMaster()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = new WebClient();
|
||||
|
||||
var data = client.DownloadString(PluginRepoBaseUrl + "pluginmaster.json");
|
||||
|
||||
this.PluginMaster = JsonConvert.DeserializeObject<ReadOnlyCollection<PluginDefinition>>(data);
|
||||
|
||||
State = InitializationState.Success;
|
||||
}
|
||||
catch(Exception ex) {
|
||||
Log.Error(ex, "Could not download PluginMaster");
|
||||
State = InitializationState.Fail;
|
||||
}
|
||||
}
|
||||
|
||||
public bool InstallPlugin(PluginDefinition definition, bool enableAfterInstall = true) {
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue