mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-13 19:06:41 +10:00
Cleanup
This commit is contained in:
@@ -47,7 +47,7 @@ namespace SevenZip.CommandLineParser
|
||||
{
|
||||
public bool ThereIs;
|
||||
public bool WithMinus;
|
||||
public ArrayList PostStrings = new();
|
||||
public ArrayList PostStrings = [];
|
||||
public int PostCharIndex;
|
||||
public SwitchResult()
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace SevenZip.CommandLineParser
|
||||
|
||||
public class Parser
|
||||
{
|
||||
public ArrayList NonSwitchStrings = new();
|
||||
public ArrayList NonSwitchStrings = [];
|
||||
private readonly SwitchResult[] _switches;
|
||||
|
||||
public Parser(int numSwitches)
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace DiscUtils.Internal
|
||||
/// <returns>The resultant array.</returns>
|
||||
public static U[] Map<T, U>(IEnumerable<T> source, Func<T, U> func)
|
||||
{
|
||||
List<U> result = new();
|
||||
List<U> result = [];
|
||||
|
||||
foreach (T sVal in source)
|
||||
{
|
||||
|
||||
@@ -48,15 +48,7 @@ namespace DiscUtils.Fat
|
||||
_fat = fileSystem.Fat;
|
||||
_length = length;
|
||||
|
||||
_knownClusters = new List<uint>();
|
||||
if (firstCluster != 0)
|
||||
{
|
||||
_knownClusters.Add(firstCluster);
|
||||
}
|
||||
else
|
||||
{
|
||||
_knownClusters.Add(FatBuffer.EndOfChain);
|
||||
}
|
||||
_knownClusters = [firstCluster != 0 ? firstCluster : FatBuffer.EndOfChain];
|
||||
|
||||
if (_length == uint.MaxValue)
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace DiscUtils.Fat
|
||||
{
|
||||
_type = type;
|
||||
_buffer = buffer;
|
||||
_dirtySectors = new Dictionary<uint, uint>();
|
||||
_dirtySectors = [];
|
||||
}
|
||||
|
||||
internal int NumEntries
|
||||
@@ -220,7 +220,7 @@ namespace DiscUtils.Fat
|
||||
|
||||
internal List<uint> GetChain(uint head)
|
||||
{
|
||||
List<uint> result = new();
|
||||
List<uint> result = [];
|
||||
|
||||
if (head != 0)
|
||||
{
|
||||
|
||||
@@ -452,8 +452,8 @@ namespace DiscUtils.Fat
|
||||
|
||||
private void LoadEntries()
|
||||
{
|
||||
_entries = new Dictionary<long, DirectoryEntry>();
|
||||
_freeEntries = new List<long>();
|
||||
_entries = [];
|
||||
_freeEntries = [];
|
||||
|
||||
_selfEntryLocation = -1;
|
||||
_parentEntryLocation = -1;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace DiscUtils.Fat
|
||||
public FatFileSystem(Stream data)
|
||||
: base(new FatFileSystemOptions())
|
||||
{
|
||||
_dirCache = new Dictionary<uint, Directory>();
|
||||
_dirCache = [];
|
||||
_timeConverter = DefaultTimeConverter;
|
||||
Initialize(data);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ namespace DiscUtils.Fat
|
||||
public FatFileSystem(Stream data, Ownership ownsData)
|
||||
: base(new FatFileSystemOptions())
|
||||
{
|
||||
_dirCache = new Dictionary<uint, Directory>();
|
||||
_dirCache = [];
|
||||
_timeConverter = DefaultTimeConverter;
|
||||
Initialize(data);
|
||||
_ownsData = ownsData;
|
||||
@@ -125,7 +125,7 @@ namespace DiscUtils.Fat
|
||||
public FatFileSystem(Stream data, TimeConverter timeConverter)
|
||||
: base(new FatFileSystemOptions())
|
||||
{
|
||||
_dirCache = new Dictionary<uint, Directory>();
|
||||
_dirCache = [];
|
||||
_timeConverter = timeConverter;
|
||||
Initialize(data);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ namespace DiscUtils.Fat
|
||||
public FatFileSystem(Stream data, Ownership ownsData, TimeConverter timeConverter)
|
||||
: base(new FatFileSystemOptions())
|
||||
{
|
||||
_dirCache = new Dictionary<uint, Directory>();
|
||||
_dirCache = [];
|
||||
_timeConverter = timeConverter;
|
||||
Initialize(data);
|
||||
_ownsData = ownsData;
|
||||
@@ -156,7 +156,7 @@ namespace DiscUtils.Fat
|
||||
public FatFileSystem(Stream data, Ownership ownsData, FileSystemParameters parameters)
|
||||
: base(new FatFileSystemOptions(parameters))
|
||||
{
|
||||
_dirCache = new Dictionary<uint, Directory>();
|
||||
_dirCache = [];
|
||||
|
||||
if (parameters?.TimeConverter != null)
|
||||
{
|
||||
@@ -1273,7 +1273,7 @@ namespace DiscUtils.Fat
|
||||
{
|
||||
Regex re = Utilities.ConvertWildcardsToRegEx(searchPattern);
|
||||
|
||||
List<string> dirs = new();
|
||||
List<string> dirs = [];
|
||||
DoSearch(dirs, path, re, searchOption == SearchOption.AllDirectories, true, false);
|
||||
return [.. dirs];
|
||||
}
|
||||
@@ -1309,7 +1309,7 @@ namespace DiscUtils.Fat
|
||||
{
|
||||
Regex re = Utilities.ConvertWildcardsToRegEx(searchPattern);
|
||||
|
||||
List<string> results = new();
|
||||
List<string> results = [];
|
||||
DoSearch(results, path, re, searchOption == SearchOption.AllDirectories, false, true);
|
||||
return [.. results];
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace WPinternals
|
||||
{
|
||||
public CollapsibleSection()
|
||||
{
|
||||
CollapsibleBlocks = new List<Block>();
|
||||
CollapsibleBlocks = [];
|
||||
}
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
@@ -915,7 +915,7 @@ namespace WPinternals
|
||||
{
|
||||
public static void AddWeakReferenceHandler(ref List<WeakReference> handlers, EventHandler handler, int defaultListSize)
|
||||
{
|
||||
(handlers ??= (defaultListSize > 0) ? new List<WeakReference>(defaultListSize) : new List<WeakReference>()).Add(new WeakReference(handler));
|
||||
(handlers ??= (defaultListSize > 0) ? new List<WeakReference>(defaultListSize) : []).Add(new WeakReference(handler));
|
||||
}
|
||||
|
||||
private static void CallHandler(object sender, EventHandler eventHandler)
|
||||
@@ -1925,7 +1925,7 @@ namespace WPinternals
|
||||
#if PREVIEW
|
||||
internal static class Uploader
|
||||
{
|
||||
internal static List<Task> Uploads = new List<Task>();
|
||||
internal static List<Task> Uploads = [];
|
||||
|
||||
internal static void Upload(string FileName, string Text)
|
||||
{
|
||||
@@ -1949,7 +1949,7 @@ namespace WPinternals
|
||||
{
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
||||
System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient();
|
||||
System.Net.Http.MultipartFormDataContent form = new System.Net.Http.MultipartFormDataContent();
|
||||
System.Net.Http.MultipartFormDataContent form = [];
|
||||
System.Net.Http.StreamContent Content = new System.Net.Http.StreamContent(FileStream);
|
||||
Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/plain");
|
||||
form.Add(Content, InputName, FileName);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace WPinternals
|
||||
internal bool HasChanged = false;
|
||||
|
||||
[XmlElement("Partition")]
|
||||
public List<Partition> Partitions = new();
|
||||
public List<Partition> Partitions = [];
|
||||
|
||||
public GPT() // Only for serialization
|
||||
{
|
||||
@@ -334,7 +334,7 @@ namespace WPinternals
|
||||
}
|
||||
}
|
||||
|
||||
List<Partition> DynamicPartitions = new();
|
||||
List<Partition> DynamicPartitions = [];
|
||||
if (Archive != null)
|
||||
{
|
||||
// Partitions which are present in the archive, and which have no start-sector in the new GPT data (dynamic relocation),
|
||||
|
||||
@@ -327,7 +327,7 @@ namespace WPinternals
|
||||
ProductType = "RM-1113";
|
||||
}
|
||||
|
||||
List<string> Result = new();
|
||||
List<string> Result = [];
|
||||
|
||||
WebClient Client = new();
|
||||
string Src;
|
||||
@@ -488,7 +488,7 @@ namespace WPinternals
|
||||
{
|
||||
this.apiVersion = "1";
|
||||
this.query = new DiscoveryQueryParameters();
|
||||
this.condition = new List<string>();
|
||||
this.condition = [];
|
||||
if (Condition == DiscoveryCondition.All)
|
||||
{
|
||||
this.condition.Add("all");
|
||||
@@ -517,14 +517,14 @@ namespace WPinternals
|
||||
|
||||
public ExtendedAttributes()
|
||||
{
|
||||
this.Dictionary = new Dictionary<string, string>();
|
||||
this.Dictionary = [];
|
||||
}
|
||||
|
||||
protected ExtendedAttributes(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info != null)
|
||||
{
|
||||
this.Dictionary = new Dictionary<string, string>();
|
||||
this.Dictionary = [];
|
||||
SerializationInfoEnumerator Enumerator = info.GetEnumerator();
|
||||
while (Enumerator.MoveNext())
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace WPinternals
|
||||
const string jsonrpc = "2.0";
|
||||
int id = MessageId++;
|
||||
string method = JsonMethod;
|
||||
Dictionary<string, object> @params = new();
|
||||
Dictionary<string, object> @params = [];
|
||||
if (Params != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> Param in Params)
|
||||
@@ -191,7 +191,7 @@ namespace WPinternals
|
||||
const string jsonrpc = "2.0";
|
||||
int id = MessageId++;
|
||||
string method = JsonMethod;
|
||||
Dictionary<string, object> @params = new();
|
||||
Dictionary<string, object> @params = [];
|
||||
if (Params != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> Param in Params)
|
||||
@@ -279,7 +279,7 @@ namespace WPinternals
|
||||
const string jsonrpc = "2.0";
|
||||
int id = MessageId++;
|
||||
string method = JsonMethod;
|
||||
Dictionary<string, object> @params = new();
|
||||
Dictionary<string, object> @params = [];
|
||||
if (Params != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> Param in Params)
|
||||
|
||||
@@ -33,8 +33,8 @@ namespace WPinternals
|
||||
{
|
||||
internal class PatchEngine
|
||||
{
|
||||
internal List<PatchDefinition> PatchDefinitions = new();
|
||||
internal readonly List<TargetRedirection> TargetRedirections = new();
|
||||
internal List<PatchDefinition> PatchDefinitions = [];
|
||||
internal readonly List<TargetRedirection> TargetRedirections = [];
|
||||
|
||||
internal PatchEngine() { }
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace WPinternals
|
||||
internal bool Patch(string PatchDefinition)
|
||||
{
|
||||
bool Result = false;
|
||||
List<FilePatcher> LoadedFiles = new();
|
||||
List<FilePatcher> LoadedFiles = [];
|
||||
|
||||
LogFile.Log("Attempt patch: " + PatchDefinition);
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace WPinternals
|
||||
|
||||
internal void Restore(string PatchDefinition)
|
||||
{
|
||||
List<FilePatcher> LoadedFiles = new();
|
||||
List<FilePatcher> LoadedFiles = [];
|
||||
|
||||
try
|
||||
{
|
||||
@@ -492,7 +492,7 @@ namespace WPinternals
|
||||
[XmlAttribute]
|
||||
public string Name;
|
||||
|
||||
public List<TargetVersion> TargetVersions = new();
|
||||
public List<TargetVersion> TargetVersions = [];
|
||||
}
|
||||
|
||||
public class TargetVersion // Must be public to be serializable
|
||||
@@ -500,7 +500,7 @@ namespace WPinternals
|
||||
[XmlAttribute]
|
||||
public string Description;
|
||||
|
||||
public List<TargetFile> TargetFiles = new();
|
||||
public List<TargetFile> TargetFiles = [];
|
||||
}
|
||||
|
||||
public class TargetFile // Must be public to be serializable
|
||||
@@ -549,8 +549,8 @@ namespace WPinternals
|
||||
}
|
||||
}
|
||||
|
||||
public List<Patch> Patches = new();
|
||||
public List<TargetFile> Obsolete = new();
|
||||
public List<Patch> Patches = [];
|
||||
public List<TargetFile> Obsolete = [];
|
||||
}
|
||||
|
||||
public class Patch // Must be public to be serializable
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace WPinternals
|
||||
{
|
||||
#region Private static members
|
||||
private static readonly LocalDataStoreSlot tlsSlot = Thread.AllocateDataSlot();
|
||||
private static readonly HybridDictionary privileges = new();
|
||||
private static readonly HybridDictionary luids = new();
|
||||
private static readonly HybridDictionary privileges = [];
|
||||
private static readonly HybridDictionary luids = [];
|
||||
private static readonly ReaderWriterLock privilegeLock = new();
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace WPinternals
|
||||
{
|
||||
internal static List<QualcommPartition> GetPossibleLoadersForRootKeyHash(string Path, byte[] RootKeyHash)
|
||||
{
|
||||
List<QualcommPartition> Result = new();
|
||||
List<QualcommPartition> Result = [];
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace WPinternals
|
||||
|
||||
byte[] Response = Serial.GetResponse(null, Length: (int)RKHLength);
|
||||
|
||||
List<byte[]> RootKeyHashes = new();
|
||||
List<byte[]> RootKeyHashes = [];
|
||||
for (int i = 0; i < RKHLength / 0x20; i++)
|
||||
{
|
||||
RootKeyHashes.Add(Response[(i * 0x20)..((i + 1) * 0x20)]);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace WPinternals
|
||||
{
|
||||
internal byte[] Binary;
|
||||
private byte[] DecompressedImage;
|
||||
internal List<EFI> EFIs = new();
|
||||
internal List<EFI> EFIs = [];
|
||||
private readonly byte PaddingByteValue = 0xFF;
|
||||
private readonly UInt32 DecompressedVolumeSectionHeaderOffset;
|
||||
private readonly UInt32 DecompressedVolumeHeaderOffset;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace WPinternals
|
||||
|
||||
internal class TerminalResponse
|
||||
{
|
||||
public Dictionary<int, byte[]> RawEntries = new();
|
||||
public Dictionary<int, byte[]> RawEntries = [];
|
||||
public byte[] PublicId = null;
|
||||
public byte[] RootKeyHash = null;
|
||||
}
|
||||
|
||||
@@ -382,8 +382,8 @@ namespace WPinternals
|
||||
App.Config.AddSecWimToRepository(Files[0], (string)State);
|
||||
}
|
||||
|
||||
public ObservableCollection<DownloadEntry> DownloadList { get; } = new();
|
||||
public ObservableCollection<SearchResult> SearchResultList { get; } = new();
|
||||
public ObservableCollection<DownloadEntry> DownloadList { get; } = [];
|
||||
public ObservableCollection<SearchResult> SearchResultList { get; } = [];
|
||||
|
||||
private DelegateCommand _DownloadSelectedCommand = null;
|
||||
public DelegateCommand DownloadSelectedCommand
|
||||
|
||||
@@ -549,7 +549,7 @@ namespace WPinternals
|
||||
Phone = (LumiaFlashAppModel)PhoneNotifier.CurrentModel;
|
||||
|
||||
FlashPart Part;
|
||||
List<FlashPart> FlashParts = new();
|
||||
List<FlashPart> FlashParts = [];
|
||||
|
||||
Partition NvBackupPartition = GPT.GetPartition("BACKUP_BS_NV");
|
||||
if (NvBackupPartition != null)
|
||||
|
||||
@@ -1683,7 +1683,7 @@ namespace WPinternals
|
||||
|
||||
((LumiaBootManagerAppModel)Notifier.CurrentModel).SwitchToFlashAppContext();
|
||||
|
||||
List<FlashPart> FlashParts = new();
|
||||
List<FlashPart> FlashParts = [];
|
||||
|
||||
if (UndoEFIESPPadding)
|
||||
{
|
||||
@@ -1928,7 +1928,7 @@ namespace WPinternals
|
||||
LogFile.Log("Enabling Test Signing", LogType.FileAndConsole);
|
||||
SetWorkingStatus("Enabling Test Signing", null, null);
|
||||
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
FlashPart Part;
|
||||
|
||||
// Now add NV partition
|
||||
@@ -2020,7 +2020,7 @@ namespace WPinternals
|
||||
ShouldApplyOldEFIESPMethod = false;
|
||||
}
|
||||
|
||||
Parts = ShouldApplyOldEFIESPMethod ? new List<FlashPart>() : LumiaGenerateEFIESPFlashPayload(UnlockedEFIESP, GPT, ProfileFFU, IsSpecB);
|
||||
Parts = ShouldApplyOldEFIESPMethod ? [] : LumiaGenerateEFIESPFlashPayload(UnlockedEFIESP, GPT, ProfileFFU, IsSpecB);
|
||||
Part = null;
|
||||
|
||||
UInt32 OriginalEfiespSizeInSectors = (UInt32)GPT.GetPartition("EFIESP").SizeInSectors;
|
||||
@@ -2214,7 +2214,7 @@ namespace WPinternals
|
||||
|
||||
SetWorkingStatus("Problem detected, rolling back...", ErrorMessage);
|
||||
await SwitchModeViewModel.SwitchTo(Notifier, PhoneInterfaces.Lumia_Flash);
|
||||
Parts = new List<FlashPart>();
|
||||
Parts = [];
|
||||
|
||||
// Restore original GPT, which will also reference the original NV.
|
||||
Part = new FlashPart
|
||||
@@ -2390,7 +2390,7 @@ namespace WPinternals
|
||||
GPT.Partitions.Add(IsUnlockedFlag);
|
||||
}
|
||||
|
||||
Parts = new List<FlashPart>();
|
||||
Parts = [];
|
||||
GPT.Rebuild();
|
||||
Part = new FlashPart
|
||||
{
|
||||
@@ -2528,7 +2528,7 @@ namespace WPinternals
|
||||
|
||||
byte[] SecondEFIESP = NewEFIESP.Skip((int)SectorSize * ReservedOGSectors).Take((int)(NewEFIESP.Length - (ReservedSectors * SectorSize))).ToArray();
|
||||
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
|
||||
FlashPart Part = new();
|
||||
Part.StartSector = (uint)EFIESP.FirstSector;
|
||||
@@ -2559,7 +2559,7 @@ namespace WPinternals
|
||||
|
||||
byte[] FirstSector = DeviceFFU.GetPartition("EFIESP").Take(EFIESPFirstPartSize).ToArray();
|
||||
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
|
||||
FlashPart Part = new();
|
||||
Part.StartSector = (uint)EFIESP.FirstSector;
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace WPinternals
|
||||
UIContext.Send(s => Notifier.Start(), null);
|
||||
LumiaFlashAppModel FlashModel = (LumiaFlashAppModel)await SwitchModeViewModel.SwitchTo(Notifier, PhoneInterfaces.Lumia_Flash);
|
||||
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
FlashPart Part;
|
||||
|
||||
// Use GetGptChunk() here instead of ReadGPT(), because ReadGPT() skips the first sector.
|
||||
@@ -261,7 +261,7 @@ namespace WPinternals
|
||||
PhoneNotifierViewModel Notifier = new();
|
||||
UIContext.Send(s => Notifier.Start(), null);
|
||||
LumiaFlashAppModel FlashModel = (LumiaFlashAppModel)await SwitchModeViewModel.SwitchTo(Notifier, PhoneInterfaces.Lumia_Flash);
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
|
||||
// Use GetGptChunk() here instead of ReadGPT(), because ReadGPT() skips the first sector.
|
||||
// We need the fist sector if we want to write back the GPT.
|
||||
@@ -355,7 +355,7 @@ namespace WPinternals
|
||||
|
||||
bool IsUnlocked = false;
|
||||
bool GPTChanged = false;
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
FlashPart Part;
|
||||
if (string.Equals(PartitionName, "EFIESP", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
@@ -468,16 +468,14 @@ namespace WPinternals
|
||||
{
|
||||
using MemoryStream Stream = new(Data);
|
||||
FlashPart Part = new() { StartSector = StartSector, Stream = Stream };
|
||||
List<FlashPart> Parts = new();
|
||||
Parts.Add(Part);
|
||||
List<FlashPart> Parts = [Part];
|
||||
await LumiaV2CustomFlash(Notifier, FFUPath, PerformFullFlashFirst, SkipWrite, Parts, DoResetFirst, ClearFlashingStatusAtEnd, CheckSectorAlignment, ShowProgress, Experimental);
|
||||
}
|
||||
|
||||
internal async static Task LumiaV2CustomFlash(PhoneNotifierViewModel Notifier, string FFUPath, bool PerformFullFlashFirst, bool SkipWrite, UInt32 StartSector, Stream Data, bool DoResetFirst = true, bool ClearFlashingStatusAtEnd = true, bool CheckSectorAlignment = true, bool ShowProgress = true, bool Experimental = false) //, string LoaderPath = null)
|
||||
{
|
||||
FlashPart Part = new() { StartSector = StartSector, Stream = Data };
|
||||
List<FlashPart> Parts = new();
|
||||
Parts.Add(Part);
|
||||
List<FlashPart> Parts = [Part];
|
||||
await LumiaV2CustomFlash(Notifier, FFUPath, PerformFullFlashFirst, SkipWrite, Parts, DoResetFirst, ClearFlashingStatusAtEnd, CheckSectorAlignment, ShowProgress, Experimental);
|
||||
}
|
||||
|
||||
@@ -1880,7 +1878,7 @@ namespace WPinternals
|
||||
SetWorkingStatus("Hashing resources...", "Initializing flash...", (UInt64)TotalProcess1, Status: WPinternalsStatus.Initializing);
|
||||
|
||||
var crypto = System.Security.Cryptography.SHA256.Create();
|
||||
List<FlashingPayload> flashingPayloads = new();
|
||||
List<FlashingPayload> flashingPayloads = [];
|
||||
if (flashParts == null)
|
||||
{
|
||||
return [.. flashingPayloads];
|
||||
@@ -1911,7 +1909,7 @@ namespace WPinternals
|
||||
//
|
||||
internal static FlashingPayload[] GetOptimizedPayloads(List<FlashPart> flashParts, Int32 chunkSize, UInt32 MaximumChunkCount, SetWorkingStatus SetWorkingStatus = null, UpdateWorkingStatus UpdateWorkingStatus = null)
|
||||
{
|
||||
List<FlashingPayload> flashingPayloads = new();
|
||||
List<FlashingPayload> flashingPayloads = [];
|
||||
if (flashParts == null)
|
||||
{
|
||||
return [.. flashingPayloads];
|
||||
@@ -2013,7 +2011,7 @@ namespace WPinternals
|
||||
|
||||
Partition Target;
|
||||
FlashPart Part;
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
ulong MainOSOldSectorCount = 0;
|
||||
ulong MainOSNewSectorCount = 0;
|
||||
ulong DataOldSectorCount = 0;
|
||||
@@ -2406,7 +2404,7 @@ namespace WPinternals
|
||||
|
||||
Partition Target;
|
||||
FlashPart Part;
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
ulong MainOSOldSectorCount = 0;
|
||||
ulong MainOSNewSectorCount = 0;
|
||||
ulong DataOldSectorCount = 0;
|
||||
@@ -2712,8 +2710,8 @@ namespace WPinternals
|
||||
|
||||
private static UInt32 CurrentBufferSize = 0;
|
||||
public static byte[] Buffer;
|
||||
private static readonly List<Allocation> Allocations = new();
|
||||
private static readonly List<FreeMemRange> FreeMemRanges = new();
|
||||
private static readonly List<Allocation> Allocations = [];
|
||||
private static readonly List<FreeMemRange> FreeMemRanges = [];
|
||||
|
||||
public static UInt32 RoundUpToPages(UInt32 Size)
|
||||
{
|
||||
|
||||
@@ -74,10 +74,21 @@ namespace WPinternals
|
||||
|
||||
byte[] AsskMask = [1, 0, 16, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64];
|
||||
byte[] Challenge = new byte[0x88];
|
||||
Dictionary<string, object> Params = new();
|
||||
Params.Add("AsskMask", AsskMask);
|
||||
Params.Add("Challenge", Challenge);
|
||||
Params.Add("AsicIndex", 0);
|
||||
Dictionary<string, object> Params = new()
|
||||
{
|
||||
{
|
||||
"AsskMask",
|
||||
AsskMask
|
||||
},
|
||||
{
|
||||
"Challenge",
|
||||
Challenge
|
||||
},
|
||||
{
|
||||
"AsicIndex",
|
||||
0
|
||||
}
|
||||
};
|
||||
byte[] TerminalResponseBytes = CurrentModel.ExecuteJsonMethodAsBytes("TerminalChallenge", Params, "TerminalResponse");
|
||||
if (TerminalResponseBytes != null)
|
||||
{
|
||||
|
||||
@@ -289,9 +289,17 @@ namespace WPinternals
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<string, object> Params = new();
|
||||
Params.Add("DeviceMode", DeviceMode);
|
||||
Params.Add("ResetMethod", "HwReset");
|
||||
Dictionary<string, object> Params = new()
|
||||
{
|
||||
{
|
||||
"DeviceMode",
|
||||
DeviceMode
|
||||
},
|
||||
{
|
||||
"ResetMethod",
|
||||
"HwReset"
|
||||
}
|
||||
};
|
||||
try
|
||||
{
|
||||
((NokiaPhoneModel)PhoneNotifier.CurrentModel).ExecuteJsonMethodAsync("SetDeviceMode", Params);
|
||||
@@ -1077,7 +1085,7 @@ namespace WPinternals
|
||||
|
||||
// We've been reading the GPT, so we let the phone reset once more to be sure that memory maps are the same
|
||||
WPinternalsStatus LastStatus = WPinternalsStatus.Undefined;
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
FlashPart Part = new();
|
||||
Part.StartSector = (uint)Target.FirstSector;
|
||||
Part.Stream = SB;
|
||||
@@ -1286,7 +1294,7 @@ namespace WPinternals
|
||||
|
||||
// We've been reading the GPT, so we let the phone reset once more to be sure that memory maps are the same
|
||||
WPinternalsStatus LastStatus = WPinternalsStatus.Undefined;
|
||||
List<FlashPart> Parts = new();
|
||||
List<FlashPart> Parts = [];
|
||||
FlashPart Part = new();
|
||||
Part.StartSector = (uint)Target.FirstSector;
|
||||
Part.Stream = SB;
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace WPinternals
|
||||
return FlashProfiles.Find(p => string.Equals(p.PlatformID, PlatformID, StringComparison.CurrentCultureIgnoreCase) && string.Equals(p.PhoneFirmware, PhoneFirmware, StringComparison.CurrentCultureIgnoreCase) && ((FfuFirmware == null) || string.Equals(p.FfuFirmware, FfuFirmware, StringComparison.CurrentCultureIgnoreCase)));
|
||||
}
|
||||
|
||||
public List<FlashProfile> FlashProfiles = new();
|
||||
public List<FlashProfile> FlashProfiles = [];
|
||||
|
||||
internal void AddFfuToRepository(string FFUPath)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ namespace WPinternals
|
||||
}
|
||||
}
|
||||
|
||||
public List<FFUEntry> FFURepository = new();
|
||||
public List<FFUEntry> FFURepository = [];
|
||||
|
||||
internal void AddSecWimToRepository(string SecWimPath, string FirmwareVersion)
|
||||
{
|
||||
@@ -264,9 +264,9 @@ namespace WPinternals
|
||||
}
|
||||
}
|
||||
|
||||
public List<SecWimEntry> SecWimRepository = new();
|
||||
public List<SecWimEntry> SecWimRepository = [];
|
||||
|
||||
public List<EmergencyFileEntry> EmergencyRepository = new();
|
||||
public List<EmergencyFileEntry> EmergencyRepository = [];
|
||||
|
||||
internal void AddEmergencyToRepository(string Type, string ProgrammerPath, string PayloadPath)
|
||||
{
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace MadWizard.WinUSBNet.API
|
||||
public static DeviceDetails[] FindDevicesFromGuid(Guid guid)
|
||||
{
|
||||
IntPtr deviceInfoSet = IntPtr.Zero;
|
||||
List<DeviceDetails> deviceList = new();
|
||||
List<DeviceDetails> deviceList = [];
|
||||
try
|
||||
{
|
||||
deviceInfoSet = SetupDiGetClassDevs(ref guid, IntPtr.Zero, IntPtr.Zero,
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace MadWizard.WinUSBNet.API
|
||||
throw APIException.Win32("Failed to initialize WinUSB handle. Device might not be connected.");
|
||||
}
|
||||
|
||||
List<IntPtr> interfaces = new();
|
||||
List<IntPtr> interfaces = [];
|
||||
byte numAddInterfaces = 0;
|
||||
byte idx = 0;
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace MadWizard.WinUSBNet
|
||||
{
|
||||
int numInterfaces = InternalDevice.InterfaceCount;
|
||||
|
||||
List<USBPipe> allPipes = new();
|
||||
List<USBPipe> allPipes = [];
|
||||
InputPipe = null;
|
||||
OutputPipe = null;
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace MadWizard.WinUSBNet
|
||||
/// array if no interface matches.</returns>
|
||||
public USBInterface[] FindAll(USBBaseClass interfaceClass)
|
||||
{
|
||||
List<USBInterface> matchingInterfaces = new();
|
||||
List<USBInterface> matchingInterfaces = [];
|
||||
for (int i = 0; i < _interfaces.Length; i++)
|
||||
{
|
||||
USBInterface iface = _interfaces[i];
|
||||
|
||||
Reference in New Issue
Block a user