diff --git a/FFXIVAPP.Client/Helpers/LocaleHelper.cs b/FFXIVAPP.Client/Helpers/LocaleHelper.cs index ad37786d..01eecc41 100644 --- a/FFXIVAPP.Client/Helpers/LocaleHelper.cs +++ b/FFXIVAPP.Client/Helpers/LocaleHelper.cs @@ -73,7 +73,7 @@ public static void Update(CultureInfo cultureInfo) var locale = dictionary.Cast() .ToDictionary(item => (string) item.Key, item => (string) item.Value); AppViewModel.Instance.Locale = locale; - foreach (PluginInstance pluginInstance in App.Plugins.Loaded) + foreach (var pluginInstance in App.Plugins.Loaded.Cast().Where(pluginInstance => pluginInstance.Loaded)) { pluginInstance.Instance.Locale = locale; } diff --git a/FFXIVAPP.Client/Helpers/PluginCollectionHelper.cs b/FFXIVAPP.Client/Helpers/PluginCollectionHelper.cs index f2c6197c..d27621da 100644 --- a/FFXIVAPP.Client/Helpers/PluginCollectionHelper.cs +++ b/FFXIVAPP.Client/Helpers/PluginCollectionHelper.cs @@ -27,6 +27,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. +using System; using System.Collections; using System.Linq; using FFXIVAPP.Client.Models; @@ -57,8 +58,15 @@ public void Remove(PluginInstance plugin) /// public PluginInstance Find(string plugin) { - return List.Cast() - .FirstOrDefault(pluginInstance => (pluginInstance.Instance.Name.Equals(plugin, Constants.InvariantComparer)) || pluginInstance.AssemblyPath.Equals(plugin, Constants.InvariantComparer)); + try + { + return List.Cast() + .FirstOrDefault(pluginInstance => (pluginInstance.Instance.Name.Equals(plugin, Constants.InvariantComparer)) || pluginInstance.AssemblyPath.Equals(plugin, Constants.InvariantComparer)); + } + catch (Exception ex) + { + return null; + } } } } diff --git a/FFXIVAPP.Client/Helpers/TabItemHelper.cs b/FFXIVAPP.Client/Helpers/TabItemHelper.cs index 0aaff5cd..eadc08e4 100644 --- a/FFXIVAPP.Client/Helpers/TabItemHelper.cs +++ b/FFXIVAPP.Client/Helpers/TabItemHelper.cs @@ -80,6 +80,10 @@ public static void LoadPluginTabItem(PluginInstance pluginInstance) { try { + if (!pluginInstance.Loaded) + { + return; + } var pluginName = pluginInstance.Instance.FriendlyName; if (SettingsViewModel.Instance.HomePluginList.Any(p => p.ToUpperInvariant() .StartsWith(pluginName.ToUpperInvariant()))) diff --git a/FFXIVAPP.Client/Initializer.cs b/FFXIVAPP.Client/Initializer.cs index 6c13de22..61db0d89 100644 --- a/FFXIVAPP.Client/Initializer.cs +++ b/FFXIVAPP.Client/Initializer.cs @@ -404,6 +404,13 @@ where enabled pluginDownload.Status = PluginStatus.UpdateAvailable; AppViewModel.Instance.HasNewPluginUpdate = true; } + else + { + if (!found.Loaded) + { + pluginDownload.Status = PluginStatus.OutOfDate; + } + } } DispatcherHelper.Invoke(() => UpdateViewModel.Instance.AvailablePlugins.Add(pluginDownload)); } diff --git a/FFXIVAPP.Client/Models/PluginInstance.cs b/FFXIVAPP.Client/Models/PluginInstance.cs index 3a84a43c..d3f1624b 100644 --- a/FFXIVAPP.Client/Models/PluginInstance.cs +++ b/FFXIVAPP.Client/Models/PluginInstance.cs @@ -36,9 +36,11 @@ internal class PluginInstance public PluginInstance() { AssemblyPath = ""; + Loaded = false; } public IPlugin Instance { get; set; } public string AssemblyPath { get; set; } + public bool Loaded { get; set; } } } diff --git a/FFXIVAPP.Client/Models/PluginStatus.cs b/FFXIVAPP.Client/Models/PluginStatus.cs index 9311ddb9..8cafbc3f 100644 --- a/FFXIVAPP.Client/Models/PluginStatus.cs +++ b/FFXIVAPP.Client/Models/PluginStatus.cs @@ -33,6 +33,7 @@ public enum PluginStatus { NotInstalled, Installed, - UpdateAvailable + UpdateAvailable, + OutOfDate } } diff --git a/FFXIVAPP.Client/PluginHost.cs b/FFXIVAPP.Client/PluginHost.cs index 719b0b1a..63abf758 100644 --- a/FFXIVAPP.Client/PluginHost.cs +++ b/FFXIVAPP.Client/PluginHost.cs @@ -218,10 +218,6 @@ private void VerifyPlugin(string assemblyPath) { load = false; } - if (!load) - { - return; - } var pType = pAssembly.GetType(pAssembly.GetName() .Name + ".Plugin"); var implementsIPlugin = typeof (IPlugin).IsAssignableFrom(pType); @@ -237,6 +233,7 @@ private void VerifyPlugin(string assemblyPath) AssemblyPath = assemblyPath }; plugin.Instance.Initialize(Instance); + plugin.Loaded = load; Loaded.Add(plugin); } catch (Exception ex) diff --git a/FFXIVAPP.Client/ShellView.xaml.cs b/FFXIVAPP.Client/ShellView.xaml.cs index 368448e9..9be5e2d5 100644 --- a/FFXIVAPP.Client/ShellView.xaml.cs +++ b/FFXIVAPP.Client/ShellView.xaml.cs @@ -31,6 +31,7 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; +using System.Linq; using System.Windows; using System.Windows.Threading; using FFXIVAPP.Client.Helpers; @@ -140,7 +141,7 @@ public static void CloseApplication(bool update = false) { Application.Current.MainWindow.WindowState = WindowState.Normal; SettingsHelper.Save(update); - foreach (PluginInstance pluginInstance in App.Plugins.Loaded) + foreach (var pluginInstance in App.Plugins.Loaded.Cast().Where(pluginInstance => pluginInstance.Loaded)) { pluginInstance.Instance.Dispose(update); } diff --git a/distribution/FFXIVAPP.Client.exe b/distribution/FFXIVAPP.Client.exe index 2b33db0a..7cf45bc6 100644 Binary files a/distribution/FFXIVAPP.Client.exe and b/distribution/FFXIVAPP.Client.exe differ