using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AssetBundleLoader;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DDSLoader")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("Loads the DDS and strings CSV for other mods")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+c0e2a95e9048eed7d906077a24dbc49eb0d40549")]
[assembly: AssemblyProduct("DDSLoader")]
[assembly: AssemblyTitle("DDSLoader")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace DDSLoader
{
public class DDSContentSource
{
public const string ManifestFileName = "ddsmanifest.json";
public DirectoryInfo directory;
private readonly Dictionary<string, List<string>> filesByFolder = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
public string Name => (directory.Parent != null) ? directory.Parent.Name : directory.Name;
public static DDSContentSource FromFolderScan(DirectoryInfo directory)
{
DDSContentSource dDSContentSource = new DDSContentSource
{
directory = directory
};
string[] files = Directory.GetFiles(directory.FullName, "*", SearchOption.AllDirectories);
foreach (string text in files)
{
dDSContentSource.Add(NormalizeFolder(Path.GetDirectoryName(text).Substring(directory.FullName.Length)), text);
}
return dDSContentSource;
}
public static DDSContentSource FromManifest(DirectoryInfo directory)
{
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_03fc: Expected O, but got Unknown
string path = Path.Combine(directory.FullName, "ddsmanifest.json");
dynamic val = NewtonsoftExtensions.NewtonsoftJson.JToken_Parse(File.ReadAllText(path));
bool flag = default(bool);
if ((!val.Value<bool>("enabled")))
{
ManualLogSource pluginLogger = DDSLoaderPlugin.PluginLogger;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Not loading DDS manifest: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(directory.Parent?.Name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Disabled)");
}
pluginLogger.LogInfo(val2);
return null;
}
DDSContentSource dDSContentSource = new DDSContentSource
{
directory = directory
};
foreach (dynamic item in val["files"])
{
string text = item.Name;
string folder = item.Value.ToString();
string text2 = Path.Combine(directory.FullName, text.Replace('\\', Path.DirectorySeparatorChar).Replace('/', Path.DirectorySeparatorChar));
if (!File.Exists(text2))
{
ManualLogSource pluginLogger2 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(44, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text2);
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (Listed in ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("ddsmanifest.json");
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", but not found)");
}
pluginLogger2.LogError(val3);
}
else
{
dDSContentSource.Add(NormalizeFolder(folder), text2);
}
}
return dDSContentSource;
}
public List<string> GetFiles(string folder, string extension)
{
if (!filesByFolder.TryGetValue(folder, out var value))
{
return new List<string>();
}
return value.Where((string filePath) => Path.GetExtension(filePath).Equals(extension, StringComparison.OrdinalIgnoreCase)).ToList();
}
public bool HasStringsForLanguage(string language)
{
return StringFolders(language).Any();
}
public List<string> GetStringFiles(string language)
{
return (from filePath in StringFolders(language).SelectMany((string folder) => filesByFolder[folder])
where Path.GetExtension(filePath).Equals(".csv", StringComparison.OrdinalIgnoreCase)
select filePath).ToList();
}
private IEnumerable<string> StringFolders(string language)
{
string languageFolder = NormalizeFolder("Strings/" + language);
return filesByFolder.Keys.Where((string folder) => folder.Equals(languageFolder, StringComparison.OrdinalIgnoreCase) || folder.StartsWith(languageFolder + "/", StringComparison.OrdinalIgnoreCase));
}
private void Add(string folder, string filePath)
{
if (!filesByFolder.TryGetValue(folder, out var value))
{
value = new List<string>();
filesByFolder[folder] = value;
}
value.Add(filePath);
}
private static string NormalizeFolder(string folder)
{
return folder.Replace('\\', '/').Trim('/');
}
}
public class DDSDebugHelper
{
public static void StartConversation(string ddsTreeId, string participantA, string participantB)
{
StartConversation(ddsTreeId, new string[2] { participantA, participantB });
}
public static void StartConversation(string ddsTreeId, string[] participants)
{
Human val = null;
List<Human> val2 = new List<Human>();
foreach (string text in participants)
{
if ((Object)(object)val == (Object)null)
{
val = GameObject.Find(text).GetComponent<Human>();
}
else
{
val2.Add(GameObject.Find(text).GetComponent<Human>());
}
}
val.ExecuteConversationTree(Toolbox.Instance.allDDSTrees[ddsTreeId], val2);
}
}
[HarmonyPatch(typeof(Human), "ExecuteConversationTree")]
public class Human_ExecuteConversationTree
{
public static void Postfix(Human __instance, DDSTreeSave newTree, List<Human> otherParticipants)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
if (DDSLoaderPlugin.debugLogConversations.Value)
{
ManualLogSource pluginLogger = DDSLoaderPlugin.PluginLogger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Conversation started: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((DDSComponent)newTree).id);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" started by ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance).name);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" and including ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(string.Join(", ", ((IEnumerable<Human>)otherParticipants.ToArray()).Select((Human other) => ((Object)other).name)));
}
pluginLogger.LogInfo(val);
}
if (DDSLoaderPlugin.debugPauseTreeGUID.Value == ((DDSComponent)newTree).id)
{
InterfaceController.Instance.ToggleNotebookButton();
}
}
}
internal class DDSLoaderHooks
{
[HarmonyPatch(typeof(Toolbox), "Start")]
public class Toolbox_Start
{
[Serializable]
private class CustomSerializableNewspaperArticle
{
public bool disabled;
public int category;
public string[] followupStories;
public string[] possibleImages;
public int context;
}
public static void Postfix()
{
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Expected O, but got Unknown
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Expected O, but got Unknown
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Expected O, but got Unknown
//IL_0688: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Expected O, but got Unknown
//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
//IL_07ed: Expected O, but got Unknown
//IL_084c: Unknown result type (might be due to invalid IL or missing references)
//IL_0853: Expected O, but got Unknown
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Expected O, but got Unknown
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Expected O, but got Unknown
//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Expected O, but got Unknown
//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
//IL_04de: Expected O, but got Unknown
//IL_0735: Unknown result type (might be due to invalid IL or missing references)
//IL_073c: Expected O, but got Unknown
//IL_057a: Unknown result type (might be due to invalid IL or missing references)
//IL_0580: Invalid comparison between Unknown and I4
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059c: Expected O, but got Unknown
//IL_061a: Unknown result type (might be due to invalid IL or missing references)
//IL_0621: Expected O, but got Unknown
//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
//IL_0c1b: Expected O, but got Unknown
//IL_0b91: Unknown result type (might be due to invalid IL or missing references)
//IL_0b98: Expected O, but got Unknown
if (DDSLoaderPlugin.debugClearNewspaperArticles.Value)
{
Toolbox.Instance.allArticleTrees.Clear();
}
bool flag = default(bool);
string text2 = default(string);
string text3 = default(string);
string text4 = default(string);
string text5 = default(string);
int num = default(int);
bool flag3 = default(bool);
string text6 = default(string);
foreach (DDSContentSource item in DDSLoaderPlugin.contentToLoadFrom)
{
foreach (string file in item.GetFiles("DDS/Blocks", ".block"))
{
try
{
DDSBlockSave val = JsonUtility.FromJson<DDSBlockSave>(File.ReadAllText(file));
if (val == null)
{
ManualLogSource pluginLogger = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(file);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Empty)");
}
pluginLogger.LogWarning(val2);
}
else
{
Toolbox.Instance.allDDSBlocks.Add(((DDSComponent)val).id, val);
}
}
catch (Exception ex)
{
ManualLogSource pluginLogger2 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file);
}
pluginLogger2.LogError(val3);
DDSLoaderPlugin.PluginLogger.LogError((object)ex);
}
}
foreach (string file2 in item.GetFiles("DDS/Blocks", ".block_patch"))
{
try
{
DDSBlockSave val4 = JsonUtility.FromJson<DDSBlockSave>(CreatePatchedJson(file2, "Blocks"));
if (val4 == null)
{
ManualLogSource pluginLogger3 = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(file2);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Empty)");
}
pluginLogger3.LogWarning(val2);
}
else
{
Toolbox.Instance.allDDSBlocks[((DDSComponent)val4).id] = val4;
}
}
catch (Exception ex2)
{
ManualLogSource pluginLogger4 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file2);
}
pluginLogger4.LogError(val3);
DDSLoaderPlugin.PluginLogger.LogError((object)ex2);
}
}
foreach (string file3 in item.GetFiles("DDS/Messages", ".msg"))
{
try
{
DDSMessageSave val5 = JsonUtility.FromJson<DDSMessageSave>(File.ReadAllText(file3));
if (val5 == null)
{
ManualLogSource pluginLogger5 = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(file3);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Empty)");
}
pluginLogger5.LogWarning(val2);
}
else
{
Toolbox.Instance.allDDSMessages.Add(((DDSComponent)val5).id, val5);
}
}
catch (Exception ex3)
{
ManualLogSource pluginLogger6 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file3);
}
pluginLogger6.LogError(val3);
DDSLoaderPlugin.PluginLogger.LogError((object)ex3);
}
}
foreach (string file4 in item.GetFiles("DDS/Messages", ".msg_patch"))
{
try
{
DDSMessageSave val6 = JsonUtility.FromJson<DDSMessageSave>(CreatePatchedJson(file4, "Messages"));
if (val6 == null)
{
ManualLogSource pluginLogger7 = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(file4);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Empty)");
}
pluginLogger7.LogWarning(val2);
}
else
{
Toolbox.Instance.allDDSMessages[((DDSComponent)val6).id] = val6;
}
}
catch (Exception ex4)
{
ManualLogSource pluginLogger8 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file4);
}
pluginLogger8.LogError(val3);
DDSLoaderPlugin.PluginLogger.LogError((object)ex4);
}
}
foreach (string file5 in item.GetFiles("DDS/Trees", ".tree"))
{
try
{
DDSTreeSave val7 = JsonUtility.FromJson<DDSTreeSave>(File.ReadAllText(file5));
if (val7 == null)
{
ManualLogSource pluginLogger9 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file5);
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (Empty)");
}
pluginLogger9.LogError(val3);
continue;
}
val7.messageRef = new Dictionary<string, DDSMessageSettings>();
Enumerator<DDSMessageSettings> enumerator7 = val7.messages.GetEnumerator();
while (enumerator7.MoveNext())
{
DDSMessageSettings current7 = enumerator7.Current;
val7.messageRef.Add(current7.instanceID, current7);
}
Toolbox.Instance.allDDSTrees.Add(((DDSComponent)val7).id, val7);
if ((int)val7.treeType == 3)
{
ManualLogSource pluginLogger10 = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(66, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Newspaper content is no longer supported - use the official editor");
}
pluginLogger10.LogWarning(val2);
}
bool flag2 = false;
Enumerator<DDSMessageSettings> enumerator8 = val7.messages.GetEnumerator();
while (enumerator8.MoveNext())
{
DDSMessageSettings current8 = enumerator8.Current;
if (current8.instanceID == val7.startingMessage)
{
flag2 = true;
break;
}
}
if (!flag2)
{
ManualLogSource pluginLogger11 = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(144, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("DDS Tree ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((DDSComponent)val7).name);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((DDSComponent)val7).id);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") doesn't reference an existing message instanceID as it's starting message. This item may not work if it is a conversation or vmail!");
}
pluginLogger11.LogWarning(val2);
}
}
catch (Exception ex5)
{
ManualLogSource pluginLogger12 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file5);
}
pluginLogger12.LogError(val3);
DDSLoaderPlugin.PluginLogger.LogError((object)ex5);
}
}
foreach (string file6 in item.GetFiles("DDS/Trees", ".tree_patch"))
{
try
{
DDSTreeSave val8 = JsonUtility.FromJson<DDSTreeSave>(CreatePatchedJson(file6, "Trees"));
if (val8 == null)
{
ManualLogSource pluginLogger13 = DDSLoaderPlugin.PluginLogger;
BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(file6);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" (Empty)");
}
pluginLogger13.LogWarning(val2);
}
else
{
val8.messageRef = new Dictionary<string, DDSMessageSettings>();
Enumerator<DDSMessageSettings> enumerator10 = val8.messages.GetEnumerator();
while (enumerator10.MoveNext())
{
DDSMessageSettings current10 = enumerator10.Current;
val8.messageRef.Add(current10.instanceID, current10);
}
Toolbox.Instance.allDDSTrees[((DDSComponent)val8).id] = val8;
}
}
catch (Exception ex6)
{
ManualLogSource pluginLogger14 = DDSLoaderPlugin.PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(16, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(file6);
}
pluginLogger14.LogError(val3);
DDSLoaderPlugin.PluginLogger.LogError((object)ex6);
}
}
ManualLogSource pluginLogger15 = DDSLoaderPlugin.PluginLogger;
BepInExInfoLogInterpolatedStringHandler val9 = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("Loaded DDS Content and Patches For: ");
((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(item.Name);
}
pluginLogger15.LogInfo(val9);
MethodInfo method = Il2CppType.From(typeof(Strings)).GetMethod("LoadIntoDictionary", (BindingFlags)40);
if (method == (MethodInfo)null)
{
DDSLoaderPlugin.PluginLogger.LogError((object)"Strings.LoadIntoDictionary not found!");
continue;
}
List<string> list = (item.HasStringsForLanguage(Game.Instance.language) ? item.GetStringFiles(Game.Instance.language) : item.GetStringFiles("English"));
if (list.Count <= 0)
{
continue;
}
foreach (string item2 in list)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item2);
string[] array = File.ReadAllLines(item2);
foreach (string text in array)
{
Strings.ParseLine(text.Trim(), ref text2, ref text3, ref text4, ref text5, ref num, ref flag3, ref text6, true);
if (text4 == null || !(method != (MethodInfo)null))
{
continue;
}
if (!Strings.stringTable.ContainsKey(fileNameWithoutExtension))
{
Strings.stringTable[fileNameWithoutExtension] = new Dictionary<string, DisplayString>();
}
if (Strings.stringTable[fileNameWithoutExtension].ContainsKey(text2))
{
if (Strings.randomEntryLists.ContainsKey(fileNameWithoutExtension))
{
for (int num2 = Strings.randomEntryLists[fileNameWithoutExtension].Count - 1; num2 >= 0; num2--)
{
if (Strings.randomEntryLists[fileNameWithoutExtension][num2].displayStr == Strings.stringTable[fileNameWithoutExtension][text2].displayStr)
{
Strings.randomEntryLists[fileNameWithoutExtension].RemoveAt(num2);
}
}
}
Strings.stringTable[fileNameWithoutExtension].Remove(text2);
}
if (((MethodBase)method).GetParametersCount() == 8)
{
((MethodBase)method).Invoke((Object)null, new Il2CppReferenceArray<Object>((Object[])(object)new Object[8]
{
Object.op_Implicit(fileNameWithoutExtension),
Object.op_Implicit(Strings.stringTable[fileNameWithoutExtension].Count + 1),
Object.op_Implicit(text2),
Object.op_Implicit(text4.Replace("\\r\\n", "\r\n")),
Object.op_Implicit(text5),
Object.op_Implicit(num),
Object.op_Implicit(flag3),
Object.op_Implicit(true)
}));
}
else
{
((MethodBase)method).Invoke((Object)null, new Il2CppReferenceArray<Object>((Object[])(object)new Object[7]
{
Object.op_Implicit(fileNameWithoutExtension),
Object.op_Implicit(Strings.stringTable[fileNameWithoutExtension].Count + 1),
Object.op_Implicit(text2),
Object.op_Implicit(text4.Replace("\\r\\n", "\r\n")),
Object.op_Implicit(text5),
Object.op_Implicit(num),
Object.op_Implicit(flag3)
}));
}
if (DDSLoaderPlugin.debugPrintLoadedStrings.Value)
{
ManualLogSource pluginLogger16 = DDSLoaderPlugin.PluginLogger;
val9 = new BepInExInfoLogInterpolatedStringHandler(2, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(fileNameWithoutExtension);
((BepInExLogInterpolatedStringHandler)val9).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(text4.Replace("\\r\\n", "\r\n"));
}
pluginLogger16.LogInfo(val9);
}
}
}
ManualLogSource pluginLogger17 = DDSLoaderPlugin.PluginLogger;
val9 = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("Loaded String Content For: ");
((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(item.Name);
}
pluginLogger17.LogInfo(val9);
}
}
private static string CreatePatchedJson(string patchPath, string vanillaFolderName)
{
FileInfo fileInfo = new FileInfo(patchPath);
return ((dynamic)JSONPatch.ApplyPatch(File.ReadAllText(Path.Combine(Application.streamingAssetsPath, "DDS", vanillaFolderName, fileInfo.Name.Split('_')[0])), File.ReadAllText(patchPath))).ToString();
}
private static void LoadNewspaperArticle(DDSTreeSave tree, string messagesPath)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)tree.treeType != 3)
{
}
}
}
private static Dictionary<string, NewspaperArticle> ddsToArticle;
}
[BepInPlugin("DDSLoader", "DDSLoader", "1.1.0")]
public class DDSLoaderPlugin : BasePlugin
{
public static ManualLogSource PluginLogger;
public static List<DDSContentSource> contentToLoadFrom = new List<DDSContentSource>();
public static ConfigEntry<bool> debugLogConversations;
public static ConfigEntry<string> debugPauseTreeGUID;
public static ConfigEntry<bool> debugClearNewspaperArticles;
public static ConfigEntry<bool> debugPrintLoadedStrings;
public override void Load()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Expected O, but got Unknown
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
PluginLogger = ((BasePlugin)this).Log;
ManualLogSource pluginLogger = PluginLogger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DDSLoader");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
pluginLogger.LogInfo(val);
Harmony val2 = new Harmony("DDSLoader");
val2.PatchAll();
ManualLogSource pluginLogger2 = PluginLogger;
val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DDSLoader");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
}
pluginLogger2.LogInfo(val);
debugLogConversations = ((BasePlugin)this).Config.Bind<bool>("Debug", "Enable debugging of conversations", false, (ConfigDescription)null);
debugPauseTreeGUID = ((BasePlugin)this).Config.Bind<string>("Debug", "Pause when this conversation tree GUID begins", "", (ConfigDescription)null);
debugClearNewspaperArticles = ((BasePlugin)this).Config.Bind<bool>("Debug", "Clear existing newspaper articles", false, (ConfigDescription)null);
debugPrintLoadedStrings = ((BasePlugin)this).Config.Bind<bool>("Debug", "Log loaded strings to the console", false, (ConfigDescription)null);
foreach (DirectoryInfo item in from dirPath in Directory.GetDirectories(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ".."), "DDSContent", SearchOption.AllDirectories)
select new DirectoryInfo(dirPath) into dir
where !File.Exists(Path.Combine(dir.Parent.FullName, "disabled.txt"))
select dir)
{
try
{
DDSContentSource dDSContentSource = (File.Exists(Path.Combine(item.FullName, "ddsmanifest.json")) ? DDSContentSource.FromManifest(item) : DDSContentSource.FromFolderScan(item));
if (dDSContentSource != null)
{
contentToLoadFrom.Add(dDSContentSource);
}
}
catch (Exception ex)
{
ManualLogSource pluginLogger3 = PluginLogger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to load DDS content from: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(item.FullName);
}
pluginLogger3.LogError(val3);
PluginLogger.LogError((object)ex);
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DDSLoader";
public const string PLUGIN_NAME = "DDSLoader";
public const string PLUGIN_VERSION = "1.1.0";
}
}