public bool FullScriptStage(ISourceScript file, ISourceManager todo, IDefinitions defs) { List <string> source = file.GetSource().ToList(); foreach (var breakpoint in _breakpoints) { for (lineCount = 0; lineCount < source.Count; lineCount++) { if (isBreaking) { do { this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Type -dbg-continue to contine processing\nType -dbg-exit to exit the program\nType -dbg-file to list the current file from line you set the breakpoint\n-dbg-file-all to list the whole file\n-dbg-dump <pathtofile> dumps the current file source.\n-dbg-add-bp <breakpointstring>"); string getInput = Console.ReadLine(); if (getInput == "-dbg-continue") { isBreaking = false; return(true); } else if (getInput == "-dbg-exit") { return(false); } else if (getInput == "-dbg-file") { source.TakeLast(source.Count - lineCount).ToList().ForEach(Console.WriteLine); } else if (getInput == "-dbg-file-all") { source.ForEach(Console.WriteLine); } else if (getInput.StartsWith("-dbg-dump ")) { string ff = getInput.Split(" ")[1]; if (ff != "") { File.WriteAllLines(ff, source); } } else if (getInput.StartsWith("-dbg-add-bp ")) { Breakpoint[] ff = Breakpoint.Parse(getInput.Split(" "), this); _breakpoints.AddRange(ff); } } while (isBreaking); } if (breakpoint.Break(lineCount, file.GetKey())) { isBreaking = true; } } } return(true); }
/// <summary> /// Processes the file with the settings, definitions and the source manager specified. /// </summary> /// <param name="files">the file paths to be processed</param> /// <param name="settings">the settings that are used</param> /// <param name="defs">the definitions that are used</param> /// <returns>Returns a list of files that can be compiled in reverse order</returns> private ISourceScript[] Process(IFileContent[] files, Settings settings, IDefinitions defs) { Logger.Log(LogType.Log, "Preprocessing files: " + files.Unpack(", "), 1); Timer.GlobalTimer.Restart(); IDefinitions definitions = defs ?? new Definitions(); settings = settings ?? new Settings(); SourceManager sm = new SourceManager(plugins); InitializePlugins(settings, definitions, sm); foreach (IFileContent file in files) { sm.SetLock(false); sm.TryCreateScript(out ISourceScript sss, sep, file, new ImportResult(), false); sm.SetLock(true); sm.AddToTodo(sss); } ISourceScript ss = sm.NextItem; do { Logger.Log(LogType.Log, "Selecting Current File: " + ss.GetFileInterface().GetFilePath(), 2); if (!(ss as SourceScript).IsSourceLoaded) { RunStages(this, ProcessStage.OnLoadStage, ss, sm, definitions); } Logger.Log(LogType.Log, $"Selecting File: {Path.GetFileName( ss.GetFileInterface().GetKey() )}", 3); //RUN MAIN sm.SetLock(false); RunStages(this, ProcessStage.OnMain, ss, sm, definitions); sm.SetLock(true); sm.SetState(ss, ProcessStage.OnFinishUp); ss = sm.NextItem; }while (ss != null); ISourceScript[] ret = sm.GetList().ToArray(); foreach (ISourceScript finishedScript in ret) { Logger.Log( LogType.Log, $"Selecting File: {Path.GetFileName( finishedScript.GetFileInterface().GetKey() )}", 3 ); RunStages(this, ProcessStage.OnFinishUp, finishedScript, sm, definitions); } Logger.Log(LogType.Log, "Finished Processing Files.", 2); return(ret); }
/// <summary> /// Compiles a File with the definitions and settings provided /// </summary> /// <param name="files">FilePaths of the files.</param> /// <param name="settings">The settings used in this compilation</param> /// <param name="defs">Definitions</param> /// <returns>Array of Compiled Lines</returns> public string[] Run(IFileContent[] files, Settings settings, IDefinitions defs) { ISourceScript[] src = Process(files, settings, defs); string[] ret = Compile(src, false); Timer.GlobalTimer.Reset(); return(ret); }
public static ISourceScript[] SetUpAndProcess(List <AbstractPlugin> chain, Settings settings, IDefinitions definitions, params string[] fileNames) { PreProcessor pp = SetUp(chain); return(pp.ProcessFiles( fileNames.Select(x => new FilePathContent(Path.GetFullPath(x))).OfType <IFileContent>().ToArray(), settings, definitions)); }
private bool EvaluateConditional(string[] expression, IDefinitions defs) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL7, "Evaluating Expression: {0}", expression.Unpack(" ")); bool ret = true; bool isOr = false; bool expectOperator = false; for (int i = 0; i < expression.Length; i++) { if (expression[i] == OrOperator || expression[i] == AndOperator) { isOr = expression[i] == OrOperator; expectOperator = false; } else if (expression[i] == "(") { //i++; if (expectOperator) { isOr = false; } expectOperator = true; int size = IndexOfClosingBracket(expression, i) - i - 1; bool tmp = EvaluateConditional(expression.SubArray(i + 1, size).ToArray(), defs); if (isOr) { ret |= tmp; } else { ret &= tmp; } i += size; } else { if (expectOperator) { isOr = false; } expectOperator = true; bool tmp = EvaluateExpression(expression[i], defs); if (isOr) { ret |= tmp; } else { ret &= tmp; } } } return(ret); }
/// <summary> /// Initializing all Plugins with the settings, definitions and the source manager for this compilation /// </summary> /// <param name="settings">The settings used</param> /// <param name="def">Definitions used</param> /// <param name="sourceManager">Sourcemanager used</param> private void InitializePlugins(Settings settings, IDefinitions def, ISourceManager sourceManager) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Initializing Plugins..."); foreach (var plugin in _plugins) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL2, "Initializing Plugin: {0}", plugin.GetType().Name); plugin.Initialize(settings.GetSettingsWithPrefix(plugin.Prefix, plugin.IncludeGlobal), sourceManager, def); } }
/// <summary> /// Initializing all Plugins with the settings, definitions and the source manager for this compilation /// </summary> /// <param name="settings">The settings used</param> /// <param name="def">Definitions used</param> /// <param name="sourceManager">Sourcemanager used</param> private void InitializePlugins(Settings settings, IDefinitions def, ISourceManager sourceManager) { Logger.Log(PPLogType.Log, Verbosity.Level1, "Initializing Plugins..."); foreach (AbstractPlugin plugin in plugins) { Logger.Log(PPLogType.Log, Verbosity.Level2, "Initializing Plugin: {0}", plugin.GetType().Name); plugin.Initialize(settings.GetSettingsWithPrefix(plugin.Prefix, plugin.IncludeGlobal), sourceManager, def); } }
/// <summary> /// Initializing all Plugins with the settings, definitions and the source manager for this compilation /// </summary> /// <param name="settings">The settings used</param> /// <param name="def">Definitions used</param> /// <param name="sourceManager">Sourcemanager used</param> private void InitializePlugins(Settings settings, IDefinitions def, ISourceManager sourceManager) { Logger.Log(LogType.Log, "Initializing Plugins...", 2); foreach (AbstractPlugin plugin in plugins) { Logger.Log(LogType.Log, $"Initializing Plugin: {plugin.GetType().Name}", 3); plugin.Initialize(settings.GetSettingsWithPrefix(plugin.Prefix, plugin.IncludeGlobal), sourceManager, def); } }
/// <summary> /// Processes the file with the settings, definitions and the source manager specified. /// </summary> /// <param name="file"></param> /// <param name="settings"></param> /// <param name="defs"></param> /// <returns>Returns a list of files that can be compiled in reverse order</returns> public ISourceScript[] Process(string[] files, Settings settings = null, IDefinitions defs = null) { string dir = Directory.GetCurrentDirectory(); defs = defs ?? new Definitions(); SourceManager sm = new SourceManager(_plugins); InitializePlugins(settings, defs, sm); this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Starting Processing of Files: {0}", files.Unpack(", ")); foreach (var file in files) { string f = Path.GetFullPath(file); Directory.SetCurrentDirectory(Path.GetDirectoryName(f)); sm.SetLock(false); sm.CreateScript(out ISourceScript sss, _sep, f, f, new Dictionary <string, object>()); sm.SetLock(true); List <ISourceScript> all = new List <ISourceScript>(); sm.AddToTodo(sss); } ISourceScript ss = sm.NextItem; do { if (!(ss as SourceScript).IsSourceLoaded) { RunStages(ProcessStage.ON_LOAD_STAGE, ss, sm, defs); } this.Log(DebugLevel.PROGRESS, Verbosity.LEVEL1, "Remaining Files: {0}", sm.GetTodoCount()); this.Log(DebugLevel.LOGS, Verbosity.LEVEL2, "Selecting File: {0}", Path.GetFileName(ss.GetFilePath())); //RUN MAIN sm.SetLock(false); RunStages(ProcessStage.ON_MAIN, ss, sm, defs); sm.SetLock(true); sm.SetState(ss, ProcessStage.ON_FINISH_UP); ss = sm.NextItem; } while (ss != null); Directory.SetCurrentDirectory(dir); ISourceScript[] ret = sm.GetList().ToArray(); this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Finishing Up..."); foreach (var finishedScript in ret) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL2, "Selecting File: {0}", Path.GetFileName(finishedScript.GetFilePath())); RunStages(ProcessStage.ON_FINISH_UP, finishedScript, sm, defs); } this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Finished Processing Files."); return(ret); }
/// <summary> /// Compiles a File with the definitions and settings provided /// </summary> /// <param name="files">FilePaths of the files.</param> /// <param name="settings">The settings used in this compilation</param> /// <param name="defs">Definitions</param> /// <returns>Array of Compiled Lines</returns> public string[] Run(IFileContent[] files, Settings settings, IDefinitions defs) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Starting Pre Processor..."); ISourceScript[] src = Process(files, settings, defs); string[] ret = Compile(src, false); this.Log(DebugLevel.PROGRESS, Verbosity.LEVEL1, "Summary: {1} Errors, {2} Warnings, Finished in {0}ms", Timer.MS, Logger.ErrorCount, Logger.WarningCount); Timer.GlobalTimer.Reset(); return(ret); }
/// <summary> /// Compiles a File with the definitions and settings provided /// </summary> /// <param name="files">FilePaths of the files.</param> /// <param name="settings">The settings used in this compilation</param> /// <param name="defs">Definitions</param> /// <returns>Array of Compiled Lines</returns> public string[] Run(IFileContent[] files, Settings settings, IDefinitions defs) { Logger.Log(PPLogType.Log, Verbosity.Level1, "Starting Pre Processor..."); ISourceScript[] src = Process(files, settings, defs); string[] ret = Compile(src, false); Logger.Log(PPLogType.Progress, Verbosity.Level1, "Finished in {0}ms.", Timer.MS); Timer.GlobalTimer.Reset(); return(ret); }
public RealSpaceEngineers( IObserver observer, ICharacterController controller, ISessionController sessionController, IItems items, IDefinitions definitions ) { Observer = observer; Character = controller; Session = sessionController; Items = items; Definitions = definitions; }
public bool FullScriptStage(ISourceScript file, ISourceManager todo, IDefinitions defs) { List <string> source = file.GetSource().ToList(); for (int i = source.Count - 1; i >= 0; i--) { if (i < source.Count - 1 && source[i].TrimEnd().EndsWith(MultiLineKeyword)) { string newstr = source[i].Substring(0, source[i].Length - MultiLineKeyword.Length) + source[i + 1]; source.RemoveAt(i + 1); source[i] = newstr; } } file.SetSource(source.ToArray()); return(true); }
/// <summary> /// Runs the specified stage on the passed script /// </summary> /// <param name="stage">The stage of the current processing</param> /// <param name="script">the script to be processed</param> /// <param name="sourceManager"></param> /// <param name="defTable">the definitions that are used</param> /// <returns></returns> private static bool RunStages(PreProcessor pp, ProcessStage stage, ISourceScript script, ISourceManager sourceManager, IDefinitions defTable) { if (!pp.RunPluginStage(PluginType.LINE_PLUGIN_BEFORE, stage, script, sourceManager, defTable)) { return(false); } if (stage != ProcessStage.ON_FINISH_UP && !pp.RunPluginStage(PluginType.FULL_SCRIPT_PLUGIN, stage, script, sourceManager, defTable)) { return(false); } if (!pp.RunPluginStage(PluginType.LINE_PLUGIN_AFTER, stage, script, sourceManager, defTable)) { return(false); } return(true); }
private KeyValuePair <bool, int> PrepareForConditionalEvaluation( string line, IDefinitions defs, IReadOnlyList <string> lastPass, int i, List <string> solvedFile, bool skipAdd = false) { bool r = EvaluateConditional(line, defs); Logger.Log(LogType.Log, $"Evaluation: {r}", PLUGIN_MIN_SEVERITY + 4); bool elseIsValid = !r; int size = GetBlockSize(lastPass, i); if (r && !skipAdd) { solvedFile.AddRange(lastPass.SubArray(i + 1, size)); Logger.Log(LogType.Log, "Adding Branch To Solved File.", PLUGIN_MIN_SEVERITY + 3); } return(new KeyValuePair <bool, int>(elseIsValid, size)); }
/// <summary> /// Runs the specified stage on the passed script /// </summary> /// <param name="stage">The stage of the current processing</param> /// <param name="script">the script to be processed</param> /// <param name="sourceManager"></param> /// <param name="defTable">the definitions that are used</param> /// <returns></returns> private static bool RunStages(PreProcessor pp, ProcessStage stage, ISourceScript script, ISourceManager sourceManager, IDefinitions defTable) { if (!pp.RunPluginStage(PluginType.LinePluginBefore, stage, script, sourceManager, defTable)) { return(false); } if (stage != ProcessStage.OnFinishUp && !pp.RunPluginStage(PluginType.FullScriptPlugin, stage, script, sourceManager, defTable)) { return(false); } if (!pp.RunPluginStage(PluginType.LinePluginAfter, stage, script, sourceManager, defTable)) { return(false); } return(true); }
protected internal virtual IEscalation FindEscalationForCode(string escalationCode) { IEnumerable <IEscalation> escalations = modelInstance.GetModelElementsByType <IEscalation>(typeof(IEscalation)); foreach (IEscalation e in escalations) { if (escalationCode.Equals(e.EscalationCode)) { // return already existing escalation return(e); } } IDefinitions definitions = modelInstance.Definitions; IEscalation escalation = CreateChild <IEscalation>(definitions, typeof(IEscalation)); escalation.EscalationCode = escalationCode; return(escalation); }
protected internal virtual IMessage FindMessageForName(string messageName) { IEnumerable <IMessage> messages = modelInstance.GetModelElementsByType <IMessage>(typeof(IMessage)); foreach (IMessage m in messages) { if (messageName.Equals(m.Name)) { // return already existing message for message name return(m); } } // create new message for non existing message name IDefinitions definitions = modelInstance.Definitions; IMessage message = CreateChild <IMessage>(definitions, typeof(IMessage)); message.Name = messageName; return(message); }
protected internal virtual ISignal FindSignalForName(string signalName) { IEnumerable <ISignal> signals = modelInstance.GetModelElementsByType <ISignal>(typeof(ISignal)); foreach (ISignal s in signals) { if (signalName.Equals(s.Name)) { // return already existing signal for signal name return(s); } } // create new signal for non existing signal name IDefinitions definitions = modelInstance.Definitions; ISignal signal = CreateChild <ISignal>(definitions, typeof(ISignal)); signal.Name = signalName; return(signal); }
protected internal virtual IError FindErrorForNameAndCode(string errorCode) { IEnumerable <IError> errors = modelInstance.GetModelElementsByType <IError>(typeof(IError)); foreach (IError e in errors) { if (errorCode.Equals(e.ErrorCode)) { // return already existing error return(e); } } // create new error IDefinitions definitions = modelInstance.Definitions; IError error = CreateChild <IError>(definitions, typeof(IError)); error.ErrorCode = errorCode; return(error); }
private bool EvaluateExpression(string expression, IDefinitions defs) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL6, "Evaluating Expression: {0}", expression); bool neg = expression.StartsWith(NotOperator); if (expression == NotOperator) { this.Log(DebugLevel.ERRORS, Verbosity.LEVEL1, "Single not Operator found. Will break the compilation."); return(false); } if (neg) { expression = expression.Substring(1, expression.Length - 1); } var val = defs.Check(expression); val = neg ? !val : val; return(val); }
public static IProcessBuilder CreateProcess() { IBpmnModelInstance modelInstance = Instance.DoCreateEmptyModel(); IDefinitions definitions = modelInstance.NewInstance <IDefinitions>(typeof(IDefinitions)); definitions.TargetNamespace = BpmnModelConstants.Bpmn20Ns; definitions.DomElement.RegisterNamespace("camunda", BpmnModelConstants.CamundaNs); modelInstance.Definitions = definitions; IProcess process = modelInstance.NewInstance <IProcess>(typeof(IProcess)); definitions.AddChildElement(process); IBpmnDiagram bpmnDiagram = modelInstance.NewInstance <IBpmnDiagram>(typeof(IBpmnDiagram)); IBpmnPlane bpmnPlane = modelInstance.NewInstance <IBpmnPlane>(typeof(IBpmnPlane)); bpmnPlane.BpmnElement = process; bpmnDiagram.AddChildElement(bpmnPlane); definitions.AddChildElement(bpmnDiagram); return(process.Builder()); }
private bool EvaluateExpression(string expression, IDefinitions defs) { Logger.Log(LogType.Log, $"Evaluating Expression: {expression}", PLUGIN_MIN_SEVERITY + 6); bool neg = expression.StartsWith(NotOperator); if (expression == NotOperator) { Logger.Log(LogType.Error, "Single not Operator found. Will break the compilation.", 1); return(false); } string exp = expression; if (neg) { exp = expression.Substring(1, expression.Length - 1); } bool val = defs.Check(exp); val = neg ? !val : val; return(val); }
private bool EvaluateExpression(string expression, IDefinitions defs) { Logger.Log(PPLogType.Log, Verbosity.Level6, "Evaluating Expression: {0}", expression); bool neg = expression.StartsWith(NotOperator); if (expression == NotOperator) { Logger.Log(PPLogType.Error, Verbosity.Level1, "Single not Operator found. Will break the compilation."); return(false); } string exp = expression; if (neg) { exp = expression.Substring(1, expression.Length - 1); } bool val = defs.Check(exp); val = neg ? !val : val; return(val); }
public override bool FullScriptStage(ISourceScript script, ISourceManager sourceManager, IDefinitions defs) { Logger.Log(LogType.Log, "Disovering Include Statments...", PLUGIN_MIN_SEVERITY); List <string> source = script.GetSource().ToList(); string currentPath = Path.GetDirectoryName(script.GetFileInterface().GetFilePath()); bool hasIncludedInline; do { hasIncludedInline = false; for (int i = source.Count - 1; i >= 0; i--) { if (Utils.IsStatement(source[i], IncludeInlineKeyword)) { Logger.Log(LogType.Log, "Found Inline Include Statement...", PLUGIN_MIN_SEVERITY + 1); string[] args = Utils.SplitAndRemoveFirst(source[i], Separator); if (args.Length == 0) { Logger.Log(LogType.Error, "No File Specified", 1); continue; } if (Utils.FileExistsRelativeTo(currentPath, args[0])) { Logger.Log(LogType.Log, "Replacing Inline Keyword with file content", PLUGIN_MIN_SEVERITY + 2); source.RemoveAt(i); source.InsertRange(i, IOManager.ReadAllLines(Path.Combine(currentPath, args[0]))); hasIncludedInline = true; } else { Logger.Log(LogType.Error, $"File does not exist: {args[0]}", 1); } } } script.SetSource(source.ToArray()); } while (hasIncludedInline); string[] incs = Utils.FindStatements(source.ToArray(), IncludeKeyword); foreach (string includes in incs) { Logger.Log(LogType.Log, $"Processing Statement: {includes}", PLUGIN_MIN_SEVERITY + 1); bool tmp = GetISourceScript(sourceManager, includes, currentPath, out List <ISourceScript> sources); if (tmp) { foreach (ISourceScript sourceScript in sources) { Logger.Log(LogType.Log, $"Processing Include: {Path.GetFileName(sourceScript.GetFileInterface().GetKey())}", PLUGIN_MIN_SEVERITY + 2); if (!sourceManager.IsIncluded(sourceScript)) { sourceManager.AddToTodo(sourceScript); } else { sourceManager.FixOrder(sourceScript); } } } else { return (false); //We crash if we didnt find the file. but if the user forgets to specify the path we will just log the error } } Logger.Log(LogType.Log, "Inclusion of Files Finished", PLUGIN_MIN_SEVERITY); return(true); }
public override void Initialize(Settings settings, ISourceManager sourceManager, IDefinitions defTable) { settings.ApplySettings(Info, this); }
public override bool FullScriptStage(ISourceScript file, ISourceManager todo, IDefinitions defs) { Logger.Log(LogType.Log, $"Starting Condition Solver passes on file: {Path.GetFileName(file.GetFileInterface().GetKey())}", PLUGIN_MIN_SEVERITY); bool ret = true; int openIf = 0; bool foundConditions = false; bool elseIsValid = false; bool expectEndOrIf = false; List <string> lastPass = file.GetSource().ToList(); List <string> solvedFile = new List <string>(); int passCount = 0; do { passCount++; Logger.Log(LogType.Log, $"Starting Condition Solver pass: {passCount}", PLUGIN_MIN_SEVERITY + 1); foundConditions = false; elseIsValid = false; for (int i = 0; i < lastPass.Count; i++) { string line = lastPass[i].TrimStart(); if (IsKeyWord(line, StartCondition)) { Logger.Log(LogType.Log, $"Found a {StartCondition} Statement", PLUGIN_MIN_SEVERITY + 2); KeyValuePair <bool, int> prep = PrepareForConditionalEvaluation(line, defs, lastPass, i, solvedFile); elseIsValid = prep.Key; i += prep.Value; openIf++; foundConditions = true; expectEndOrIf = false; } else if (elseIsValid && IsKeyWord(line, ElseIfCondition)) { Logger.Log(LogType.Log, $"Found a {ElseIfCondition} Statement", PLUGIN_MIN_SEVERITY + 2); if (!expectEndOrIf && openIf > 0) { KeyValuePair <bool, int> prep = PrepareForConditionalEvaluation(line, defs, lastPass, i, solvedFile); elseIsValid = prep.Key; i += prep.Value; foundConditions = true; } else if (expectEndOrIf) { Logger.Log(LogType.Error, $"A {ElseCondition} can not be followed by an {ElseIfCondition}", 1); ret = false; break; } else { Logger.Log(LogType.Error, $"A {ElseIfCondition} should be preceeded by a {StartCondition}", 1); ret = false; break; } } else if (IsKeyWord(line, ElseCondition)) { if (openIf > 0) { Logger.Log(LogType.Log, $"Found a {ElseCondition} Statement", PLUGIN_MIN_SEVERITY + 2); int size = GetBlockSize(lastPass, i); if (elseIsValid) { solvedFile.AddRange(lastPass.SubArray(i + 1, size)); Logger.Log(LogType.Log, "Adding Branch To Solved File.", PLUGIN_MIN_SEVERITY + 3); } else { Logger.Log(LogType.Log, "Ignored since a previous condition was true", PLUGIN_MIN_SEVERITY + 3); } i += size; foundConditions = true; expectEndOrIf = true; } else { Logger.Log(LogType.Error, $"A {ElseCondition} should be preceeded by a {StartCondition}", 1); ret = false; break; } } else if (IsKeyWord(line, EndCondition)) { if (openIf > 0) { expectEndOrIf = false; openIf--; } else { ret = false; Logger.Log(LogType.Error, $"A {EndCondition} should be preceeded by a {StartCondition}", 1); break; } } else if (EnableDefine && line.StartsWith(DefineKeyword)) { Logger.Log(LogType.Log, $"Found a {DefineKeyword} Statement", PLUGIN_MIN_SEVERITY + 2); defs.Set(Utils.SplitAndRemoveFirst(line, Separator)); solvedFile.Add(lastPass[i]); } else if (EnableUndefine && line.StartsWith(UndefineKeyword)) { Logger.Log(LogType.Log, $"Found a {UndefineKeyword} Statement", PLUGIN_MIN_SEVERITY + 2); defs.Unset(Utils.SplitAndRemoveFirst(line, Separator)); solvedFile.Add(lastPass[i]); } else { solvedFile.Add(lastPass[i]); } } if (ret) { lastPass = solvedFile; } else { break; } solvedFile = new List <string>(); } while (foundConditions); file.SetSource(lastPass.ToArray()); Logger.Log(LogType.Log, "Conditional Solver Finished", PLUGIN_MIN_SEVERITY); return(ret); }
public bool FullScriptStage(ISourceScript file, ISourceManager sourceManager, IDefinitions defs) { if (!file.HasValueOfType <string[]>("genParams")) { return(true); //No error, we just dont have any generic parameters to replace. } string[] GenParams = file.GetValueFromCache <string[]>("genParams"); this.Log(DebugLevel.LOGS, Verbosity.LEVEL5, "Discovering Generic Keywords..."); if (GenParams != null && GenParams.Length > 0) { for (var i = GenParams.Length - 1; i >= 0; i--) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL6, "Replacing Keyword {0}{1} with {2} in file {3}", GenericKeyword, i, GenParams[i], file.GetKey()); Utils.ReplaceKeyWord(file.GetSource(), GenParams[i], GenericKeyword + i); } } this.Log(DebugLevel.LOGS, Verbosity.LEVEL5, "Generic Keyword Replacement Finished"); return(true); }
public override bool OnMain_FullScriptStage(ISourceScript script, ISourceManager sourceManager, IDefinitions defTable) { return(FullScriptStage(script, sourceManager, defTable)); }
public override void Initialize(Settings settings, ISourceManager sourceManager, IDefinitions defs) { settings.ApplySettings(Info, this); sourceManager.SetComputingScheme(ComputeNameAndKey_Generic); }