private async void Compile(Action func) { String generatedSourceFile = Path.Combine(new FileInfo(Mapset.Path).Directory.FullName, "maps.asm"); ASM.Export(generatedSourceFile, AsmBaseLineFullPath, Mapset); AddLine($"{Environment.NewLine}**Generating {GetXEXFullPath()} **{Environment.NewLine}", Color.Red); String arguments = $"-i:\"{Path.GetDirectoryName(generatedSourceFile)}\" \"{generatedSourceFile}\" -o:\"{GetXEXFullPath()}\""; if (firstmap > 0) { arguments += $" -d:BLCK_MAPSTART={firstmap}"; } AddLine(arguments, Color.Red); var processResult = await ProcessAsyncHelper.RunProcessAsync(MADSFullPath, arguments, -1, P_OutputDataReceived, p_ErrorDataReceived); // Mads Exit codes // 3 = bad parameters, assembling not started // 2 = error occured // 0 = no errors buttonOK.Enabled = true; if (processResult.ExitCode == 0) { func(); } }
public static void Export(String fileName, string asmBaseLineFullPath, MapSet mapset) { ASM asm = new ASM(); using (StreamWriter file = new StreamWriter(fileName, false, isoLatin1Encoding)) { asm.AddSet(file, "BLCK_STARTADR", "L0418"); asm.AddSet(file, "BLCK_MAPCOUNT", (UInt16)(mapset.Maps.Count - 1)); if (mapset.SpriteSet == MapSet.SpriteSetEnum.TIX) { asm.AddDef(file, "BLCK_TIXPM"); } asm.AddIcl(file, asmBaseLineFullPath); foreach (String include in mapset.Includes) { asm.AddIcl(file, include); } asm.ExportFOE(file, mapset); asm.ExportBruceStart(file, mapset); asm.ExportSpawnPositions(file, mapset); asm.ExportEnterPositions(file, mapset); asm.ExportExit1(file, mapset); asm.ExportExit2(file, mapset); asm.ExportExit3(file, mapset); asm.ExportExit4(file, mapset); asm.ExportLamps(file, mapset); asm.ExportCollision(file, mapset); asm.ExportRoutines(file, mapset); asm.ExportFonts(file, mapset); asm.ExportDLIs(file, mapset); asm.ExportRLE(file, mapset); asm.AddRunAd(file, "BLCK_STARTADR"); } }