Skip to content

Commit

Permalink
Remove Defunct MSR Downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
gus33000 committed Oct 12, 2024
1 parent 57c9595 commit 14bf607
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 1,498 deletions.
519 changes: 17 additions & 502 deletions WPinternals/CommandLine.cs

Large diffs are not rendered by default.

894 changes: 0 additions & 894 deletions WPinternals/Models/Lumia/MSR/LumiaDownloadModel.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System;
using WPinternals.HelperClasses;
using WPinternals.Models.Lumia.UEFI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System;
using WPinternals.HelperClasses;
using WPinternals.Models.Lumia.UEFI;

Expand Down
104 changes: 37 additions & 67 deletions WPinternals/ViewModels/DownloadsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,42 @@ internal DownloadsViewModel(PhoneNotifierViewModel Notifier)
LastStatusText = null;
}
});

AddSecWIMCommand = new DelegateCommand(() =>
{
string SecWIMPath = null;
OpenFileDialog dlg = new();
dlg.DefaultExt = ".secwim"; // Default file extension
dlg.Filter = "Secure WIM images (.secwim)|*.secwim"; // Filter files by extension
bool? result = dlg.ShowDialog();
if (result == true)
{
SecWIMPath = dlg.FileName;
string SecWIMFile = Path.GetFileName(SecWIMPath);
try
{
App.Config.AddSecWimToRepository(SecWIMPath, FirmwareVersion);
App.Config.WriteConfig();
LastStatusText = $"File \"{SecWIMFile}\" was added to the repository.";
}
catch (WPinternalsException Ex)
{
LastStatusText = $"Error: {Ex.Message}. File \"{SecWIMFile}\" was not added.";
}
catch
{
LastStatusText = $"Error: File \"{SecWIMFile}\" was not added.";
}
}
else
{
LastStatusText = null;
}
});
}

private string _LastStatusText = null;
Expand Down Expand Up @@ -192,9 +228,7 @@ private void Search()

new Thread(() =>
{
string FFUURL = null;
string[] EmergencyURLs = null;
string SecureWIMURL = null;
try
{
Expand All @@ -206,16 +240,6 @@ private void Search()
ProductType = TempProductType;
try
{
FFUURL = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType);
}
catch (WPinternalsException ex)
{
LogFile.LogException(ex, LogType.FileOnly);
FFUURL = LumiaDownloadModel.SearchFFU(ProductType, null, OperatorCode, out TempProductType);
}
if (TempProductType != null)
{
ProductType = TempProductType;
Expand All @@ -225,11 +249,6 @@ private void Search()
{
EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
}
if (ProductType != null && FirmwareVersion != null)
{
(SecureWIMURL, string _) = LumiaDownloadModel.SearchENOSW(ProductType, FirmwareVersion);
}
}
catch (Exception ex)
{
Expand All @@ -238,20 +257,10 @@ private void Search()
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));
}
if (SecureWIMURL != null)
{
SearchResultList.Add(new SearchResult($"{ProductType} ENOSW-files", SecureWIMURL, ProductType, ENOSWDownloaded, FirmwareVersion));
}
}, null);
IsSearching = false;
Expand Down Expand Up @@ -279,9 +288,7 @@ private void DownloadAll()

new Thread(() =>
{
string FFUURL = null;
string[] EmergencyURLs = null;
string SecureWIMURL = null;
try
{
string TempProductType = ProductType.ToUpper();
Expand All @@ -291,7 +298,6 @@ private void DownloadAll()
}
ProductType = TempProductType;
FFUURL = LumiaDownloadModel.SearchFFU(ProductType, ProductCode, OperatorCode, out TempProductType);
if (TempProductType != null)
{
ProductType = TempProductType;
Expand All @@ -301,11 +307,6 @@ private void DownloadAll()
{
EmergencyURLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
}
if (ProductType != null && FirmwareVersion != null)
{
(SecureWIMURL, string _) = LumiaDownloadModel.SearchENOSW(ProductType, FirmwareVersion);
}
}
catch (Exception ex)
{
Expand All @@ -314,20 +315,10 @@ private void DownloadAll()
UIContext.Post(s =>
{
if (FFUURL != null)
{
Download(FFUURL, ProductType, FFUDownloadedAndCheckSupported, null);
}
if (EmergencyURLs != null)
{
Download(EmergencyURLs, ProductType, EmergencyDownloaded, ProductType);
}
if (SecureWIMURL != null)
{
Download(SecureWIMURL, ProductType, ENOSWDownloaded, FirmwareVersion);
}
}, null);
}).Start();
}
Expand All @@ -340,23 +331,6 @@ private void DownloadSelected()
}
}

private void FFUDownloaded(string[] Files, object State)
{
App.Config.AddFfuToRepository(Files[0]);
}

private void FFUDownloadedAndCheckSupported(string[] Files, object State)
{
App.Config.AddFfuToRepository(Files[0]);

if (!App.Config.FFURepository.Any(e => App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V2-EFIESP").TargetVersions.Any(v => v.Description == e.OSVersion)))
{
const string ProductType2 = "RM-1085";
string URL = LumiaDownloadModel.SearchFFU(ProductType2, null, null);
Download(URL, ProductType2, FFUDownloaded, null);
}
}

private void EmergencyDownloaded(string[] Files, object State)
{
string Type = (string)State;
Expand All @@ -382,11 +356,6 @@ private void EmergencyDownloaded(string[] Files, object State)
}
}

private void ENOSWDownloaded(string[] Files, object State)
{
App.Config.AddSecWimToRepository(Files[0], (string)State);
}

public ObservableCollection<DownloadEntry> DownloadList { get; } = [];
public ObservableCollection<SearchResult> SearchResultList { get; } = [];

Expand Down Expand Up @@ -683,6 +652,7 @@ internal override async void EvaluateViewState()
}
}
public DelegateCommand AddFFUCommand { get; } = null;
public DelegateCommand AddSecWIMCommand { get; } = null;
}

internal enum DownloadStatus
Expand Down
1 change: 0 additions & 1 deletion WPinternals/ViewModels/LumiaV2UnlockBootViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
using WPinternals.Config;
using WPinternals.HelperClasses;
using WPinternals.Models.Lumia.UEFI;
using WPinternals.Models.UEFIApps;
using WPinternals.Models.UEFIApps.BootMgr;
using WPinternals.Models.UEFIApps.Flash;
using WPinternals.Models.UEFIApps.PhoneInfo;
Expand Down
2 changes: 0 additions & 2 deletions WPinternals/ViewModels/PhoneNotifierViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
using System.Threading;
using System.Threading.Tasks;
using WPinternals.HelperClasses;
using WPinternals.Models.Lumia;
using WPinternals.Models.Lumia.NCSd;
using WPinternals.Models.Lumia.UEFI;
using WPinternals.Models.UEFIApps;
using WPinternals.Models.UEFIApps.BootMgr;
using WPinternals.Models.UEFIApps.Flash;
using WPinternals.Models.UEFIApps.PhoneInfo;
Expand Down
30 changes: 0 additions & 30 deletions WPinternals/ViewModels/SwitchModeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@
using System.Threading.Tasks;
using WPinternals.HelperClasses;
using WPinternals.Models.Lumia;
using WPinternals.Models.Lumia.MSR;
using WPinternals.Models.Lumia.NCSd;
using WPinternals.Models.Lumia.UEFI;
using WPinternals.Models.UEFIApps;
using WPinternals.Models.UEFIApps.BootMgr;
using WPinternals.Models.UEFIApps.Flash;
using WPinternals.Models.UEFIApps.PhoneInfo;
Expand Down Expand Up @@ -761,21 +759,7 @@ void Finish()
PhoneInfoAppInfo.Type = "RM-1151";
}
(string ENOSWFileUrl, string DPLFileUrl) = LumiaDownloadModel.SearchENOSW(PhoneInfoAppInfo.Type, Info.Firmware);
UIContext?.Post(d => SetWorkingStatus($"Downloading {PhoneInfoAppInfo.Type} Test Mode package...", MaxProgressValue: 100), null);
DownloadEntry downloadEntry = new(ENOSWFileUrl, TempFolder, [ENOSWFileUrl], ENOSWDownloadCompleted, Info.Firmware);
downloadEntry.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
{
if (e.PropertyName == "Progress")
{
int progress = (sender as DownloadEntry)?.Progress ?? 0;
ulong.TryParse(progress.ToString(), out ulong progressret);
UIContext?.Post(d => UpdateWorkingStatus(null, CurrentProgressValue: progressret), null);
}
};
}
catch (Exception Ex)
{
Expand Down Expand Up @@ -875,21 +859,7 @@ void Finish()
PhoneInfoAppInfo.Type = "RM-1151";
}
(string ENOSWFileUrl, string DPLFileUrl) = LumiaDownloadModel.SearchENOSW(PhoneInfoAppInfo.Type, Info.Firmware);
UIContext?.Post(d => SetWorkingStatus($"Downloading {PhoneInfoAppInfo.Type} Test Mode package...", MaxProgressValue: 100), null);
DownloadEntry downloadEntry = new(ENOSWFileUrl, TempFolder, [ENOSWFileUrl], ENOSWDownloadCompleted, Info.Firmware);
downloadEntry.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
{
if (e.PropertyName == "Progress")
{
int progress = (sender as DownloadEntry)?.Progress ?? 0;
ulong.TryParse(progress.ToString(), out ulong progressret);
UIContext?.Post(d => UpdateWorkingStatus(null, CurrentProgressValue: progressret), null);
}
};
}
catch (Exception Ex)
{
Expand Down

0 comments on commit 14bf607

Please sign in to comment.