internal ProxyPlugin(string pluginFile, TrainBase train) { externalCrashed = false; PluginTitle = System.IO.Path.GetFileName(pluginFile); //Load the plugin via the proxy callback var handle = Process.GetCurrentProcess().MainWindowHandle; try { var hostProcess = new Process(); hostProcess.StartInfo.FileName = @"Win32PluginProxy.exe"; hostProcess.Start(); HostInterface.Win32PluginHostReady.WaitOne(); pipeProxy = new DuplexChannelFactory <IAtsPluginProxy>(new InstanceContext(this), new NetNamedPipeBinding(), new EndpointAddress(HostInterface.Win32PluginHostEndpointAddress)).CreateChannel(); pipeProxy.SetPluginFile(pluginFile, Process.GetCurrentProcess().Id); SetForegroundWindow(handle.ToInt32()); } catch { //That didn't work externalCrashed = true; } PluginValid = true; PluginMessage = null; Train = train; Panel = new int[256]; SupportsAI = AISupport.None; switch (PluginTitle.ToLowerInvariant()) { case "ukdt.dll": SupportsAI = AISupport.Program; AI = new UKDtAI(this); break; case "ukspt.dll": SupportsAI = AISupport.Program; AI = new UKSptAI(this); break; case "ukmut.dll": SupportsAI = AISupport.Program; AI = new UKMUtAI(this); break; case "hei_ats.dll": SupportsAI = AISupport.Program; AI = new HeiAtsAI(this); break; } LastTime = 0.0; LastReverser = -2; LastPowerNotch = -1; LastBrakeNotch = -1; LastAspects = new int[] { }; LastSection = -1; LastException = null; Sound = new int[256]; LastSound = new int[256]; }
public static PluginInformation With( PluginId id, PluginTitle title, PluginVersion version, PluginDescription description, Uri uri) { return new PluginInformation( id, title, version, description, uri); }
public void Start(Action <Action <IPluginRegistration> > pluginRegistra) { pluginRegistra(r => { var assembly = typeof(JokesPluginBootstrapper).Assembly; r.SetPluginInformation(PluginInformation.With( PluginId.From(assembly), PluginTitle.With("Jokes"), PluginVersion.From(assembly), PluginDescription.With("Provides jokes"), r.Uri)); r.RegisterHttpApi(new JokesApi(r.ConfigApi, r.HttpApi, r.MessageApi)); r.RegisterHttpApiCommands(); }); }
public void Start(Action <Action <IPluginRegistration> > pluginRegistra) { pluginRegistra(r => { var assembly = typeof(HelpPluginBootstrapper).Assembly; r.SetPluginInformation(PluginInformation.With( PluginId.From(assembly), PluginTitle.With("Help"), PluginVersion.From(assembly), PluginDescription.With("Provides help for the Borg"), r.Uri)); r.RegisterHttpApi(new HelpApi(r.HttpApi, r.MessageApi, r.PluginApi)); r.RegisterHttpApiCommands(); }); }
public void Start(Action <Action <IPluginRegistration> > pluginRegistra) { pluginRegistra(r => { var assembly = typeof(GitHubPluginBootstrapper).Assembly; var gitHubClientFactory = new GitHubClientFactory(r.ConfigApi); var gitHubService = new GitHubService(gitHubClientFactory); r.SetPluginInformation(PluginInformation.With( PluginId.From(assembly), PluginTitle.With("GitHub"), PluginVersion.From(assembly), PluginDescription.With("Provides GitHub support for the Borg"), r.Uri)); r.RegisterHttpApi(new GitHubApi(r.MessageApi, gitHubService)); r.RegisterHttpApiCommands(); }); }
// --- constructors --- internal Win32Plugin(string pluginFile, TrainBase train) { base.PluginTitle = System.IO.Path.GetFileName(pluginFile); base.PluginValid = true; base.PluginMessage = null; base.Train = train; base.Panel = new int[256]; base.SupportsAI = AISupport.None; switch (PluginTitle.ToLowerInvariant()) { case "ukdt.dll": SupportsAI = AISupport.Program; AI = new UKDtAI(this); break; case "ukspt.dll": SupportsAI = AISupport.Program; AI = new UKSptAI(this); break; case "ukmut.dll": SupportsAI = AISupport.Program; AI = new UKMUtAI(this); break; case "hei_ats.dll": SupportsAI = AISupport.Program; AI = new HeiAtsAI(this); break; } base.LastTime = 0.0; base.LastReverser = -2; base.LastPowerNotch = -1; base.LastBrakeNotch = -1; base.LastAspects = new int[] { }; base.LastSection = -1; base.LastException = null; this.PluginFile = pluginFile; this.Sound = new int[256]; this.LastSound = new int[256]; this.PanelHandle = new GCHandle(); this.SoundHandle = new GCHandle(); }
public PluginInformation( PluginId id, PluginTitle title, PluginVersion version, PluginDescription description, Uri uri) { if (id == null) throw new ArgumentNullException(nameof(id)); if (title == null) throw new ArgumentNullException(nameof(title)); if (version == null) throw new ArgumentNullException(nameof(version)); if (description == null) throw new ArgumentNullException(nameof(description)); if (uri == null) throw new ArgumentNullException(nameof(uri)); Id = id; Title = title; Version = version; Description = description; Uri = uri; }