private void PerformTransformations( ConcurrentDictionary <string, object> objectCache, IIncludeContext includeContext, ServerDefinition server, string role, StageDefinition stage) { _logMessageSink.EnterBlock(sink => { string environmentPath = Path.Combine(server.OutputPath, $"{role}.json"); try { sink.Message($"------------------------------------------------------------------------------------------------------\nStarting {environmentPath}"); TargetingInformation targetingInformation = new TargetingInformation { Replication = server.Replication, Role = role, Stage = stage.Stage, Server = server.Server }; // This needs to be created per file creation thread TransformationContext transformationContext = new TransformationContext(); // use the shared cache created in the wrapping service method to share resource reads. transformationContext.Cache = objectCache; PatchingTemplate template = _templateProvider.GetTemplate(transformationContext, targetingInformation.Role); JArray runtimeTemplate = JArray.Parse(template.String); transformationContext.SetPluginPolicy(includeContext); transformationContext.SetPluginPolicy(targetingInformation); transformationContext.SetPluginPolicy(sink); _transformationEngine.EvaluateMakros(transformationContext, runtimeTemplate); File.WriteAllText(environmentPath, JsonConvert.SerializeObject(runtimeTemplate, Formatting.Indented)); sink.Message($"Finished {environmentPath}\n------------------------------------------------------------------------------------------------------"); } catch (Exception e) { sink.Error($"Error while generating {environmentPath}...\n{e.ToString()}"); } }); }
public static bool PluginIncludeConditionDelegate(ITransformationContext context, JObject conditionNode) { TargetingInformation targetingInformation = context.GetPluginPolicy <TargetingInformation>(); JObject targetInformation = (JObject)conditionNode["targetInformation"]; bool canApply = true; if (targetInformation["targetStages"] != null) { canApply &= targetInformation["targetStages"] .Values <string>() .Contains(targetingInformation.Stage); } if (targetInformation["targetServers"] != null) { canApply &= targetInformation["targetServers"] .Values <string>() .Contains(targetingInformation.Server); } if (targetInformation["targetRoles"] != null) { canApply &= targetInformation["targetRoles"] .Values <string>() .Contains(targetingInformation.Role); } if (targetInformation["targetReplications"] != null) { if (string.IsNullOrEmpty(targetingInformation.Replication)) { return(false); } canApply &= targetInformation["targetReplications"] .Values <string>() .Contains(targetingInformation.Replication); } return(canApply); }
private void CheckAbility(TargetingInformation targetInfo) { }
private void StartMovementPathLogic() { targetInfo = unitMovement.PassTargetInfo(); StartCoroutine(GenerateMovementPath(targetInfo.startingPoint, targetInfo.targetPoint)); MoveUnit(); }
private void StoreTargetInfo(Vector3 startingPos, Vector3 targetPos) { targetInformation = new TargetingInformation(startingPos, targetPos); }