Implement protocol handler

This commit is contained in:
serras 2012-02-27 15:56:45 +01:00
parent 0b3e4f6f7e
commit 9f2fb59b2f
6 changed files with 114 additions and 11 deletions

View file

@ -26,6 +26,7 @@ using System.Threading;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using CefSharp;
using Microsoft.Win32;
namespace SparkleShare {
@ -111,17 +112,6 @@ namespace SparkleShare {
}
}
/*public override string GetAvatar (string email, int size)
{
if (string.IsNullOrEmpty (email)) {
return "application://sparkleshare/avatar-default-32.png";
}
string avatar_file_path = SparkleHelpers.CombineMore (
SparklePaths.SparkleLocalIconPath, size + "x" + size, "status", "avatar-" + email);
return avatar_file_path;
}*/
// Creates a .desktop entry in autostart folder to
// start SparkleShare automatically at login
@ -132,6 +122,22 @@ namespace SparkleShare {
public override void InstallProtocolHandler()
{
// Get assembly location
string location = System.Reflection.Assembly.GetExecutingAssembly().Location;
string folder = Path.GetDirectoryName(location);
string inviteExe = Path.Combine(folder, "SparkleShareInviteOpen.exe");
// Register protocol handler as explained in
// http://msdn.microsoft.com/en-us/library/ie/aa767914(v=vs.85).aspx
string mainKey = "HKEY_CLASSES_ROOT\\sparkleshare";
Registry.SetValue(mainKey, "", "SparkleShare Invites");
Registry.SetValue(mainKey, "URL Protocol", "");
string iconKey = "HKEY_CLASSES_ROOT\\sparkleshare\\DefaultIcon";
Registry.SetValue(iconKey, "", inviteExe + ",1");
string actionKey = "HKEY_CLASSES_ROOT\\sparkleshare\\shell\\open\\command";
Registry.SetValue(actionKey, "", "\"" + inviteExe + "\" \"%1\"");
}

View file

@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShare", "SparkleShar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleLib", "..\..\SparkleLib\windows\SparkleLib.csproj", "{2C914413-B31C-4362-93C7-1AE34F09112A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleShareInviteOpen", "SparkleShareInviteOpen\SparkleShareInviteOpen.csproj", "{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -19,6 +21,10 @@ Global
{2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.Build.0 = Release|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -25,6 +25,8 @@
<File Id='avutil50.dll' Name='avutil-50.dll' Source='!(wix.root)\bin\avutil-50.dll' DiskId='1' />
<File Id='icudt42.dll' Name='icudt42.dll' Source='!(wix.root)\bin\icudt42.dll' DiskId='1' />
<File Id='libcef.dll' Name='libcef.dll' Source='!(wix.root)\bin\libcef.dll' DiskId='1' />
<File Id='sparkleshare.ico' Name='sparkleshare.ico' Source='!(wix.root)\bin\sparkleshare.ico' DiskId='1' />
<File Id='SparkleShareInviteOpen.exe' Name='SparkleShareInviteOpen.exe' Source='!(wix.root)\bin\SparkleShareInviteOpen.exe' DiskId='1' />
</Component>
<Directory Id='MSYSGIT_DIR' Name='msysgit'>
</Directory>

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// La información general sobre un ensamblado se controla mediante el siguiente
// conjunto de atributos. Cambie estos atributos para modificar la información
// asociada con un ensamblado.
[assembly: AssemblyTitle("SparkleShareInviteOpen")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SparkleShareInviteOpen")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Si establece ComVisible como false, los tipos de este ensamblado no estarán visibles
// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde
// COM, establezca el atributo ComVisible como true en este tipo.
[assembly: ComVisible(false)]
// El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM
[assembly: Guid("5d15209c-88a2-4d7f-9934-af24b8c90c55")]
// La información de versión de un ensamblado consta de los cuatro valores siguientes:
//
// Versión principal
// Versión secundaria
// Número de versión de compilación
// Revisión
//
// Puede especificar todos los valores o establecer como predeterminados los números de versión de compilación y de revisión
// mediante el asterisco ('*'), como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SparkleShareInviteOpen</RootNamespace>
<AssemblyName>SparkleShareInviteOpen</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ApplicationIcon>..\..\..\data\icons\sparkleshare.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\sparkleshare-invite-open.cs">
<Link>sparkleshare-invite-open.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -11,6 +11,8 @@ cd lib
copy * ..\..\..\bin
cd ..
cp ..\..\data\icons\sparkleshare.ico ..\..\bin
%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="AnyCPU" %~dp0\tools\gettext-cs-utils\Gettext.CsUtils\Core\Gettext.Cs\Gettext.Cs.csproj
%msbuild% /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" %~dp0\SparkleShare.sln