public string[] Preprocess(IFileContent filename, Dictionary <string, bool> defs) { PreProcessor pp = new PreProcessor(); Logger.VerbosityLevel = VerbosityLevel; pp.SetFileProcessingChain(Plugins); Definitions definitions; if (defs == null) { definitions = new Definitions(); } else { definitions = new Definitions(defs); } string[] ret = { "FILE NOT FOUND" }; try { ret = pp.Run(new[] { filename }, new Settings(), definitions); } catch (ProcessorException ex) { DebugHelper.Crash( new TextProcessingException("Could not preprocess file: " + filename.GetFilePath(), ex), true); } return(ret); }
public string[] Preprocess(IFileContent filename, Dictionary <string, bool> defs) { PreProcessor pp = new PreProcessor(); pp.SetFileProcessingChain(Plugins); Definitions definitions; if (defs == null) { definitions = new Definitions(); } else { definitions = new Definitions(defs); } string[] ret; try { ret = pp.Run(new[] { filename }, new Settings(), definitions); } catch (ProcessorException ex) { throw new TextProcessingException("Could not preprocess file: " + filename.GetFilePath(), ex); } return(ret); }
/// <summary> /// Returns true if the path is valid relative to the current path(the current script that is processed /// </summary> /// <param name="currentPath">the current path of the program</param> /// <param name="file">the relative file path</param> /// <returns>true if the relative path is pointing towards a valid file.</returns> public static bool FileExistsRelativeTo(string currentPath, IFileContent file) { if (file.HasValidFilepath) { return(FileExistsRelativeTo(currentPath, file.GetFilePath())); } return(true); }
internal static string[] PreprocessLines(IFileContent file, Dictionary <string, bool> defs) { string ext = new string(file.GetFilePath().TakeLast(3).ToArray()); if (_configs.ContainsKey(ext)) { DebugHelper.Log("Found Matching PreProcessor Config for: " + ext, 1 | 1 << 21); return(_configs[ext].Preprocess(file, defs)); } DebugHelper.Log("Loading File with Default PreProcessing", 1 | 1 << 21); return(_configs["***"].Preprocess(file, defs)); }
internal static string[] PreprocessLines(IFileContent file, Dictionary <string, bool> defs) { string ext = new string(file.GetFilePath().Reverse().Take(3).Reverse().ToArray()); string key = ""; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { key = "WIN"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { key = "OSX"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { key = "LINUX"; } if (defs == null) { defs = new Dictionary <string, bool>(); } if (!defs.ContainsKey(key)) { defs.Add(key, true); } if (Configs.ContainsKey(ext)) { Logger.Log(DebugChannel.Log, "Found Matching PreProcessor Config for: " + ext); return(Configs[ext].Preprocess(file, defs)); } Logger.Log(DebugChannel.Log, "Loading File with Default PreProcessing"); return(Configs["***"].Preprocess(file, defs)); }