public StageContainer Build(JObject configuration) { var stageConfiguration = new StageConfiguration(configuration); StageContainer result = new StageContainer(); result.InputSelector = this.builderProvider.Resolve <ICodeFileSelector>(stageConfiguration.Input.BuilderName).Build(stageConfiguration.Input.Configuration); if (stageConfiguration.Output != null) { result.FinalOutputSelector = this.builderProvider.Resolve <ICodeFileSelector>(stageConfiguration.Output.BuilderName).Build(stageConfiguration.Output.Configuration); } Dictionary <string, ICodeFileDestination> mappers = new Dictionary <string, ICodeFileDestination>(); foreach (var mapper in stageConfiguration.CodeStreamMappers) { mappers.Add(mapper.Key, this.builderProvider.Resolve <ICodeFileDestination>(mapper.Value.BuilderName).Build(mapper.Value.Configuration)); } result.OutputCodeStreamRenames = stageConfiguration.OutputCodeStreamRenames; result.CodeFileDestinations = mappers; result.Stage = this.BuildPluginStage(stageConfiguration.Plugin, stageConfiguration.Name); result.CleanDestinations = stageConfiguration.CleanDestinations; return(result); }
private List <System.Web.Mvc.SelectListItem> LoadStages(long?stageId = null, PhenologicalStage phenologicalState = null) { StageConfiguration sc = new StageConfiguration(); List <Stage> stage = sc.GetAllStage(); List <System.Web.Mvc.SelectListItem> result = new List <SelectListItem>(); foreach (var item in stage) { bool isSelected = false; if (phenologicalState != null && stageId.HasValue) { isSelected = (phenologicalState.StageId == stageId); } SelectListItem sl = new SelectListItem() { Value = item.StageId.ToString(), Text = item.Name, Selected = isSelected }; result.Add(sl); } return(result); }
protected override void Create(bool creating) { StageConfiguration untypedStageConfiguration; StageConfiguration <TStageSpecificConfiguration> typedStageConfiguration; base.Create(creating); if (!creating) { return; } untypedStageConfiguration = base.Configuration; if ((object)untypedStageConfiguration == null) { throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", nameof(untypedStageConfiguration))); } if ((object)untypedStageConfiguration.StageSpecificConfiguration == null) { throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", nameof(untypedStageConfiguration.StageSpecificConfiguration))); } typedStageConfiguration = new StageConfiguration <TStageSpecificConfiguration>(untypedStageConfiguration); if ((object)typedStageConfiguration.StageSpecificConfiguration == null) { throw new InvalidOperationException(string.Format("Configuration missing: '{0}'.", nameof(typedStageConfiguration.StageSpecificConfiguration))); } this.Configuration = typedStageConfiguration; this.AssertValidConfiguration(); }
protected override void Dispose(bool disposing) { if (disposing) { this.Configuration = null; } base.Dispose(disposing); }
protected override async Task DisposeAsync(bool disposing, CancellationToken cancellationToken) { if (disposing) { this.Configuration = null; } await base.DisposeAsync(disposing, cancellationToken); }
public TKSimpleStyle(Dimension targetDimension) : base(targetDimension) { TalkingHeadConfig = new TalkingHeadConfiguration { Crop = new CropDimensions(0.2f, 0.0f, 0.6f, 0.8f, targetDimension), ChromaKeyTalkingHead = false }; StageConfig = new StageConfiguration { SlideTransformation = new TranslateScaleAndDeformTransformation(0.008f, 0.014f, 0.75f, 0.03f, targetDimension), }; }
public TKStudioStyle(Dimension targetDim) : base(targetDim) { ChromaKeyParams = new ChromaKeyParameters { Color = "0x249561", Similarity = "0.13", Blend = "0.001" }; TalkingHeadConfig = new TalkingHeadConfiguration { Crop = new CropDimensions(0.16f, 0.1f, 0.6f, 0.8f, targetDim), ChromaKeyTalkingHead = true }; StageConfig = new StageConfiguration { ChromaKeyTalkingHead = true, SlideTransformation = new TranslateScaleAndDeformTransformation(0.008f, 0.014f, 0.75f, 0.03f, targetDim), SpeakerTransformation = new TranslateScaleAndDeformTransformation(0.49f, 0.30f, 0.75f, 0, targetDim) }; }
public static ISyncProcessorBuilder UseMiddleware(this ISyncProcessorBuilder processorBuilder, Type processorType, StageConfiguration stageConfiguration) { if ((object)processorBuilder == null) { throw new ArgumentNullException(nameof(processorBuilder)); } if ((object)processorType == null) { throw new ArgumentNullException(nameof(processorType)); } if ((object)stageConfiguration == null) { throw new ArgumentNullException(nameof(stageConfiguration)); } return(processorBuilder.Use(next => { return (context, configuration, channel) => { ISyncProcessor processor; ISyncChannel newChannel; processor = (ISyncProcessor)Activator.CreateInstance(processorType); if ((object)processor == null) { throw new InvalidOperationException(nameof(processor)); } using (processor) { processor.Configuration = stageConfiguration; processor.Create(); processor.PreExecute(context, configuration); newChannel = processor.Process(context, configuration, channel, next); processor.PostExecute(context, configuration); return newChannel; } }; })); }
public static ISyncProcessorBuilder UseMiddleware(this ISyncProcessorBuilder processorBuilder, ISyncProcessor processor, StageConfiguration stageConfiguration) { if ((object)processorBuilder == null) { throw new ArgumentNullException(nameof(processorBuilder)); } if ((object)processor == null) { throw new ArgumentNullException(nameof(processor)); } if ((object)stageConfiguration == null) { throw new ArgumentNullException(nameof(stageConfiguration)); } return(processorBuilder.Use(next => { return (context, configuration, channel) => { ISyncProcessor _processor = processor; // prevent closure bug ISyncChannel newChannel; using (_processor) { _processor.Configuration = stageConfiguration; _processor.Create(); _processor.PreExecute(context, configuration); newChannel = _processor.Process(context, configuration, channel, next); _processor.PostExecute(context, configuration); return newChannel; } }; })); }
public static IAsyncProcessorBuilder UseMiddlewareAsync(this IAsyncProcessorBuilder asyncProcessorBuilder, Type asyncProcessorType, StageConfiguration stageConfiguration) { if ((object)asyncProcessorBuilder == null) { throw new ArgumentNullException(nameof(asyncProcessorBuilder)); } if ((object)asyncProcessorType == null) { throw new ArgumentNullException(nameof(asyncProcessorType)); } if ((object)stageConfiguration == null) { throw new ArgumentNullException(nameof(stageConfiguration)); } return(asyncProcessorBuilder.UseAsync(asyncNext => { return async(asyncContext, configuration, asyncChannel, cancellationToken) => { IAsyncProcessor asyncProcessor; IAsyncChannel newAsyncChannel; asyncProcessor = (IAsyncProcessor)Activator.CreateInstance(asyncProcessorType); if ((object)asyncProcessor == null) { throw new InvalidOperationException(nameof(asyncProcessor)); } using (AsyncDisposal.Await(asyncProcessor, cancellationToken)) { asyncProcessor.Configuration = stageConfiguration; await asyncProcessor.CreateAsync(cancellationToken); await asyncProcessor.PreExecuteAsync(asyncContext, configuration, cancellationToken); newAsyncChannel = await asyncProcessor.ProcessAsync(asyncContext, configuration, asyncChannel, asyncNext, cancellationToken); await asyncProcessor.PostExecuteAsync(asyncContext, configuration, cancellationToken); return newAsyncChannel; } }; })); }
public static IAsyncProcessorBuilder UseMiddlewareAsync(this IAsyncProcessorBuilder asyncProcessorBuilder, IAsyncProcessor asyncProcessor, StageConfiguration stageConfiguration) { if ((object)asyncProcessorBuilder == null) { throw new ArgumentNullException(nameof(asyncProcessorBuilder)); } if ((object)asyncProcessor == null) { throw new ArgumentNullException(nameof(asyncProcessor)); } if ((object)stageConfiguration == null) { throw new ArgumentNullException(nameof(stageConfiguration)); } return(asyncProcessorBuilder.UseAsync(asyncNext => { return async(asyncContext, configuration, asyncChannel, cancellationToken) => { IAsyncProcessor _asyncProcessor = asyncProcessor; // prevent closure bug IAsyncChannel newAsyncChannel; using (AsyncDisposal.Await(_asyncProcessor, cancellationToken)) { _asyncProcessor.Configuration = stageConfiguration; await _asyncProcessor.CreateAsync(cancellationToken); await _asyncProcessor.PreExecuteAsync(asyncContext, configuration, cancellationToken); newAsyncChannel = await _asyncProcessor.ProcessAsync(asyncContext, configuration, asyncChannel, asyncNext, cancellationToken); await _asyncProcessor.PostExecuteAsync(asyncContext, configuration, cancellationToken); return newAsyncChannel; } }; })); }
public static int ReturnAmountOfStagesIn(int groupIndex) => StageConfiguration.ReturnAmountOfStagesInGroup(groupIndex);
private static AssetReference ReturnStageAsAssetReference(int stageGroup, int stage) => StageConfiguration.ReturnAssetReferenceForStage(stageGroup, stage);
public static int ReturnStageIndex(int stageGroup, int stage) => StageConfiguration.ReturnAssetReferenceIndex(stageGroup, stage);