private Directive RemapIni(RawSourceFile source, string gamePath) { var data = File.ReadAllText(source.AbsolutePath); data = data.Replace(GamePath, Consts.GAME_PATH_MAGIC_BACK); data = data.Replace(GamePath.Replace("\\", "\\\\"), Consts.GAME_PATH_MAGIC_DOUBLE_BACK); data = data.Replace(GamePath.Replace("\\", "/"), Consts.GAME_PATH_MAGIC_FORWARD); data = data.Replace(MO2Folder, Consts.MO2_PATH_MAGIC_BACK); data = data.Replace(MO2Folder.Replace("\\", "\\\\"), Consts.MO2_PATH_MAGIC_DOUBLE_BACK); data = data.Replace(MO2Folder.Replace("\\", "/"), Consts.MO2_PATH_MAGIC_FORWARD); var result = source.EvolveTo <RemappedInlineFile>(); result.SourceData = Encoding.UTF8.GetBytes(data).ToBase64(); return(result); }
private Directive RunStack(IEnumerable <Func <RawSourceFile, Directive> > stack, RawSourceFile source) { Status("Compiling {0}", source.Path); return((from f in stack let result = f(source) where result != null select result).First()); }
private Directive RunStack(IEnumerable <Func <RawSourceFile, Directive> > stack, RawSourceFile source) { Status("Compiling {0}", source.Path); foreach (var f in stack) { var result = f(source); if (result != null) { return(result); } } throw new InvalidDataException("Data fell out of the compilation stack"); }