diff --git a/.github/workflows/build-component.yml b/.github/workflows/build-component.yml index adc0beb1..d347d1ef 100644 --- a/.github/workflows/build-component.yml +++ b/.github/workflows/build-component.yml @@ -15,7 +15,8 @@ jobs: runs-on: windows-latest # For a list of available runner types, refer to env: - Solution_Name: Tunny.sln + Main_Solution_Name: Tunny.sln + DE_Solution_Name: TT-DesignExplorer/DesignExplorer.sln Plugin_File_Name: Tunny steps: @@ -23,6 +24,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + submodules: true - name: Download python & wheel zip shell: powershell @@ -37,13 +39,23 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v2 - - name: Restore the application - run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + - name: Restore the Tunny application + run: msbuild $env:Main_Solution_Name /t:Restore /p:Configuration=$env:Configuration env: Configuration: ${{ matrix.configuration }} - - name: Build the application - run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration + - name: Build the Tunny application + run: msbuild $env:Main_Solution_Name /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + - name: Restore the design explorer application + run: msbuild $env:DE_Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + - name: Build the design explorer application + run: msbuild $env:DE_Solution_Name /p:Configuration=$env:Configuration env: Configuration: ${{ matrix.configuration }} @@ -54,6 +66,7 @@ jobs: cp ./LICENSE ./Release/LICENSE.txt cp ./PYTHON_PACKAGE_LICENSES ./Release/PYTHON_PACKAGE_LICENSES.txt cp ./Tunny/bin/Debug/net48 ./Release/Tunny -recurse + cp ./TT-DesignExplorer/server/bin/Debug/net48/TT-DesignExplorer.zip ./Release/Tunny/Lib/TT-DesignExplorer.zip - name: Upload release build of plugin as artefact uses: actions/upload-artifact@v4 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..43031458 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "TT-DesignExplorer"] + path = TT-DesignExplorer + url = https://github.com/hrntsm/DesignExplorer.git diff --git a/TT-DesignExplorer b/TT-DesignExplorer new file mode 160000 index 00000000..013df22f --- /dev/null +++ b/TT-DesignExplorer @@ -0,0 +1 @@ +Subproject commit 013df22fb5fffa601b1890fb45433cb4539c674b diff --git a/Tunny.Core/Handler/DesignExplorer.cs b/Tunny.Core/Handler/DesignExplorer.cs index f482052d..913515ca 100644 --- a/Tunny.Core/Handler/DesignExplorer.cs +++ b/Tunny.Core/Handler/DesignExplorer.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; +using System.IO.Compression; using System.Net; using System.Net.NetworkInformation; @@ -22,6 +23,12 @@ public DesignExplorer(string targetStudyName, Settings.Storage storage) TLog.MethodStart(); _targetStudyName = targetStudyName; _storage = storage; + + string envPath = TEnvVariables.TunnyEnvPath; + if (!Directory.Exists(envPath + "/TT-DesignExplorer")) + { + SetupTTDesignExplorer(); + } } public void Run() @@ -185,5 +192,18 @@ private static bool IsPortInUse(int port) return false; } + + public static void SetupTTDesignExplorer() + { + TLog.MethodStart(); + string envPath = TEnvVariables.TunnyEnvPath; + string componentFolderPath = TEnvVariables.ComponentFolder; + TLog.Info("Unzip TT-DesignExplorer libraries: " + envPath); + if (Directory.Exists(envPath + "/TT-DesignExplorer")) + { + Directory.Delete(envPath + "/TT-DesignExplorer", true); + } + ZipFile.ExtractToDirectory(componentFolderPath + "/Lib/TT-DesignExplorer.zip", envPath + "/TT-DesignExplorer"); + } } } diff --git a/Tunny/UI/OptimizationWindow.cs b/Tunny/UI/OptimizationWindow.cs index 90784d35..f71b6d0d 100644 --- a/Tunny/UI/OptimizationWindow.cs +++ b/Tunny/UI/OptimizationWindow.cs @@ -7,6 +7,7 @@ using Serilog.Events; using Tunny.Component.Optimizer; +using Tunny.Core.Handler; using Tunny.Core.Input; using Tunny.Core.Settings; using Tunny.Core.TEnum; @@ -36,10 +37,17 @@ public OptimizationWindow(FishingComponent component) _settings = TSettings.LoadFromJson(); SetUIValues(); RunPythonInstaller(); + SetupTTDesignExplorer(); SetOptimizeBackgroundWorker(); SetOutputResultBackgroundWorker(); } + private static void SetupTTDesignExplorer() + { + TLog.MethodStart(); + DesignExplorer.SetupTTDesignExplorer(); + } + private void RunPythonInstaller() { TLog.MethodStart();