diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj | 4 | ||||
-rw-r--r-- | win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs | 35 | ||||
-rw-r--r-- | win/C#/HandBrake.Framework/HandBrake.Framework.csproj | 4 | ||||
-rw-r--r-- | win/C#/HandBrake.Framework/WindsorInstaller.cs | 33 | ||||
-rw-r--r-- | win/C#/Program.cs | 13 | ||||
-rw-r--r-- | win/C#/app.config | 4 |
6 files changed, 88 insertions, 5 deletions
diff --git a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index ba0e3a64e..31cc44f7a 100644 --- a/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/C#/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -44,6 +44,9 @@ <ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Castle.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
+ <Reference Include="Castle.MicroKernel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
+ <Reference Include="Castle.Windsor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
<Reference Include="Growl.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=980c2339411be384, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\libraries\Growl.Connector.dll</HintPath>
@@ -105,6 +108,7 @@ <Compile Include="Services\Interfaces\IScan.cs" />
<Compile Include="Services\Queue.cs" />
<Compile Include="Services\Scan.cs" />
+ <Compile Include="WindsorInstaller.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
diff --git a/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs b/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs new file mode 100644 index 000000000..a9bc473a2 --- /dev/null +++ b/win/C#/HandBrake.ApplicationServices/WindsorInstaller.cs @@ -0,0 +1,35 @@ +/* WindsorInstaller.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.ApplicationServices
+{
+ using Castle.MicroKernel;
+ using Castle.Windsor;
+
+ using HandBrake.ApplicationServices.Services;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ /// <summary>
+ /// This is the Windsor Installer class.
+ /// </summary>
+ public class WindsorInstaller : IWindsorInstaller
+ {
+ /// <summary>
+ /// Setup the Services for this Library
+ /// </summary>
+ /// <param name="container">
+ /// The container.
+ /// </param>
+ /// <param name="store">
+ /// The store.
+ /// </param>
+ public void Install(IWindsorContainer container, IConfigurationStore store)
+ {
+ container.AddComponent<IScan, ScanService>();
+ container.AddComponent<IQueue, Queue>();
+ container.AddComponent<IEncode, Encode>();
+ }
+ }
+}
diff --git a/win/C#/HandBrake.Framework/HandBrake.Framework.csproj b/win/C#/HandBrake.Framework/HandBrake.Framework.csproj index ef4246d6a..18f20ab13 100644 --- a/win/C#/HandBrake.Framework/HandBrake.Framework.csproj +++ b/win/C#/HandBrake.Framework/HandBrake.Framework.csproj @@ -44,6 +44,9 @@ <ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Castle.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
+ <Reference Include="Castle.MicroKernel, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
+ <Reference Include="Castle.Windsor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
@@ -85,6 +88,7 @@ <Compile Include="Views\UpdateInfo.Designer.cs">
<DependentUpon>UpdateInfo.cs</DependentUpon>
</Compile>
+ <Compile Include="WindsorInstaller.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
diff --git a/win/C#/HandBrake.Framework/WindsorInstaller.cs b/win/C#/HandBrake.Framework/WindsorInstaller.cs new file mode 100644 index 000000000..0362c7fbb --- /dev/null +++ b/win/C#/HandBrake.Framework/WindsorInstaller.cs @@ -0,0 +1,33 @@ +/* WindsorInstaller.cs $
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr>.
+ It may be used under the terms of the GNU General Public License. */
+
+namespace HandBrake.Framework
+{
+ using Castle.MicroKernel;
+ using Castle.Windsor;
+
+ using HandBrake.Framework.Services;
+ using HandBrake.Framework.Services.Interfaces;
+
+ /// <summary>
+ /// This is the Windsor Installer class.
+ /// </summary>
+ public class WindsorInstaller : IWindsorInstaller
+ {
+ /// <summary>
+ /// Setup the Services for this Library
+ /// </summary>
+ /// <param name="container">
+ /// The container.
+ /// </param>
+ /// <param name="store">
+ /// The store.
+ /// </param>
+ public void Install(IWindsorContainer container, IConfigurationStore store)
+ {
+ container.AddComponent<IErrorService, ErrorService>();
+ }
+ }
+}
diff --git a/win/C#/Program.cs b/win/C#/Program.cs index e702265d9..e81ffd66c 100644 --- a/win/C#/Program.cs +++ b/win/C#/Program.cs @@ -8,15 +8,17 @@ namespace Handbrake using System;
using System.Diagnostics;
using System.IO;
+ using System.Reflection;
using System.Windows.Forms;
using Caliburn.Castle;
- using Castle.Core.Resource;
+ using Castle.MicroKernel;
using Castle.Windsor;
- using Castle.Windsor.Configuration.Interpreters;
using HandBrake.ApplicationServices;
+ using HandBrake.Framework.Services;
+ using HandBrake.Framework.Services.Interfaces;
using Handbrake.Presets;
using Handbrake.Properties;
@@ -37,7 +39,12 @@ namespace Handbrake [STAThread]
public static void Main(string[] args)
{
- WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));
+ // WindsorContainer container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));
+ WindsorContainer container = new WindsorContainer();
+ // TODO Would be nice to find a way to do this automatically without having to reference the libraries specifically.
+ container.Install(new HandBrake.Framework.WindsorInstaller());
+ container.Install(new HandBrake.ApplicationServices.WindsorInstaller());
+
ServiceLocator.SetLocatorProvider(() => new WindsorAdapter(container));
InstanceId = Process.GetProcessesByName("HandBrake").Length;
diff --git a/win/C#/app.config b/win/C#/app.config index 313c90e7a..f3baa7e72 100644 --- a/win/C#/app.config +++ b/win/C#/app.config @@ -145,12 +145,12 @@ <startup />
- <castle>
+ <!--<castle>
<components>
<component id="IErrorService"
service="HandBrake.Framework.Services.Interfaces.IErrorService, HandBrake.Framework"
type="HandBrake.Framework.Services.ErrorService, HandBrake.Framework"/>
</components>
- </castle>
+ </castle>-->
</configuration>
\ No newline at end of file |