public static Platform PromptForPlatform() { Platform retVal = Platform.None; PlatformPrompt pp = new PlatformPrompt(); if (pp.ShowDialog() == DialogResult.OK) { retVal = pp.Platform; } pp.Dispose(); return(retVal); }
private static string TextureMunge(string file, Platform platform) { string retVal = null; if (File.Exists(file)) { int index = file.LastIndexOf('\\'); string tmpFile = Program.TmpDir + file.Substring(index + 1); File.Copy(file, tmpFile, true); string prog = Path.GetFullPath(Program.ModToolsDir + "\\ToolsFL\\bin\\pc_TextureMunge.exe"); if (!File.Exists(prog)) { prog = Path.GetFullPath(Program.ModToolsDir + "\\ToolsFL\\bin\\TextureMunge.exe"); } if (!File.Exists(prog)) { throw new Exception( "Could not find texture munge program; ensure modtools directory is set correctly"); } if (platform == Platform.None) { platform = PlatformPrompt.PromptForPlatform(); } if (platform != Platform.None) { string args = String.Format( "-sourcedir {0} -platform {1} -inputfile {2} -outputdir {3}", Program.TmpDir, platform.ToString(), tmpFile, Program.TmpDir); string programOutput = Program.RunCommand(prog, args, true); string outputFile = tmpFile.Replace(".tga", ".texture"); if (File.Exists(outputFile)) { retVal = outputFile; } Console.WriteLine(programOutput); } } return(retVal); }