Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions PS5 NOR Modifier/Common/Helpers/Browser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace PS5_NOR_Modifier.Common.Helpers
{
public static class Browser
{
/// <summary>
/// Lauinches a URL in a new window using the default browser...
/// </summary>
/// <param name="url">The URL you want to launch</param>
public static void OpenUrl(string url)
{
try
{
Process.Start(url);
}
catch
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
url = url.Replace("&", "^&");
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start("xdg-open", url);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
Process.Start("open", url);
}
else
{
throw;
}
}
}
}
}
51 changes: 51 additions & 0 deletions PS5 NOR Modifier/Common/Helpers/XmlSerializationHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Xml.Serialization;

namespace PS5_NOR_Modifier.Common.Helpers
{
public static class XmlSerializationHelper
{
public static T? DeserilazeXmlFromFile<T>(string filePath)
{
T? result = default;

if (string.IsNullOrEmpty(filePath))
{
throw new ArgumentNullException("File path is empty");
}

if (!File.Exists(filePath))
{
throw new FileNotFoundException("Local XML file '" + filePath + "' not found.");
}

XmlSerializer serializer = new XmlSerializer(typeof(T));

using (StreamReader reader = new StreamReader(filePath))
{
result = (T?)serializer.Deserialize(reader);
}

return result;
}

public static T? DeserilazeXmlFromString<T>(string xmlData)
{
T? result = default;

if (string.IsNullOrEmpty(xmlData))
{
throw new ArgumentNullException("XML data to deserialize is empty");
}

XmlSerializer serializer = new XmlSerializer(typeof(T));

using (StringReader reader = new StringReader(xmlData))
{
result = (T?)serializer.Deserialize(reader);
}

return result;
}
}
}
20 changes: 20 additions & 0 deletions PS5 NOR Modifier/Events/StatusUpdateEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;


namespace PS5_NOR_Modifier.UserControls.Events
{
public class StatusUpdateEventArgs : EventArgs
{
private string _text;

public string Text
{
get { return _text; }
}

public StatusUpdateEventArgs(string newStatus) : base()
{
_text = newStatus;
}
}
}
729 changes: 71 additions & 658 deletions PS5 NOR Modifier/Form1.Designer.cs

Large diffs are not rendered by default.

Loading