private void FFUDownloadedAndCheckSupported(string[] Files, object State) { App.Config.AddFfuToRepository(Files[0]); if (App.Config.FFURepository.Where(e => App.PatchEngine.PatchDefinitions.Where(p => p.Name == "SecureBootHack-V2-EFIESP").First().TargetVersions.Any(v => v.Description == e.OSVersion)).Count() == 0) { string ProductType2 = "RM-1085"; string URL = LumiaDownloadModel.SearchFFU(ProductType2, null, null); Download(URL, ProductType2, FFUDownloaded, null); } }
private void Search() { if (IsSearching) { return; } IsSearching = true; SynchronizationContext UIContext = SynchronizationContext.Current; SearchResultList.Clear(); new Thread(() => { string FFUURL = null; string[] EmergencyURLs = null; try { string TempProductType = ProductType.ToUpper(); if ((TempProductType != null) && TempProductType.StartsWith("RM") && !TempProductType.StartsWith("RM-")) { TempProductType = "RM-" + TempProductType.Substring(2); } ProductType = TempProductType; FFUURL = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType); if (TempProductType != null) { ProductType = TempProductType; } if (ProductType != null) { EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType); } } catch { } UIContext.Post(s => { if (FFUURL != null) { SearchResultList.Add(new SearchResult(FFUURL, ProductType, FFUDownloaded, null)); } if (EmergencyURLs != null) { SearchResultList.Add(new SearchResult(ProductType + " emergency-files", EmergencyURLs, ProductType, EmergencyDownloaded, ProductType)); } }, null); IsSearching = false; }).Start(); }
private void DownloadAll() { SynchronizationContext UIContext = SynchronizationContext.Current; new Thread(() => { string FFUURL = null; string[] EmergencyURLs = null; try { string TempProductType = ProductType.ToUpper(); if ((TempProductType != null) && TempProductType.StartsWith("RM") && !TempProductType.StartsWith("RM-")) { TempProductType = "RM-" + TempProductType.Substring(2); } ProductType = TempProductType; FFUURL = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType); if (TempProductType != null) { ProductType = TempProductType; } if (ProductType != null) { EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType); } } catch { } UIContext.Post(s => { if (FFUURL != null) { Download(FFUURL, ProductType, FFUDownloadedAndCheckSupported, null); } if (EmergencyURLs != null) { Download(EmergencyURLs, ProductType, EmergencyDownloaded, ProductType); } }, null); }).Start(); }
private void SwitchFromFlashToLabelMode(bool Continuation = false) { string ProgressText; if (Continuation) { ProgressText = "And now preparing to boot the phone to Label mode..."; } else { ProgressText = "Preparing to boot the phone to Label mode..."; } NokiaFlashModel FlashModel = (NokiaFlashModel)CurrentModel; if (CurrentMode == PhoneInterfaces.Lumia_Bootloader) { try { FlashModel.SwitchToFlashAppContext(); } catch { } } PhoneInfo Info = FlashModel.ReadPhoneInfo(ExtendedInfo: true); if (Info.MmosOverUsbSupported) { new Thread(() => { LogFile.BeginAction("SwitchToLabelMode"); try { ModeSwitchProgressWrapper(ProgressText, null); string TempFolder = Environment.GetEnvironmentVariable("TEMP") + @"\WPInternals"; if (Info.Type == "RM-1152") { Info.Type = "RM-1151"; } string ENOSWPackage = LumiaDownloadModel.SearchENOSW(Info.Type, Info.Firmware); SetWorkingStatus("Downloading " + Info.Type + " Test Mode package...", MaxProgressValue: 100); DownloadEntry downloadEntry = new DownloadEntry(ENOSWPackage, TempFolder, null, null, null); downloadEntry.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { if (e.PropertyName == "Progress") { int progress = (sender as DownloadEntry).Progress; ulong progressret; ulong.TryParse(progress.ToString(), out progressret); UpdateWorkingStatus(null, CurrentProgressValue: progressret); if (progress == 100) { ModeSwitchProgressWrapper("Initializing Flash...", null); string MMOSPath = TempFolder + "\\" + (sender as DownloadEntry).Name; PhoneNotifier.NewDeviceArrived += NewDeviceArrived; FileInfo info = new FileInfo(MMOSPath); uint length = uint.Parse(info.Length.ToString()); int maximumbuffersize = 0x00240000; uint totalcounts = (uint)Math.Truncate((decimal)length / maximumbuffersize); SetWorkingStatus("Flashing Test Mode package...", MaxProgressValue: 100); ProgressUpdater progressUpdater = new ProgressUpdater(totalcounts + 1, (int i, TimeSpan? time) => UpdateWorkingStatus(null, CurrentProgressValue: (ulong)i)); FlashModel.FlashMMOS(MMOSPath, progressUpdater); SetWorkingStatus("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."); } } }; } catch (Exception Ex) { LogFile.LogException(Ex); ModeSwitchErrorWrapper(Ex.Message); } LogFile.EndAction("SwitchToLabelMode"); }).Start(); } else { byte[] BootModeFlagCommand = new byte[] { 0x4E, 0x4F, 0x4B, 0x58, 0x46, 0x57, 0x00, 0x55, 0x42, 0x46, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 }; // NOKFW UBF byte[] RebootCommand = new byte[] { 0x4E, 0x4F, 0x4B, 0x52 }; // NOKR BootModeFlagCommand[0x0F] = 0x59; ((NokiaPhoneModel)CurrentModel).ExecuteRawMethod(BootModeFlagCommand); ((NokiaPhoneModel)CurrentModel).ExecuteRawVoidMethod(RebootCommand); PhoneNotifier.NewDeviceArrived += NewDeviceArrived; ModeSwitchProgressWrapper("Rebooting phone to Label mode", null); LogFile.Log("Rebooting phone to Label mode", LogType.FileAndConsole); } }