From dcd420b07770157b08e3885343ed661c845f7820 Mon Sep 17 00:00:00 2001 From: Olivia McKeon Date: Wed, 28 Sep 2022 18:32:20 +1000 Subject: [PATCH 1/5] ADD: Added namespace lines to Program.cs file This will allow for easier changing of the namespace to the folder name in the skm_fix_dotnet.sh file --- dotnet/files/Program.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dotnet/files/Program.cs b/dotnet/files/Program.cs index d36d51c..bc28b71 100644 --- a/dotnet/files/Program.cs +++ b/dotnet/files/Program.cs @@ -1,10 +1,13 @@ using System; using SplashKitSDK; -public class Program +namespace SkmProject { - public static void Main() + public class Program { + public static void Main() + { + } } } From 1a3f0594cda3cf0c73c2253e8e12848721ab90af Mon Sep 17 00:00:00 2001 From: Olivia McKeon Date: Wed, 28 Sep 2022 18:36:47 +1000 Subject: [PATCH 2/5] CONFIG: Updated to use .NET 6 --- fix/dotnet/skm_fix_dotnet.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fix/dotnet/skm_fix_dotnet.sh b/fix/dotnet/skm_fix_dotnet.sh index cbcf0ce..ce55d60 100755 --- a/fix/dotnet/skm_fix_dotnet.sh +++ b/fix/dotnet/skm_fix_dotnet.sh @@ -17,11 +17,9 @@ else fi if [ $SK_OS = "macos" ]; then - sed -i '' "s|.*|netcoreapp5.0|g" "$PRJ_NAME" - sed -i '' "s|.*|disable|g" "$PRJ_NAME" + sed -i '' "s|.*|net6.0|g" "$PRJ_NAME" else - sed -i "s|.*|netcoreapp5.0|g" "$PRJ_NAME" - sed -i "s|.*|disable|g" "$PRJ_NAME" + sed -i "s|.*|net6.0|g" "$PRJ_NAME" fi dotnet restore From 565bd6da4a3d00ca8736464ce27104d458efd2d1 Mon Sep 17 00:00:00 2001 From: Olivia McKeon Date: Wed, 28 Sep 2022 18:48:09 +1000 Subject: [PATCH 3/5] CONFIG: Add Run Configuration to .csproj for macos Description: - For macos - This will add the required Run Configuration code to the .csproj file to allow the SplashKit project to be run in Visual Studio (without needing to use the terminal). Testing success: - Running `skm dotnet restore` multiple times did not add new RunConfiguration lines if it was already there, and added it if it was not there. - Simple SplashKit project was able to be run on an M1 mac directly from Visual Studio (Using Visual Studio 2022 for Mac). --- fix/dotnet/skm_fix_dotnet.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fix/dotnet/skm_fix_dotnet.sh b/fix/dotnet/skm_fix_dotnet.sh index ce55d60..327e6cc 100755 --- a/fix/dotnet/skm_fix_dotnet.sh +++ b/fix/dotnet/skm_fix_dotnet.sh @@ -18,6 +18,14 @@ fi if [ $SK_OS = "macos" ]; then sed -i '' "s|.*|net6.0|g" "$PRJ_NAME" + if ! grep -q RunConfiguration "$PRJ_NAME"; then + sed -i '' "s|| \n\ + Project\n\ + true\n\ + \n\ + \n\ + \n \n\n|g" "$PRJ_NAME" + fi else sed -i "s|.*|net6.0|g" "$PRJ_NAME" fi From c64697b8ec093dab9d33db7686800f1ed5f08ed8 Mon Sep 17 00:00:00 2001 From: Olivia McKeon Date: Wed, 28 Sep 2022 18:52:33 +1000 Subject: [PATCH 4/5] CONFIG: Update the Program.cs file's namespace This added code updates the namespace in the Program.cs file from `SkmProject` to the name of the folder that the project has been created within. --- fix/dotnet/skm_fix_dotnet.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fix/dotnet/skm_fix_dotnet.sh b/fix/dotnet/skm_fix_dotnet.sh index 327e6cc..6daa56c 100755 --- a/fix/dotnet/skm_fix_dotnet.sh +++ b/fix/dotnet/skm_fix_dotnet.sh @@ -30,4 +30,10 @@ else sed -i "s|.*|net6.0|g" "$PRJ_NAME" fi +if [ $SK_OS = "macos" ]; then + sed -i '' "s|namespace SkmProject|namespace ${PWD##*/}|g" "$PROGRAM_CS_NAME" +else + sed -i "s|namespace SkmProject|namespace ${PWD##*/}|g" "$PROGRAM_CS_NAME" +fi + dotnet restore From 5e02547f366eecda55440a98bcf98439f7a6a988 Mon Sep 17 00:00:00 2001 From: Olivia McKeon Date: Wed, 28 Sep 2022 20:24:05 +1000 Subject: [PATCH 5/5] Updated to use MAC_RUN_CONFIG variable Using MAC_RUN_CONFIG variable to improve readability and formatting. --- fix/dotnet/skm_fix_dotnet.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fix/dotnet/skm_fix_dotnet.sh b/fix/dotnet/skm_fix_dotnet.sh index 6daa56c..45a69d8 100755 --- a/fix/dotnet/skm_fix_dotnet.sh +++ b/fix/dotnet/skm_fix_dotnet.sh @@ -5,6 +5,13 @@ APP_PATH=`cd "$APP_PATH"; pwd` PRJ_NAME="${PWD##*/}.csproj" SKM_PATH=`cd "$APP_PATH/../.."; pwd` +PROGRAM_CS_NAME='Program.cs' +MAC_RUN_CONFIG=" \n\ + Project\n\ + true\n\ + \n\ + \n\ + \n \n" source "${SKM_PATH}/tools/set_sk_env_vars.sh" @@ -19,12 +26,7 @@ fi if [ $SK_OS = "macos" ]; then sed -i '' "s|.*|net6.0|g" "$PRJ_NAME" if ! grep -q RunConfiguration "$PRJ_NAME"; then - sed -i '' "s|| \n\ - Project\n\ - true\n\ - \n\ - \n\ - \n \n\n|g" "$PRJ_NAME" + sed -i '' "s||$MAC_RUN_CONFIG\n|g" "$PRJ_NAME" fi else sed -i "s|.*|net6.0|g" "$PRJ_NAME"