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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Digitalroot.Valheim.Common;
using Digitalroot.Valheim.Common.Json;
using HarmonyLib;
using JetBrains.Annotations;
using Jotunn.Managers;
using Jotunn.Utils;
using SimpleJson;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Digitalroot.ValheimMisophoniaFriendly")]
[assembly: AssemblyDescription("Digitalroot Misophonia Friendly")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Digitalroot Technologies")]
[assembly: AssemblyProduct("Digitalroot Valheim Mods")]
[assembly: AssemblyCopyright("Copyright © Digitalroot Technologies 2021 - 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3ccc4dc1-5b17-47c1-b996-ca03b8639a61")]
[assembly: AssemblyFileVersion("1.0.37")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.37.0")]
[module: UnverifiableCode]
namespace Digitalroot.Valheim.MisophoniaFriendly
{
[BepInPlugin("digitalroot.mods.misophoniafriendly", "Digitalroot Misophonia Friendly", "1.0.37")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin, ITraceableLogging
{
public static Main Instance;
public readonly ConfigEntry<int> NexusId;
public const string Version = "1.0.37";
public const string Name = "Digitalroot Misophonia Friendly";
public const string Guid = "digitalroot.mods.misophoniafriendly";
public const string Namespace = "Digitalroot.ValheimMisophoniaFriendly";
public string Source => "Digitalroot.ValheimMisophoniaFriendly";
public bool EnableTrace { get; }
public Main()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
Instance = this;
NexusId = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 1667, new ConfigDescription("Nexus mod ID for updates.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
IsAdminOnly = false,
Browsable = false,
ReadOnly = true
} }));
EnableTrace = false;
Log.RegisterSource(Instance);
Log.Trace(Instance, "Digitalroot.ValheimMisophoniaFriendly." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name);
}
[UsedImplicitly]
private void Awake()
{
try
{
Log.Trace(Instance, "Digitalroot.ValheimMisophoniaFriendly." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name);
if (!Utils.IsHeadless())
{
PrefabManager.OnVanillaPrefabsAvailable += PrefabManagerOnVanillaPrefabsAvailable;
}
}
catch (Exception e)
{
Log.Error(Instance, e);
}
}
[HarmonyWrapSafe]
private void PrefabManagerOnVanillaPrefabsAvailable()
{
try
{
Log.Trace(Instance, "Digitalroot.ValheimMisophoniaFriendly." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name);
string[] array = new string[6] { "sfx_Puke_male", "sfx_Puke_female", "sfx_creature_consume", "sfx_eat", "sfx_chicken_eat", "sfx_hare_idle_eating" };
for (int i = 0; i < array.Length; i++)
{
Cache.GetPrefab<GameObject>(array[i]).GetComponent<AudioSource>().mute = true;
}
}
catch (Exception e)
{
Log.Error(Instance, e);
}
finally
{
PrefabManager.OnVanillaPrefabsAvailable += PrefabManagerOnVanillaPrefabsAvailable;
}
}
}
}
namespace Digitalroot.Valheim.Common
{
internal interface ITraceableLogging
{
string Source { get; }
bool EnableTrace { get; }
}
internal sealed class Log
{
private static readonly Dictionary<string, TraceLogger> TraceLoggers;
[UsedImplicitly]
private static Log Instance { get; }
static Log()
{
TraceLoggers = new Dictionary<string, TraceLogger>();
Instance = new Log();
}
private Log()
{
TraceLoggers.Add("Digitalroot", new TraceLogger("Digitalroot", enableTrace: false));
}
public static void RegisterSource(ITraceableLogging sender)
{
if ((!TraceLoggers.ContainsKey(sender.Source) || TraceLoggers[sender.Source].IsTraceEnabled != sender.EnableTrace) && (!TraceLoggers.ContainsKey(sender.Source) || sender.EnableTrace))
{
if (TraceLoggers.ContainsKey(sender.Source) && sender.EnableTrace)
{
TraceLoggers[sender.Source].EnableTrace();
}
else
{
TraceLoggers.Add(sender.Source, new TraceLogger(sender.Source, sender.EnableTrace));
}
}
}
private static TraceLogger GetTraceLogger(ITraceableLogging sender)
{
if (!TraceLoggers.ContainsKey(sender.Source))
{
return TraceLoggers["Digitalroot"];
}
return TraceLoggers[sender.Source];
}
[UsedImplicitly]
public static void SetEnableTrace(ITraceableLogging sender, bool value)
{
if (value)
{
GetTraceLogger(sender).EnableTrace();
}
else
{
GetTraceLogger(sender).DisableTrace();
}
}
[UsedImplicitly]
public static void SetEnableTraceForAllLoggers(bool value)
{
foreach (TraceLogger value2 in TraceLoggers.Values)
{
if (value)
{
value2.EnableTrace();
}
else
{
value2.DisableTrace();
}
}
}
[UsedImplicitly]
public static void Debug(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogDebug(value);
}
[UsedImplicitly]
public static void Error(ITraceableLogging sender, Exception e, int i = 1)
{
Error(sender, "Message: " + e.Message);
Error(sender, $"TargetSite: {e.TargetSite}");
Error(sender, "StackTrace: " + e.StackTrace);
Error(sender, "Source: " + e.Source);
if (e.Data.Count > 0)
{
foreach (object key in e.Data.Keys)
{
Error(sender, $"key: {key}, value: {e.Data[key]}");
}
}
if (e.InnerException != null)
{
Error(sender, $"--- InnerException [{i}][Start] ---");
Error(sender, e.InnerException, ++i);
}
}
[UsedImplicitly]
public static void Error(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogError(value);
}
[UsedImplicitly]
public static void Info(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogInfo(value);
}
[UsedImplicitly]
public static void Fatal(ITraceableLogging sender, Exception e, int i = 1)
{
Fatal(sender, "Message: " + e.Message);
Fatal(sender, $"TargetSite: {e.TargetSite}");
Fatal(sender, "StackTrace: " + e.StackTrace);
Fatal(sender, "Source: " + e.Source);
if (e.Data.Count > 0)
{
foreach (object key in e.Data.Keys)
{
Fatal(sender, $"key: {key}, value: {e.Data[key]}");
}
}
if (e.InnerException != null)
{
Fatal(sender, $"--- InnerException [{i}][Start] ---");
Fatal(sender, e.InnerException, ++i);
}
}
[UsedImplicitly]
public static void Fatal(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogFatal(value);
}
[UsedImplicitly]
public static void Message(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogMessage(value);
}
[UsedImplicitly]
public static void Trace(ITraceableLogging sender, object value)
{
if (GetTraceLogger(sender).IsTraceEnabled || sender.EnableTrace)
{
GetTraceLogger(sender).LoggerRef.Log((LogLevel)63, value);
}
}
[UsedImplicitly]
public static void Warning(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogWarning(value);
}
}
internal class TraceLogger
{
internal readonly ManualLogSource LoggerRef;
private readonly string _source;
private readonly FileInfo _traceFileInfo;
public bool IsTraceEnabled { get; private set; }
private DirectoryInfo AssemblyDirectory => new FileInfo(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).Directory;
public TraceLogger(string source, bool enableTrace)
{
_source = source;
IsTraceEnabled = enableTrace;
LoggerRef = Logger.CreateLogSource(_source);
_traceFileInfo = new FileInfo(Path.Combine(Paths.BepInExRootPath ?? AssemblyDirectory.FullName, "logs", _source + ".Trace.log"));
if (_traceFileInfo.DirectoryName != null)
{
Directory.CreateDirectory(_traceFileInfo.DirectoryName);
}
if (_traceFileInfo.Exists)
{
_traceFileInfo.Delete();
_traceFileInfo.Refresh();
}
LoggerRef.LogEvent += OnLogEvent;
}
public void EnableTrace()
{
IsTraceEnabled = true;
}
public void DisableTrace()
{
IsTraceEnabled = false;
}
[UsedImplicitly]
public void StopTrace()
{
LoggerRef.LogEvent -= OnLogEvent;
}
private void OnLogEvent(object sender, LogEventArgs e)
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (e.Source.SourceName != _source || !IsTraceEnabled)
{
return;
}
using Mutex mutex = new Mutex(initiallyOwned: false, "Digitalroot.Valheim.Common.TraceLogger." + _source);
mutex.WaitOne();
try
{
if (e.Data is string)
{
string contents = $"[{e.Level,-7}:{e.Source.SourceName,10}] {e.Data}{Environment.NewLine}";
File.AppendAllText(_traceFileInfo.FullName, contents, Encoding.UTF8);
}
else
{
string contents2 = $"[{e.Level,-7}:{e.Source.SourceName,10}] {JsonSerializationProvider.Serialize(e.Data)}{Environment.NewLine}";
File.AppendAllText(_traceFileInfo.FullName, contents2, Encoding.UTF8);
}
}
finally
{
mutex.ReleaseMutex();
}
}
}
}
namespace Digitalroot.Valheim.Common.Json
{
[UsedImplicitly]
internal static class JsonSerializationProvider
{
[Obsolete("Use Deserialize<T>()")]
public static T FromJson<T>(string json)
{
return Deserialize<T>(json);
}
public static T Deserialize<T>(string json)
{
return SimpleJson.DeserializeObject<T>(json, (IJsonSerializerStrategy)(object)new DigitalrootJsonSerializerStrategy());
}
[Obsolete("Use Serialize()")]
public static string ToJson(object obj, bool pretty = false)
{
return Serialize(obj);
}
public static string Serialize(object obj)
{
return SimpleJson.SerializeObject(obj, (IJsonSerializerStrategy)(object)new DigitalrootJsonSerializerStrategy());
}
}
internal class DigitalrootJsonSerializerStrategy : PocoJsonSerializerStrategy
{
public override bool TrySerializeNonPrimitiveObject(object input, out object output)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (!(input is Vector3 val))
{
if (input is Quaternion val2)
{
output = new float[4] { val2.x, val2.y, val2.z, val2.w };
return true;
}
return ((PocoJsonSerializerStrategy)this).TrySerializeNonPrimitiveObject(input, ref output);
}
output = new float[3] { val.x, val.y, val.z };
return true;
}
public override object DeserializeObject(object value, Type type)
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
if (type == null)
{
throw new ArgumentNullException("type");
}
if (value == null)
{
throw new ArgumentNullException("value");
}
if (value is string value2)
{
if (string.IsNullOrWhiteSpace(value2))
{
throw new ArgumentNullException("value");
}
if (type == typeof(Vector3))
{
if (!(((PocoJsonSerializerStrategy)this).DeserializeObject(value, typeof(float[])) is float[] array) || (array != null && array.Length != 3))
{
throw new ArgumentException(string.Format("The value '{0}' can be converted to a {1}.", value, "Vector3"), "value");
}
return (object)new Vector3(array[0], array[1], array[2]);
}
if (type == typeof(Quaternion))
{
if (!(((PocoJsonSerializerStrategy)this).DeserializeObject(value, typeof(float[])) is float[] array2) || (array2 != null && array2.Length != 4))
{
throw new ArgumentException(string.Format("The value '{0}' can be converted to a {1}.", value, "Quaternion"), "value");
}
return (object)new Quaternion(array2[0], array2[1], array2[2], array2[3]);
}
return ((PocoJsonSerializerStrategy)this).DeserializeObject(value, type);
}
throw new ArgumentException($"The value '{value}' can be converted to a {type.Name}.", "value");
}
}
}
namespace Digitalroot.Valheim.Common
{
internal static class Utils
{
private static readonly ITraceableLogging Logger = GetLogger();
[UsedImplicitly]
public static DirectoryInfo AssemblyDirectory => new FileInfo(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).Directory;
[UsedImplicitly]
public static bool IsDedicated => ZNet.instance.IsDedicated();
[UsedImplicitly]
public static bool IsServer => ZNet.instance.IsServer();
public static bool IsRunningFromNUnit => AppDomain.CurrentDomain.GetAssemblies().Any((Assembly a) => a.FullName.ToLowerInvariant().StartsWith("nunit.framework"));
public static string Namespace => "Digitalroot.Valheim.Common";
private static ITraceableLogging GetLogger()
{
return new StaticSourceLogger();
}
[UsedImplicitly]
public static bool IsHeadless()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
return (int)SystemInfo.graphicsDeviceType == 4;
}
[UsedImplicitly]
public static List<T> AllOf<T>()
{
return Enum.GetValues(typeof(T)).OfType<T>().ToList();
}
[UsedImplicitly]
public static IEnumerable<string> AllNames(Type type)
{
foreach (FieldInfo item in from f1 in type.GetFields()
where f1.FieldType == typeof(string)
select f1)
{
yield return item.GetValue(null).ToString();
}
}
[UsedImplicitly]
public static bool DoesPluginExist(string pluginGuid)
{
return Chainloader.PluginInfos.Any((KeyValuePair<string, PluginInfo> keyValuePair) => keyValuePair.Value.Metadata.GUID == pluginGuid);
}
[UsedImplicitly]
public static Vector3 GetGroundHeight(int x, int z)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return Utils.GetGroundHeight(new Vector3Int(x, 500, z));
}
[UsedImplicitly]
public static Vector3 GetGroundHeight(float x, float z)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return Utils.GetGroundHeight(new Vector3(x, 500f, z));
}
public static Vector3 GetGroundHeight(Vector3Int vector3)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
return new Vector3((float)((Vector3Int)(ref vector3)).x, ZoneSystem.instance.GetGroundHeight(Vector3Int.op_Implicit(vector3)), (float)((Vector3Int)(ref vector3)).z);
}
public static Vector3 GetGroundHeight(Vector3 vector3)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(vector3.x, ZoneSystem.instance.GetGroundHeight(vector3), vector3.z);
}
[UsedImplicitly]
public static GameObject GetItemPrefab(string itemName)
{
if (!IsObjectDBReady())
{
return null;
}
return GetObjectDB().GetItemPrefab(itemName);
}
[UsedImplicitly]
public static GameObject GetItemPrefab(int hash)
{
if (!IsObjectDBReady())
{
return null;
}
return GetObjectDB().GetItemPrefab(hash);
}
[UsedImplicitly]
public static Player GetLocalPlayer()
{
return Player.m_localPlayer;
}
[UsedImplicitly]
public static Vector3 GetLocalPlayersPosition()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return ((Component)Player.m_localPlayer).transform.position;
}
[UsedImplicitly]
public static ObjectDB GetObjectDB()
{
return ObjectDB.instance;
}
[UsedImplicitly]
public static string GetPluginPath(Type modPluginType)
{
return Path.GetDirectoryName(modPluginType.Assembly.Location);
}
[UsedImplicitly]
public static GameObject GetPrefab(string itemName)
{
if (!IsZNetSceneReady())
{
return null;
}
return ZNetScene.instance.GetPrefab(itemName);
}
[UsedImplicitly]
public static GameObject GetPrefab(int hash)
{
if (!IsZNetSceneReady())
{
return null;
}
return ZNetScene.instance.GetPrefab(hash);
}
[UsedImplicitly]
public static T GetPrivateField<T>(object instance, string name)
{
FieldInfo field = instance.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
return (T)field.GetValue(instance);
}
Log.Error(Logger, "Variable " + name + " does not exist on type: " + instance.GetType());
return default(T);
}
[UsedImplicitly]
public static object InvokePrivate(object instance, string name, object[] args = null)
{
MethodInfo method = instance.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (method == null)
{
Type[] types = ((args == null) ? Type.EmptyTypes : args.Select((object arg) => arg.GetType()).ToArray());
method = instance.GetType().GetMethod(name, types);
}
if (method == null)
{
Log.Error(Logger, "Method " + name + " does not exist on type: " + instance.GetType());
return null;
}
return method.Invoke(instance, args);
}
[UsedImplicitly]
public static bool IsGameInMainScene()
{
return (Object)(object)ZNetScene.instance != (Object)null;
}
[UsedImplicitly]
public static bool IsObjectDBReady()
{
if (!((Object)(object)GetObjectDB() != (Object)null) || GetObjectDB().m_items.Count == 0 || !((Object)(object)GetItemPrefab("Amber") != (Object)null))
{
return IsRunningFromNUnit;
}
return true;
}
[UsedImplicitly]
public static bool IsPlayerReady()
{
return (Object)(object)GetLocalPlayer() != (Object)null;
}
[UsedImplicitly]
public static bool IsZNetSceneReady()
{
if ((Object)(object)ZNetScene.instance != (Object)null)
{
List<GameObject> list = ZNetScene.instance?.m_prefabs;
if (list != null)
{
return list.Count > 0;
}
return false;
}
return false;
}
[UsedImplicitly]
public static bool IsZNetReady()
{
return (Object)(object)ZNet.instance != (Object)null;
}
[UsedImplicitly]
public static string Localize(string value)
{
return Localization.instance.Localize(value);
}
[UsedImplicitly]
public static Vector3 GetStartTemplesPosition()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
LocationInstance val = default(LocationInstance);
if (ZoneSystem.instance.FindClosestLocation("StartTemple", Vector3.zero, ref val))
{
Log.Trace(Logger, $"[GetStartTemplesPosition] StartTemple at {val.m_position}");
return val.m_position;
}
Log.Error(Logger, "[GetStartTemplesPosition] Can't find StartTemple");
return Vector3.zero;
}
[UsedImplicitly]
public static void SetPrivateField(object instance, string name, object value)
{
FieldInfo field = instance.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
Log.Error(Logger, "Variable " + name + " does not exist on type: " + instance.GetType());
}
else
{
field.SetValue(instance, value);
}
}
[UsedImplicitly]
public static GameObject Spawn([NotNull] string prefabName, Vector3 location, [CanBeNull] Transform parent = null)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
Log.Trace(Logger, $"{Namespace}.{MethodBase.GetCurrentMethod().DeclaringType?.Name}.{MethodBase.GetCurrentMethod().Name}({prefabName}, {location}, {((parent != null) ? ((Object)parent).name : null)})");
GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(prefabName));
if (!((Object)(object)itemPrefab == (Object)null))
{
return Spawn(itemPrefab, location, parent);
}
return null;
}
[UsedImplicitly]
public static GameObject Spawn([NotNull] GameObject prefab, Vector3 location, [CanBeNull] Transform parent = null)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
Log.Trace(Logger, $"{Namespace}.{MethodBase.GetCurrentMethod().DeclaringType?.Name}.{MethodBase.GetCurrentMethod().Name}({((Object)prefab).name}, {location}, {((parent != null) ? ((Object)parent).name : null)})");
if ((Object)(object)parent == (Object)null)
{
return Object.Instantiate<GameObject>(prefab, location, Quaternion.identity);
}
return Object.Instantiate<GameObject>(prefab, location, Quaternion.identity, parent);
}
public static AssetBundle LoadAssetBundleFromResources(string bundleName, Assembly resourceAssembly)
{
if (resourceAssembly == null)
{
throw new ArgumentNullException("resourceAssembly");
}
string text = null;
try
{
text = resourceAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName));
}
catch (Exception)
{
}
if (text == null)
{
Log.Error(Logger, "AssetBundle " + bundleName + " not found in assembly manifest");
return null;
}
using Stream stream = resourceAssembly.GetManifestResourceStream(text);
return AssetBundle.LoadFromStream(stream);
}
}
[DebuggerDisplay("Source = {Source}, EnableTrace = {EnableTrace}", Name = "{Source}")]
internal class StaticSourceLogger : ITraceableLogging
{
public static StaticSourceLogger PreMadeTraceableInstance = new StaticSourceLogger(enableTrace: true);
public static StaticSourceLogger PreMadeNonTraceableInstance = new StaticSourceLogger();
public string Source { get; }
public bool EnableTrace { get; }
public StaticSourceLogger(bool enableTrace = false)
: this("Digitalroot", enableTrace)
{
}
public StaticSourceLogger(string source, bool enableTrace = false)
{
Source = source;
EnableTrace = enableTrace;
}
}
}
internal class DigitalrootValheimMisophoniaFriendly_ProcessedByFody
{
internal const string FodyVersion = "6.6.0.0";
internal const string ILMerge = "1.22.0.0";
}