mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Python.cs: DisablePython check in CheckCompression + some refactoring
This commit is contained in:
@@ -2,12 +2,9 @@
|
||||
using Flowframes.IO;
|
||||
using Flowframes.MiscUtils;
|
||||
using Flowframes.Ui;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Flowframes.Os
|
||||
{
|
||||
@@ -20,8 +17,9 @@ namespace Flowframes.Os
|
||||
|
||||
public static async Task CheckCompression ()
|
||||
{
|
||||
if(HasEmbeddedPyFolder() && (Config.Get(Config.Key.compressedPyVersion) != Updater.GetInstalledVer().ToString()))
|
||||
{
|
||||
if (Implementations.DisablePython || !HasEmbeddedPyFolder() || (Config.Get(Config.Key.compressedPyVersion) == Updater.GetInstalledVer().ToString()))
|
||||
return;
|
||||
|
||||
Program.mainForm.SetWorking(true, false);
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Restart();
|
||||
@@ -41,14 +39,15 @@ namespace Flowframes.Os
|
||||
while (!compact.HasExited)
|
||||
{
|
||||
await Task.Delay(500);
|
||||
if(sw.ElapsedMilliseconds > 10000)
|
||||
|
||||
if (sw.ElapsedMilliseconds > 10000)
|
||||
{
|
||||
Logger.Log($"This can take up to a few minutes, but only needs to be done once. (Elapsed: {FormatUtils.Time(sw.Elapsed)})", false, shownPatienceMsg);
|
||||
shownPatienceMsg = true;
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Config.Set("compressedPyVersion", Updater.GetInstalledVer().ToString());
|
||||
Logger.Log("Done compressing python runtime.");
|
||||
Logger.WriteToFile(compactOutput, true, "compact");
|
||||
@@ -56,14 +55,13 @@ namespace Flowframes.Os
|
||||
catch { }
|
||||
Program.mainForm.SetWorking(false);
|
||||
}
|
||||
}
|
||||
|
||||
static void CompactOutputHandler (object sendingProcess, DataReceivedEventArgs outLine)
|
||||
{
|
||||
if (outLine == null || outLine.Data == null)
|
||||
return;
|
||||
string line = outLine.Data;
|
||||
compactOutput = compactOutput + line + "\n";
|
||||
|
||||
compactOutput = $"{compactOutput}{outLine.Data}\n";
|
||||
}
|
||||
|
||||
public static string GetPyCmd (bool unbufferedStdOut = true, bool quiet = false)
|
||||
|
||||
Reference in New Issue
Block a user