Coder Social home page Coder Social logo

acandylevey / nativemessaging Goto Github PK

View Code? Open in Web Editor NEW
70.0 4.0 26.0 41 KB

C# Chome Native Messaging Library

License: MIT License

C# 100.00%
nativemessaging chrome native-messaging native-messaging-host edge chromium chrome-native-messaging edge-native-messaging chromium-native-messaging chrome-extension

nativemessaging's People

Contributors

acandylevey avatar albertopa avatar floydfix avatar jerecknet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nativemessaging's Issues

Nuget update to flag Dotnet6 support

As per title, can the nuget package be updated (or a new submission made if updating that one is not possible) to include the fact that Dotnet6 is supported?

The current nuget version actually seems to work ok, but I'm getting warnings in vscode because it doesn't declare that it supports dotnet6, e.g. the microsoft C# plugin reports errors on load and outputs:

Error: Package 'NativeMessaging 2.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net6.0-windows7.0'. This package may not be fully compatible with your project.

and dotnet build gives:

warning NU1701: Package 'NativeMessaging 2.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,V
ersion=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the  
project target framework 'net6.0-windows7.0'. This package may not be fully compatible with your project.

Thanks!

Port to .Net 6

I have made a few modifications to port NativeMessaging to .Net 6 for a small project. They are here: https://github.com/AlbertoPa/NativeMessaging. If you think they are useful or want to merge them, let me know and I can make a PR.

I also plan to add a small example of extension, since the one linked in the code is not available anymore.

Thanks for your work!

C# console app not receiving messages

The .exe gets launched when I use the example chrome extension and press "connect" but when I press send the c# program doesn't do anything

public class ChromeServerHost : Host
    {
        private const bool SendConfirmationReceipt = true;

        public override string Hostname
        {
            get { return "com.google.chrome.example.echo-manifest.json"; }
        }

        public ChromeServerHost() : base(SendConfirmationReceipt)
        {

        }

        protected override void ProcessReceivedMessage(JObject data)
        {
            Console.WriteLine("HELLO");
            SendMessage(data);
        }
    }

Then in main I have

ChromeServerHost host = new ChromeServerHost();
host.Listen();

It is registered correctly,

private JObject Read()
        {
            Utils.LogMessage("Waiting for Data");
            var stdin = Console.OpenStandardInput();

            var lengthBytes = new byte[4];
            Console.WriteLine("HELLO1");
            stdin.Read(lengthBytes, 0, 4);
            Console.WriteLine("HELLO2");
            var buffer = new char[BitConverter.ToInt32(lengthBytes, 0)];

            using (var reader = new StreamReader(stdin)) while (reader.Peek() >= 0) reader.Read(buffer, 0, buffer.Length);

            return JsonConvert.DeserializeObject<JObject>(new string(buffer));
        };

Hello1 gets printed but not hello2, also the logger never logs "Data Received:"

How to use in console application?

I really like what you have done here but could you provide a sample console application that uses this library to communicate with the example Chrome extension that you made? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.