/// <summary> /// Sets the processing state of the script to done /// it will not be returned by the NextItem property. /// </summary> /// <param name="script">The script to set the stage for</param> public void SetState(ISourceScript script, ProcessStage stage) { if (IsIncluded(script)) { doneState[IndexOfFile(script.GetKey())] = stage; } }
public override 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"); Logger.Log(PPLogType.Log, Verbosity.Level5, "Discovering Generic Keywords..."); if (genParams != null && genParams.Length > 0) { for (int i = genParams.Length - 1; i >= 0; i--) { Logger.Log(PPLogType.Log, 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); } } Logger.Log(PPLogType.Log, Verbosity.Level5, "Generic Keyword Replacement Finished"); return(true); }
/// <summary> /// Adds a file to a list while checking for the key /// </summary> /// <param name="script"></param> /// <param name="checkForExistingKey"></param> private void AddFile(ISourceScript script, bool checkForExistingKey) { if (checkForExistingKey && ContainsFile(script.GetKey())) { return; } _sources.Add(script); }
/// <summary> /// Sets the processing state of the script to done /// it will not be returned by the NextItem property. /// </summary> /// <param name="script"></param> public void SetState(ISourceScript script, ProcessStage stage) { if (IsIncluded(script)) { _doneState[IndexOfFile(script.GetKey())] = stage; this.Log(DebugLevel.LOGS, Verbosity.LEVEL3, "Finished Script: {0}", Path.GetFileName(script.GetFilePath())); } }
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> /// Sets the processing state of the script to done /// it will not be returned by the NextItem property. /// </summary> /// <param name="script">The script to set the stage for</param> public void SetState(ISourceScript script, ProcessStage stage) { if (IsIncluded(script)) { doneState[IndexOfFile(script.GetKey())] = stage; Logger.Log(PPLogType.Log, Verbosity.Level3, "Finished Script: {0}", Path.GetFileName(script.GetFileInterface().GetKey())); } }
/// <summary> /// Fixes the order of the file tree if a script was being loaded and is now referenced (again) /// by removing it from the lower position and readding it at the top /// </summary> /// <param name="script"></param> public void FixOrder(ISourceScript script) { this.Log(DebugLevel.LOGS, Verbosity.LEVEL3, "Fixing Build Order of file: {0}", Path.GetFileName(script.GetFilePath())); int idx = IndexOfFile(script.GetKey()); var a = _sources[idx]; var ab = _doneState[idx]; _doneState.RemoveAt(idx); _doneState.Add(ab); _sources.RemoveAt(idx); AddFile(a, true); }
/// <summary> /// Fixes the order of the file tree if a script was being loaded and is now referenced (again) /// by removing it from the lower position and readding it at the top /// </summary> /// <param name="script">The script that got referenced.</param> public void FixOrder(ISourceScript script) { Logger.Log(LogType.Log, "Fixing Build Order of file: {Path.GetFileName(script.GetFileInterface().GetKey())}", 3); int idx = IndexOfFile(script.GetKey()); ISourceScript a = sources[idx]; ProcessStage ab = doneState[idx]; doneState.RemoveAt(idx); doneState.Add(ab); sources.RemoveAt(idx); AddFile(a, true); }
/// <summary> /// Adds a file to a list while checking for the key /// </summary> /// <param name="script">The file to be added.</param> /// <param name="checkForExistingKey">A flag to optionally check if the key of the file is already existing</param> private void AddFile(ISourceScript script, bool checkForExistingKey, bool atFront = false) { if (checkForExistingKey && ContainsFile(script.GetKey())) { return; } if (atFront) { sources.Insert(0, script); return; } sources.Add(script); }
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); }
/// <summary> /// Returns true if the scripts key is contained in the manager /// </summary> /// <param name="script"></param> /// <returns></returns> public bool IsIncluded(ISourceScript script) { return(_sources.Any(x => x.GetKey() == script.GetKey())); }
public override 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"); Logger.Log(LogType.Log, "Discovering Generic Keywords...", PLUGIN_MIN_SEVERITY); if (genParams != null && genParams.Length > 0) { for (int i = genParams.Length - 1; i >= 0; i--) { Logger.Log(LogType.Log, $"Replacing Keyword {GenericKeyword}{i} with {genParams[i]} in file {file.GetKey()}", PLUGIN_MIN_SEVERITY + 1); Utils.ReplaceKeyWord(file.GetSource(), genParams[i], GenericKeyword + i); } } Logger.Log(LogType.Log, "Generic Keyword Replacement Finished", PLUGIN_MIN_SEVERITY); return(true); }