Some changes

This commit is contained in:
Gustave Monce
2024-10-12 19:44:11 +02:00
parent 7c18a168fa
commit d9da49915e
24 changed files with 193 additions and 35 deletions
+10 -2
View File
@@ -156,8 +156,12 @@ namespace WPinternals
? Convert.ToUInt64(args[2][2..], 16) ? Convert.ToUInt64(args[2][2..], 16)
: Convert.ToUInt64(args[2], 10); : Convert.ToUInt64(args[2], 10);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Bad start sector", LogType.ConsoleOnly); LogFile.Log("Bad start sector", LogType.ConsoleOnly);
break; break;
} }
@@ -1674,8 +1678,12 @@ namespace WPinternals
}; };
Console.SetOut(standardOutput); Console.SetOut(standardOutput);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
} }
} }
+6 -1
View File
@@ -48,8 +48,13 @@ namespace WPinternals.HelperClasses
{ {
UnderlyingStreamLength = UnderlyingStream.Length; UnderlyingStreamLength = UnderlyingStream.Length;
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
throw new ArgumentException("Unknown stream length"); throw new ArgumentException("Unknown stream length");
} }
} }
@@ -18,6 +18,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using System.Xml; using System.Xml;
@@ -53,8 +54,13 @@ namespace WPinternals.Models.Lumia.MSR
{ {
Config = Client.DownloadString($"https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/{ProductType}/emergency_flash_config.xml"); Config = Client.DownloadString($"https://repairavoidance.blob.core.windows.net/packages/EmergencyFlash/{ProductType}/emergency_flash_config.xml");
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Emergency files for " + ProductType + " not found", LogType.FileAndConsole); LogFile.Log("Emergency files for " + ProductType + " not found", LogType.FileAndConsole);
return null; return null;
} }
@@ -22,6 +22,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Json; using System.Text.Json;
using WPinternals.HelperClasses;
namespace WPinternals.Models.Lumia.NCSd namespace WPinternals.Models.Lumia.NCSd
{ {
@@ -73,20 +74,26 @@ namespace WPinternals.Models.Lumia.NCSd
Length = Device.InputPipe.Read(Buffer); Length = Device.InputPipe.Read(Buffer);
} }
JsonDocument ResultMessage = JsonDocument.Parse(System.Text.Encoding.ASCII.GetString(Buffer, 0, Length)); string ResultString = System.Text.Encoding.ASCII.GetString(Buffer, 0, Length);
JsonDocument ResultMessage = JsonDocument.Parse(ResultString);
try try
{ {
JsonElement? ResultToken = ResultMessage.RootElement.GetProperty("result"); bool result = ResultMessage.RootElement.TryGetProperty("result", out JsonElement ResultToken);
if (ResultToken == null || ResultElement == null) if (!result || ResultElement == null)
{ {
return null; return null;
} }
return ResultToken.Value.GetProperty(ResultElement); return ResultToken.GetProperty(ResultElement);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
return null; return null;
} }
} }
@@ -348,8 +348,13 @@ namespace WPinternals.Models.UEFIApps.BootMgr
ByteOperations.WriteAsciiString(Request, 0, RebootSignature); ByteOperations.WriteAsciiString(Request, 0, RebootSignature);
ExecuteRawVoidMethod(Request); ExecuteRawVoidMethod(Request);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Sending reset-request failed", LogType.FileOnly); LogFile.Log("Sending reset-request failed", LogType.FileOnly);
LogFile.Log("Assuming automatic reset already in progress", LogType.FileOnly); LogFile.Log("Assuming automatic reset already in progress", LogType.FileOnly);
} }
@@ -911,8 +911,13 @@ namespace WPinternals.Models.UEFIApps.Flash
ByteOperations.WriteAsciiString(Request, 0, RebootSignature); ByteOperations.WriteAsciiString(Request, 0, RebootSignature);
ExecuteRawVoidMethod(Request); ExecuteRawVoidMethod(Request);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Sending reset-request failed", LogType.FileOnly); LogFile.Log("Sending reset-request failed", LogType.FileOnly);
LogFile.Log("Assuming automatic reset already in progress", LogType.FileOnly); LogFile.Log("Assuming automatic reset already in progress", LogType.FileOnly);
} }
+7 -1
View File
@@ -22,6 +22,7 @@ using System;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
using WPinternals.HelperClasses;
namespace WPinternals namespace WPinternals
{ {
@@ -488,8 +489,13 @@ namespace WPinternals
callback(state); callback(state);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
p.Revert(); p.Revert();
throw; throw;
} }
+7 -1
View File
@@ -21,6 +21,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using WPinternals.HelperClasses;
namespace WPinternals namespace WPinternals
{ {
@@ -40,8 +41,13 @@ namespace WPinternals
Serial.SendCommand([0x06], [0x02]); Serial.SendCommand([0x06], [0x02]);
return true; return true;
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
return false; return false;
} }
} }
+6 -1
View File
@@ -67,8 +67,13 @@ namespace WPinternals
Serial.SendData(PacketFromPcToProgrammer); Serial.SendData(PacketFromPcToProgrammer);
LogFile.Log("Hello packet accepted", LogType.FileOnly); LogFile.Log("Hello packet accepted", LogType.FileOnly);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Hello packet not accepted", LogType.FileOnly); LogFile.Log("Hello packet not accepted", LogType.FileOnly);
} }
+6 -1
View File
@@ -285,8 +285,13 @@ namespace WPinternals
byte[] Ready = Serial.SendCommand(HelloResponse, [0x03, 0x00, 0x00, 0x00]); byte[] Ready = Serial.SendCommand(HelloResponse, [0x03, 0x00, 0x00, 0x00]);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
Result = false; Result = false;
} }
+6 -1
View File
@@ -195,8 +195,13 @@ namespace WPinternals
MassStorage.RestorePartition(part, partname, (v, t) => LogFile.Log("Progress: " + v + "%", LogType.ConsoleOnly)); MassStorage.RestorePartition(part, partname, (v, t) => LogFile.Log("Progress: " + v + "%", LogType.ConsoleOnly));
LogFile.Log("", LogType.ConsoleOnly); LogFile.Log("", LogType.ConsoleOnly);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("", LogType.ConsoleOnly); LogFile.Log("", LogType.ConsoleOnly);
LogFile.Log($"Failed writing {partname} to the device.", LogType.ConsoleOnly); LogFile.Log($"Failed writing {partname} to the device.", LogType.ConsoleOnly);
} }
+6 -1
View File
@@ -29,7 +29,12 @@ namespace WPinternals
{ {
protected SynchronizationContext UIContext; protected SynchronizationContext UIContext;
public bool IsSwitchingInterface = false; private bool _IsSwitchingInterface = false;
public bool IsSwitchingInterface
{
get => _IsSwitchingInterface;
set => _IsSwitchingInterface = value;
}
public bool IsFlashModeOperation = false; public bool IsFlashModeOperation = false;
public event PropertyChangedEventHandler PropertyChanged = delegate { }; public event PropertyChangedEventHandler PropertyChanged = delegate { };
+18 -3
View File
@@ -82,8 +82,13 @@ namespace WPinternals
{ {
LastFFUStatusText = $"Error: {Ex.Message}. File \"{FFUFile}\" was not added."; LastFFUStatusText = $"Error: {Ex.Message}. File \"{FFUFile}\" was not added.";
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LastFFUStatusText = $"Error: File \"{FFUFile}\" was not added."; LastFFUStatusText = $"Error: File \"{FFUFile}\" was not added.";
} }
} }
@@ -120,8 +125,13 @@ namespace WPinternals
{ {
LastSecWIMStatusText = $"Error: {Ex.Message}. File \"{SecWIMFile}\" was not added."; LastSecWIMStatusText = $"Error: {Ex.Message}. File \"{SecWIMFile}\" was not added.";
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LastSecWIMStatusText = $"Error: File \"{SecWIMFile}\" was not added."; LastSecWIMStatusText = $"Error: File \"{SecWIMFile}\" was not added.";
} }
} }
@@ -1093,8 +1103,13 @@ namespace WPinternals
completed?.Invoke(true); completed?.Invoke(true);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
completed?.Invoke(false); completed?.Invoke(false);
} }
} }
@@ -850,8 +850,13 @@ namespace WPinternals
FFU FFU = new(_FFUPath); FFU FFU = new(_FFUPath);
IsSupportedFfuNeeded = !App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V1.1-EFIESP").TargetVersions.Any(v => v.Description == FFU.GetOSVersion()); IsSupportedFfuNeeded = !App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V1.1-EFIESP").TargetVersions.Any(v => v.Description == FFU.GetOSVersion());
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
IsSupportedFfuNeeded = false; IsSupportedFfuNeeded = false;
return; return;
} }
@@ -918,8 +923,13 @@ namespace WPinternals
FFU ProfileFFU = new(_ProfileFFUPath); FFU ProfileFFU = new(_ProfileFFUPath);
IsSupportedFfuNeeded = !App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V2-EFIESP").TargetVersions.Any(v => v.Description == ProfileFFU.GetOSVersion()); IsSupportedFfuNeeded = !App.PatchEngine.PatchDefinitions.First(p => p.Name == "SecureBootHack-V2-EFIESP").TargetVersions.Any(v => v.Description == ProfileFFU.GetOSVersion());
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
IsSupportedFfuNeeded = false; IsSupportedFfuNeeded = false;
return; return;
} }
@@ -1023,8 +1033,13 @@ namespace WPinternals
ValidatedSupportedFfuPath = SupportedFFUPath; ValidatedSupportedFfuPath = SupportedFFUPath;
} }
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
IsSupportedFfuValid = false; IsSupportedFfuValid = false;
} }
} }
@@ -1742,8 +1742,13 @@ namespace WPinternals
await Notifier.WaitForArrival(); await Notifier.WaitForArrival();
} }
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
// If switching to mass storage mode failed, then we just skip that part. This might be a half unlocked phone. // If switching to mass storage mode failed, then we just skip that part. This might be a half unlocked phone.
LogFile.Log("Skipping Mass Storage mode", LogType.FileAndConsole); LogFile.Log("Skipping Mass Storage mode", LogType.FileAndConsole);
} }
@@ -787,6 +787,8 @@ namespace WPinternals
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole); LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole); LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
FailedToStartProgrammer = true; FailedToStartProgrammer = true;
} }
} }
@@ -810,6 +812,8 @@ namespace WPinternals
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole); LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole); LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
FailedToStartProgrammer = true; FailedToStartProgrammer = true;
} }
} }
@@ -1507,6 +1511,8 @@ namespace WPinternals
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole); LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole); LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
FailedToStartProgrammer = true; FailedToStartProgrammer = true;
} }
} }
@@ -1787,6 +1793,8 @@ namespace WPinternals
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole); LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole); LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
FailedToStartProgrammer = true; FailedToStartProgrammer = true;
} }
} }
@@ -286,8 +286,13 @@ namespace WPinternals
LogFile.Log("Native Debug Status: " + NativeDebugStatus.ToString()); LogFile.Log("Native Debug Status: " + NativeDebugStatus.ToString());
} }
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Reading status from Flash interface was aborted."); LogFile.Log("Reading status from Flash interface was aborted.");
} }
DeviceInfoLoaded = true; DeviceInfoLoaded = true;
@@ -76,8 +76,13 @@ namespace WPinternals
LogFile.Log("Effective Bootloader Security Status: " + EffectiveBootloaderSecurityStatus.ToString()); LogFile.Log("Effective Bootloader Security Status: " + EffectiveBootloaderSecurityStatus.ToString());
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Reading status from Flash interface was aborted."); LogFile.Log("Reading status from Flash interface was aborted.");
} }
DeviceInfoLoaded = true; DeviceInfoLoaded = true;
@@ -88,8 +88,13 @@ namespace WPinternals
LogFile.Log("Effective Bootloader Security Status: " + EffectiveBootloaderSecurityStatus.ToString()); LogFile.Log("Effective Bootloader Security Status: " + EffectiveBootloaderSecurityStatus.ToString());
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Reading status from Flash interface was aborted."); LogFile.Log("Reading status from Flash interface was aborted.");
} }
DeviceInfoLoaded = true; DeviceInfoLoaded = true;
@@ -76,8 +76,13 @@ namespace WPinternals
LogFile.Log("Effective Bootloader Security Status: " + EffectivePhoneInfoSecurityStatus.ToString()); LogFile.Log("Effective Bootloader Security Status: " + EffectivePhoneInfoSecurityStatus.ToString());
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Reading status from Flash interface was aborted."); LogFile.Log("Reading status from Flash interface was aborted.");
} }
DeviceInfoLoaded = true; DeviceInfoLoaded = true;
@@ -108,8 +108,13 @@ namespace WPinternals
IMEI = Info.Imei; IMEI = Info.Imei;
LogFile.Log("IMEI: " + ProductType); LogFile.Log("IMEI: " + ProductType);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Reading status from Flash interface was aborted."); LogFile.Log("Reading status from Flash interface was aborted.");
} }
DeviceInfoLoaded = true; DeviceInfoLoaded = true;
@@ -21,6 +21,7 @@
using MadWizard.WinUSBNet; using MadWizard.WinUSBNet;
using System; using System;
using System.Diagnostics.Eventing.Reader; using System.Diagnostics.Eventing.Reader;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using WPinternals.HelperClasses; using WPinternals.HelperClasses;
@@ -152,8 +153,10 @@ namespace WPinternals
LogWatcher.Dispose(); LogWatcher.Dispose();
} }
internal async Task WaitForNextNodeChange() internal async Task WaitForNextNodeChange([CallerMemberName] string callerName = "")
{ {
LogFile.Log("WaitForNextNodeChange Originating caller: " + callerName, LogType.FileOnly);
// Node change events are on all USBnotifiers, so we just pick one // Node change events are on all USBnotifiers, so we just pick one
await LumiaEmergencyNotifier.WaitForNextNodeChange(); await LumiaEmergencyNotifier.WaitForNextNodeChange();
} }
@@ -250,8 +253,13 @@ namespace WPinternals
tmpModel.Dispose(); tmpModel.Dispose();
LogFile.Log("Flash App Type: " + type.ToString(), LogType.FileOnly); LogFile.Log("Flash App Type: " + type.ToString(), LogType.FileOnly);
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
LogFile.Log("Flash App Type could not be determined, assuming " + type.ToString(), LogType.FileOnly); LogFile.Log("Flash App Type could not be determined, assuming " + type.ToString(), LogType.FileOnly);
} }
@@ -543,10 +551,12 @@ namespace WPinternals
} }
} }
internal async Task<IDisposable> WaitForArrival() internal async Task<IDisposable> WaitForArrival([CallerMemberName] string callerName = "")
{ {
IDisposable Result = null; IDisposable Result = null;
LogFile.Log("WaitForArrival Originating caller: " + callerName, LogType.FileOnly);
if (CurrentInterface == null) if (CurrentInterface == null)
{ {
LogFile.Log("Waiting for phone to connect...", LogType.FileOnly); LogFile.Log("Waiting for phone to connect...", LogType.FileOnly);
@@ -568,8 +578,10 @@ namespace WPinternals
return Result; return Result;
} }
internal async Task WaitForRemoval() internal async Task WaitForRemoval([CallerMemberName] string callerName = "")
{ {
LogFile.Log("WaitForRemoval Originating caller: " + callerName, LogType.FileOnly);
LogFile.Log("Waiting for phone to disconnect...", LogType.FileOnly); LogFile.Log("Waiting for phone to disconnect...", LogType.FileOnly);
await Task.Run(() => await Task.Run(() =>
@@ -68,8 +68,13 @@ namespace WPinternals
Completed(); Completed();
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
Failed(); Failed();
} }
}); });
@@ -528,8 +528,13 @@ namespace WPinternals
await SwitchToWithStatus(PhoneNotifier, TargetMode, SetWorkingStatus, UpdateWorkingStatus); await SwitchToWithStatus(PhoneNotifier, TargetMode, SetWorkingStatus, UpdateWorkingStatus);
ModeSwitchSuccessWrapper(); ModeSwitchSuccessWrapper();
} }
catch catch (Exception ex)
{ {
LogFile.Log("An unexpected error happened", LogType.FileAndConsole);
LogFile.Log(ex.GetType().ToString(), LogType.FileAndConsole);
LogFile.Log(ex.Message, LogType.FileAndConsole);
LogFile.Log(ex.StackTrace, LogType.FileAndConsole);
switch (TargetMode) switch (TargetMode)
{ {
case PhoneInterfaces.Lumia_Flash: case PhoneInterfaces.Lumia_Flash: