Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

家具コイン取得を追加 #241

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions Grabacr07.KanColleViewer/Composition/PluginHost.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace Grabacr07.KanColleViewer.Composition
{
/// <summary>
/// プラグインを読み込み、機能へのアクセスを提供します。
/// </summary>
public class PluginHost : IDisposable
{
/// <summary>
/// プラグインを検索するディレクトリへの相対パスを表す文字列を取得します。
/// </summary>
/// <value>プラグインを検索するディレクトリへの相対パスを表す文字列。</value>
public const string PluginsDirectory = "Plugins";

#region singleton members

private static readonly PluginHost instance = new PluginHost();

/// <summary>
/// <see cref="PluginHost"/> のインスタンスを取得します。
/// </summary>
/// <value><see cref="PluginHost"/> のインスタンス。</value>
public static PluginHost Instance { get { return instance; } }

#endregion

private readonly CompositionContainer container;

/// <summary>
/// プラグインによって提供される通知機能を表すオブジェクトのシーケンスを取得します。
/// </summary>
/// <value>プラグインによって提供される通知機能を表すオブジェクトのシーケンス。</value>
[ImportMany]
public IEnumerable<Lazy<INotifier, IPluginMetadata>> Notifiers { get; set; }

/// <summary>
/// プラグインによって提供されるツール機能を表すオブジェクトのシーケンスを取得します。
/// </summary>
[ImportMany]
public IEnumerable<Lazy<IToolPlugin, IPluginMetadata>> Tools { get; set; }

/// <summary>
/// インポートされたプラグインのシーケンスを取得します。
/// </summary>
[ImportMany]
public IEnumerable<IPlugin> Plugins { get; set; }

// ToDo: Plugins を Lazy に
// ToDo: IPlugin に Initialize() と Dispose() がほしい


private PluginHost()
{
var catalog = new AggregateCatalog(new AssemblyCatalog(Assembly.GetExecutingAssembly()));

var current = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
if (current != null)
{
var pluginsPath = Path.Combine(current, PluginsDirectory);
if (Directory.Exists(pluginsPath))
{
catalog.Catalogs.Add(new DirectoryCatalog(pluginsPath));
}
}

this.container = new CompositionContainer(catalog);
}

public void Dispose()
{
this.container.Dispose();
this.GetNotifier().Dispose();
}

/// <summary>
/// プラグインをロードし、初期化を行います。
/// </summary>
public void Initialize()
{
this.container.ComposeParts(this);
this.GetNotifier().Initialize();
foreach (var p in this.Plugins) p.GetSettingsView();
}

/// <summary>
/// ロードされている全ての通知機能を集約して操作するオブジェクトを返します。
/// </summary>
/// <returns>ロードされている全ての通知機能を集約して操作するオブジェクト。</returns>
public INotifier GetNotifier()
{
return new AggregateNotifier(this.Notifiers.Select(x => x.Value));
}
}
}
174 changes: 174 additions & 0 deletions KanColleViewer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Blend for Visual Studio 14
VisualStudioVersion = 14.0.22310.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KanColleViewer", "Grabacr07.KanColleViewer\KanColleViewer.csproj", "{C5F0111F-3F68-4A74-BB20-BB762564D080}"
ProjectSection(ProjectDependencies) = postProject
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264} = {21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}
{A6B0A741-5BE0-479D-B813-E65672350057} = {A6B0A741-5BE0-479D-B813-E65672350057}
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D} = {0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B8B36616-103B-4D8B-A752-A7C07FE1BA70}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KanColleWrapper", "Grabacr07.KanColleWrapper\KanColleWrapper.csproj", "{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".resharper", ".resharper", "{4CB2D693-E4DB-447F-816E-C4F3EF36FD70}"
ProjectSection(SolutionItems) = preProject
KanColleViewer.sln.DotSettings = KanColleViewer.sln.DotSettings
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{7F9428F0-290D-4DBC-80ED-A704ECB12C64}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Desktop.Metro", "Grabacr07.Desktop.Metro\Desktop.Metro.csproj", "{F00FC570-2A80-4F61-8364-798CD44514B2}"
ProjectSection(ProjectDependencies) = postProject
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264} = {21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}
{A6B0A741-5BE0-479D-B813-E65672350057} = {A6B0A741-5BE0-479D-B813-E65672350057}
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D} = {0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{D844E42C-9406-43BF-9681-4F06F6CB3AD9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsNotifier", "Plugins\WindowsNotifier\WindowsNotifier.csproj", "{55C0036D-3206-4C63-A2C0-447C41CAFAF5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MetroRadiance", "MetroRadiance", "{6FE85CE3-7479-4630-B746-EA18BCE3311D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetroRadiance", "MetroRadiance\MetroRadiance\MetroRadiance.csproj", "{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetroRadiance.Chrome", "MetroRadiance\MetroRadiance.Chrome\MetroRadiance.Chrome.csproj", "{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}"
ProjectSection(ProjectDependencies) = postProject
{A6B0A741-5BE0-479D-B813-E65672350057} = {A6B0A741-5BE0-479D-B813-E65672350057}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetroRadiance.Core", "MetroRadiance\MetroRadiance.Core\MetroRadiance.Core.csproj", "{A6B0A741-5BE0-479D-B813-E65672350057}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Counter", "Plugins\Counter\Counter.csproj", "{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MasterDataViewer", "Plugins\MasterDataViewer\MasterDataViewer.csproj", "{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blynclight", "Plugins\Blynclight\Blynclight.csproj", "{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release (beta)|Any CPU = Release (beta)|Any CPU
Release (beta)|x86 = Release (beta)|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Debug|x86.ActiveCfg = Debug|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Release (beta)|Any CPU.ActiveCfg = Release (beta)|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Release (beta)|Any CPU.Build.0 = Release (beta)|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Release (beta)|x86.ActiveCfg = Release (beta)|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Release|Any CPU.Build.0 = Release|Any CPU
{C5F0111F-3F68-4A74-BB20-BB762564D080}.Release|x86.ActiveCfg = Release|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Debug|x86.ActiveCfg = Debug|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Release (beta)|Any CPU.ActiveCfg = Release (beta)|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Release (beta)|Any CPU.Build.0 = Release (beta)|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Release (beta)|x86.ActiveCfg = Release (beta)|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Release|Any CPU.Build.0 = Release|Any CPU
{0BC8CF79-76D9-46AD-867F-FEC6C6AD4594}.Release|x86.ActiveCfg = Release|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Debug|x86.ActiveCfg = Debug|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Release (beta)|Any CPU.ActiveCfg = Release (beta)|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Release (beta)|Any CPU.Build.0 = Release (beta)|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Release (beta)|x86.ActiveCfg = Release (beta)|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Release|Any CPU.Build.0 = Release|Any CPU
{F00FC570-2A80-4F61-8364-798CD44514B2}.Release|x86.ActiveCfg = Release|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Debug|x86.ActiveCfg = Debug|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Release (beta)|Any CPU.ActiveCfg = Release (beta)|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Release (beta)|Any CPU.Build.0 = Release (beta)|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Release (beta)|x86.ActiveCfg = Release (beta)|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Release|Any CPU.Build.0 = Release|Any CPU
{55C0036D-3206-4C63-A2C0-447C41CAFAF5}.Release|x86.ActiveCfg = Release|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Debug|x86.ActiveCfg = Debug|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Release (beta)|Any CPU.ActiveCfg = Release|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Release (beta)|Any CPU.Build.0 = Release|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Release (beta)|x86.ActiveCfg = Release|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Release|Any CPU.Build.0 = Release|Any CPU
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D}.Release|x86.ActiveCfg = Release|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Debug|x86.ActiveCfg = Debug|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Release (beta)|Any CPU.ActiveCfg = Release|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Release (beta)|Any CPU.Build.0 = Release|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Release (beta)|x86.ActiveCfg = Release|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Release|Any CPU.Build.0 = Release|Any CPU
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264}.Release|x86.ActiveCfg = Release|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Debug|x86.ActiveCfg = Debug|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Release (beta)|Any CPU.ActiveCfg = Release|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Release (beta)|Any CPU.Build.0 = Release|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Release (beta)|x86.ActiveCfg = Release|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Release|Any CPU.Build.0 = Release|Any CPU
{A6B0A741-5BE0-479D-B813-E65672350057}.Release|x86.ActiveCfg = Release|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Debug|x86.ActiveCfg = Debug|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Release (beta)|Any CPU.ActiveCfg = Release|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Release (beta)|Any CPU.Build.0 = Release|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Release (beta)|x86.ActiveCfg = Release|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Release|Any CPU.Build.0 = Release|Any CPU
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7}.Release|x86.ActiveCfg = Release|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Debug|x86.ActiveCfg = Debug|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Release (beta)|Any CPU.ActiveCfg = Release|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Release (beta)|Any CPU.Build.0 = Release|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Release (beta)|x86.ActiveCfg = Release|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Release|Any CPU.Build.0 = Release|Any CPU
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E}.Release|x86.ActiveCfg = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Debug|x86.ActiveCfg = Debug|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Debug|x86.Build.0 = Debug|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release (beta)|Any CPU.ActiveCfg = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release (beta)|Any CPU.Build.0 = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release (beta)|x86.ActiveCfg = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release (beta)|x86.Build.0 = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release|Any CPU.Build.0 = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release|x86.ActiveCfg = Release|Any CPU
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F00FC570-2A80-4F61-8364-798CD44514B2} = {7F9428F0-290D-4DBC-80ED-A704ECB12C64}
{55C0036D-3206-4C63-A2C0-447C41CAFAF5} = {D844E42C-9406-43BF-9681-4F06F6CB3AD9}
{0AF0B9FF-D981-4D0F-A41F-C3AB6FE2F16D} = {6FE85CE3-7479-4630-B746-EA18BCE3311D}
{21B4AD15-D9FA-4873-BFAD-1EEEFBC6C264} = {6FE85CE3-7479-4630-B746-EA18BCE3311D}
{A6B0A741-5BE0-479D-B813-E65672350057} = {6FE85CE3-7479-4630-B746-EA18BCE3311D}
{DE2400A1-2AAE-4AB0-BCD5-A88DC78033A7} = {D844E42C-9406-43BF-9681-4F06F6CB3AD9}
{08226BB3-A7A0-49E3-84DE-ED5B7A7D293E} = {D844E42C-9406-43BF-9681-4F06F6CB3AD9}
{814BDBA9-CF03-413B-A5AD-3CA3575F50A3} = {D844E42C-9406-43BF-9681-4F06F6CB3AD9}
EndGlobalSection
EndGlobal
Binary file added Plugins/Blynclight/Assemblies/BlyncLightSDK.dll
Binary file not shown.
Loading