public override void Run() { taskInterface.SetStatus("Copying References"); var modCompile = Path.Combine(SteamDir.Get(), "ModCompile"); var references = new[] {"FNA.dll", "Microsoft.CodeAnalysis.dll", "Microsoft.CodeAnalysis.CSharp.dll", "System.Reflection.Metadata.dll", "Mono.Cecil.Pdb.dll" }; foreach (var dll in references) Copy(Path.Combine(Program.baseDir, "references/"+dll), Path.Combine(modCompile, dll)); Copy(Path.Combine(Program.baseDir, "RoslynWrapper/bin/Release/RoslynWrapper.dll"), Path.Combine(modCompile, "RoslynWrapper.dll")); taskInterface.SetStatus("Generating Debug Configuration"); File.WriteAllText(Path.Combine(Program.baseDir, "src/tModLoader/Terraria.csproj.user"), DebugConfig); taskInterface.SetStatus("Compiling tModLoaderMac.exe"); compileFailed = Program.RunCmd(Path.Combine(Program.baseDir, "solutions"), "msbuild", "tModLoader.sln /p:Configuration=MacRelease /p:Platform=\"x86\"", null, null, null, taskInterface.CancellationToken() ) != 0; }
public override void Run() { taskInterface.SetStatus("Deleting Old Src"); if (Directory.Exists(FullSrcDir)) { Directory.Delete(FullSrcDir, true); } var resolver = new EmbeddedAssemblyResolver(); var readParams = new ReaderParameters() { AssemblyResolver = resolver }; taskInterface.CancellationToken().ThrowIfCancellationRequested(); taskInterface.SetStatus("Loading Terraria.exe"); clientModule = ModuleDefinition.ReadModule(TerrariaPath, readParams); taskInterface.CancellationToken().ThrowIfCancellationRequested(); taskInterface.SetStatus("Loading TerrariaServer.exe"); serverModule = ModuleDefinition.ReadModule(TerrariaServerPath, readParams); resolver.baseModule = clientModule; VersionCheck(clientModule.Assembly); VersionCheckAlt(serverModule.Assembly); var options = new DecompilationOptions { FullDecompilation = true, CancellationToken = taskInterface.CancellationToken(), SaveAsProjectDirectory = FullSrcDir }; var clientSources = GetCodeFiles(clientModule, options).ToList(); var serverSources = GetCodeFiles(serverModule, options).ToList(); var clientResources = GetResourceFiles(clientModule, options).ToList(); var serverResources = GetResourceFiles(serverModule, options).ToList(); var sources = CombineFiles(clientSources, serverSources, src => src.Key); var resources = CombineFiles(clientResources, serverResources, res => res.Item1); var items = new List <WorkItem>(); items.AddRange(sources.Select(src => new WorkItem( "Decompiling: " + src.Key, () => DecompileSourceFile(src, options)))); items.AddRange(resources.Select(res => new WorkItem( "Extracting: " + res.Item1, () => ExtractResource(res, options)))); items.Add(new WorkItem("Writing Assembly Info", () => WriteAssemblyInfo(clientModule, options))); items.Add(new WorkItem("Writing Terraria" + lang.ProjectFileExtension, () => WriteProjectFile(clientModule, clientGuid, clientSources, clientResources, options))); items.Add(new WorkItem("Writing TerrariaServer" + lang.ProjectFileExtension, () => WriteProjectFile(serverModule, serverGuid, serverSources, serverResources, options))); items.Add(new WorkItem("Writing Terraria" + lang.ProjectFileExtension + ".user", () => WriteProjectUserFile(clientModule, SteamDir.Get(), options))); items.Add(new WorkItem("Writing TerrariaServer" + lang.ProjectFileExtension + ".user", () => WriteProjectUserFile(serverModule, SteamDir.Get(), options))); ExecuteParallel(items, maxDegree: SingleDecompileThread.Get() ? 1 : 0); }