[banshee] Windows: new Backend, with barely working HardwareManager



commit 96ee3070cdaf14d2af35e340bb4a1a7b0dd73bc0
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Sat Feb 19 00:08:35 2011 -0600

    Windows: new Backend, with barely working HardwareManager
    
    It loads my Android G1!  Needs to be cleaned up mucho, and needs to listen for
    changes in the hardware.

 Banshee.sln                                        |   14 ++
 build/AddinXmlStringExtractor.cs                   |    2 +-
 .../Banshee.Windows/Banshee.Windows.addin.xml      |   23 ++
 .../Banshee.Windows/Banshee.Windows.csproj         |  109 +++++++++
 .../Banshee.Windows/HardwareManager.cs             |  232 ++++++++++++++++++++
 .../Banshee.Windows/WindowsService.cs              |   66 ++++++
 6 files changed, 445 insertions(+), 1 deletions(-)
---
diff --git a/Banshee.sln b/Banshee.sln
index 815c87a..0a9b386 100644
--- a/Banshee.sln
+++ b/Banshee.sln
@@ -62,6 +62,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Osx", "src\Backends
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.GStreamerSharp", "src\Backends\Banshee.GStreamerSharp\Banshee.GStreamerSharp.csproj", "{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Banshee.Windows", "src\Backends\Banshee.Windows\Banshee.Windows.csproj", "{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}"
+EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dap", "Dap", "{057215DF-2773-4B42-8B8A-64F2CF7764F2}"
 	ProjectSection(SolutionItems) = postProject
 	EndProjectSection
@@ -297,6 +299,7 @@ Global
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Release|Any CPU.ActiveCfg = Debug|Any CPU
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Release|Any CPU.Build.0 = Debug|Any CPU
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
+		{6B73E278-23FB-4A59-9B44-AB7F0212B936}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{6D17167C-AC3F-4D40-A652-46627276A9A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{6D17167C-AC3F-4D40-A652-46627276A9A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{6D17167C-AC3F-4D40-A652-46627276A9A1}.Release|Any CPU.Build.0 = Release|Any CPU
@@ -343,6 +346,15 @@ Global
 		{9A8BCA22-82D6-4106-961A-DB4F77937BD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9A8BCA22-82D6-4106-961A-DB4F77937BD5}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
 		{9A8BCA22-82D6-4106-961A-DB4F77937BD5}.Windows|Any CPU.Build.0 = Windows|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Debug|x86.Build.0 = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Release|Any CPU.Build.0 = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Release|x86.ActiveCfg = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Release|x86.Build.0 = Debug|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{9C7B8E9C-A4E6-4459-A2C4-3D2D199EA919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{9C7B8E9C-A4E6-4459-A2C4-3D2D199EA919}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9C7B8E9C-A4E6-4459-A2C4-3D2D199EA919}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
@@ -385,6 +397,7 @@ Global
 		{BC2E94DF-7A82-461E-BE7C-60E41ADC3562}.Release|Any CPU.ActiveCfg = Debug|Any CPU
 		{BC2E94DF-7A82-461E-BE7C-60E41ADC3562}.Release|Any CPU.Build.0 = Debug|Any CPU
 		{BC2E94DF-7A82-461E-BE7C-60E41ADC3562}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
+		{BC2E94DF-7A82-461E-BE7C-60E41ADC3562}.Windows|Any CPU.Build.0 = Windows|Any CPU
 		{BF5D1722-269B-452E-B577-AEBA0CB894BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{BF5D1722-269B-452E-B577-AEBA0CB894BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{BF5D1722-269B-452E-B577-AEBA0CB894BA}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
@@ -491,6 +504,7 @@ Global
 		{46C02D13-5ED4-4A14-9ACF-125B1E4B6EB5} = {A03B194F-F644-4E95-A602-87200029240D}
 		{379034DF-F34D-409B-8DE9-097BE78E37C8} = {A03B194F-F644-4E95-A602-87200029240D}
 		{BA67DA42-F0DA-4D64-BD8B-22F30C727BAB} = {A03B194F-F644-4E95-A602-87200029240D}
+		{9AA07695-3EF9-45CE-849E-A0AB9A1F4006} = {A03B194F-F644-4E95-A602-87200029240D}
 		{BC2E94DF-7A82-461E-BE7C-60E41ADC3562} = {057215DF-2773-4B42-8B8A-64F2CF7764F2}
 		{6B73E278-23FB-4A59-9B44-AB7F0212B936} = {057215DF-2773-4B42-8B8A-64F2CF7764F2}
 		{3935AE8A-E283-4C0D-9094-7435A937DC90} = {057215DF-2773-4B42-8B8A-64F2CF7764F2}
diff --git a/build/AddinXmlStringExtractor.cs b/build/AddinXmlStringExtractor.cs
index 9d837f5..f6473ca 100644
--- a/build/AddinXmlStringExtractor.cs
+++ b/build/AddinXmlStringExtractor.cs
@@ -24,7 +24,7 @@ internal static class AddinXmlStringCatalog
         paths.Sort ();
 
         var blacklist = new string [] { "GStreamer", "Gnome", "Osx", "Unix", "MeeGo", "Gio", "NowPlaying",
-            "Hal", "src/Core", "Banshee.Dap/", "RemoteAudio", "Sample", "SqlDebugConsole", "Template" };
+            "Hal", "src/Core", "Banshee.Dap/", "RemoteAudio", "Sample", "SqlDebugConsole", "Template", "Windows" };
 
         foreach (var path in paths) {
             if (blacklist.Any (path.Contains))
diff --git a/src/Backends/Banshee.Windows/Banshee.Windows.addin.xml b/src/Backends/Banshee.Windows/Banshee.Windows.addin.xml
new file mode 100644
index 0000000..b1c95cd
--- /dev/null
+++ b/src/Backends/Banshee.Windows/Banshee.Windows.addin.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Addin 
+    id="Banshee.Windows"
+    version="1.0"
+    compatVersion="1.0"
+    copyright="© 2011 Novell Inc. Licensed under the MIT X11 license."
+    category="required:Backends"
+    description="Backend providers for the Windows platform. Includes general Windows integration."
+    defaultEnabled="true">
+
+  <Dependencies>
+    <Addin id="Banshee.Core" version="1.0"/>
+    <Addin id="Banshee.Services" version="1.0"/>
+  </Dependencies>
+
+  <Extension path="/Banshee/ServiceManager/Service">
+    <Service class="Banshee.Windows.WindowsService"/>
+  </Extension>
+  
+  <Extension path="/Banshee/Platform/HardwareManager">
+    <HardwareManager class="Banshee.Windows.HardwareManager" id="Banshee.Windows.HardwareManager"/>
+  </Extension>
+</Addin>
\ No newline at end of file
diff --git a/src/Backends/Banshee.Windows/Banshee.Windows.csproj b/src/Backends/Banshee.Windows/Banshee.Windows.csproj
new file mode 100644
index 0000000..e4e33c6
--- /dev/null
+++ b/src/Backends/Banshee.Windows/Banshee.Windows.csproj
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"; ToolsVersion="3.5">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <ProjectGuid>{9AA07695-3EF9-45CE-849E-A0AB9A1F4006}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <UseParentDirectoryAsNamespace>true</UseParentDirectoryAsNamespace>
+    <AssemblyName>Banshee.Windows</AssemblyName>
+    <SchemaVersion>2.0</SchemaVersion>
+    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <Optimize>true</Optimize>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ReleaseVersion>1.3</ReleaseVersion>
+    <RootNamespace>Banshee.Windows</RootNamespace>
+    <AssemblyOriginatorKeyFile>.</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <WarningLevel>4</WarningLevel>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\bin</OutputPath>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <WarningLevel>4</WarningLevel>
+    <Optimize>false</Optimize>
+    <OutputPath>..\..\..\bin\bin</OutputPath>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\Core\Banshee.Core\Banshee.Core.csproj">
+      <Project>{2ADB831A-A050-47D0-B6B9-9C19D60233BB}</Project>
+      <Name>Banshee.Core</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Core\Banshee.Services\Banshee.Services.csproj">
+      <Project>{B28354F0-BA87-44E8-989F-B864A3C7C09F}</Project>
+      <Name>Banshee.Services</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Core\Banshee.ThickClient\Banshee.ThickClient.csproj">
+      <Project>{AC839523-7BDF-4AB6-8115-E17921B96EC6}</Project>
+      <Name>Banshee.ThickClient</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Hyena\Hyena.Data.Sqlite\Hyena.Data.Sqlite.csproj">
+      <Project>{95374549-9553-4C1E-9D89-667755F90E13}</Project>
+      <Name>Hyena.Data.Sqlite</Name>
+      <Private>False</Private>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Hyena\Hyena\Hyena.csproj">
+      <Project>{95374549-9553-4C1E-9D89-667755F90E12}</Project>
+      <Name>Hyena</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\Hyena\Hyena.Gui\Hyena.Gui.csproj">
+      <Project>{C856EFD8-E812-4E61-8B76-E3583D94C233}</Project>
+      <Name>Hyena.Gui</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="gtk-sharp">
+      <SpecificVersion>False</SpecificVersion>
+    </Reference>
+    <Reference Include="Mono.Posix">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..bin\Mono.Posix.dll</HintPath>
+    </Reference>
+    <Reference Include="gio-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\bin\bin\gio-sharp.dll</HintPath>
+    </Reference>
+    <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+    <Reference Include="System.Management" />
+    <Reference Include="System.Core">
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Banshee.Windows\WindowsService.cs" />
+    <Compile Include="Banshee.Windows\HardwareManager.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Banshee.Windows.addin.xml">
+      <LogicalName>Banshee.Windows.addin.xml</LogicalName>
+    </EmbeddedResource>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ProjectExtensions>
+    <MonoDevelop>
+      <Properties>
+        <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile.am">
+          <BuildFilesVar Sync="true" Name="SOURCES" />
+          <DeployFilesVar />
+          <ResourcesVar Sync="true" Name="RESOURCES" />
+          <OthersVar />
+          <GacRefVar />
+          <AsmRefVar />
+          <ProjectRefVar />
+        </MonoDevelop.Autotools.MakefileInfo>
+      </Properties>
+    </MonoDevelop>
+  </ProjectExtensions>
+</Project>
diff --git a/src/Backends/Banshee.Windows/Banshee.Windows/HardwareManager.cs b/src/Backends/Banshee.Windows/Banshee.Windows/HardwareManager.cs
new file mode 100644
index 0000000..1bc545d
--- /dev/null
+++ b/src/Backends/Banshee.Windows/Banshee.Windows/HardwareManager.cs
@@ -0,0 +1,232 @@
+//
+// HardwareManager.cs
+// 
+// Author:
+//   Gabriel Burt <gabriel burt gmail com>
+//
+// Copyright 2011 Novell, Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+using Banshee.Hardware;
+using System.Management;
+using System.Globalization;
+
+namespace Banshee.Windows
+{
+    public class UsbDevice : IUsbDevice
+    {
+        // Expects a CIM_USBDevice entry
+        internal UsbDevice (ManagementObject o)
+        {
+            Uuid = o.Str ("DeviceID");
+            int i = Uuid.IndexOf ("VID_");
+            VendorId = Int32.Parse (Uuid.Substring (i + 4, 4), NumberStyles.HexNumber);
+            i = Uuid.IndexOf ("PID_");
+            ProductId = Int32.Parse (Uuid.Substring (i + 4, 4), NumberStyles.HexNumber);
+        }
+
+        public int ProductId { get; set; }
+        public int VendorId { get; set; }
+        public double Speed { get; set; }
+        public double Version { get; set; }
+
+        // IDevice
+        public string Uuid { get; set; }
+        public string Serial { get; set; }
+        public string Name { get; set; }
+        public string Product { get; set; }
+        public string Vendor { get; set; }
+
+        public IDeviceMediaCapabilities MediaCapabilities { get; set; }
+
+        public virtual IUsbDevice ResolveRootUsbDevice ()
+        {
+            return null;
+        }
+
+        public IUsbPortInfo ResolveUsbPortInfo ()
+        {
+            return null;
+        }
+    }
+
+    public class Volume : IVolume
+    {
+        UsbDevice usb_device;
+
+        // Expects a Win32_DiskDrive object
+        internal Volume (ManagementObject o)
+        {
+            Uuid = o.Str ("DeviceID");
+
+            string cc = o.Str ("PNPDeviceID");
+            int i =  cc.LastIndexOf ('&');
+            if (i >= 0) {
+                cc = cc.Substring (0, cc.LastIndexOf ('&'));
+                i = cc.LastIndexOf ('&');
+                if (i >= 0) {
+                    cc = cc.Substring (i + 1, cc.Length - i - 1);
+                    cc = HardwareManager.Escape (cc);
+                    //= USBSTOR\DISK&VEN_HTC&PROD_ANDROID_PHONE&REV_0100\8&5901EA1&0&HT851N003062&0
+                    var query = String.Format ("SELECT * FROM CIM_USBDevice WHERE DeviceID LIKE '%{0}'", cc);
+
+                    Console.WriteLine ("query = {0}", query);
+                    var u = HardwareManager.Query (query).FirstOrDefault ();
+                    if (u != null) {
+                        usb_device = new UsbDevice (u);
+                    }
+                }
+            }
+
+            // Look up the MountPoint, going from DiskDrive -> Partition -> LogicalDisk
+            ManagementObject logical_disk = null;
+            foreach (ManagementObject b in o.GetRelated("Win32_DiskPartition")) {
+                Console.WriteLine("  PartName: {0}", b["Name"]);
+                /*foreach (var p in b.Properties) {
+                    Console.WriteLine ("  part prop {0} = {1}", p.Name, p.Value);
+                }*/
+                foreach (ManagementObject c in b.GetRelated("Win32_LogicalDisk")) {
+                    Console.WriteLine("    LDName: {0}", c["Name"]); // here it will print drive letter
+                    logical_disk = c;
+                }
+            }
+
+            Console.WriteLine ("logical disk null? {0}", logical_disk == null);
+            if (logical_disk != null) {
+                var ld = logical_disk;
+                Console.WriteLine ("Got Logical disk!!");
+                //IsMounted = (bool)ld.GetPropertyValue ("Automount") == true;
+                //IsReadOnly = (ushort) ld.GetPropertyValue ("Access") == 1;
+                MountPoint = ld.Str ("Name") + "/";
+                FileSystem = ld.Str ("FileSystem");
+                Capacity = (ulong) ld.GetPropertyValue ("Size");
+                Available = (long)(ulong)ld.GetPropertyValue ("FreeSpace");
+            }
+        }
+
+        // IVolume
+
+        public string DeviceNode { get; set; }
+        public string MountPoint { get; set; }
+        public bool IsMounted { get; set; }
+        public bool IsReadOnly { get; set; }
+        public ulong Capacity { get; set; }
+        public long Available { get; set; }
+        public IBlockDevice Parent { get; set; }
+        public bool ShouldIgnore { get; set; }
+        public string FileSystem { get; set; }
+
+        public bool CanEject { get; set; }
+        public void Eject () {}
+
+        public bool CanMount { get; set; }
+        public void Mount () {}
+
+        public bool CanUnmount { get; set; }
+        public void Unmount () {}
+
+        // IDevice
+
+        public IUsbDevice ResolveRootUsbDevice ()
+        {
+            return usb_device;
+        }
+
+        public IUsbPortInfo ResolveUsbPortInfo ()
+        {
+            return null;
+        }
+
+        public string Uuid { get; set; }
+        public string Serial { get; set; }
+        public string Name { get; set; }
+        public string Product { get; set; }
+        public string Vendor { get; set; }
+        public IDeviceMediaCapabilities MediaCapabilities { get; set; }
+    }
+
+    public class HardwareManager : IHardwareManager
+    {
+        public HardwareManager ()
+        {
+        }
+
+        public event DeviceAddedHandler DeviceAdded;
+        public event DeviceRemovedHandler DeviceRemoved;
+
+        public IEnumerable<IDevice> GetAllDevices ()
+        {
+            return Query ("SELECT * FROM Win32_DiskDrive").Select (o => new Volume (o) as IDevice);
+        }
+
+        private IEnumerable<T> GetAllBlockDevices<T> () where T : IBlockDevice
+        {
+            yield break;
+        }
+
+        public IEnumerable<IBlockDevice> GetAllBlockDevices ()
+        {
+            yield break;
+        }
+
+        public IEnumerable<ICdromDevice> GetAllCdromDevices ()
+        {
+            yield break;
+        }
+
+        public IEnumerable<IDiskDevice> GetAllDiskDevices ()
+        {
+            yield break;
+        }
+
+        public static IEnumerable<ManagementObject> Query (string q)
+        {
+            using (var s = new ManagementObjectSearcher (new ObjectQuery (q))) {
+                foreach (ManagementObject o in s.Get ()) {
+                    yield return o;
+                }
+            }
+        }
+
+        public static string Escape (string input)
+        {
+            input = input.Replace ("_", "[_]"); // escape _'s
+            input = input.Replace ("\\", "\\\\"); // escape _'s
+            return input;
+        }
+
+        public void Dispose ()
+        {
+        }
+    }
+
+    internal static class Extensions
+    {
+        public static string Str (this ManagementObject o, string propName)
+        {
+            var p = o.GetPropertyValue (propName);
+            return p == null ? null : p.ToString ();
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/Backends/Banshee.Windows/Banshee.Windows/WindowsService.cs b/src/Backends/Banshee.Windows/Banshee.Windows/WindowsService.cs
new file mode 100644
index 0000000..f18beb7
--- /dev/null
+++ b/src/Backends/Banshee.Windows/Banshee.Windows/WindowsService.cs
@@ -0,0 +1,66 @@
+//
+// WindowsService.cs
+//
+// Authors:
+//   Gabriel Burt <gabriel burt gmail com>
+//
+// Copyright 2011 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Linq;
+using System.Collections;
+using Gtk;
+using Mono.Unix;
+
+using Banshee.ServiceStack;
+using Banshee.Gui;
+using Hyena.Downloader;
+
+using GLib;
+using System.Management;
+
+namespace Banshee.Windows
+{
+    public class WindowsService : IExtensionService, IDisposable
+    {
+        bool disposed;
+
+        void IExtensionService.Initialize ()
+        {
+            // TODO check for updates and other cool stuff
+        }
+
+        public void Dispose ()
+        {
+            if (disposed) {
+                return;
+            }
+            
+            disposed = true;
+        }
+
+        string IService.ServiceName {
+            get { return "WindowsService"; }
+        }
+    }
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]