fix issues with downloading files

This commit is contained in:
Gustave Monce
2024-09-01 12:45:46 +02:00
parent 29c6ab06d4
commit 91961b0e7b
5 changed files with 64 additions and 26 deletions
+19 -12
View File
@@ -936,26 +936,33 @@ namespace WPinternals
string TempFolder = $@"{Environment.GetEnvironmentVariable("TEMP")}\WPInternals";
LumiaFlashAppModel FlashModel = (LumiaFlashAppModel)PhoneNotifier.CurrentModel;
ModeSwitchProgressWrapper("Initializing Flash...", null);
Task.Run(() =>
{
ModeSwitchProgressWrapper("Initializing Flash...", null);
string MMOSPath = Path.Combine(TempFolder, Name);
string MMOSPath = Path.Combine(TempFolder, Name);
App.Config.AddSecWimToRepository(MMOSPath, Firmware);
App.Config.AddSecWimToRepository(MMOSPath, Firmware);
PhoneNotifier.NewDeviceArrived += NewDeviceArrived;
PhoneNotifier.NewDeviceArrived += NewDeviceArrived;
FileInfo info = new(MMOSPath);
uint fileLength = uint.Parse(info.Length.ToString());
const int maximumBufferSize = 0x00240000;
uint chunkCount = (uint)Math.Truncate((decimal)fileLength / maximumBufferSize);
LumiaFlashAppPhoneInfo Info = FlashModel.ReadPhoneInfo();
UIContext?.Post(d => SetWorkingStatus("Flashing Test Mode package...", MaxProgressValue: 100), null);
FileInfo info = new(MMOSPath);
uint length = uint.Parse(info.Length.ToString());
ProgressUpdater progressUpdater = new(chunkCount + 1, (int i, TimeSpan? time) => UIContext?.Post(d => UpdateWorkingStatus(null, CurrentProgressValue: (ulong)i), null));
int maximumBufferSize = (int)Info.WriteBufferSize;
FlashModel.FlashMMOS(MMOSPath, progressUpdater);
uint chunkCount = (uint)Math.Truncate((decimal)length / maximumBufferSize);
ModeSwitchProgressWrapper("And now booting phone to MMOS...", "If the phone stays on the lightning cog screen for a while, you may need to unplug and replug the phone to continue the boot process.");
UIContext?.Post(d => SetWorkingStatus("Flashing Test Mode package...", MaxProgressValue: 100), null);
ProgressUpdater progressUpdater = new(chunkCount + 1, (int i, TimeSpan? time) => UpdateWorkingStatus(null, CurrentProgressValue: (ulong)i));
FlashModel.FlashMMOS(MMOSPath, progressUpdater);
ModeSwitchProgressWrapper("And now booting phone to MMOS...", "If the phone stays on the lightning cog screen for a while, you may need to unplug and replug the phone to continue the boot process.");
});
}
private void SwitchFromPhoneInfoToMassStorageMode(bool Continuation = false)