• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

luttje / Key2Joy / 6883578120

15 Nov 2023 10:18PM UTC coverage: 44.758% (-0.2%) from 44.916%
6883578120

push

github

web-flow
Fix notes and warning styling

798 of 2447 branches covered (0.0%)

Branch coverage included in aggregate %.

4035 of 8351 relevant lines covered (48.32%)

1396.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.5
/Core/Key2Joy.PluginHost/Program.cs
1
using System;
2
using System.Collections;
3
using System.Diagnostics;
4
using System.Runtime.Remoting;
5
using System.Runtime.Remoting.Channels;
6
using System.Runtime.Remoting.Channels.Ipc;
7
using System.Runtime.Serialization.Formatters;
8
using System.Windows.Threading;
9
using Key2Joy.Contracts;
10
using Key2Joy.Contracts.Plugins.Remoting;
11
using static Key2Joy.PluginHost.Native;
12

13
namespace Key2Joy.PluginHost;
14

15
internal class Program
16
{
17
    public static Dispatcher AppDispatcher { get; private set; }
14✔
18

19
    private static string portName;
20

21
    [STAThread]
22
    private static void Main(string[] args)
23
    {
24
        if (args.Length != 1)
14!
25
        {
26
            Console.Error.WriteLine("Usage: PluginHost name");
×
27
            return;
×
28
        }
29

30
        SetConsoleCtrlHandler(ProcessExitHandler, true);
14✔
31

32
        try
33
        {
34
            portName = args[0];
14✔
35
            Console.WriteLine("Starting PluginHost {0}", portName);
14✔
36

37
            AppDispatcher = Dispatcher.CurrentDispatcher;
14✔
38

39
            BinaryServerFormatterSinkProvider serverProvider = new() { TypeFilterLevel = TypeFilterLevel.Full };
14✔
40
            BinaryClientFormatterSinkProvider clientProvider = new();
14✔
41
            Hashtable properties = new();
14✔
42
            properties["portName"] = portName;
14✔
43

44
            // Note:https://github.com/microsoft/win32-app-isolation/issues/16
45
            IpcChannel channel = new(properties, clientProvider, serverProvider);
14✔
46
            ChannelServices.RegisterChannel(channel, false);
14✔
47

48
            RemotingConfiguration.RegisterWellKnownServiceType(
14✔
49
                typeof(PluginHost), nameof(PluginHost), WellKnownObjectMode.Singleton);
14✔
50

51
            RemoteEventSubscriber.InitClient(portName);
14✔
52
            RemoteEventSubscriber.ClientInstance.Disposing += (s, e) => AppDispatcher.InvokeShutdown();
14✔
53
            Console.WriteLine($"Connected to pipe @ {RemotePipe.GetClientPipeName(portName)}");
14✔
54

55
            Dispatcher.Run();
14✔
56
        }
×
57
        catch (Exception ex)
×
58
        {
59
            Output.WriteLine(ex);
×
60
            Debugger.Launch();
×
61
            var mostInnerException = ex;
×
62

63
            while (mostInnerException.InnerException != null)
×
64
            {
65
                mostInnerException = mostInnerException.InnerException;
×
66
            }
67

68
            RemoteEventSubscriber.ClientInstance.Exit();
×
69
            Console.WriteLine(mostInnerException.Message);
×
70
        }
×
71
    }
×
72

73
    private static bool ProcessExitHandler(CtrlType sig)
74
    {
75
        RemoteEventSubscriber.ClientInstance.Exit();
×
76
        Console.WriteLine("Sending close signal...");
×
77
        return false;
×
78
    }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc