private static void VerifyNpc(INonPlayerCharacter npc) { VerifyMob(npc); string type = "NPC"; VerifyNpcType(npc, type); VerifyNpcLevel(npc, type); foreach (IPersonality personality in npc.Personalities) { IMerchant merchant = personality as IMerchant; if (merchant != null) { foreach (IItem item in merchant.Sellables) { VerifyItem(item); } } IPhase phase = personality as IPhase; if (phase != null) { if (!npc.God) { ThrowConfigException(npc, type, string.Format($"Npc {npc.ShortDescription} needs to have God mode turned on.")); } } } }
public static BinaryFileSchema CheckBfs(BinaryFileSchema schema, IBfsErrorHandler errorHandler) { handler = errorHandler; IPhase[] phases = new IPhase[] { new Environments(), new TypeLinking(), new Hierarchy(), new TypeChecking(), new DefiniteAssignment() }; gotError = false; foreach (IPhase phase in phases) { phase.Check(schema); if (gotError && errorHandler != null) { errorHandler.HandleMessage("Schema has errors. Compilation stopped."); return null; } } return schema; }
public void TakeTurn() { if (currentPhase.HasEnteredPhase == false) { currentPhase.RaisePhaseComplete += HandleOnPhaseCompleted; currentPhase.EnterPhase( ); } currentPhase.ExecutePhase( ); if (currentPhase.HasCompletedPhase == false) { return; } currentPhase = nextPhase; if (nextPhase == null) { OnTurnCompleted( ); return; } nextPhase = null; currentPhase.RaisePhaseComplete -= HandleOnPhaseCompleted; }
public EliminationPhaseViewVm(IPhase phase) { if (!(phase.GameStepList.First() is IEliminationStep firsStep)) { throw new NotSupportedException(); } EliminationStepList = new ObservableCollection <EliminationStepView>(); var countGameStep = EliminationStep.CountStep(firsStep.Type); for (var i = 0; i < countGameStep; i++) { EliminationStepList.Add(null); } for (var i = 0; i < phase.GameStepList.Count; i++) { var temp = phase.GameStepList[i] as EliminationStep; EliminationStepList[EliminationStep.IndexStep(temp.Type)] = new EliminationStepView(temp, i == 0, i + 1 == countGameStep); } phase.NextStepStarted += (sender, step) => { var temp = step as EliminationStep; var i = EliminationStep.IndexStep(temp.Type); EliminationStepList[i] = new EliminationStepView(temp, i + 1 == countGameStep, i == 0); }; }
protected GameStep(IPhase phase, IList <ITeam> teamList, IMatchSetting currentMatchSetting) : this() { if (teamList == null) { throw new ArgumentNullException(nameof(teamList)); } FlippingContainer.Instance.ComposeParts(this); foreach (var team in teamList) { var count = teamList.Count(item => item == team); if (count != 1) { throw new ArgumentException( $"La liste des équipes ne peut pas contenir plus deux fois la même équipe. Equipe:{team.Id}. Count:{count}."); } } Phase = phase ?? throw new ArgumentNullException(nameof(phase)); TeamList = teamList; CurrentMatchSetting = currentMatchSetting; MatchList = new List <IMatch>(); }
//funzione chiamata dall'OnClick del bottone next o registrata nel costruttore all'evento relativo public void ChangePhase() { this._currentPhaseManager.Unregister(); if (!this._preturnoPerTutti) { this._phaseIndex = (this._phaseIndex + 1) % Settings.PhaseManagers.Count(); this._currentPhaseManager = (IPhase)MainManager.GetManagerInstance(Settings.PhaseManagers.ElementAt(_phaseIndex)); } if (this._phaseIndex == 0 || this._preturnoPerTutti) { this.ChangeTurn(); } if (this._playerIndex == 0 && this._preturnoPerTutti) { this._preturnoPerTutti = false; } if (this.phaseChanged != null) { this.phaseChanged(this._currentPhaseManager.PhaseName); } this._currentPhaseManager.Register(); }
/// <summary> /// Create a new instance (in memory and database) of <see cref="T:Business.EliminationStep" /> with specified param /// </summary> /// <param name="phase">Phase linked to this new step</param> /// <param name="teamList">Team involved in this new step</param> /// <param name="matchSetting">Set setting match for new Elimination phase</param> /// <param name="firstStep">Set first step for elimination step</param> /// <returns>EliminationStep's instance</returns> public static IEliminationStep Create(IPhase phase, IList <ITeam> teamList, IMatchSetting matchSetting, EliminationType firstStep) { if (phase == null) { throw new ArgumentNullException(nameof(phase)); } if (teamList == null) { throw new ArgumentNullException(nameof(teamList)); } if (matchSetting == null) { throw new ArgumentNullException(nameof(matchSetting)); } var requiredTeam = (ushort)firstStep * 2; if (teamList.Count != requiredTeam) { throw new ArgumentException( $"La première étape de la phase éliminatoire ne correspond pas au nombre équipe fourni. Nombre d'équipe requise:{requiredTeam}. Nombre d'équipe:{teamList.Count}"); } var result = new EliminationStep(phase, teamList, matchSetting) { Type = firstStep }; return(result); }
private IPhase CreatePhaseInstance(PhaseDescriptor phaseDescriptor, IDictionary <string, string> parameterPool) { IPhase instance = Activator.CreateInstance(phaseDescriptor.Type) as IPhase; foreach (var parameter in phaseDescriptor.Parameters) { if (parameterPool.ContainsKey(parameter.Name)) { var value = parameterPool[parameter.Name]; var propertyInfo = parameter.PropertyInfo; if (propertyInfo.PropertyType == typeof(string)) { propertyInfo.SetValue(instance, value, null); } else if (propertyInfo.PropertyType == typeof(string[])) { propertyInfo.SetValue(instance, value.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries), null); } else { throw new SawPhaseException($"Unable to inject the value for parameter `{parameter.Name}`of phase `{phaseDescriptor.Name}`"); } } else { if (parameter.Required) { throw new SawPhaseException($"Missing required parameter `{parameter.Name}`"); } } } return(instance); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public ScreenBattle(IScreenLoader screenLoader, IWindowQueuer windowQueuer, IPhase startPhase, BattleData battleData) : base(screenLoader) { this.windowQueuer = windowQueuer; this.battleData = battleData; currentPhase = startPhase; windowBattle = new WindowBattle(new Vector2(0, 113), 240, 45); }
private void OnStartOfSimulation(object sender, EventArgs e) { stage = phenology.Stage; uptakeModels = Apsim.ChildrenRecursively(Parent, typeof(IUptake)); zones = Apsim.ChildrenRecursively(this.Parent, typeof(Zone)); previousPhase = phenology.CurrentPhase; DMPlantMax = 9999; }
private void OnStartOfSimulation(object sender, EventArgs e) { stage = phenology.Stage; uptakeModels = Apsim.ChildrenRecursively(Parent, typeof(IUptake)); zones = Apsim.ChildrenRecursively(this.Parent, typeof(Zone)); DaysTotal = new List <double>(); previousPhase = phenology.CurrentPhase; }
public override void Update(double gameTime) { currentPhase.Update(gameTime); if (currentPhase.IsDone) { currentPhase = currentPhase.GetNextPhase(); currentPhase.LoadContent(contentLoader, windowQueuer, battleData); } }
public IPhase ChangePhase(Situation situation, IPhase phase) { var oldPhase = _phaseStack.Pop(); oldPhase.Exit(situation); _phaseStack.Push(phase); phase.Start(situation); return oldPhase; }
public EliminationPhaseView(IPhase phase) { if (phase == null) { throw new ArgumentNullException(nameof(phase)); } InitializeComponent(); DataContext = new EliminationPhaseViewVm(phase); }
public PhaseExecutionHost(string workflowUniqueName, IPhase hostedPhase) { _workflowUniqueName = workflowUniqueName; _hostedPhase = hostedPhase; _predecessors = new List <PhaseExecutionHost>(); _successors = new List <PhaseExecutionHost>(); _predecessorIRs = new Dictionary <PhaseExecutionHost, IIR>(); ExecutionStarted = false; ExecutionComplete = false; }
public PhaseExecutionHost(string workflowUniqueName, IPhase hostedPhase) { _workflowUniqueName = workflowUniqueName; _hostedPhase = hostedPhase; _predecessors = new List<PhaseExecutionHost>(); _successors = new List<PhaseExecutionHost>(); _predecessorIRs = new Dictionary<PhaseExecutionHost, IIR>(); ExecutionStarted = false; ExecutionComplete = false; }
/// <summary> /// Immediately ends the current phase, as stored in GamePhaseSequencer. /// </summary> public void EndCurrentTurnPhase(IPhase nextPhase) { if (nextPhase == null) { Log.LogMsg("[" + GameID.ToString() + "] couldn't determine which phase should come after [" + nextPhase.PhaseName + "|" + nextPhase.PhaseID.ToString() + "]. Game is likely stuck now."); return; } GamePhaseSequencer.ClearSequence(); GamePhaseSequencer.AddItem(nextPhase as Phase, GetTurnPhaseDelay(nextPhase as Phase)); GamePhaseSequencer.ActivateNextItem(); }
private void PushPhase(string phaseID) { System.Runtime.Remoting.ObjectHandle handle = System.Activator.CreateInstance(_appProxyConfig.m_assemblyPrimary, phaseID); IPhase phase = handle.Unwrap() as IPhase; if (LoggingManager.Instance.Filter(LoggingManager.Domain.Phases)) { Debug.Log("(AppManager) Entering phase: " + phaseID + " (" + _phases.Count + ")"); } _phases.Add(phase); phase.Setup(this); }
public PhaseExecutionHost AddPhase(string WorkflowUniqueName, IPhase Phase) { if (this._PhaseExecutionHostsByWorkflowUniqueName.ContainsKey(WorkflowUniqueName)) { Message.Trace(Severity.Error, Resources.ErrorAttemptedWorkflowDuplicateUniquePhaseName, WorkflowUniqueName); return null; } PhaseExecutionHost Host = new PhaseExecutionHost(WorkflowUniqueName, Phase); this._PhaseExecutionHostsByWorkflowUniqueName.Add(WorkflowUniqueName, Host); this._PhaseWorkflow.Add(Host); return Host; }
public PhaseExecutionHost(string WorkflowUniqueName, IPhase HostedPhase) { this._WorkflowUniqueName = WorkflowUniqueName; this._HostedPhase = HostedPhase; this._Predecessors = new List <PhaseExecutionHost>(); this._Successors = new List <PhaseExecutionHost>(); this._PredecessorIRs = new Dictionary <PhaseExecutionHost, IIR>(); this.ExecutionStarted = false; this.ExecutionComplete = false; this.Message = MessageEngine.Create(String.Format("__PHASE EXECUTION HOST: {0}", WorkflowUniqueName)); }
private void Setup() { userInterface = GameObject.Find("UserInterface").GetComponent <IUserInterface>(); battlePhase = new BattlePhase(); itemStorePhase = new ItemStorePhase(); itemManager = new ItemManager(); playerStatus = new PlayerStatus(); userInterface.Setup(itemManager); battlePhase.Setup(userInterface, itemManager, playerStatus); itemStorePhase.Setup(userInterface, itemManager, playerStatus); itemManager.Setup(playerStatus); }
public PhaseExecutionHost AddPhase(string WorkflowUniqueName, IPhase Phase) { if (this._PhaseExecutionHostsByWorkflowUniqueName.ContainsKey(WorkflowUniqueName)) { Message.Trace(Severity.Error, Resources.ErrorAttemptedWorkflowDuplicateUniquePhaseName, WorkflowUniqueName); return(null); } PhaseExecutionHost Host = new PhaseExecutionHost(WorkflowUniqueName, Phase); this._PhaseExecutionHostsByWorkflowUniqueName.Add(WorkflowUniqueName, Host); this._PhaseWorkflow.Add(Host); return(Host); }
public Turn(IPlayer player) { this.player = player; State.GetInstance.CurrentPlayer = this.player; this.Phases.Add(new BeginningPhase(this.player)); this.Phases.Add(new MainPhase(this.player)); this.Phases.Add(new CombatPhase(this.player)); this.Phases.Add(new MainPhase(this.player)); this.Phases.Add(new EndingPhase(this.player)); this.currentPhase = this.Phases[0]; }
public void SupersedePhase(IPhase newPhase) { Clock.Stop(); CurrentPhase.SupersededBy = newPhase; newPhase.Supersedes = CurrentPhase; CurrentPhase.Pause(); CurrentPhase = newPhase; CurrentPhase.Start(); Clock.Start(CurrentPhase.Duration); }
public PhaseExecutionHost AddPhase(string workflowUniqueName, IPhase phase) { if (_phaseExecutionHostsByWorkflowUniqueName.ContainsKey(workflowUniqueName)) { MessageEngine.Trace(Severity.Error, Resources.ErrorAttemptedWorkflowDuplicateUniquePhaseName, workflowUniqueName); return(null); } var host = new PhaseExecutionHost(workflowUniqueName, phase); _phaseExecutionHostsByWorkflowUniqueName.Add(workflowUniqueName, host); _phaseWorkflow.Add(host); return(host); }
/// <summary>Gets the value.</summary> /// <value>The value.</value> /// <exception cref="System.Exception">Something is a miss here. Specifically, the number of values in your StageCode function don't match the number of stage names. Sort it out numb nuts!!</exception> public double Value(int arrayIndex = -1) { if (StageCodes == null) { StageCodes = new int[Stages.Length]; for (int i = 0; i < Stages.Length; i++) { IPhase p = Phenology.PhaseStartingWith(Stages[i]); StageCodes[i] = Phenology.IndexFromPhaseName(p.Name) + 1; } } //Fixme. For some reason this error message won't cast properly?? if (Codes.Length != StageCodes.Length) { throw new Exception("Something is a miss here. Specifically, the number of values in your StageCode function don't match the number of stage names. Sort it out numb nuts!!"); } for (int i = 0; i < StageCodes.Length; i++) { if (Phenology.Stage <= StageCodes[i]) { if (i == 0) { return(Codes[0]); } if (Phenology.Stage == StageCodes[i]) { return(Codes[i]); } if (Proportional) { double slope = MathUtilities.Divide(Codes[i] - Codes[i - 1], StageCodes[i] - StageCodes[i - 1], Codes[i]); return(Codes[i] + slope * (Phenology.Stage - StageCodes[i])); } else { // Simple lookup. return(Codes[i - 1]); } } } return(Codes[StageCodes.Length - 1]); }
public void NextPhase() { var currentPhaseNum = this.Phases.IndexOf(this.currentPhase); if (currentPhaseNum == this.Phases.Count - 1) { this.turnEnded = true; if (State.GetInstance.Me().HitPoints < 1 || State.GetInstance.Opponent().HitPoints < 1) { //Console.WriteLine("Game is over."); //Console.ReadLine(); } } else { this.currentPhase = this.Phases[currentPhaseNum + 1]; } }
/// <summary>A function that resets phenology to a specified stage</summary> public void ReSetToStage(double NewStage) { if (NewStage == 0) { throw new Exception(this + "Must pass positive stage to set to"); } int SetPhaseIndex = Convert.ToInt32(Math.Floor(NewStage)) - 1; CurrentPhase = phases[SetPhaseIndex]; IPhase Current = phases[CurrentPhaseIndex]; double proportionOfPhase = NewStage - CurrentPhaseIndex - 1; Current.FractionComplete = proportionOfPhase; if (PhaseRewind != null) { PhaseRewind.Invoke(this, new EventArgs()); } }
private PhaseManager() { this._players = MainManager.GetInstance().Players; this._currentPhaseManager = (IPhase)MainManager.GetManagerInstance(Settings.PhaseManagers.ElementAt(_phaseIndex)); this._currentPlayer = this._players.ElementAt(_playerIndex); if (this.phaseChanged != null) { this.phaseChanged(this._currentPhaseManager.PhaseName); } if (this.turnChanged != null) { this.turnChanged(this._currentPlayer); } GameObject.Find("MainScene/GUI").GetComponent <GUIController>().nextClicked += ChangePhase; }
/// <summary> /// Create a new instance (in memory and database) of <see cref="T:Business.QualificationStep" /> with specified param /// </summary> /// <param name="phase">Phase linked to this new step</param> /// <param name="teamList">Team involved in this new step</param> /// <param name="setting">Set setting for new qualification step</param> /// <param name="number">Number of qualification group</param> /// <returns>QualificationStep's instance</returns> public static IGameStep Create(IPhase phase, List <ITeam> teamList, IQualificationStepSetting setting, int number) { if (setting == null) { throw new ArgumentNullException(nameof(setting)); } if (teamList.Count < setting.MinTeamRegister) { throw new ArgumentException( $"Le nombre d'équipe enregistré est insuffisant. Minimum:{setting.MinTeamRegister}. Fourni:{teamList.Count}.", nameof(teamList)); } return(new QualificationStep(phase, teamList, setting.MatchSetting) { Number = number, MatchWithRevenge = setting.MatchWithRevenche, NumberOfQualifiedTeam = setting.CountTeamQualified }); }
private async Task TickAsync(UpdateContext context, CancellationToken cancellationToken) { if (_activePhase == null) { // Start with the spinning phase _activePhase = _spinningPhase; await _activePhase.StartAsync(); _phaseTimer.Reset(); } _phaseTimer.Update(_gameTime); if (_phaseTimer.HasElapsed) { // Stop the active phase await _activePhase.StopAsync(); // Swap phases if (ReferenceEquals(_activePhase, _spinningPhase)) { _activePhase = _shootingPhase; } else { _activePhase = _spinningPhase; } // Start the next phase await _activePhase.StartAsync(); _phaseTimer.Reset(); } // Tick the active phase await _activePhase.TickAsync(_gameTime); }
public R01MountGroupPhase(IPhase phase) { _phase = phase ?? throw new ArgumentNullException(); }
public PhaseExecutionHost AddPhase(string workflowUniqueName, IPhase phase) { if (_phaseExecutionHostsByWorkflowUniqueName.ContainsKey(workflowUniqueName)) { MessageEngine.Trace(Severity.Error, Resources.ErrorAttemptedWorkflowDuplicateUniquePhaseName, workflowUniqueName); return null; } var host = new PhaseExecutionHost(workflowUniqueName, phase); _phaseExecutionHostsByWorkflowUniqueName.Add(workflowUniqueName, host); _phaseWorkflow.Add(host); return host; }
protected EliminationStep(IPhase phase, IList <ITeam> teamList, IMatchSetting currentMatchSetting) : base(phase, teamList, currentMatchSetting) { }
public void StartPhase(Situation situation, IPhase phase) { _phaseStack.Push(phase); phase.Start(situation); }
public PhaseExecutionHost(string WorkflowUniqueName, IPhase HostedPhase) { this._WorkflowUniqueName = WorkflowUniqueName; this._HostedPhase = HostedPhase; this._Predecessors = new List<PhaseExecutionHost>(); this._Successors = new List<PhaseExecutionHost>(); this._PredecessorIRs = new Dictionary<PhaseExecutionHost, IIR>(); this.ExecutionStarted = false; this.ExecutionComplete = false; this.Message = MessageEngine.Create(String.Format("__PHASE EXECUTION HOST: {0}", WorkflowUniqueName)); }
public PhaseResult(IPhase phase) { PhaseName = phase.GetType().AssemblyQualifiedName; }
/// <summary> /// Fires after the phase start delay, if any, elapses /// </summary> public virtual void OnNextTurnPhase(IPhase itm) { Log.LogMsg("At " + itm.PhaseName + " for [" + CurrentPlayer.CharacterName + "]"); }
internal static void WritePhase(IEmitter emitter, IPhase phase, Boolean noBootstrap = false) { if (!noBootstrap) { emitter.Emit(new MappingStart()); } if (phase is PhasesTemplateReference) { var reference = phase as PhasesTemplateReference; if (!noBootstrap) { emitter.Emit(new Scalar(YamlConstants.Template)); emitter.Emit(new Scalar(reference.Name)); if (reference.Parameters != null && reference.Parameters.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Parameters)); WriteMapping(emitter, reference.Parameters); } } if (reference.PhaseSelectors != null && reference.PhaseSelectors.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Phases)); emitter.Emit(new SequenceStart(null, null, true, SequenceStyle.Block)); foreach (PhaseSelector selector in reference.PhaseSelectors) { emitter.Emit(new MappingStart()); if (!String.IsNullOrEmpty(selector.Name)) { emitter.Emit(new Scalar(YamlConstants.Name)); emitter.Emit(new Scalar(selector.Name)); } if (selector.StepOverrides != null && selector.StepOverrides.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Steps)); WriteStepOverrides(emitter, selector.StepOverrides); } emitter.Emit(new MappingEnd()); } emitter.Emit(new SequenceEnd()); } WriteStep(emitter, reference as StepsTemplateReference, noBootstrap: true); } else { var p = phase as Phase; if (!noBootstrap) { emitter.Emit(new Scalar(YamlConstants.Name)); emitter.Emit(new Scalar(p.Name ?? String.Empty)); } if (p.DependsOn != null && p.DependsOn.Count > 0) { emitter.Emit(new Scalar(YamlConstants.DependsOn)); if (p.DependsOn.Count == 1) { emitter.Emit(new Scalar(p.DependsOn[0])); } else { WriteSequence(emitter, p.DependsOn); } } if (!String.IsNullOrEmpty(p.Condition)) { emitter.Emit(new Scalar(YamlConstants.Condition)); emitter.Emit(new Scalar(p.Condition)); } if (!String.IsNullOrEmpty(p.ContinueOnError)) { emitter.Emit(new Scalar(YamlConstants.ContinueOnError)); emitter.Emit(new Scalar(p.ContinueOnError)); } if (!String.IsNullOrEmpty(p.EnableAccessToken)) { emitter.Emit(new Scalar(YamlConstants.EnableAccessToken)); emitter.Emit(new Scalar(p.EnableAccessToken)); } if (p.Target != null) { QueueTarget queueTarget = null; DeploymentTarget deploymentTarget = null; ServerTarget serverTarget = null; if ((queueTarget = p.Target as QueueTarget) != null) { emitter.Emit(new Scalar(YamlConstants.Queue)); // Test for the simple case "queue: name". if (!String.IsNullOrEmpty(queueTarget.Name) && String.IsNullOrEmpty(queueTarget.ContinueOnError) && String.IsNullOrEmpty(queueTarget.Parallel) && String.IsNullOrEmpty(queueTarget.TimeoutInMinutes) && (queueTarget.Demands == null || queueTarget.Demands.Count == 0) && (queueTarget.Matrix == null || queueTarget.Matrix.Count == 0)) { emitter.Emit(new Scalar(queueTarget.Name)); } else // Otherwise write the mapping. { emitter.Emit(new MappingStart()); if (!String.IsNullOrEmpty(queueTarget.Name)) { emitter.Emit(new Scalar(YamlConstants.Name)); emitter.Emit(new Scalar(queueTarget.Name)); } if (!String.IsNullOrEmpty(queueTarget.ContinueOnError)) { emitter.Emit(new Scalar(YamlConstants.ContinueOnError)); emitter.Emit(new Scalar(queueTarget.ContinueOnError)); } if (!String.IsNullOrEmpty(queueTarget.Parallel)) { emitter.Emit(new Scalar(YamlConstants.Parallel)); emitter.Emit(new Scalar(queueTarget.Parallel)); } if (!String.IsNullOrEmpty(queueTarget.TimeoutInMinutes)) { emitter.Emit(new Scalar(YamlConstants.TimeoutInMinutes)); emitter.Emit(new Scalar(queueTarget.TimeoutInMinutes)); } if (queueTarget.Demands != null && queueTarget.Demands.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Demands)); if (queueTarget.Demands.Count == 1) { emitter.Emit(new Scalar(queueTarget.Demands[0])); } else { WriteSequence(emitter, queueTarget.Demands); } } if (queueTarget.Matrix != null && queueTarget.Matrix.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Matrix)); emitter.Emit(new MappingStart()); foreach (KeyValuePair<String, IDictionary<String, String>> pair in queueTarget.Matrix.OrderBy(x => x.Key, StringComparer.OrdinalIgnoreCase)) { emitter.Emit(new Scalar(pair.Key)); WriteMapping(emitter, pair.Value); } emitter.Emit(new MappingEnd()); } emitter.Emit(new MappingEnd()); } } else if ((deploymentTarget = p.Target as DeploymentTarget) != null) { emitter.Emit(new Scalar(YamlConstants.Deployment)); // Test for the simple case "deployment: group". if (!String.IsNullOrEmpty(deploymentTarget.Group) && String.IsNullOrEmpty(deploymentTarget.ContinueOnError) && String.IsNullOrEmpty(deploymentTarget.HealthOption) && String.IsNullOrEmpty(deploymentTarget.Percentage) && String.IsNullOrEmpty(deploymentTarget.TimeoutInMinutes) && (deploymentTarget.Tags == null || deploymentTarget.Tags.Count == 0)) { emitter.Emit(new Scalar(deploymentTarget.Group)); } else // Otherwise write the mapping. { emitter.Emit(new MappingStart()); if (!String.IsNullOrEmpty(deploymentTarget.Group)) { emitter.Emit(new Scalar(YamlConstants.Group)); emitter.Emit(new Scalar(deploymentTarget.Group)); } if (!String.IsNullOrEmpty(deploymentTarget.ContinueOnError)) { emitter.Emit(new Scalar(YamlConstants.ContinueOnError)); emitter.Emit(new Scalar(deploymentTarget.ContinueOnError)); } if (!String.IsNullOrEmpty(deploymentTarget.HealthOption)) { emitter.Emit(new Scalar(YamlConstants.HealthOption)); emitter.Emit(new Scalar(deploymentTarget.HealthOption)); } if (!String.IsNullOrEmpty(deploymentTarget.Percentage)) { emitter.Emit(new Scalar(YamlConstants.Percentage)); emitter.Emit(new Scalar(deploymentTarget.Percentage)); } if (!String.IsNullOrEmpty(deploymentTarget.TimeoutInMinutes)) { emitter.Emit(new Scalar(YamlConstants.TimeoutInMinutes)); emitter.Emit(new Scalar(deploymentTarget.TimeoutInMinutes)); } if (deploymentTarget.Tags != null && deploymentTarget.Tags.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Tags)); if (deploymentTarget.Tags.Count == 1) { emitter.Emit(new Scalar(deploymentTarget.Tags[0])); } else { WriteSequence(emitter, deploymentTarget.Tags); } } emitter.Emit(new MappingEnd()); } } else if ((serverTarget = p.Target as ServerTarget) != null) { emitter.Emit(new Scalar(YamlConstants.Server)); // Test for the simple case "server: true". if (String.IsNullOrEmpty(serverTarget.ContinueOnError) && String.IsNullOrEmpty(serverTarget.Parallel) && String.IsNullOrEmpty(serverTarget.TimeoutInMinutes) && (serverTarget.Matrix == null || serverTarget.Matrix.Count == 0)) { emitter.Emit(new Scalar("true")); } else // Otherwise write the mapping. { emitter.Emit(new MappingStart()); if (!String.IsNullOrEmpty(serverTarget.ContinueOnError)) { emitter.Emit(new Scalar(YamlConstants.ContinueOnError)); emitter.Emit(new Scalar(serverTarget.ContinueOnError)); } if (!String.IsNullOrEmpty(serverTarget.Parallel)) { emitter.Emit(new Scalar(YamlConstants.Parallel)); emitter.Emit(new Scalar(serverTarget.Parallel)); } if (!String.IsNullOrEmpty(serverTarget.TimeoutInMinutes)) { emitter.Emit(new Scalar(YamlConstants.TimeoutInMinutes)); emitter.Emit(new Scalar(serverTarget.TimeoutInMinutes)); } if (serverTarget.Matrix != null && serverTarget.Matrix.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Matrix)); emitter.Emit(new MappingStart()); foreach (KeyValuePair<String, IDictionary<String, String>> pair in serverTarget.Matrix.OrderBy(x => x.Key, StringComparer.OrdinalIgnoreCase)) { emitter.Emit(new Scalar(pair.Key)); WriteMapping(emitter, pair.Value); } emitter.Emit(new MappingEnd()); } emitter.Emit(new MappingEnd()); } } else { throw new NotSupportedException($"Unexpected target type: '{p.Target.GetType().FullName}'"); } } if (p.Variables != null && p.Variables.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Variables)); WriteVariables(emitter, p.Variables); } if (p.Steps != null && p.Steps.Count > 0) { emitter.Emit(new Scalar(YamlConstants.Steps)); WriteSteps(emitter, p.Steps); } } if (!noBootstrap) { emitter.Emit(new MappingEnd()); } }
private void RunPhase(IPhase phase) { PhaseResult pr = phase.Run(_context); _context.PushResult(pr); }