static void Main(string[] args) { if (args.Any(a => !a.Equals("-Embedding", StringComparison.InvariantCultureIgnoreCase))) { var startCommand = System.Reflection.Assembly.GetEntryAssembly().Location; if (args.Length == 1) { if (args[0].Equals("/i", StringComparison.CurrentCultureIgnoreCase) || args[0].Equals("/install", StringComparison.CurrentCultureIgnoreCase)) { PluginMessageLoop.Register(Guid.Parse(PluginClsid), PluginProgId, startCommand); return; } else if (args[0].Equals("/u", StringComparison.CurrentCultureIgnoreCase) || args[0].Equals("/uninstall", StringComparison.CurrentCultureIgnoreCase)) { PluginMessageLoop.Unregister(Guid.Parse(PluginClsid)); return; } } PrintUsage(startCommand); return; } else { var broker = new ChannelBroker(); Application.Run(new BrokerMessageLoop(broker.AcceptConnection, broker)); } }
public BrokerMessageLoop(Action <IAsyncDvcChannel> acceptHandler, ChannelBroker targetBroker) : base(new Dictionary <string, Action <IAsyncDvcChannel> >() { { BrokerChannelName, acceptHandler } }, Guid.Parse(PluginClsid), false) { this.BrokerRegistration = new ClassObjectRegistration(Guid.Parse(BrokerClsid), CreateClassFactoryFor(() => targetBroker), CLSCTX.LOCAL_SERVER, REGCLS.MULTIPLEUSE | REGCLS.SUSPENDED); CoResumeClassObjects(); }
public UnregisterProxy(ChannelBroker channelBroker, ServiceRegistration existingRegistration) { this.Broker = channelBroker; this.Registration = new WeakReference <ServiceRegistration>(existingRegistration); }