Skip to content

Commit

Permalink
3.0.5592.38336
Browse files Browse the repository at this point in the history
Show plugins as "OutOfDate" if dependencies don't match.
  • Loading branch information
Icehunter committed May 1, 2015
1 parent c647174 commit 2a4de7d
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion FFXIVAPP.Client/Helpers/LocaleHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void Update(CultureInfo cultureInfo)
var locale = dictionary.Cast<DictionaryEntry>()
.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<PluginInstance>().Where(pluginInstance => pluginInstance.Loaded))
{
pluginInstance.Instance.Locale = locale;
}
Expand Down
12 changes: 10 additions & 2 deletions FFXIVAPP.Client/Helpers/PluginCollectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -57,8 +58,15 @@ public void Remove(PluginInstance plugin)
/// <returns> </returns>
public PluginInstance Find(string plugin)
{
return List.Cast<PluginInstance>()
.FirstOrDefault(pluginInstance => (pluginInstance.Instance.Name.Equals(plugin, Constants.InvariantComparer)) || pluginInstance.AssemblyPath.Equals(plugin, Constants.InvariantComparer));
try
{
return List.Cast<PluginInstance>()
.FirstOrDefault(pluginInstance => (pluginInstance.Instance.Name.Equals(plugin, Constants.InvariantComparer)) || pluginInstance.AssemblyPath.Equals(plugin, Constants.InvariantComparer));
}
catch (Exception ex)
{
return null;
}
}
}
}
4 changes: 4 additions & 0 deletions FFXIVAPP.Client/Helpers/TabItemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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())))
Expand Down
7 changes: 7 additions & 0 deletions FFXIVAPP.Client/Initializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
2 changes: 2 additions & 0 deletions FFXIVAPP.Client/Models/PluginInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
3 changes: 2 additions & 1 deletion FFXIVAPP.Client/Models/PluginStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public enum PluginStatus
{
NotInstalled,
Installed,
UpdateAvailable
UpdateAvailable,
OutOfDate
}
}
5 changes: 1 addition & 4 deletions FFXIVAPP.Client/PluginHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -237,6 +233,7 @@ private void VerifyPlugin(string assemblyPath)
AssemblyPath = assemblyPath
};
plugin.Instance.Initialize(Instance);
plugin.Loaded = load;
Loaded.Add(plugin);
}
catch (Exception ex)
Expand Down
3 changes: 2 additions & 1 deletion FFXIVAPP.Client/ShellView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<PluginInstance>().Where(pluginInstance => pluginInstance.Loaded))
{
pluginInstance.Instance.Dispose(update);
}
Expand Down
Binary file modified distribution/FFXIVAPP.Client.exe
Binary file not shown.

0 comments on commit 2a4de7d

Please sign in to comment.