diff --git a/Dalamud.Bootstrap/BootstrapException.cs b/Dalamud.Bootstrap/BootstrapException.cs
new file mode 100644
index 000000000..81f8d7172
--- /dev/null
+++ b/Dalamud.Bootstrap/BootstrapException.cs
@@ -0,0 +1,17 @@
+using System;
+using System.ComponentModel;
+
+namespace Dalamud.Bootstrap
+{
+ ///
+ /// An error that is thrown when bootstraping Dalamud failed.
+ ///
+ public class BootstrapException : Exception
+ {
+ internal BootstrapException() : base() { }
+
+ internal BootstrapException(string message) : base(message) { }
+
+ internal BootstrapException(string message, Exception innerException) : base(message, innerException) { }
+ }
+}
diff --git a/Dalamud.Bootstrap/SqexArg/EncodedArgument.cs b/Dalamud.Bootstrap/SqexArg/EncodedArgument.cs
index 3e740b215..95dcba021 100644
--- a/Dalamud.Bootstrap/SqexArg/EncodedArgument.cs
+++ b/Dalamud.Bootstrap/SqexArg/EncodedArgument.cs
@@ -27,37 +27,34 @@ namespace Dalamud.Bootstrap.SqexArg
m_key = key;
}
- public static bool TryParse(string argument, out EncodedArgument? value)
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static EncodedArgument Parse(string argument)
{
if (argument.Length <= 17)
{
// does not contain: //**sqex0003 + payload + checksum + **//
- value = null;
- return false;
+ var exMessage = $"The string ({argument}) is too short to parse encoded argument.";
+ throw new SqexArgException(exMessage);
}
if (!argument.StartsWith("//**sqex0003") || !argument.EndsWith("**//"))
{
- value = null;
- return false;
+ var exMessage = $"The string ({argument}) doesn't look like valid encoded argument format."
+ + $"It either doesn't start with //**sqeex003 or end with **// marker.";
+ throw new SqexArgException(exMessage);
}
var checksum = argument[^5];
var payload = DecodeUrlSafeBase64(argument.Substring(12, argument.Length - 1 - 12 - 4)); // //**sqex0003, checksum, **//
- if (!FindPartialKey(checksum, out var partialKey))
- {
- value = null;
- return false;
- }
-
- for (var i = 0u; i <= 0xFFF; i++)
- {
- var key = (i << 20) | partialKey;
- }
+ // ...
}
- private static bool FindPartialKey(char checksum, out uint recoveredKey)
+ private static bool GetKeyFragmentFromChecksum(char checksum, out uint recoveredKey)
{
var index = MemoryExtensions.IndexOf(ChecksumTable, checksum);
diff --git a/Dalamud.Bootstrap/SqexArg/SqexArgException.cs b/Dalamud.Bootstrap/SqexArg/SqexArgException.cs
new file mode 100644
index 000000000..062fd0ef0
--- /dev/null
+++ b/Dalamud.Bootstrap/SqexArg/SqexArgException.cs
@@ -0,0 +1,11 @@
+using System;
+
+namespace Dalamud.Bootstrap.SqexArg
+{
+ public class SqexArgException : Exception
+ {
+ public SqexArgException() { }
+ public SqexArgException(string message) : base(message) { }
+ public SqexArgException(string message, Exception inner) : base(message, inner) { }
+ }
+}
diff --git a/Dalamud.Bootstrap/Exceptions.cs b/Dalamud.Bootstrap/Windows/ProcessException.cs
similarity index 59%
rename from Dalamud.Bootstrap/Exceptions.cs
rename to Dalamud.Bootstrap/Windows/ProcessException.cs
index e62cdb996..61306ad95 100644
--- a/Dalamud.Bootstrap/Exceptions.cs
+++ b/Dalamud.Bootstrap/Windows/ProcessException.cs
@@ -1,21 +1,8 @@
using System;
-using System.ComponentModel;
-namespace Dalamud.Bootstrap
+namespace Dalamud.Bootstrap.Windows
{
- ///
- /// An error that is thrown when bootstraping Dalamud failed.
- ///
- public class BootstrapException : Exception
- {
- internal BootstrapException() : base() { }
-
- internal BootstrapException(string message) : base(message) { }
-
- internal BootstrapException(string message, Exception innerException) : base(message, innerException) { }
- }
-
- public class ProcessException : BootstrapException
+ public class ProcessException : Exception
{
public uint Pid { get; }
diff --git a/build/DalamudBuild.cs b/build/DalamudBuild.cs
index 4fec2b496..ad9ad8e4d 100644
--- a/build/DalamudBuild.cs
+++ b/build/DalamudBuild.cs
@@ -69,6 +69,6 @@ class DalamudBuild : NukeBuild
.Executes(() =>
{
// TODO
- Direct
+
});
}