using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using KawaTurbo.SayoNui;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KawaTurbo.SayoNui")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KawaTurbo.SayoNui")]
[assembly: AssemblyTitle("SayoNui")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = 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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace SayoNui
{
internal class SayoNuiConfig
{
public readonly ConfigEntry<bool> modEnabled;
public readonly ConfigEntry<string> mode;
public readonly ConfigEntry<bool> debug;
public SayoNuiConfig(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
modEnabled = cfg.Bind<bool>("General", "ModEnabled", true, "Modのオン・オフを切り替えます\ntrueで有効、falseで無効にできます\nEnable or disable the mod\ntrue to enable, false to disable");
mode = cfg.Bind<string>("General", "Mode", "Sayo", "ビンボンの見た目・声を切り替えます\n「Sayo」、「SayoEx」、「Yona」から選んでください\n「SayoEx」はexVOICEを読み込むモードです(詳細はmodページをお読みください)\nSwitching appearance and voice of Bing Bong\nYou can select \"Sayo\", \"SayoEx\", or \"Yona\"\n\"SayoEx\" is a mode that loads exVOICE (please read the mod page for details)");
debug = cfg.Bind<bool>("General", "Debug", false, "使用非推奨\nデバッグモードを有効にします\ntrueで有効、falseで無効にできます\nUse not recommended\nEnable debug mode\ntrue to enable, false to disable");
ClearOrphanedEntries(cfg);
cfg.Save();
cfg.SaveOnConfigSet = true;
}
private static void ClearOrphanedEntries(ConfigFile cfg)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
dictionary.Clear();
}
}
public class ExVoice
{
public required string filename { get; set; }
public required string subtitle { get; set; }
}
internal class FileLoader
{
public enum LoadStatus
{
NotLoaded,
Loading,
Loaded,
Failed
}
public static string? CurrentLoadedModMode;
private static AssetBundle? CurrentBundle;
public static List<VoiceData> StandardVoiceDataList = new List<VoiceData>();
public static List<VoiceData> ExVoiceDataList = new List<VoiceData>();
public static GameObject? CustomModelPrefab;
public static Texture2D? UIIcon;
public static LoadStatus AssetBundleLoadStatus = LoadStatus.NotLoaded;
public static LoadStatus StandardVoiceDataLoadStatus = LoadStatus.NotLoaded;
public static LoadStatus ExVoiceLoadStatus = LoadStatus.NotLoaded;
public static LoadStatus ModelLoadStatus = LoadStatus.NotLoaded;
public static LoadStatus UIIconLoadStatus = LoadStatus.NotLoaded;
internal static Action? OnModelLoaded;
internal static List<VoiceData> CurrentVoiceDataList
{
get
{
string value = Plugin.BoundConfig.mode.Value;
if (value == "SayoEx")
{
return StandardVoiceDataList.Concat(ExVoiceDataList).ToList();
}
return StandardVoiceDataList;
}
}
public static bool IsAllAssetsLoaded
{
get
{
if (AssetBundleLoadStatus == LoadStatus.Loaded && StandardVoiceDataLoadStatus == LoadStatus.Loaded && ModelLoadStatus == LoadStatus.Loaded && UIIconLoadStatus == LoadStatus.Loaded)
{
if (!(Plugin.BoundConfig.mode.Value != "SayoEx"))
{
return ExVoiceLoadStatus == LoadStatus.Loaded;
}
return true;
}
return false;
}
}
internal static string ModDirectory => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static string ExVoiceDirectory => Path.Combine(Paths.ConfigPath, "SayoNui", "exVOICE");
internal static void UnloadCurrentAssets()
{
Patch_Ask.StopAllVoiceAndSubtitleRoutine();
Patch_Item.RestoreAllModels(Patch_Item.ItemModelManagerDict);
if ((Object)(object)CurrentBundle != (Object)null)
{
CurrentBundle.Unload(true);
CurrentBundle = null;
AssetBundleLoadStatus = LoadStatus.NotLoaded;
StandardVoiceDataList.Clear();
StandardVoiceDataLoadStatus = LoadStatus.NotLoaded;
CustomModelPrefab = null;
ModelLoadStatus = LoadStatus.NotLoaded;
UIIcon = null;
UIIconLoadStatus = LoadStatus.NotLoaded;
}
foreach (VoiceData exVoiceData in ExVoiceDataList)
{
Object.Destroy((Object)(object)exVoiceData.audioClip);
Object.Destroy((Object)(object)exVoiceData);
}
ExVoiceDataList.Clear();
ExVoiceLoadStatus = LoadStatus.NotLoaded;
}
internal static IEnumerator Load(string modMode)
{
yield return LoadAssetBundleAsync(modMode switch
{
"Sayo" => "sayo_bundle",
"SayoEx" => "sayo_bundle",
"Yona" => "yona_bundle",
_ => throw new ArgumentException("不明なモード: " + modMode),
});
if ((Object)(object)CurrentBundle == (Object)null)
{
Plugin.Log.LogError((object)"既にバンドルがロードされているのでロードを中断します。");
yield break;
}
yield return LoadStandardVoiceDataAsync();
yield return LoadModelAsync();
yield return LoadUIIconAsync();
if (modMode == "SayoEx")
{
yield return LoadExVoicesAsync();
}
CurrentLoadedModMode = modMode;
Plugin.Log.LogDebug((object)("現在のモード: " + modMode));
}
internal static IEnumerator LoadAssetBundleAsync(string bundleName)
{
Plugin.Log.LogDebug((object)("アセットバンドルのロードを開始します: " + bundleName));
AssetBundleLoadStatus = LoadStatus.Loading;
AssetBundleCreateRequest bundleRequest = AssetBundle.LoadFromFileAsync(Path.Combine(ModDirectory, "SayoNui_assets", bundleName));
yield return bundleRequest;
if ((Object)(object)bundleRequest.assetBundle != (Object)null)
{
Plugin.Log.LogDebug((object)("アセットバンドルのロードに成功しました: " + bundleName));
CurrentBundle = bundleRequest.assetBundle;
AssetBundleLoadStatus = LoadStatus.Loaded;
}
else
{
Plugin.Log.LogError((object)("アセットバンドルのロードに失敗しました: " + bundleName));
AssetBundleLoadStatus = LoadStatus.Failed;
}
}
internal static IEnumerator LoadStandardVoiceDataAsync()
{
StandardVoiceDataLoadStatus = LoadStatus.Loading;
if ((Object)(object)CurrentBundle == (Object)null)
{
Plugin.Log.LogError((object)"アセットバンドルがロードされていません");
StandardVoiceDataLoadStatus = LoadStatus.Failed;
yield break;
}
AssetBundleRequest request = CurrentBundle.LoadAllAssetsAsync<VoiceData>();
yield return request;
if (request.allAssets != null)
{
StandardVoiceDataList = request.allAssets.OfType<VoiceData>().ToList();
StandardVoiceDataLoadStatus = LoadStatus.Loaded;
Plugin.Log.LogDebug((object)$"VoiceDataの一括読み込みに成功しました。読み込まれた音声データの数: {StandardVoiceDataList.Count}");
}
else
{
Plugin.Log.LogError((object)"VoiceDataの一括読み込みに失敗しました。");
StandardVoiceDataLoadStatus = LoadStatus.Failed;
}
}
internal static IEnumerator LoadExVoicesAsync()
{
ExVoiceLoadStatus = LoadStatus.Loading;
string exVoiceDirectory = ExVoiceDirectory;
string text = Path.Combine(exVoiceDirectory, "voicelist.json");
if (!File.Exists(text))
{
Plugin.Log.LogError((object)("JSONファイルが見つかりません: " + text));
ExVoiceLoadStatus = LoadStatus.Failed;
yield break;
}
string text2 = File.ReadAllText(text);
List<ExVoice> list = JsonConvert.DeserializeObject<List<ExVoice>>(text2);
if (list == null || list.Count == 0)
{
Plugin.Log.LogError((object)"JSONファイルの内容が壊れています。");
ExVoiceLoadStatus = LoadStatus.Failed;
yield break;
}
foreach (ExVoice voice in list)
{
string uriString = Path.Combine(exVoiceDirectory, voice.filename);
string absoluteUri = new Uri(uriString).AbsoluteUri;
UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(absoluteUri, (AudioType)20);
try
{
yield return request.SendWebRequest();
if ((int)request.result != 1)
{
Plugin.Log.LogError((object)("音声ファイルの読み込みに失敗しました: " + voice.filename));
continue;
}
AudioClip content = DownloadHandlerAudioClip.GetContent(request);
VoiceData val = ScriptableObject.CreateInstance<VoiceData>();
val.audioClip = content;
val.subtitle = voice.subtitle;
ExVoiceDataList.Add(val);
}
finally
{
((IDisposable)request)?.Dispose();
}
}
if (ExVoiceDataList.Count == 0)
{
Plugin.Log.LogError((object)"exVOICEフォルダ内に音声データが見つかりません\nexVOICEを使用しない場合はモードを「Sayo」に変更してください。");
ExVoiceLoadStatus = LoadStatus.Failed;
}
else
{
Plugin.Log.LogDebug((object)$"exVOICEの一括読み込みに成功しました。読み込まれた音声データの数: {ExVoiceDataList.Count}");
ExVoiceLoadStatus = LoadStatus.Loaded;
}
}
internal static IEnumerator LoadModelAsync()
{
ModelLoadStatus = LoadStatus.Loading;
if ((Object)(object)CurrentBundle == (Object)null)
{
Plugin.Log.LogError((object)"アセットバンドルがロードされていません");
ModelLoadStatus = LoadStatus.Failed;
yield break;
}
AssetBundleRequest request = CurrentBundle.LoadAssetAsync<GameObject>("NuiModel");
yield return request;
if (request.asset != (Object)null)
{
Object asset = request.asset;
CustomModelPrefab = (GameObject?)(object)((asset is GameObject) ? asset : null);
ModelLoadStatus = LoadStatus.Loaded;
OnModelLoaded?.Invoke();
Plugin.Log.LogDebug((object)"3Dモデルの読み込みに成功しました。");
}
else
{
Plugin.Log.LogError((object)"3Dモデルの読み込みに失敗しました。");
ModelLoadStatus = LoadStatus.Failed;
}
}
internal static IEnumerator LoadUIIconAsync()
{
if ((Object)(object)CurrentBundle == (Object)null)
{
Plugin.Log.LogError((object)"アセットバンドルがロードされていません");
UIIconLoadStatus = LoadStatus.Failed;
yield break;
}
AssetBundleRequest request = CurrentBundle.LoadAssetAsync<Texture2D>("UIIcon");
yield return request;
if (request.asset != (Object)null)
{
Object asset = request.asset;
UIIcon = (Texture2D?)(object)((asset is Texture2D) ? asset : null);
UIIconLoadStatus = LoadStatus.Loaded;
Plugin.Log.LogDebug((object)"UIアイコンの読み込みに成功しました。");
}
else
{
Plugin.Log.LogError((object)"UIアイコンの読み込みに失敗しました。");
UIIconLoadStatus = LoadStatus.Failed;
}
}
}
public static class BingBongRandomManager
{
private const string PROP_RANDOM_NUMBER = "RandomNumber";
public static bool IsModLeader()
{
if (!PhotonNetwork.InRoom)
{
return false;
}
PlayerManager.UpdateModPlayerList();
Player val = (from p in PlayerManager.GetModPlayers()
orderby p.ActorNumber
select p).FirstOrDefault();
if (val != null)
{
return val.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber;
}
return false;
}
public static void ReserveNextRandom()
{
int value = Random.Range(0, 1000);
RoomManager.SetRoomProperty("RandomNumber", value);
Plugin.Log.LogDebug((object)string.Format("RandomNumber set to {0}", RoomManager.GetRoomProperty("RandomNumber")));
}
public static int GetNextRandom()
{
return (RoomManager.GetRoomProperty("RandomNumber") as int?).GetValueOrDefault();
}
}
[HarmonyPatch(typeof(Action_AskBingBong), "Ask", new Type[]
{
typeof(int),
typeof(bool)
})]
public static class Patch_Ask
{
private static int debugNum = 0;
private static Camera? cam;
private static readonly Dictionary<Action_AskBingBong, Coroutine> ActiveAskRoutine = new Dictionary<Action_AskBingBong, Coroutine>();
private static readonly Dictionary<Action_AskBingBong, Coroutine> ActiveSubtitleRoutine = new Dictionary<Action_AskBingBong, Coroutine>();
private static readonly FieldRef<Action_AskBingBong, AskEvent> OnAskFieldRef = AccessTools.FieldRefAccess<Action_AskBingBong, AskEvent>("OnAsk");
private static void EnsureCameraFound()
{
if ((Object)(object)cam == (Object)null && (Object)(object)MainCamera.instance != (Object)null)
{
cam = ((Component)MainCamera.instance).GetComponent<Camera>();
Plugin.Log.LogDebug((object)("MainCamera instance found: " + ((Object)cam).name));
}
}
private static IEnumerator SquishRoutine(Transform modelTransform)
{
Vector3 originalScale = modelTransform.localScale;
float elapsedTime = 0f;
while (elapsedTime < 0.1f)
{
float num = elapsedTime / 0.1f;
float num2 = Mathf.Lerp(1f, 0.6f, num);
modelTransform.localScale = new Vector3(originalScale.x * num2, originalScale.y, originalScale.z);
elapsedTime += Time.deltaTime;
yield return null;
}
modelTransform.localScale = new Vector3(originalScale.x * 0.6f, originalScale.y, originalScale.z);
elapsedTime = 0f;
while (elapsedTime < 0.35f)
{
float num3 = elapsedTime / 0.35f;
float num4 = 1f - Mathf.Pow(1f - num3, 2f);
float num5 = Mathf.Lerp(0.6f, 1f, num4);
modelTransform.localScale = new Vector3(originalScale.x * num5, originalScale.y, originalScale.z);
elapsedTime += Time.deltaTime;
yield return null;
}
modelTransform.localScale = originalScale;
yield return null;
}
public static IEnumerator ReserveNextRandomRoutine()
{
yield return (object)new WaitForSeconds(0.1f);
BingBongRandomManager.ReserveNextRandom();
}
[HarmonyPrefix]
public static bool Prefix(Action_AskBingBong __instance, int index, bool spamming, Item ___item, ref Coroutine ___askRoutine, ref Coroutine ___subtitleRoutine)
{
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
EnsureCameraFound();
int nextRandom = BingBongRandomManager.GetNextRandom();
List<VoiceData> currentVoiceDataList = FileLoader.CurrentVoiceDataList;
if (!Plugin.BoundConfig.modEnabled.Value || !FileLoader.IsAllAssetsLoaded || currentVoiceDataList.Count == 0)
{
if (BingBongRandomManager.IsModLeader())
{
((MonoBehaviour)__instance).StartCoroutine(ReserveNextRandomRoutine());
}
return true;
}
if (Plugin.BoundConfig.debug.Value)
{
Plugin.Log.LogDebug((object)"Debug mode is enabled.");
nextRandom = debugNum;
debugNum++;
}
int num = nextRandom % currentVoiceDataList.Count;
Plugin.Log.LogDebug((object)$"Number: {nextRandom}, modIndex: {num}, VoiceDataList.Count: {currentVoiceDataList.Count}");
if ((Object)(object)___item.holderCharacter != (Object)null)
{
__instance.squishAnim.SetTrigger("Squish");
SFX_Player.instance.PlaySFX(__instance.squeak, ((Component)__instance).transform.position, ((Component)__instance).transform, (SFX_Settings)null, 1f, false);
Plugin.Log.LogDebug((object)$"ItemID: {((Object)___item).GetInstanceID()}");
if (Patch_Item.ItemModelManagerDict.TryGetValue(___item, out ItemModelManager value))
{
((MonoBehaviour)__instance).StartCoroutine(SquishRoutine(value.CustomModelInstance.transform));
}
((Component)__instance.subtitles).gameObject.SetActive(false);
if (___askRoutine != null)
{
((MonoBehaviour)__instance).StopCoroutine(___askRoutine);
}
if (___subtitleRoutine != null)
{
((MonoBehaviour)__instance).StopCoroutine(___subtitleRoutine);
}
if (ActiveAskRoutine.TryGetValue(__instance, out Coroutine value2))
{
((MonoBehaviour)__instance).StopCoroutine(value2);
}
ActiveAskRoutine[__instance] = ((MonoBehaviour)__instance).StartCoroutine(CustomAskRoutine(__instance, num, spamming, currentVoiceDataList, ___item, index));
}
if (BingBongRandomManager.IsModLeader())
{
((MonoBehaviour)__instance).StartCoroutine(ReserveNextRandomRoutine());
}
return false;
}
public static IEnumerator CustomAskRoutine(Action_AskBingBong __instance, int modIndex, bool spamming, List<VoiceData> VoiceDataList, Item item, int originalIndex)
{
float t = 0f;
while (t < 0.5f)
{
item.holderCharacter.refs.items.UpdateAttachedItem();
t += Time.deltaTime;
yield return null;
}
if (spamming)
{
yield break;
}
__instance.source.Stop();
((Component)__instance.subtitles).gameObject.SetActive(false);
yield return (object)new WaitForSeconds(0.5f);
if (ActiveSubtitleRoutine.TryGetValue(__instance, out Coroutine value))
{
((MonoBehaviour)__instance).StopCoroutine(value);
}
ActiveSubtitleRoutine[__instance] = ((MonoBehaviour)__instance).StartCoroutine(CustomSubtitleRoutine(VoiceDataList[modIndex].subtitle, __instance, VoiceDataList[modIndex].audioClip.length));
if ((Object)(object)VoiceDataList[modIndex] != (Object)null)
{
Plugin.Log.LogDebug((object)$"Playing audio clip: {((Object)VoiceDataList[modIndex].audioClip).name}, length: {VoiceDataList[modIndex].audioClip.length}");
Plugin.Log.LogDebug((object)("AudioSource: " + $"enabled={((Behaviour)__instance.source).enabled}, " + $"isActiveAndEnabled={((Behaviour)__instance.source).isActiveAndEnabled}, " + $"volume={__instance.source.volume}, " + $"mute={__instance.source.mute}, " + $"pitch={__instance.source.pitch}, " + $"spatialBlend={__instance.source.spatialBlend}, " + $"outputAudioMixerGroup={__instance.source.outputAudioMixerGroup}, " + $"clip={__instance.source.clip}, " + $"isPlaying={__instance.source.isPlaying}"));
Plugin.Log.LogDebug((object)("Action_AskBingBong: " + $"instance={((Object)__instance).GetInstanceID()}, " + "gameObject=" + ((Object)((Component)__instance).gameObject).name + ", " + $"active={((Component)__instance).gameObject.activeInHierarchy}, " + $"sourceInstance={((Object)__instance.source).GetInstanceID()}"));
__instance.source.PlayOneShot(VoiceDataList[modIndex].audioClip);
AskEvent val = OnAskFieldRef.Invoke(__instance);
if (val != null)
{
val.Invoke(__instance.responses[originalIndex].sfx.clips[0]);
}
}
}
public static IEnumerator CustomSubtitleRoutine(string subtitle, Action_AskBingBong __instance, float audioLength)
{
yield return (object)new WaitForSeconds(0.19f);
((Component)__instance.subtitles).gameObject.SetActive(true);
((TMP_Text)__instance.subtitles).text = subtitle;
try
{
float t = 0f;
while (t < audioLength)
{
t += Time.deltaTime;
((TMP_Text)__instance.subtitles).alpha = Mathf.Clamp01(t * 12f);
if ((Object)(object)cam != (Object)null)
{
__instance.subtitles.transform.localScale = Vector3.one * __instance.scaleCurve.Evaluate(Vector3.Distance(__instance.subtitles.transform.position, ((Component)cam).transform.position));
__instance.subtitles.transform.forward = ((Component)cam).transform.forward;
}
yield return null;
}
}
finally
{
((Component)__instance.subtitles).gameObject.SetActive(false);
Plugin.Log.LogDebug((object)"Subtitle is stopped.");
}
}
public static void StopAllVoiceAndSubtitleRoutine()
{
foreach (KeyValuePair<Action_AskBingBong, Coroutine> item in ActiveAskRoutine)
{
if ((Object)(object)item.Key != (Object)null)
{
((MonoBehaviour)item.Key).StopCoroutine(item.Value);
item.Key.source.Stop();
}
}
ActiveAskRoutine.Clear();
foreach (KeyValuePair<Action_AskBingBong, Coroutine> item2 in ActiveSubtitleRoutine)
{
if ((Object)(object)item2.Key != (Object)null)
{
((MonoBehaviour)item2.Key).StopCoroutine(item2.Value);
((Component)item2.Key.subtitles).gameObject.SetActive(false);
}
}
ActiveSubtitleRoutine.Clear();
Plugin.Log.LogDebug((object)"[StopAllVoiceAndSubtitleRoutine] Completed.");
}
}
public class ItemModelManager(Renderer originalMainRenderer, Renderer[]? originalAddtlRenderers, GameObject customModelInstance)
{
public Renderer OriginalMainRenderer = originalMainRenderer;
public Renderer[]? OriginalAddtlRenderers = originalAddtlRenderers;
public GameObject CustomModelInstance = customModelInstance;
}
[HarmonyPatch(typeof(Item))]
public static class Patch_Item
{
internal static readonly Dictionary<Item, ItemModelManager> ItemModelManagerDict = new Dictionary<Item, ItemModelManager>();
private static readonly List<(Item item, MaterialPropertyBlock mpb)> pendingItems = new List<(Item, MaterialPropertyBlock)>();
internal static string ReplacementDisplayName
{
get
{
if (Plugin.BoundConfig.mode.Value.Equals("Yona"))
{
return "よなぬい";
}
return "さよぬい";
}
}
public static bool IsBingBong(Item item)
{
if ((Object)(object)item != (Object)null)
{
if (!((Object)item).name.Contains("BingBong", StringComparison.OrdinalIgnoreCase))
{
return ((Object)item).name.Contains("Bing Bong", StringComparison.OrdinalIgnoreCase);
}
return true;
}
return false;
}
public static void ReplaceModel(Item instance, MaterialPropertyBlock mpb)
{
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
instance.mainRenderer.enabled = false;
Plugin.Log.LogDebug((object)("Disabled mainRenderer: " + ((Object)instance.mainRenderer).name));
if (instance.addtlRenderers != null && instance.addtlRenderers.Length != 0)
{
Renderer[] addtlRenderers = instance.addtlRenderers;
foreach (Renderer val in addtlRenderers)
{
val.enabled = false;
Plugin.Log.LogDebug((object)("Disabled addtlRenderer: " + ((Object)val).name));
}
}
GameObject val2 = Object.Instantiate<GameObject>(FileLoader.CustomModelPrefab, instance.transform);
if ((Object)(object)val2 == (Object)null)
{
Plugin.Log.LogError((object)"Failed to instantiate custom model.");
return;
}
Plugin.Log.LogDebug((object)("Instantiated custom model: " + ((Object)val2).name));
if (Plugin.BoundConfig.mode.Value == "Yona")
{
val2.transform.localPosition = new Vector3(0f, -0.2f, 0.1f);
if (((Object)instance).name == "BingBong(Clone)")
{
val2.transform.localRotation = Quaternion.Euler(-90f, 180f, 0f);
}
else
{
val2.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
}
val2.transform.localScale = new Vector3(30f, 30f, 30f);
}
else
{
val2.transform.localPosition = new Vector3(0f, -0.2f, 0.1f);
if (((Object)instance).name == "BingBong(Clone)")
{
val2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
}
else
{
val2.transform.localRotation = Quaternion.identity;
}
val2.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
}
ItemModelManager itemModelManager = new ItemModelManager(instance.mainRenderer, instance.addtlRenderers, val2);
ItemModelManagerDict.Add(instance, itemModelManager);
Renderer[] componentsInChildren = val2.GetComponentsInChildren<Renderer>();
if (componentsInChildren.Length != 0)
{
Renderer val3 = componentsInChildren[0];
Plugin.Log.LogDebug((object)("customMainRenderer: " + ((Object)val3).name));
instance.mainRenderer = val3;
Renderer[] subArray = componentsInChildren[1..];
Plugin.Log.LogDebug((object)$"customAddtlRenderer count: {subArray.Length}");
instance.addtlRenderers = subArray;
instance.mainRenderer.SetPropertyBlock(mpb);
Renderer[] addtlRenderers2 = instance.addtlRenderers;
foreach (Renderer val4 in addtlRenderers2)
{
val4.SetPropertyBlock(mpb);
}
Plugin.Log.LogDebug((object)("Enabling mainRenderer: " + ((Object)instance.mainRenderer).name));
instance.mainRenderer.enabled = true;
Renderer[] addtlRenderers3 = instance.addtlRenderers;
foreach (Renderer val5 in addtlRenderers3)
{
Plugin.Log.LogDebug((object)("Enabling addtlRenderer: " + ((Object)val5).name));
val5.enabled = true;
}
ItemLog(instance, itemModelManager);
}
}
public static void RestoreAllModels(Dictionary<Item, ItemModelManager> itemModelManagerDict)
{
foreach (Item key in itemModelManagerDict.Keys)
{
RestoreOriginalModel(key, itemModelManagerDict[key]);
}
Plugin.Log.LogDebug((object)"[RestoreAllModels] Completed.");
}
public static void RestoreOriginalModel(Item instance, ItemModelManager itemModelManager)
{
instance.mainRenderer.enabled = false;
Renderer[] addtlRenderers = instance.addtlRenderers;
foreach (Renderer val in addtlRenderers)
{
val.enabled = false;
}
instance.mainRenderer = itemModelManager.originalMainRenderer;
instance.addtlRenderers = itemModelManager.originalAddtlRenderers;
instance.mainRenderer.enabled = true;
if (instance.addtlRenderers != null)
{
Renderer[] addtlRenderers2 = instance.addtlRenderers;
foreach (Renderer val2 in addtlRenderers2)
{
val2.enabled = true;
}
}
Object.Destroy((Object)(object)itemModelManager.customModelInstance);
}
public static void OnModelLoaded()
{
foreach (var (val, val2) in pendingItems)
{
if ((Object)(object)val != (Object)null && val2 != null)
{
ReplaceModel(val, val2);
}
}
pendingItems.Clear();
}
public static void ItemLog(Item instance, ItemModelManager itemModelManager)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogDebug((object)"============================================================");
Plugin.Log.LogDebug((object)("instance name: " + ((Object)instance).name));
Plugin.Log.LogDebug((object)$"InstanceID: {((Object)instance).GetInstanceID()}");
Plugin.Log.LogDebug((object)$"itemState: {instance.itemState}");
Renderer[] array = (from r in ((IEnumerable<Renderer>)(object)new Renderer[1] { itemModelManager.originalMainRenderer }).Concat(itemModelManager.originalAddtlRenderers ?? Array.Empty<Renderer>()).Append(instance.mainRenderer).Concat(instance.addtlRenderers ?? Array.Empty<Renderer>())
where (Object)(object)r != (Object)null
select r).ToArray();
for (int num = 0; num < array.Length; num++)
{
Renderer val = array[num];
if ((Object)(object)val == (Object)null)
{
Plugin.Log.LogDebug((object)$"Renderer[{num}]: null");
continue;
}
Transform transform = ((Component)val).transform;
Plugin.Log.LogDebug((object)($"--- Renderer[{num}] ---\n" + "Type: " + ((object)val).GetType().Name + "\nName: " + ((Object)val).name + "\n" + $"InstanceID: {((Object)val).GetInstanceID()}\n" + $"Enabled: {val.enabled}\n" + $"Visible: {val.isVisible}\n" + $"ActiveInHierarchy: {((Component)val).gameObject.activeInHierarchy}\n" + $"Position: {transform.position}\n" + $"Rotation: {transform.rotation}\n" + $"LocalPosition: {transform.localPosition}\n" + $"LocalRotation: {transform.localRotation}\n" + $"LossyScale: {transform.lossyScale}\n" + "Parent: " + (((Object)(object)transform.parent != (Object)null) ? ((Object)transform.parent).name : "null") + "\n"));
}
Plugin.Log.LogDebug((object)"============================================================");
}
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void AwakePostFix(Item __instance, ref MaterialPropertyBlock ___mpb)
{
if (IsBingBong(__instance))
{
Plugin.Log.LogDebug((object)"[AwakePostFix]");
Plugin.Log.LogDebug((object)$"InstanceID: {((Object)__instance).GetInstanceID()}");
if ((Object)(object)FileLoader.CustomModelPrefab == (Object)null)
{
pendingItems.Add((__instance, ___mpb));
}
else
{
ReplaceModel(__instance, ___mpb);
}
}
}
[HarmonyPatch("OnDestroy")]
[HarmonyPostfix]
public static void OnDestroyPostFix(Item __instance)
{
ItemModelManagerDict.Remove(__instance);
}
[HarmonyPatch("SetState")]
[HarmonyPostfix]
public static void SetStatePostFix(Item __instance, ItemState setState)
{
//IL_000a: 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_001c: Invalid comparison between Unknown and I4
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Invalid comparison between Unknown and I4
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
Plugin.Log.LogDebug((object)$"[SetStatePostFix] ItemState: {setState}");
ItemModelManager value2;
if ((int)setState == 1)
{
if (ItemModelManagerDict.TryGetValue(__instance, out ItemModelManager value))
{
Plugin.Log.LogDebug((object)$"InstanceID: {((Object)__instance).GetInstanceID()}, ItemState: {__instance.itemState}, CustomModelInstance: {value.customModelInstance}");
value.customModelInstance.transform.localPosition = new Vector3(-0.08f, -0.1f, 0.1f);
}
}
else if ((int)setState == 2 && ItemModelManagerDict.TryGetValue(__instance, out value2))
{
Plugin.Log.LogDebug((object)$"InstanceID: {((Object)__instance).GetInstanceID()}, ItemState: {__instance.itemState}, CustomModelInstance: {value2.customModelInstance}");
ManualLogSource log = Plugin.Log;
Quaternion localRotation = value2.customModelInstance.transform.localRotation;
log.LogDebug((object)$"CustomModel LocalRotation(before): {((Quaternion)(ref localRotation)).eulerAngles}");
value2.customModelInstance.transform.localRotation = Quaternion.identity;
ManualLogSource log2 = Plugin.Log;
localRotation = value2.customModelInstance.transform.localRotation;
log2.LogDebug((object)$"CustomModel LocalRotation(after): {((Quaternion)(ref localRotation)).eulerAngles}");
}
}
[HarmonyPatch("GetName")]
[HarmonyPostfix]
public static void GetNamePostFix(Item __instance, ref string __result)
{
if (IsBingBong(__instance))
{
__result = ReplacementDisplayName;
}
}
}
[HarmonyPatch(typeof(ItemUIData))]
public class ItemUIDataPatch
{
public static bool IsBingBong(ItemUIData itemUIData)
{
if (itemUIData != null)
{
if (!itemUIData.itemName.Contains("BingBong", StringComparison.OrdinalIgnoreCase))
{
return itemUIData.itemName.Contains("Bing Bong", StringComparison.OrdinalIgnoreCase);
}
return true;
}
return false;
}
[HarmonyPatch("GetIcon")]
[HarmonyPostfix]
public static void GetIconPostFix(ItemUIData __instance, ref Texture2D __result)
{
if (IsBingBong(__instance) && (Object)(object)FileLoader.UIIcon != (Object)null)
{
__result = FileLoader.UIIcon;
}
}
}
[BepInPlugin("KawaTurbo.SayoNui", "SayoNui", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private Coroutine? loadCoroutine;
public const string Id = "KawaTurbo.SayoNui";
internal static Plugin Instance { get; private set; }
internal static ManualLogSource Log { get; private set; }
internal static SayoNuiConfig BoundConfig { get; private set; }
public static string Name => "SayoNui";
public static string Version => "1.0.0";
private void Awake()
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
BoundConfig = new SayoNuiConfig(((BaseUnityPlugin)this).Config);
InitializeExVoiceFolder();
StartLoading();
FileLoader.OnModelLoaded = (Action)Delegate.Combine(FileLoader.OnModelLoaded, (Action)delegate
{
Patch_Item.OnModelLoaded();
});
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
try
{
val.PatchAll(Assembly.GetExecutingAssembly());
}
catch (Exception ex)
{
Log.LogError((object)("Failed to apply Harmony patches: " + ex));
}
BoundConfig.mode.SettingChanged += delegate
{
Log.LogDebug((object)("Config mode changed: " + BoundConfig.mode.Value));
if (PhotonNetwork.InRoom)
{
Log.LogDebug((object)("CurrentLoadedModMode: " + FileLoader.CurrentLoadedModMode + ", NewMode: " + BoundConfig.mode.Value));
if (!BoundConfig.mode.Value.Equals(FileLoader.CurrentLoadedModMode))
{
StopLoadingAndUnload();
StartLoading();
}
}
};
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)286))
{
((BaseUnityPlugin)this).Config.Reload();
((BaseUnityPlugin)this).Logger.LogInfo((object)"手動で設定ファイルを再読み込みしました。");
}
if (!BoundConfig.debug.Value)
{
return;
}
if (Input.GetKeyDown((KeyCode)282))
{
Patch_Ask.StopAllVoiceAndSubtitleRoutine();
}
if (!Input.GetKeyDown((KeyCode)283))
{
return;
}
foreach (KeyValuePair<Item, ItemModelManager> item in Patch_Item.ItemModelManagerDict)
{
Patch_Item.ItemLog(item.Key, item.Value);
}
}
internal static void StartLoading()
{
Log.LogDebug((object)"Start loading assets");
if (Instance.loadCoroutine == null)
{
Instance.loadCoroutine = ((MonoBehaviour)Instance).StartCoroutine(LoadRoutine());
}
}
internal static IEnumerator LoadRoutine()
{
yield return FileLoader.Load(BoundConfig.mode.Value);
Instance.loadCoroutine = null;
if (FileLoader.IsAllAssetsLoaded)
{
Log.LogDebug((object)"Load completed.");
}
else
{
Log.LogError((object)($"AssetBundleLoadStatus: {FileLoader.AssetBundleLoadStatus}" + $"StandardVoiceDataLoadStatus: {FileLoader.StandardVoiceDataLoadStatus}" + $"ModelLoadStatus: {FileLoader.ModelLoadStatus}" + $"UIIconLoadStatus: {FileLoader.UIIconLoadStatus}"));
}
}
internal static void StopLoadingAndUnload()
{
Log.LogDebug((object)"Stop loading and unload assets");
if (Instance.loadCoroutine != null)
{
((MonoBehaviour)Instance).StopCoroutine(Instance.loadCoroutine);
Instance.loadCoroutine = null;
}
FileLoader.UnloadCurrentAssets();
}
internal static void InitializeExVoiceFolder()
{
string modDirectory = FileLoader.ModDirectory;
string text = Path.Combine(modDirectory, "voicelist.json");
string exVoiceDirectory = FileLoader.ExVoiceDirectory;
string text2 = Path.Combine(exVoiceDirectory, "voicelist.json");
if (!Directory.Exists(exVoiceDirectory))
{
Directory.CreateDirectory(exVoiceDirectory);
}
if (!File.Exists(text2))
{
if (File.Exists(text))
{
File.Copy(text, text2);
Log.LogInfo((object)("Copied default voicelist.json to " + text2));
}
else
{
Log.LogError((object)("Default voicelist.json not found at " + text));
}
}
}
}
public class RoomManager
{
public static Hashtable roomHash = new Hashtable();
public static void SetRoomProperty<T>(string key, T value)
{
if (PhotonNetwork.InRoom)
{
Room currentRoom = PhotonNetwork.CurrentRoom;
roomHash[(object)key] = value;
currentRoom.SetCustomProperties(roomHash, (Hashtable)null, (WebFlags)null);
((Dictionary<object, object>)(object)roomHash).Clear();
}
}
public static object? GetRoomProperty(string key)
{
if (PhotonNetwork.InRoom)
{
Room currentRoom = PhotonNetwork.CurrentRoom;
return ((RoomInfo)currentRoom).CustomProperties[(object)key];
}
return null;
}
}
public class PlayerManager
{
private static readonly HashSet<Player> ModPlayers = new HashSet<Player>();
public static IReadOnlyCollection<Player> GetModPlayers()
{
return ModPlayers;
}
public static void UpdateModPlayerList()
{
ModPlayers.Clear();
if (PhotonNetwork.CurrentRoom == null)
{
return;
}
foreach (Player value2 in PhotonNetwork.CurrentRoom.Players.Values)
{
if (((Dictionary<object, object>)(object)value2.CustomProperties).TryGetValue((object)"HasSayoNui", out object value) && (bool)value)
{
ModPlayers.Add(value2);
}
}
}
}
[HarmonyPatch(typeof(PhotonHandler), "OnJoinedRoom")]
internal class Patch_OnJoinedRoom
{
private static void Postfix(PhotonHandler __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
Hashtable val = new Hashtable();
val[(object)"HasSayoNui"] = true;
PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
PlayerManager.UpdateModPlayerList();
if (BingBongRandomManager.GetNextRandom() != 0)
{
Plugin.Log.LogInfo((object)"Skipped random reservation");
}
else if (BingBongRandomManager.IsModLeader())
{
BingBongRandomManager.ReserveNextRandom();
}
}
}
[HarmonyPatch(typeof(PhotonHandler), "OnPlayerEnteredRoom")]
internal class Patch_OnPlayerEnteredRoom
{
private static void Postfix(Player newPlayer)
{
PlayerManager.UpdateModPlayerList();
}
}
[HarmonyPatch(typeof(PhotonHandler), "OnPlayerPropertiesUpdate")]
internal class Patch_OnPlayerPropertiesUpdate
{
private static void Postfix(Player targetPlayer, Hashtable changedProps)
{
if (((Dictionary<object, object>)(object)changedProps).ContainsKey((object)"HasSayoNui"))
{
PlayerManager.UpdateModPlayerList();
}
}
}
[HarmonyPatch(typeof(PhotonHandler), "OnPlayerLeftRoom")]
internal class Patch_OnPlayerLeftRoom
{
private static void Postfix(Player otherPlayer)
{
PlayerManager.UpdateModPlayerList();
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}