Commits

Anonymous committed af9f08e

Refactoring: Introduced BuildProcess class.

  • Participants
  • Parent commits 655b353

Comments (0)

Files changed (5)

File BlueGo.suo

Binary file modified.

File BlueGo/BlueGo.csproj

     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="BuildProcess.cs" />
     <Compile Include="Qt.cs" />
     <Compile Include="ServenZip.cs" />
     <Compile Include="Boost.cs" />

File BlueGo/Boost.cs

     public delegate void StandardErrorMessageEventHandler(object sender, string message);
     public delegate void FinishedEventHandler(object sender);
 
-    class BoostBuildProcess
+    class BoostBuildProcess : BuildProcess
     {
         public BoostBuildProcess(boostBuildProcessDescripton bbpd)
         {

File BlueGo/BuildProcess.cs

+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using System.Diagnostics;
+
+namespace BlueGo
+{
+    class BuildProcess
+    {
+        public ProcessStartInfo CreateVisualStudioCommandPromptProcessStartInfo(eCompiler compilerType, ePlatform platformType)
+        {
+            ProcessStartInfo info = null;
+
+            string compilerPath = Compiler.GetCompilerPath(compilerType);
+
+            if (platformType == ePlatform.x64)
+            {
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + compilerPath + @"\VC\vcvarsall.bat"" amd64");
+            }
+            else if (platformType == ePlatform.x86)
+            {
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + compilerPath + @"\VC\vcvarsall.bat"" x86");
+            }
+            else
+            {
+                throw new Exception("Unknown Platform type.");
+            }
+
+            return info;
+        }
+    }
+}

File BlueGo/Qt.cs

         public ePlatform platform;
     }
 
-    class QtBuildProcess
+    class QtBuildProcess : BuildProcess
     {
         string destinationFolder;
         eCompiler compilerType;
             eCompiler compiler = compilerType;
   
             Process p = new Process();
-            ProcessStartInfo info = null;
-            if (platform == ePlatform.x64)
-            {
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
-            }
-            else
-            {
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" x86");
-            }
-
-
+            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);
+         
             info.RedirectStandardInput = true;
             info.UseShellExecute = false;
             info.RedirectStandardOutput = true;
             eCompiler compiler = compilerType;
 
             Process p = new Process();
-            ProcessStartInfo info = null;
-          
-            if (platform == ePlatform.x64)
-            {
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
-            }
-            else
-            {
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" x86");
-            }
-
+            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);
 
             info.RedirectStandardInput = true;
             info.UseShellExecute = false;