mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-14 03:16:40 +10:00
Remove deprecated download command line options
This commit is contained in:
@@ -28,7 +28,6 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WPinternals.Config;
|
||||
using WPinternals.HelperClasses;
|
||||
using WPinternals.Models.Lumia.MSR;
|
||||
using WPinternals.Models.Lumia.NCSd;
|
||||
using WPinternals.Models.UEFIApps.BootMgr;
|
||||
using WPinternals.Models.UEFIApps.Flash;
|
||||
@@ -1268,262 +1267,6 @@ namespace WPinternals
|
||||
|
||||
LogFile.Log("Root access enabled on image", LogType.FileAndConsole);
|
||||
break;
|
||||
case "downloademergency":
|
||||
LogFile.Log("Command: Download Emergency files", LogType.FileAndConsole);
|
||||
Notifier = new PhoneNotifierViewModel();
|
||||
UIContext.Send(s => Notifier.Start(), null);
|
||||
if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Normal)
|
||||
{
|
||||
NormalModel = (NokiaCareSuiteModel)Notifier.CurrentModel;
|
||||
ProductType = NormalModel.ExecuteJsonMethodAsString("ReadManufacturerModelName", "ManufacturerModelName");
|
||||
if (ProductType.Contains('_'))
|
||||
{
|
||||
ProductType = ProductType.Substring(0, ProductType.IndexOf('_'));
|
||||
}
|
||||
}
|
||||
else if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
BootMgrModel = (LumiaBootManagerAppModel)Notifier.CurrentModel;
|
||||
BootManagerInfo = BootMgrModel.ReadPhoneInfo();
|
||||
//ProductType = BootManagerInfo.Type; // TODO: FIXME
|
||||
ProductType = "";
|
||||
}
|
||||
else if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Flash)
|
||||
{
|
||||
FlashModel = (LumiaFlashAppModel)Notifier.CurrentModel;
|
||||
FlashInfo = FlashModel.ReadPhoneInfo();
|
||||
//ProductType = FlashInfo.Type; // TODO: FIXME
|
||||
ProductType = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
NormalModel = (NokiaCareSuiteModel)await SwitchModeViewModel.SwitchTo(Notifier, PhoneInterfaces.Lumia_Normal);
|
||||
ProductType = NormalModel.ExecuteJsonMethodAsString("ReadManufacturerModelName", "ManufacturerModelName");
|
||||
if (ProductType.Contains('_'))
|
||||
{
|
||||
ProductType = ProductType.Substring(0, ProductType.IndexOf('_'));
|
||||
}
|
||||
}
|
||||
URLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
|
||||
if (URLs != null)
|
||||
{
|
||||
DownloadFolder = args.Length >= 3
|
||||
? args[2]
|
||||
: Environment.ExpandEnvironmentVariables("%ALLUSERSPROFILE%\\WPInternals\\Repository\\" + ProductType.ToUpper());
|
||||
|
||||
if (!Directory.Exists(DownloadFolder))
|
||||
{
|
||||
Directory.CreateDirectory(DownloadFolder);
|
||||
}
|
||||
|
||||
LogFile.Log("Download folder: " + DownloadFolder, LogType.FileAndConsole);
|
||||
for (int i = 0; i < URLs.Length; i++)
|
||||
{
|
||||
LogFile.Log("URL: " + URLs[i], LogType.FileAndConsole);
|
||||
URI = new Uri(URLs[i]);
|
||||
EmergencyFileName = Path.GetFileName(URI.LocalPath);
|
||||
LogFile.Log("File: " + EmergencyFileName, LogType.FileAndConsole);
|
||||
EmergencyFilePath = Path.Combine(DownloadFolder, EmergencyFileName);
|
||||
if (i == 0)
|
||||
{
|
||||
ProgrammerPath = EmergencyFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
PayloadPath = EmergencyFilePath;
|
||||
}
|
||||
|
||||
LogFile.Log("Downloading...", LogType.FileAndConsole);
|
||||
using (System.Net.WebClient myWebClient = new())
|
||||
{
|
||||
await myWebClient.DownloadFileTaskAsync(URLs[i], EmergencyFilePath);
|
||||
}
|
||||
LogFile.Log("Download finished", LogType.FileAndConsole);
|
||||
}
|
||||
App.Config.AddEmergencyToRepository(ProductType, ProgrammerPath, PayloadPath);
|
||||
}
|
||||
Notifier.Stop();
|
||||
break;
|
||||
case "downloademergencybyproducttype":
|
||||
LogFile.Log("Command: Download Emergency files", LogType.FileAndConsole);
|
||||
if (args.Length < 3)
|
||||
{
|
||||
throw new WPinternalsException("Wrong number of arguments. Usage: WPinternals.exe -DownloadEmergencyByProductType <Product type> <Optional: Download folder>");
|
||||
}
|
||||
|
||||
ProductType = args[2];
|
||||
URLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
|
||||
if (URLs != null)
|
||||
{
|
||||
DownloadFolder = args.Length >= 4
|
||||
? args[3]
|
||||
: Environment.ExpandEnvironmentVariables("%ALLUSERSPROFILE%\\WPInternals\\Repository\\" + ProductType.ToUpper());
|
||||
|
||||
if (!Directory.Exists(DownloadFolder))
|
||||
{
|
||||
Directory.CreateDirectory(DownloadFolder);
|
||||
}
|
||||
|
||||
LogFile.Log("Download folder: " + DownloadFolder, LogType.FileAndConsole);
|
||||
for (int i = 0; i < URLs.Length; i++)
|
||||
{
|
||||
LogFile.Log("URL: " + URLs[i], LogType.FileAndConsole);
|
||||
URI = new Uri(URLs[i]);
|
||||
EmergencyFileName = Path.GetFileName(URI.LocalPath);
|
||||
LogFile.Log("File: " + EmergencyFileName, LogType.FileAndConsole);
|
||||
EmergencyFilePath = Path.Combine(DownloadFolder, EmergencyFileName);
|
||||
if (i == 0)
|
||||
{
|
||||
ProgrammerPath = EmergencyFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
PayloadPath = EmergencyFilePath;
|
||||
}
|
||||
|
||||
LogFile.Log("Downloading...", LogType.FileAndConsole);
|
||||
using (System.Net.WebClient myWebClient = new())
|
||||
{
|
||||
await myWebClient.DownloadFileTaskAsync(URLs[i], EmergencyFilePath);
|
||||
}
|
||||
LogFile.Log("Download finished", LogType.FileAndConsole);
|
||||
}
|
||||
App.Config.AddEmergencyToRepository(ProductType, ProgrammerPath, PayloadPath);
|
||||
}
|
||||
break;
|
||||
case "downloadall":
|
||||
LogFile.Log("Command: Download all", LogType.FileAndConsole);
|
||||
Notifier = new PhoneNotifierViewModel();
|
||||
UIContext.Send(s => Notifier.Start(), null);
|
||||
if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Normal)
|
||||
{
|
||||
NormalModel = (NokiaCareSuiteModel)Notifier.CurrentModel;
|
||||
ProductType = NormalModel.ExecuteJsonMethodAsString("ReadManufacturerModelName", "ManufacturerModelName");
|
||||
if (ProductType.Contains('_'))
|
||||
{
|
||||
ProductType = ProductType.Substring(0, ProductType.IndexOf('_'));
|
||||
}
|
||||
}
|
||||
else if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Bootloader)
|
||||
{
|
||||
BootMgrModel = (LumiaBootManagerAppModel)Notifier.CurrentModel;
|
||||
BootManagerInfo = BootMgrModel.ReadPhoneInfo();
|
||||
//ProductType = BootManagerInfo.Type; // TODO: FIXME
|
||||
ProductType = "";
|
||||
}
|
||||
else if (Notifier.CurrentInterface == PhoneInterfaces.Lumia_Flash)
|
||||
{
|
||||
FlashModel = (LumiaFlashAppModel)Notifier.CurrentModel;
|
||||
FlashInfo = FlashModel.ReadPhoneInfo();
|
||||
//ProductType = FlashInfo.Type; // TODO: FIXME
|
||||
ProductType = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
NormalModel = (NokiaCareSuiteModel)await SwitchModeViewModel.SwitchTo(Notifier, PhoneInterfaces.Lumia_Normal);
|
||||
ProductType = NormalModel.ExecuteJsonMethodAsString("ReadManufacturerModelName", "ManufacturerModelName");
|
||||
if (ProductType.Contains('_'))
|
||||
{
|
||||
ProductType = ProductType.Substring(0, ProductType.IndexOf('_'));
|
||||
}
|
||||
}
|
||||
|
||||
DownloadFolder = args.Length >= 3
|
||||
? args[2]
|
||||
: Environment.ExpandEnvironmentVariables("%ALLUSERSPROFILE%\\WPInternals\\Repository\\" + ProductType.ToUpper());
|
||||
|
||||
if (!Directory.Exists(DownloadFolder))
|
||||
{
|
||||
Directory.CreateDirectory(DownloadFolder);
|
||||
}
|
||||
|
||||
URLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
|
||||
if (URLs != null)
|
||||
{
|
||||
for (int i = 0; i < URLs.Length; i++)
|
||||
{
|
||||
LogFile.Log("URL: " + URLs[i], LogType.FileAndConsole);
|
||||
URI = new Uri(URLs[i]);
|
||||
EmergencyFileName = Path.GetFileName(URI.LocalPath);
|
||||
LogFile.Log("File: " + EmergencyFileName, LogType.FileAndConsole);
|
||||
EmergencyFilePath = Path.Combine(DownloadFolder, EmergencyFileName);
|
||||
if (i == 0)
|
||||
{
|
||||
ProgrammerPath = EmergencyFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
PayloadPath = EmergencyFilePath;
|
||||
}
|
||||
|
||||
LogFile.Log("Downloading...", LogType.FileAndConsole);
|
||||
using (System.Net.WebClient myWebClient = new())
|
||||
{
|
||||
await myWebClient.DownloadFileTaskAsync(URLs[i], EmergencyFilePath);
|
||||
}
|
||||
LogFile.Log("Download finished", LogType.FileAndConsole);
|
||||
}
|
||||
App.Config.AddEmergencyToRepository(ProductType, ProgrammerPath, PayloadPath);
|
||||
}
|
||||
|
||||
if (!App.Config.FFURepository.Any(e => App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V2-EFIESP").TargetVersions.Any(v => v.Description == e.OSVersion)))
|
||||
{
|
||||
throw new WPinternalsException("Unable to find compatible FFU", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
Notifier.Stop();
|
||||
break;
|
||||
case "downloadallbyproducttype":
|
||||
LogFile.Log("Command: Download all by Product Type", LogType.FileAndConsole);
|
||||
if (args.Length < 3)
|
||||
{
|
||||
throw new ArgumentException("Wrong number of arguments. Usage: WPinternals.exe -DownloadAllByProductType <Product type> <Optional: Download folder>");
|
||||
}
|
||||
|
||||
ProductType = args[2];
|
||||
LogFile.Log("Product type: " + ProductType, LogType.FileAndConsole);
|
||||
DownloadFolder = args.Length >= 4
|
||||
? args[3]
|
||||
: Environment.ExpandEnvironmentVariables("%ALLUSERSPROFILE%\\WPInternals\\Repository\\" + ProductType.ToUpper());
|
||||
|
||||
if (!Directory.Exists(DownloadFolder))
|
||||
{
|
||||
Directory.CreateDirectory(DownloadFolder);
|
||||
}
|
||||
|
||||
URLs = LumiaDownloadModel.SearchEmergencyFiles(ProductType);
|
||||
if (URLs != null)
|
||||
{
|
||||
for (int i = 0; i < URLs.Length; i++)
|
||||
{
|
||||
LogFile.Log("URL: " + URLs[i], LogType.FileAndConsole);
|
||||
URI = new Uri(URLs[i]);
|
||||
EmergencyFileName = Path.GetFileName(URI.LocalPath);
|
||||
LogFile.Log("File: " + EmergencyFileName, LogType.FileAndConsole);
|
||||
EmergencyFilePath = Path.Combine(DownloadFolder, EmergencyFileName);
|
||||
if (i == 0)
|
||||
{
|
||||
ProgrammerPath = EmergencyFilePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
PayloadPath = EmergencyFilePath;
|
||||
}
|
||||
|
||||
LogFile.Log("Downloading...", LogType.FileAndConsole);
|
||||
using (System.Net.WebClient myWebClient = new())
|
||||
{
|
||||
await myWebClient.DownloadFileTaskAsync(URLs[i], EmergencyFilePath);
|
||||
}
|
||||
LogFile.Log("Download finished", LogType.FileAndConsole);
|
||||
}
|
||||
App.Config.AddEmergencyToRepository(ProductType, ProgrammerPath, PayloadPath);
|
||||
}
|
||||
|
||||
if (!App.Config.FFURepository.Any(e => App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V2-EFIESP").TargetVersions.Any(v => v.Description == e.OSVersion)))
|
||||
{
|
||||
throw new WPinternalsException("Unable to find compatible FFU", "No donor-FFU has been found in the repository with a supported OS version. You can add a donor-FFU within the download section of the tool or by using the command line. A donor-FFU can be for a different device and a different CPU than your device. It is only used to gather Operating System specific binaries to be patched and used as part of the unlock process.");
|
||||
}
|
||||
break;
|
||||
case "rewritepartitionsfrommassstorage":
|
||||
if (args.Length < 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user