/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { return(new Message { Text = FinalizeAllScriptsCompileScriptingStatusInterpretationStrategy.FinalizeAllScriptsCompileMessage }); }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { return(new Message { Text = string.Empty }); }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { return(new Message { Text = BeginAllScriptsExecuteScriptingStatusInterpretationStrategy.BeginAllScriptsExecuteMessage }); }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { FileDiscoveryInfo fileDiscoveryInfo = scriptingStatus.AditionalData as FileDiscoveryInfo; return(new Message { Color = ConsoleOutputColor.Blue, Text = $"[{ fileDiscoveryInfo.FileName }]: Finished compiling file." }); }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { ScriptExecuteInfo scriptExecuteInfo = scriptingStatus.AditionalData as ScriptExecuteInfo; return(new Message { Color = ConsoleOutputColor.Blue, Text = $"[{ scriptExecuteInfo.FileName }]: Script finished executing..." }); }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { ScriptExecuteInfo scriptExecuteInfo = scriptingStatus.AditionalData as ScriptExecuteInfo; return(new Message { Color = ConsoleOutputColor.Green, Text = $"[{ scriptExecuteInfo.FileName }]: SUCCESS" }); }
/// <summary> /// Receives a message from a observed instance. /// </summary> /// <param name="observedInstance">The observed instance.</param> /// <param name="message">The message.</param> public void ReceiveMessage(object observedInstance, ScriptingStatus message) { IScriptingStatusInterpretationStrategy scriptingStatusInterpretationStrategy = this.scriptingStatusInterpretationStrategyFactory .GetStrategy(message.ScriptingStatusDescription); Message interpretedMessage = scriptingStatusInterpretationStrategy.InterpretScriptingStatus(message); if (!string.IsNullOrEmpty(interpretedMessage.Text)) { this.consoleOutput.WriteLine(interpretedMessage.Text, interpretedMessage.Color); } }
/// <summary> /// Notifies the observers. /// </summary> /// <param name="scriptingStatusDescription">The scripting status description.</param> /// <param name="aditionalData">The aditional data.</param> private void NotifyObservers(ScriptingStatusDescription scriptingStatusDescription, object aditionalData) { ScriptingStatus scriptingStatus = new ScriptingStatus { AditionalData = aditionalData, ScriptingStatusDescription = scriptingStatusDescription }; foreach (IScriptingStatusObserver observer in this.observers) { observer.ReceiveMessage(this, scriptingStatus); } }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { ScriptExecuteInfo scriptExecuteInfo = scriptingStatus.AditionalData as ScriptExecuteInfo; StringBuilder interpretedStatusMessage = new StringBuilder($"[{ scriptExecuteInfo.FileName }]: FAIL"); interpretedStatusMessage.AppendLine(); interpretedStatusMessage.Append(scriptExecuteInfo.ThrownException.Message); return(new Message { Color = ConsoleOutputColor.Red, Text = interpretedStatusMessage.ToString() }); }
/// <summary> /// Interprets the scripting status. /// </summary> /// <param name="scriptingStatus">The scripting status.</param> /// <returns></returns> public Message InterpretScriptingStatus(ScriptingStatus scriptingStatus) { throw new NotImplementedException("Script compilation not supported."); }