private static T GetOtherProperty <T>(ILaunchProfile launchProfile, string propertyName, T defaultValue) { if (launchProfile.TryGetSetting(propertyName, out object?value)) { if (value is T b) { return(b); } if (value is string s && TypeDescriptor.GetConverter(typeof(T)) is TypeConverter converter && converter.CanConvertFrom(typeof(string))) { try { if (converter.ConvertFromString(s) is T o) { return(o); } } catch (Exception) { // ignore bad data in the json file and just let them have the default value } } } return(defaultValue); }
public static string?RemoteDebugMachine(this ILaunchProfile profile) { if (profile.TryGetSetting(RemoteDebugMachineProperty, out object?value) && value is string s) { return(s); } return(null); }
public static bool IsRemoteDebugEnabled(this ILaunchProfile profile) { if (profile.TryGetSetting(RemoteDebugEnabledProperty, out object?value) && value is bool b) { return(b); } return(false); }
/// <summary> /// Returns true if jsWebView2Debugging property is set to true /// </summary> public static bool IsJSWebView2DebuggingEnabled(this ILaunchProfile profile) { if (profile.TryGetSetting(JSWebView2DebuggingProperty, out object?value) && value is bool b) { return(b); } return(false); }
public static bool IsHotReloadEnabled(this ILaunchProfile profile) { if (profile.TryGetSetting(HotReloadEnabledProperty, out object?value) && value is bool b) { return(b); } return(true); }
public static string?RemoteAuthenticationMode(this ILaunchProfile profile) { if (profile.TryGetSetting(RemoteAuthenticationModeProperty, out object?value) && value is string s) { return(s); } return(null); }