forked from aly/qstbak
148 lines
7.4 KiB
C#
148 lines
7.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Security.Cryptography;
|
|
using System.Threading;
|
|
using Questionable.Model.IO;
|
|
using Questionable.Model.Questing;
|
|
|
|
namespace Questionable.QuestPaths;
|
|
|
|
internal static class AssemblyQuestLoader
|
|
{
|
|
private static readonly Lazy<IReadOnlyDictionary<ElementId, QuestRoot>> Quests = new Lazy<IReadOnlyDictionary<ElementId, QuestRoot>>(LoadQuests, LazyThreadSafetyMode.ExecutionAndPublication);
|
|
|
|
internal static TimeSpan? DecodeDuration { get; private set; }
|
|
|
|
internal static Stream QuestSchema
|
|
{
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
get
|
|
{
|
|
return _200E_200D_206A_200C_200B_200B_206F_200B_206D_206E_202A_206A_202A_202B_202E_206B_206F_200B_202A_202E_202B_206F_200C_202E_202E_206E_202D_200D_202B_202C_200B_200C_202A_200B_206A_206B_206F_200B_200E_202E(_202C_202D_200C_206D_202A_200E_200C_206B_206B_206B_206B_206B_206B_202D_206B_206E_206C_200D_206F_202B_200C_206B_202D_202A_206B_200F_202E_200E_200B_206F_200C_200F_206D_202D_200F_206D_206C_202B_206C_206C_202E(_202D_202C_202A_206B_202E_206C_206E_206B_200B_202A_200D_200D_202A_202A_206D_206C_200F_202C_206A_202D_200F_202B_202E_202E_206D_202E_206F_202E_200D_200F_206C_200E_202E_200E_206E_200E_202D_202D_206C_206F_202E(typeof(AssemblyQuestLoader).TypeHandle)), global::_003CModule_003E._206F_202D_200C_200B_206A_202E_206E_202A_200D_206A_202B_202C_200E_202B_200B_202C_200B_202C_206A_202D_206C_200C_206A_200D_200B_202A_206C_206F_206E_202E_200E_206A_202D_200B_200E_206E_200E_200D_202A_202E<string>(-1394732188));
|
|
}
|
|
}
|
|
|
|
internal static IReadOnlyDictionary<ElementId, QuestRoot> GetQuests()
|
|
{
|
|
return Quests.Value;
|
|
}
|
|
|
|
internal static string? GetQuestPath(ElementId questId)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
|
private static IReadOnlyDictionary<ElementId, QuestRoot> LoadQuests()
|
|
{
|
|
Stopwatch stopwatch = _200B_200E_200D_200D_202B_206F_200E_202A_206E_206E_202A_206B_202B_202E_206C_200E_202A_200B_206E_200C_202A_200D_200C_200F_206E_206F_200C_206B_200E_200F_206B_206B_206F_202E_202B_206F_206C_200B_202B_202E();
|
|
Stream stream = _200E_200D_206A_200C_200B_200B_206F_200B_206D_206E_202A_206A_202A_202B_202E_206B_206F_200B_202A_202E_202B_206F_200C_202E_202E_206E_202D_200D_202B_202C_200B_200C_202A_200B_206A_206B_206F_200B_200E_202E(_202C_202D_200C_206D_202A_200E_200C_206B_206B_206B_206B_206B_206B_202D_206B_206E_206C_200D_206F_202B_200C_206B_202D_202A_206B_200F_202E_200E_200B_206F_200C_200F_206D_202D_200F_206D_206C_202B_206C_206C_202E(_202D_202C_202A_206B_202E_206C_206E_206B_200B_202A_200D_200D_202A_202A_206D_206C_200F_202C_206A_202D_200F_202B_202E_202E_206D_202E_206F_202E_200D_200F_206C_200E_202E_200E_206E_200E_202D_202D_206C_206F_202E(typeof(AssemblyQuestLoader).TypeHandle)), global::_003CModule_003E._200B_200F_206E_200E_206B_200B_200D_200E_200C_202C_200B_202C_200D_206F_206E_202E_202C_202B_202C_206B_206F_200F_206E_206B_206A_206B_200C_206A_200B_206A_200D_206C_206B_202E_200C_206E_202E_202D_200D_206D_202E<string>(-1192865642));
|
|
try
|
|
{
|
|
byte[] array = PathBundleSecret.Key();
|
|
List<KeyValuePair<string, QuestRoot>> list = PathBundle.Deserialize<QuestRoot>(stream, array);
|
|
_206E_200C_206B_206D_206B_202E_206E_200F_202B_200C_200F_202D_202B_200E_206E_206D_202B_206C_200E_202E_202C_200B_202B_206F_202E_206B_202A_202C_200D_206A_200D_200B_206D_206B_206E_200B_202D_202E_206F_206D_202E((Span<byte>)array);
|
|
Dictionary<ElementId, QuestRoot> dictionary = new Dictionary<ElementId, QuestRoot>(list.Count);
|
|
using (List<KeyValuePair<string, QuestRoot>>.Enumerator enumerator = list.GetEnumerator())
|
|
{
|
|
int num = -221038175;
|
|
while (true)
|
|
{
|
|
int num2 = num;
|
|
int num3 = -221038175;
|
|
int num4 = num2;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
num = (enumerator.MoveNext() ? (-221038176) : (-221038174));
|
|
break;
|
|
case 1:
|
|
var (text2, value) = (KeyValuePair<string, QuestRoot>)(ref enumerator.Current);
|
|
dictionary[_200D_206F_200D_206E_200B_202D_206C_206A_202E_200C_206B_200D_200C_206D_200E_202C_206C_200E_206E_202D_200C_202C_200F_200E_202B_206E_206F_206E_200C_206C_202A_206A_206F_200E_202D_200E_206F_206E_206B_206F_202E(text2)] = value;
|
|
num = -221038175;
|
|
break;
|
|
case 2:
|
|
num = -221038175;
|
|
break;
|
|
case 3:
|
|
goto end_IL_005c;
|
|
}
|
|
continue;
|
|
end_IL_005c:
|
|
break;
|
|
}
|
|
}
|
|
DecodeDuration = _202A_206C_200C_202D_202A_202E_202C_206E_206E_206E_202C_202D_202B_200C_200F_200F_202E_206D_200D_206B_202E_202A_200B_202A_200E_200E_206A_200C_200F_202D_206D_206A_206B_202C_206B_202E_200C_200F_206F_206B_202E(stopwatch);
|
|
return dictionary;
|
|
}
|
|
finally
|
|
{
|
|
int num = ((stream == null) ? (-142648274) : (-142648275));
|
|
while (true)
|
|
{
|
|
int num5 = num;
|
|
int num3 = -142648273;
|
|
int num4 = num5;
|
|
switch ((num4 | num3) - (num4 & num3))
|
|
{
|
|
case 0:
|
|
num = -142648275;
|
|
break;
|
|
case 2:
|
|
_202D_206B_200E_206C_202A_206B_206C_200E_206A_200D_206E_202E_200E_202A_206C_202C_200E_206E_200F_200F_202D_206E_202B_202C_206E_202D_202A_200F_202D_200C_202A_202C_202A_206A_202B_206F_206C_202C_206F_206D_202E((IDisposable)stream);
|
|
num = -142648274;
|
|
break;
|
|
case 1:
|
|
goto end_IL_013c;
|
|
}
|
|
continue;
|
|
end_IL_013c:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
static Type _202D_202C_202A_206B_202E_206C_206E_206B_200B_202A_200D_200D_202A_202A_206D_206C_200F_202C_206A_202D_200F_202B_202E_202E_206D_202E_206F_202E_200D_200F_206C_200E_202E_200E_206E_200E_202D_202D_206C_206F_202E(RuntimeTypeHandle P_0)
|
|
{
|
|
return Type.GetTypeFromHandle(P_0);
|
|
}
|
|
|
|
static Assembly _202C_202D_200C_206D_202A_200E_200C_206B_206B_206B_206B_206B_206B_202D_206B_206E_206C_200D_206F_202B_200C_206B_202D_202A_206B_200F_202E_200E_200B_206F_200C_200F_206D_202D_200F_206D_206C_202B_206C_206C_202E(Type P_0)
|
|
{
|
|
return P_0.Assembly;
|
|
}
|
|
|
|
static Stream _200E_200D_206A_200C_200B_200B_206F_200B_206D_206E_202A_206A_202A_202B_202E_206B_206F_200B_202A_202E_202B_206F_200C_202E_202E_206E_202D_200D_202B_202C_200B_200C_202A_200B_206A_206B_206F_200B_200E_202E(Assembly P_0, string P_1)
|
|
{
|
|
return P_0.GetManifestResourceStream(P_1);
|
|
}
|
|
|
|
static Stopwatch _200B_200E_200D_200D_202B_206F_200E_202A_206E_206E_202A_206B_202B_202E_206C_200E_202A_200B_206E_200C_202A_200D_200C_200F_206E_206F_200C_206B_200E_200F_206B_206B_206F_202E_202B_206F_206C_200B_202B_202E()
|
|
{
|
|
return Stopwatch.StartNew();
|
|
}
|
|
|
|
static void _206E_200C_206B_206D_206B_202E_206E_200F_202B_200C_200F_202D_202B_200E_206E_206D_202B_206C_200E_202E_202C_200B_202B_206F_202E_206B_202A_202C_200D_206A_200D_200B_206D_206B_206E_200B_202D_202E_206F_206D_202E(Span<byte> P_0)
|
|
{
|
|
CryptographicOperations.ZeroMemory(P_0);
|
|
}
|
|
|
|
static ElementId _200D_206F_200D_206E_200B_202D_206C_206A_202E_200C_206B_200D_200C_206D_200E_202C_206C_200E_206E_202D_200C_202C_200F_200E_202B_206E_206F_206E_200C_206C_202A_206A_206F_200E_202D_200E_206F_206E_206B_206F_202E(string P_0)
|
|
{
|
|
return ElementId.FromString(P_0);
|
|
}
|
|
|
|
static TimeSpan _202A_206C_200C_202D_202A_202E_202C_206E_206E_206E_202C_202D_202B_200C_200F_200F_202E_206D_200D_206B_202E_202A_200B_202A_200E_200E_206A_200C_200F_202D_206D_206A_206B_202C_206B_202E_200C_200F_206F_206B_202E(Stopwatch P_0)
|
|
{
|
|
return P_0.Elapsed;
|
|
}
|
|
|
|
static void _202D_206B_200E_206C_202A_206B_206C_200E_206A_200D_206E_202E_200E_202A_206C_202C_200E_206E_200F_200F_202D_206E_202B_202C_206E_202D_202A_200F_202D_200C_202A_202C_202A_206A_202B_206F_206C_202C_206F_206D_202E(IDisposable P_0)
|
|
{
|
|
P_0.Dispose();
|
|
}
|
|
}
|