mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-18 05:47:43 +01:00
EncodedArg
This commit is contained in:
parent
a01bc259a8
commit
c6a9879498
3 changed files with 46 additions and 48 deletions
40
Dalamud.Bootstrap/SqexArg/ArgumentContainer.cs
Normal file
40
Dalamud.Bootstrap/SqexArg/ArgumentContainer.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Bootstrap.SqexArg
|
||||
{
|
||||
internal sealed class ArgumentContainer
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="argument"></param>
|
||||
/// <param name="container"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Parse(string argument, out ArgumentContainer? container)
|
||||
{
|
||||
if (argument.Length < 17)
|
||||
{
|
||||
// does not contain: //**sqex003 + payload + checksum + **//
|
||||
container = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!argument.StartsWith("//**sqex003") || !argument.EndsWith("**//"))
|
||||
{
|
||||
container = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
var checksum = argument[^5];
|
||||
var payload = argument[11..^5]
|
||||
.Replace(; // encoded in url-safe variant of base64
|
||||
|
||||
// decode
|
||||
|
||||
Convert.FromBase64String();
|
||||
container = new ArgumentContainer(payload, checksum);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue