Skip to content

Commit

Permalink
* プラグインのメイン処理に関連するアセンブリを OverlayPlugin.Core に変更
Browse files Browse the repository at this point in the history
* アドオンに関連するインターフェイスを OverlayPlugin.Common として分離
* カスタムアセンブリリゾルバを事前に設定するためのアセンブリを追加(OverlayPlugin)
* 静的コンストラクタを使用したアドオンの初期化を廃止
* シリアライズ可能な IOverlayConfig インターフェイスのリストである OverlayConfigList クラスを追加
* ロガーを PluginMain から分離
* OverlayForm の終了処理に問題があったので修正
* HtmlRenderer の終了処理に問題があったので修正
* すべてのプロジェクトのプラットフォームターゲットを Any CPU に変更(OverlayPlugin プロジェクトおよびソリューションのプラットフォーム設定としての x64、x86 は存続)
* 配布用スクリプトをアセンブリの追加に対応
  • Loading branch information
RainbowMage committed Mar 10, 2015
1 parent 3a6f843 commit 7bd87e4
Show file tree
Hide file tree
Showing 73 changed files with 1,347 additions and 800 deletions.
57 changes: 57 additions & 0 deletions AddonExample/AddonExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using RainbowMage.OverlayPlugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AddonExample
{
public class AddonExample : IOverlayAddon
{
public string Name
{
get { return "Addon Example"; }
}

public string Description
{
get { return "Just displays www.yahoo.com."; }
}

public Type OverlayType
{
get { return typeof(AddonExampleOverlay); }
}

public Type OverlayConfigType
{
get { return typeof(AddonExampleOverlayConfig); }
}

public Type OverlayConfigControlType
{
get { return typeof(AddonExampleOverlayConfigPanel); }
}

public IOverlay CreateOverlayInstance(IOverlayConfig config)
{
return new AddonExampleOverlay((AddonExampleOverlayConfig)config);
}

public IOverlayConfig CreateOverlayConfigInstance(string name)
{
return new AddonExampleOverlayConfig(name);
}

public System.Windows.Forms.Control CreateOverlayConfigControlInstance(IOverlay overlay)
{
return new AddonExampleOverlayConfigPanel();
}

public void Dispose()
{

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,26 @@
<ProjectGuid>{B9BBE478-8FD7-43D9-BD50-C806B1EC672F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExternalOverlayTest</RootNamespace>
<AssemblyName>ExternalOverlayTest</AssemblyName>
<RootNamespace>AddonExample</RootNamespace>
<AssemblyName>AddonExample</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
Expand All @@ -60,26 +42,30 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ExternalOverlay.cs" />
<Compile Include="ExternalOverlayConfig.cs" />
<Compile Include="ExternalOverlayConfigPanel.cs">
<Compile Include="AddonExampleOverlay.cs" />
<Compile Include="AddonExampleOverlayConfig.cs" />
<Compile Include="AddonExampleOverlayConfigPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ExternalOverlayConfigPanel.Designer.cs">
<DependentUpon>ExternalOverlayConfigPanel.cs</DependentUpon>
<Compile Include="AddonExampleOverlayConfigPanel.Designer.cs">
<DependentUpon>AddonExampleOverlayConfigPanel.cs</DependentUpon>
</Compile>
<Compile Include="OverlayAddonMain.cs" />
<Compile Include="AddonExample.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OverlayPlugin\OverlayPlugin.csproj">
<ProjectReference Include="..\OverlayPlugin.Common\OverlayPlugin.Common.csproj">
<Project>{423fcbfc-dd3b-415f-be29-7a4a46614b79}</Project>
<Name>OverlayPlugin.Common</Name>
</ProjectReference>
<ProjectReference Include="..\OverlayPlugin.Core\OverlayPlugin.Core.csproj">
<Project>{dd6d2a9a-4ad4-47b8-a1d0-c8608ea37092}</Project>
<Name>OverlayPlugin</Name>
<Name>OverlayPlugin.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ExternalOverlayConfigPanel.resx">
<DependentUpon>ExternalOverlayConfigPanel.cs</DependentUpon>
<EmbeddedResource Include="AddonExampleOverlayConfigPanel.resx">
<DependentUpon>AddonExampleOverlayConfigPanel.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
using System.Text;
using System.Threading.Tasks;

namespace ExternalOverlayTest
namespace AddonExample
{
public class ExternalOverlay : OverlayBase<ExternalOverlayConfig>
public class AddonExampleOverlay : OverlayBase<AddonExampleOverlayConfig>
{
public ExternalOverlay(ExternalOverlayConfig config)
public AddonExampleOverlay(AddonExampleOverlayConfig config)
: base(config, config.Name)
{
Navigate("http://www.yahoo.com/");
Expand Down
28 changes: 28 additions & 0 deletions AddonExample/AddonExampleOverlayConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using RainbowMage.OverlayPlugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AddonExample
{
public class AddonExampleOverlayConfig : OverlayConfigBase
{
public AddonExampleOverlayConfig(string name)
: base(name)
{

}

private AddonExampleOverlayConfig() : base(null)
{

}

public override Type OverlayType
{
get { return typeof(AddonExampleOverlay); }
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ExternalOverlayTest
namespace AddonExample
{
public partial class ExternalOverlayConfigPanel : UserControl
public partial class AddonExampleOverlayConfigPanel : UserControl
{
public ExternalOverlayConfigPanel()
public AddonExampleOverlayConfigPanel()
{
InitializeComponent();
}
Expand Down
File renamed without changes.
23 changes: 0 additions & 23 deletions ExternalOverlayTest/ExternalOverlayConfig.cs

This file was deleted.

26 changes: 0 additions & 26 deletions ExternalOverlayTest/OverlayAddonMain.cs

This file was deleted.

30 changes: 6 additions & 24 deletions HtmlRenderer/HtmlRenderer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,21 @@
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion HtmlRenderer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyVersion("1.0.0.2")]
7 changes: 1 addition & 6 deletions HtmlRenderer/Renderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,7 @@ internal void OnConsoleLog(CefBrowser browser, string message, string source, in

public void Dispose()
{
var host = Browser.GetHost();
host.CloseBrowser(true);
host.Dispose();
host = null;
Browser.Dispose();
Browser = null;
this.EndRender();
}

static bool initialized = false;
Expand Down
10 changes: 9 additions & 1 deletion OverlayPlugin/IOverlay.cs → OverlayPlugin.Common/IOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace RainbowMage.OverlayPlugin
public interface IOverlay : IDisposable
{
string Name { get; }
OverlayForm Overlay { get; }
event EventHandler<LogEventArgs> OnLog;

void Start();
Expand All @@ -28,4 +27,13 @@ public LogEventArgs(LogLevel level, string message)
this.Level = level;
}
}

public enum LogLevel
{
Trace,
Debug,
Info,
Warning,
Error
}
}
21 changes: 21 additions & 0 deletions OverlayPlugin.Common/IOverlayAddon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RainbowMage.OverlayPlugin
{
public interface IOverlayAddon : IDisposable
{
string Name { get; }
string Description { get; }
Type OverlayType { get; }
Type OverlayConfigType { get; }
Type OverlayConfigControlType { get; }
IOverlay CreateOverlayInstance(IOverlayConfig config);
IOverlayConfig CreateOverlayConfigInstance(string name);
Control CreateOverlayConfigControlInstance(IOverlay overlay);
}
}
Loading

0 comments on commit 7bd87e4

Please sign in to comment.