-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - Reorganized folder hierarchy - Added Solution file - Updated Nuget * - Updated AssemblyInfo - Updated XML Comments - Added Nuspec file to create a NuGet package * - Added test application
- Loading branch information
Showing
19 changed files
with
617 additions
and
125 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30204.135 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeMessaging", "NativeMessaging\NativeMessaging.csproj", "{7617A281-576A-4478-BFA7-44530AC2ED6C}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NativeMessagingTest", "NativeMessagingTest\NativeMessagingTest.csproj", "{4F8A86C0-4F0B-469E-BF2A-B1E6A3C403BF}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{7617A281-576A-4478-BFA7-44530AC2ED6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7617A281-576A-4478-BFA7-44530AC2ED6C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7617A281-576A-4478-BFA7-44530AC2ED6C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7617A281-576A-4478-BFA7-44530AC2ED6C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{4F8A86C0-4F0B-469E-BF2A-B1E6A3C403BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{4F8A86C0-4F0B-469E-BF2A-B1E6A3C403BF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{4F8A86C0-4F0B-469E-BF2A-B1E6A3C403BF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{4F8A86C0-4F0B-469E-BF2A-B1E6A3C403BF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {CC8CA26A-ABD0-4BEC-90D4-19A6DAB2D068} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NativeMessaging | ||
{ | ||
/// <summary> | ||
/// Exception raised when trying to interact with chrome while the extension is not registered in the Windows Registry | ||
/// </summary> | ||
[Serializable] | ||
public class NotRegisteredWithChromeException : Exception | ||
{ | ||
internal NotRegisteredWithChromeException() { } | ||
internal NotRegisteredWithChromeException(string message) : base(message) { } | ||
internal NotRegisteredWithChromeException(string message, Exception inner) : base(message, inner) { } | ||
internal NotRegisteredWithChromeException( | ||
System.Runtime.Serialization.SerializationInfo info, | ||
System.Runtime.Serialization.StreamingContext context) : base(info, context) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package > | ||
<metadata> | ||
<id>$id$</id> | ||
<version>$version$</version> | ||
<title>$title$</title> | ||
<authors>Alex Newton Levey</authors> | ||
<owners>anewtonlevey</owners> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<license type="expression">MIT</license> | ||
<description>C# Chome Native Messaging Library</description> | ||
<copyright>$copyright$</copyright> | ||
<tags>Chrome Extension Chromium Native Messaging</tags> | ||
<repository type="git" url="https://github.com/anewtonlevey/NativeMessaging" /> | ||
</metadata> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("Chromium Native Messaging Host")] | ||
[assembly: AssemblyDescription("C# Chome Native Messaging Library")] | ||
[assembly: AssemblyProduct("Chromium Native Messaging Host")] | ||
[assembly: AssemblyCopyright("Copyright © Alex Newton Levey 2017")] | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("7617a281-576a-4478-bfa7-44530ac2ed6c")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" /> | ||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using NativeMessaging; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace NativeMessagingTest { | ||
public class MyHost : Host { | ||
// This can currently be used with the example app provided here: | ||
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/docs/examples/api/nativeMessaging | ||
|
||
private const bool SendConfirmationReceipt = true; | ||
|
||
public override string Hostname { | ||
get { return "com.google.chrome.example.echo"; } | ||
} | ||
|
||
public MyHost() : base(SendConfirmationReceipt) { | ||
|
||
} | ||
|
||
protected override void ProcessReceivedMessage(JObject data) { | ||
SendMessage(data); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{4F8A86C0-4F0B-469E-BF2A-B1E6A3C403BF}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>NativeMessagingTest</RootNamespace> | ||
<AssemblyName>NativeMessagingTest</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="MyHost.cs" /> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\NativeMessaging\NativeMessaging.csproj"> | ||
<Project>{7617a281-576a-4478-bfa7-44530ac2ed6c}</Project> | ||
<Name>NativeMessaging</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using NativeMessaging; | ||
|
||
namespace NativeMessagingTest { | ||
class Program { | ||
static public string AssemblyLoadDirectory { | ||
get { | ||
string codeBase = Assembly.GetEntryAssembly().CodeBase; | ||
UriBuilder uri = new UriBuilder(codeBase); | ||
string path = Uri.UnescapeDataString(uri.Path); | ||
return Path.GetDirectoryName(path); | ||
} | ||
} | ||
|
||
static public string AssemblyExecuteablePath { | ||
get { | ||
string codeBase = Assembly.GetEntryAssembly().CodeBase; | ||
UriBuilder uri = new UriBuilder(codeBase); | ||
return Uri.UnescapeDataString(uri.Path); | ||
} | ||
} | ||
|
||
static Host Host; | ||
|
||
static string[] AllowedOrigins = new string[] { "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/" }; | ||
static string Description = "Description Goes Here"; | ||
|
||
static void Main(string[] args) { | ||
Host = new MyHost(); | ||
if (args.Contains("--register")) { | ||
Host.GenerateManifest(Description, AllowedOrigins); | ||
Host.Register(); | ||
} else if (args.Contains("--unregister")) { | ||
Host.UnRegister(); | ||
} else { | ||
Host.Listen(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
[assembly: AssemblyTitle("Chromium Native Messaging Host Test Project")] | ||
[assembly: AssemblyDescription("C# Chome Native Messaging Library")] | ||
[assembly: AssemblyProduct("Chromium Native Messaging Host")] | ||
[assembly: AssemblyCopyright("Copyright © Alex Newton Levey 2017")] | ||
|
||
[assembly: ComVisible(false)] | ||
|
||
[assembly: Guid("4f8a86c0-4f0b-469e-bf2a-b1e6a3c403bf")] | ||
|
||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net452" /> | ||
</packages> |
Oops, something went wrong.