Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	scriptsharp/ScriptSharp/Program.cs
  • Loading branch information
PierreOlivierBrillant committed Oct 17, 2024
2 parents da1ebcf + 21f1e24 commit 434a8ed
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
2 changes: 1 addition & 1 deletion scriptsharp/ScriptSharp/Script3N5.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ await Task.WhenAll(
UtilsAndroidStudio.InstallAndroidStudio(),
DownloadRepo3N5());
// start android studio
await Utils.StartAndroidStudio();
await UtilsAndroidStudio.StartAndroidStudio();
LogSingleton.Get.LogAndWriteLine(" FAIT Installation pour 3N5 Android complet");
}

Expand Down
4 changes: 2 additions & 2 deletions scriptsharp/ScriptSharp/Script4N6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ await Task.WhenAll(
// start android studio
Utils.CreateDesktopShortcut("IntelliJ", UtilsIntellij.PathToIntellij());

await Utils.StartAndroidStudio();
await UtilsAndroidStudio.StartAndroidStudio();
Utils.StartKmb();
LogSingleton.Get.LogAndWriteLine(" FAIT Installation 4N6 Android + serveur Spring ");
}
Expand Down Expand Up @@ -72,7 +72,7 @@ await Task.WhenAll(
//Program.DownloadRepoKMB(),
DownloadRepo4N6());
// start android studio
await Utils.StartAndroidStudio();
await UtilsAndroidStudio.StartAndroidStudio();
LogSingleton.Get.LogAndWriteLine(" FAIT Installation 4N6 Android fini");
}
}
6 changes: 3 additions & 3 deletions scriptsharp/ScriptSharp/Script5N6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ await Task.WhenAll(
Utils.RunCommand(UtilsAndroidStudio.PathToAndroidStudio() + " installPlugins com.localizely.flutter-intl");
await UtilsFlutter.InstallFlutter();
Utils.StartKmb();
await Utils.StartAndroidStudio();
await UtilsAndroidStudio.StartAndroidStudio();
Utils.CreateDesktopShortcut("IntelliJ", UtilsIntellij.PathToIntellij());
LogSingleton.Get.LogAndWriteLine(" FAIT 5N6 Flutter complet");
}

public static async Task Handle5N6FlutterFirebaseAsync()
{
LogSingleton.Get.LogAndWriteLine("Installation de 5N6 flutter + firebase ...");
UtilsFirebase.InstallFirebase();
await Utils.CopyFileFromNetworkShareAsync(
Path.Combine(Config.LocalCache, "Sdk-Android-Flutter.7z"),
Path.Combine(Config.LocalTemp, "Sdk.7z") );
Expand Down Expand Up @@ -83,9 +84,8 @@ await Task.WhenAll(
//Utils.StartKMB();
Utils.AddToPath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "AppData",
"Local", "Pub", "Cache", "bin"));
UtilsFirebase.InstallFirebase();
UtilsFirebase.InstallFlutterFire();
await Utils.StartAndroidStudio();
await UtilsAndroidStudio.StartAndroidStudio();
LogSingleton.Get.LogAndWriteLine(" FAIT 5N6 Flutter + firebase complet");
}

Expand Down
30 changes: 5 additions & 25 deletions scriptsharp/ScriptSharp/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ public static void RunCommand(string command)
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
process.WaitForExit();

// Afficher les résultats de la commande exécutée
if (string.IsNullOrEmpty(error))

if (!string.IsNullOrEmpty(output))
{
LogSingleton.Get.LogAndWriteLine(" FAIT Sortie pour : " + command);
LogSingleton.Get.LogAndWriteLine(output);
}
else
if (!string.IsNullOrEmpty(error))
{
LogSingleton.Get.LogAndWriteLine(" ERREUR Sortie pour : " + command);
LogSingleton.Get.LogAndWriteLine(error);
}

}
}
catch (Exception ex)
Expand Down Expand Up @@ -269,27 +269,6 @@ private static void RunPowerShellCommand(string command)
}
}

public static Task StartAndroidStudio()
{
LogSingleton.Get.LogAndWriteLine("Lancement d'Android Studio");
string androidStudioPath = UtilsAndroidStudio.PathToAndroidStudio();
if (File.Exists(androidStudioPath))
{
CreateDesktopShortcut("Android-Studio", UtilsAndroidStudio.PathToAndroidStudio());
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = androidStudioPath,
UseShellExecute = true
};
Process.Start(processStartInfo);
}
else
{
LogSingleton.Get.LogAndWriteLine(" ERREUR Android Studio n'est pas installé");
}
return Task.CompletedTask;
}

public static void AddToPath(string binPath)
{
string currentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User);
Expand Down Expand Up @@ -364,6 +343,7 @@ private static void RemoveAllEnv()

public static void SetEnvVariable(string name, string value)
{
Environment.SetEnvironmentVariable(name, value);
Environment.SetEnvironmentVariable(name, value, EnvironmentVariableTarget.User);
Environment.SetEnvironmentVariable(name, value, EnvironmentVariableTarget.Process);
}
Expand Down
21 changes: 21 additions & 0 deletions scriptsharp/ScriptSharp/Utils/UtilsAndroidStudio.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

Expand All @@ -22,4 +23,24 @@ public static async Task InstallAndroidStudio()
await Utils.Unzip7ZFileAsync(Path.Combine(Config.LocalTemp, "android-studio.7z"), destinationFolder);
LogSingleton.Get.LogAndWriteLine(" FAIT Installation Android Studio fini");
}
public static Task StartAndroidStudio()
{
LogSingleton.Get.LogAndWriteLine("Lancement d'Android Studio");
string androidStudioPath = UtilsAndroidStudio.PathToAndroidStudio();
if (File.Exists(androidStudioPath))
{
Utils.CreateDesktopShortcut("Android-Studio", UtilsAndroidStudio.PathToAndroidStudio());
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = androidStudioPath,
UseShellExecute = true
};
Process.Start(processStartInfo);
}
else
{
LogSingleton.Get.LogAndWriteLine(" ERREUR Android Studio n'est pas installé");
}
return Task.CompletedTask;
}
}

0 comments on commit 434a8ed

Please sign in to comment.