/// <summary> /// Gets the default plugins used when a new plugin is created /// </summary> #region Default Plugins /// <summary> /// Trys to get a configured Light Setup Plugin (no specific ordering), /// failing that it will attempt to create a new Light Setup Plugin from the available types (no specific ordering) /// </summary> /// <returns>A list with one Light Setup Plugin</returns> /// <exception cref="ArgumentNullException"></exception> public SerializableInterfaceList<ILightSetupPlugin> DefaultLightSetupPlugins() { SerializableInterfaceList<ILightSetupPlugin> lightSetupPlugins = new SerializableInterfaceList<ILightSetupPlugin>(); Type type = AvailableLightSetupPlugins.FirstOrDefault(); if (type == null) { AfterglowRuntime.Logger.Fatal("No ILightSetupPlugin's have been loaded, please check the install and try again"); } else { ILightSetupPlugin plugin = null; if (this.Profiles.Any()) { plugin = this.Profiles.Last().LightSetupPlugin; } else { plugin = Activator.CreateInstance(type) as ILightSetupPlugin; } //Add at least one light if (!plugin.Lights.Any()) { plugin.Lights.Add(new Light() { Id = 1, Index = 0, Height = 1, Width = 1 }); } plugin.Id = this.GetNewId<ILightSetupPlugin>(); lightSetupPlugins.Add(plugin); } return lightSetupPlugins; }
/// <summary> /// Trys to get a configured Output Plugin (no specific ordering), /// failing that it will attempt to create a new Output Plugin from the available types (no specific ordering) /// </summary> /// <returns>A list with one Output Plugin</returns> /// <exception cref="ArgumentNullException"></exception> public SerializableInterfaceList<IOutputPlugin> DefaultOutputPlugins() { SerializableInterfaceList<IOutputPlugin> outputPlugins = new SerializableInterfaceList<IOutputPlugin>(); Type type = AvailableOutputPlugins.FirstOrDefault(); if (type == null) { AfterglowRuntime.Logger.Fatal("No IOutputPlugin's have been loaded, please check the install and try again"); } else { IOutputPlugin plugin = Activator.CreateInstance(type) as IOutputPlugin; plugin.Id = this.GetNewId<IOutputPlugin>(); outputPlugins.Add(plugin); } return outputPlugins; }
/// <summary> /// Trys to get a configured Capture Setup Plugin (no specific ordering), /// failing that it will attempt to create a new Capture Plugin from the available types (trys CopyScreenCapture first then, no specific ordering) /// </summary> /// <returns>A list with one Capture Plugin</returns> /// <exception cref="ArgumentNullException"></exception> public SerializableInterfaceList<ICapturePlugin> DefaultCapturePlugins() { SerializableInterfaceList<ICapturePlugin> capturePlugins = new SerializableInterfaceList<ICapturePlugin>(); Type type = AvailableCapturePlugins.Where(a => a.Name == "CopyScreenCapture").FirstOrDefault(); if (type == null) { type = AvailableCapturePlugins.FirstOrDefault(); } if (type == null) { AfterglowRuntime.Logger.Fatal("No ICapturePlugin's have been loaded, please check the install and try again"); } else { ICapturePlugin plugin = Activator.CreateInstance(type) as ICapturePlugin; plugin.Id = this.GetNewId<ICapturePlugin>(); capturePlugins.Add(plugin); } return capturePlugins; }