using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using BepInEx.NET.Common;
using BepInExResoniteShim;
using Elements.Core;
using FrooxEngine;
using FrooxEngine.ProtoFlux;
using HarmonyLib;
using ProtoFlux.Core;
using ProtoFlux.Runtimes.Execution;
using ProtoFlux.Runtimes.Execution.Nodes.FrooxEngine.Rendering;
using Renderite.Shared;
using SkyFrost.Base;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")]
[assembly: AssemblyCompany("art0007i")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+1862240c560ad309e79c95d7db5d324093ce12d5")]
[assembly: AssemblyProduct("SimplePictureCapture")]
[assembly: AssemblyTitle("SimplePictureCapture")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/SimplePictureCapture")]
[assembly: AssemblyVersion("1.0.2.0")]
[module: RefSafetyRules(11)]
namespace SimplePictureCapture;
[ResonitePlugin("art0007i.SimplePictureCapture", "SimplePictureCapture", "1.0.2", "art0007i", "https://github.com/art0007i/SimplePictureCapture")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
[HarmonyPatch(typeof(RenderToTextureAsset), "RunAsync")]
private class SimplePictureCapturePatch
{
[CompilerGenerated]
private sealed class <>c__DisplayClass0_0
{
[StructLayout((LayoutKind)3)]
private struct <<Prefix>b__0>d : IAsyncStateMachine
{
public int <>1__state;
public AsyncTaskMethodBuilder<IOperation> <>t__builder;
public <>c__DisplayClass0_0 <>4__this;
private <>c__DisplayClass0_1 <>8__1;
private TaskAwaiter<Uri> <>u__1;
private void MoveNext()
{
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Expected O, but got Unknown
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
<>c__DisplayClass0_0 <>c__DisplayClass0_ = <>4__this;
IOperation target;
try
{
TaskAwaiter<Uri> val;
if (num == 0)
{
val = <>u__1;
<>u__1 = default(TaskAwaiter<Uri>);
num = (<>1__state = -1);
goto IL_01e3;
}
<>8__1 = new <>c__DisplayClass0_1();
<>8__1.CS$<>8__locals1 = <>c__DisplayClass0_;
<>8__1.world = Engine.Current.WorldManager.FocusedWorld;
int2 val2 = ExecutionContextExtensions.Evaluate<int2>(<>c__DisplayClass0_.__instance.Resolution, (ExecutionContext)(object)<>c__DisplayClass0_.context, default(int2));
string text = ExecutionContextExtensions.Evaluate<string>(<>c__DisplayClass0_.__instance.Format, (ExecutionContext)(object)<>c__DisplayClass0_.context, "webp");
int num2 = ExecutionContextExtensions.Evaluate<int>(<>c__DisplayClass0_.__instance.Quality, (ExecutionContext)(object)<>c__DisplayClass0_.context, 200);
RenderTask renderSettings = <>c__DisplayClass0_.cam.GetRenderSettings(val2);
if (!WorldExtensions.IsUserspace(((Worker)<>c__DisplayClass0_.cam).World))
{
goto IL_0134;
}
UserRoot root = <>8__1.world.LocalUser.Root;
if (root != null)
{
renderSettings.position = ((Component)root).Slot.LocalPointToGlobal(ref renderSettings.position);
renderSettings.rotation = ((Component)root).Slot.LocalRotationToGlobal(ref renderSettings.rotation);
goto IL_0134;
}
Log.LogError((object)"You have no user root? How did you click the button wtf");
target = ((Continuation)(ref <>c__DisplayClass0_.__instance.OnFailed)).Target;
goto end_IL_000e;
IL_01e3:
Uri result = val.GetResult();
<>8__1.texture = result;
((ComponentBase<Component>)(object)<>c__DisplayClass0_.cam).RunSynchronously((Action)([AsyncStateMachine(typeof(<>c__DisplayClass0_1.<<Prefix>b__1>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_1.<<Prefix>b__1>d <<Prefix>b__1>d = default(<>c__DisplayClass0_1.<<Prefix>b__1>d);
<<Prefix>b__1>d.<>t__builder = AsyncVoidMethodBuilder.Create();
<<Prefix>b__1>d.<>4__this = <>8__1;
<<Prefix>b__1>d.<>1__state = -1;
((AsyncVoidMethodBuilder)(ref <<Prefix>b__1>d.<>t__builder)).Start<<>c__DisplayClass0_1.<<Prefix>b__1>d>(ref <<Prefix>b__1>d);
}), false);
if (<>8__1.texture != (Uri)null)
{
ExecutionContextExtensions.Write<Uri>(<>c__DisplayClass0_.__instance.RenderedAssetURL, <>8__1.texture, (ExecutionContext)(object)<>c__DisplayClass0_.context);
target = ((Continuation)(ref <>c__DisplayClass0_.__instance.OnRendered)).Target;
}
else
{
target = ((Continuation)(ref <>c__DisplayClass0_.__instance.OnFailed)).Target;
}
goto end_IL_000e;
IL_0134:
if (renderSettings.excludeObjects == null || WorldExtensions.IsUserspace(((Worker)<>c__DisplayClass0_.cam).World))
{
renderSettings.excludeObjects = new List<Slot>();
}
InteractionHandler.GetLaserRoots((global::System.Collections.Generic.IEnumerable<User>)<>8__1.world.AllUsers, renderSettings.excludeObjects);
val = <>8__1.world.Render.RenderToAsset(renderSettings, text, num2).GetAwaiter();
if (!val.IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = val;
<>t__builder.AwaitUnsafeOnCompleted<TaskAwaiter<Uri>, <<Prefix>b__0>d>(ref val, ref this);
return;
}
goto IL_01e3;
end_IL_000e:;
}
catch (global::System.Exception exception)
{
<>1__state = -2;
<>8__1 = null;
<>t__builder.SetException(exception);
return;
}
<>1__state = -2;
<>8__1 = null;
<>t__builder.SetResult(target);
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
<>t__builder.SetStateMachine(stateMachine);
}
}
public RenderToTextureAsset __instance;
public FrooxEngineContext context;
public Camera cam;
[AsyncStateMachine(typeof(<<Prefix>b__0>d))]
internal async global::System.Threading.Tasks.Task<IOperation>? <Prefix>b__0()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_1 CS$<>8__locals7 = new <>c__DisplayClass0_1
{
CS$<>8__locals1 = this,
world = Engine.Current.WorldManager.FocusedWorld
};
int2 val = ExecutionContextExtensions.Evaluate<int2>(__instance.Resolution, (ExecutionContext)(object)context, default(int2));
string text = ExecutionContextExtensions.Evaluate<string>(__instance.Format, (ExecutionContext)(object)context, "webp");
int num = ExecutionContextExtensions.Evaluate<int>(__instance.Quality, (ExecutionContext)(object)context, 200);
RenderTask renderSettings = cam.GetRenderSettings(val);
if (WorldExtensions.IsUserspace(((Worker)cam).World))
{
UserRoot root = CS$<>8__locals7.world.LocalUser.Root;
if (root == null)
{
Log.LogError((object)"You have no user root? How did you click the button wtf");
return ((Continuation)(ref __instance.OnFailed)).Target;
}
renderSettings.position = ((Component)root).Slot.LocalPointToGlobal(ref renderSettings.position);
renderSettings.rotation = ((Component)root).Slot.LocalRotationToGlobal(ref renderSettings.rotation);
}
if (renderSettings.excludeObjects == null || WorldExtensions.IsUserspace(((Worker)cam).World))
{
renderSettings.excludeObjects = new List<Slot>();
}
InteractionHandler.GetLaserRoots((global::System.Collections.Generic.IEnumerable<User>)CS$<>8__locals7.world.AllUsers, renderSettings.excludeObjects);
CS$<>8__locals7.texture = await CS$<>8__locals7.world.Render.RenderToAsset(renderSettings, text, num);
((ComponentBase<Component>)(object)cam).RunSynchronously((Action)([AsyncStateMachine(typeof(<>c__DisplayClass0_1.<<Prefix>b__1>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_1.<<Prefix>b__1>d <<Prefix>b__1>d = default(<>c__DisplayClass0_1.<<Prefix>b__1>d);
<<Prefix>b__1>d.<>t__builder = AsyncVoidMethodBuilder.Create();
<<Prefix>b__1>d.<>4__this = CS$<>8__locals7;
<<Prefix>b__1>d.<>1__state = -1;
((AsyncVoidMethodBuilder)(ref <<Prefix>b__1>d.<>t__builder)).Start<<>c__DisplayClass0_1.<<Prefix>b__1>d>(ref <<Prefix>b__1>d);
}), false);
if (CS$<>8__locals7.texture != (Uri)null)
{
ExecutionContextExtensions.Write<Uri>(__instance.RenderedAssetURL, CS$<>8__locals7.texture, (ExecutionContext)(object)context);
return ((Continuation)(ref __instance.OnRendered)).Target;
}
return ((Continuation)(ref __instance.OnFailed)).Target;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass0_1
{
[StructLayout((LayoutKind)3)]
private struct <<Prefix>b__1>d : IAsyncStateMachine
{
public int <>1__state;
public AsyncVoidMethodBuilder <>t__builder;
public <>c__DisplayClass0_1 <>4__this;
private Slot <photo>5__2;
private bool <shouldDelete>5__3;
private TaskAwaiter <>u__1;
private void MoveNext()
{
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
int num = <>1__state;
<>c__DisplayClass0_1 <>c__DisplayClass0_ = <>4__this;
try
{
TaskAwaiter val5;
if (num != 0)
{
<photo>5__2 = ((Worker)<>c__DisplayClass0_.CS$<>8__locals1.cam).LocalUserSpace.AddSlot("Photo in " + <>c__DisplayClass0_.world.Name, true);
StaticTexture2D val = SlotAssets.AttachTexture(<photo>5__2, <>c__DisplayClass0_.texture, true, false, false, false, (TextureWrapMode)0, (int?)null);
ImageImporter.SetupTextureProxyComponents(<photo>5__2, (IAssetProvider<Texture2D>)(object)val, (StereoLayout)0, (ImageProjection)0, false);
PhotoMetadata obj = ((ContainerWorker<Component>)(object)<photo>5__2).AttachComponent<PhotoMetadata>(true, (Action<PhotoMetadata>)null);
SetupMetadataFromWorld(obj, <>c__DisplayClass0_.world);
((SyncField<bool>)(object)obj.Is360).Value = false;
((SyncField<StereoLayout>)(object)obj.StereoLayout).Value = (StereoLayout)0;
((SyncField<string>)(object)obj.CameraManufacturer).Value = "art0007i";
((SyncField<string>)(object)obj.CameraModel).Value = "SimplePictureCapture Mod";
((SyncField<float>)(object)obj.CameraFOV).Value = Sync<float>.op_Implicit(<>c__DisplayClass0_.CS$<>8__locals1.cam.FieldOfView);
((SyncField<bool>)(object)((ContainerWorker<Component>)(object)<photo>5__2).AttachComponent<Grabbable>(true, (Action<Grabbable>)null).Scalable).Value = true;
AttachedModel<QuadMesh, UnlitMaterial> val2 = SlotMeshes.AttachMesh<QuadMesh, UnlitMaterial>(<photo>5__2, false, 0);
((SyncRef<IAssetProvider<ITexture2D>>)(object)val2.material.Texture).Target = (IAssetProvider<ITexture2D>)(object)val;
((SyncField<Sidedness>)(object)val2.material.Sidedness).Value = (Sidedness)3;
TextureSizeDriver obj2 = ((ContainerWorker<Component>)(object)<photo>5__2).AttachComponent<TextureSizeDriver>(true, (Action<TextureSizeDriver>)null);
((SyncRef<IAssetProvider<ITexture2D>>)(object)obj2.Texture).Target = (IAssetProvider<ITexture2D>)(object)val;
((SyncField<Mode>)(object)obj2.DriveMode).Value = (Mode)3;
((SyncRef<IField<float2>>)(object)obj2.Target).Target = (IField<float2>)(object)val2.mesh.Size;
BoxCollider obj3 = ((ContainerWorker<Component>)(object)<photo>5__2).AttachComponent<BoxCollider>(true, (Action<BoxCollider>)null);
Float2ToFloat3SwizzleDriverExtensions.DriveFromXY((IField<float3>)(object)obj3.Size, (IField<float2>)(object)val2.mesh.Size, 0, 1, -1);
((SyncField<ColliderType>)(object)((Collider)obj3).Type).Value = (ColliderType)0;
Slot val3 = (((Worker)<>c__DisplayClass0_.CS$<>8__locals1.cam).IsRemoved ? null : Enumerable.FirstOrDefault<Slot>((global::System.Collections.Generic.IEnumerable<Slot>)<>c__DisplayClass0_.CS$<>8__locals1.cam.ExcludeRender));
<shouldDelete>5__3 = val3 == null;
if (!<shouldDelete>5__3)
{
int childrenCount = val3.ChildrenCount;
float3 val4 = new float3(0f, 0f, 0.05f);
float3 localPosition = childrenCount * (ref val4);
<photo>5__2.Parent = val3;
<photo>5__2.LocalPosition = localPosition;
<photo>5__2.LocalRotation = floatQ.Identity;
<photo>5__2.LocalScale = float3.One;
}
else
{
<photo>5__2.LocalPosition = new float3(0f, -10000f, 0f);
}
val5 = obj.NotifyOfScreenshot(true).GetAwaiter();
if (!((TaskAwaiter)(ref val5)).IsCompleted)
{
num = (<>1__state = 0);
<>u__1 = val5;
((AsyncVoidMethodBuilder)(ref <>t__builder)).AwaitUnsafeOnCompleted<TaskAwaiter, <<Prefix>b__1>d>(ref val5, ref this);
return;
}
}
else
{
val5 = <>u__1;
<>u__1 = default(TaskAwaiter);
num = (<>1__state = -1);
}
((TaskAwaiter)(ref val5)).GetResult();
if (<shouldDelete>5__3)
{
<photo>5__2.Destroy();
}
}
catch (global::System.Exception exception)
{
<>1__state = -2;
<photo>5__2 = null;
((AsyncVoidMethodBuilder)(ref <>t__builder)).SetException(exception);
return;
}
<>1__state = -2;
<photo>5__2 = null;
((AsyncVoidMethodBuilder)(ref <>t__builder)).SetResult();
}
[DebuggerHidden]
private void SetStateMachine(IAsyncStateMachine stateMachine)
{
((AsyncVoidMethodBuilder)(ref <>t__builder)).SetStateMachine(stateMachine);
}
}
public World world;
public Uri texture;
public <>c__DisplayClass0_0 CS$<>8__locals1;
[AsyncStateMachine(typeof(<<Prefix>b__1>d))]
internal void <Prefix>b__1()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<<Prefix>b__1>d <<Prefix>b__1>d = default(<<Prefix>b__1>d);
<<Prefix>b__1>d.<>t__builder = AsyncVoidMethodBuilder.Create();
<<Prefix>b__1>d.<>4__this = this;
<<Prefix>b__1>d.<>1__state = -1;
((AsyncVoidMethodBuilder)(ref <<Prefix>b__1>d.<>t__builder)).Start<<<Prefix>b__1>d>(ref <<Prefix>b__1>d);
}
}
public static bool Prefix(RenderToTextureAsset __instance, FrooxEngineContext context, ref global::System.Threading.Tasks.Task<IOperation> __result)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
Camera cam = ExecutionContextExtensions.Evaluate<Camera>(__instance.Camera, (ExecutionContext)(object)context, (Camera)null);
Camera obj = cam;
if (((obj == null) ? null : ((SyncField<string>)(object)((ContainerWorker<Component>)(object)((Component)obj).Slot).GetComponent<Comment>((Predicate<Comment>)null, false)?.Text).Value) == "me.art0007i.SimplePictureCapture")
{
<>c__DisplayClass0_0 CS$<>8__locals2;
__result = global::System.Threading.Tasks.Task.Run<IOperation>((Func<global::System.Threading.Tasks.Task<IOperation>>)([AsyncStateMachine(typeof(<>c__DisplayClass0_0.<<Prefix>b__0>d))] async () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_1 CS$<>8__locals10 = new <>c__DisplayClass0_1();
CS$<>8__locals10.CS$<>8__locals1 = CS$<>8__locals2;
CS$<>8__locals10.world = Engine.Current.WorldManager.FocusedWorld;
int2 val = ExecutionContextExtensions.Evaluate<int2>(__instance.Resolution, (ExecutionContext)(object)context, default(int2));
string text = ExecutionContextExtensions.Evaluate<string>(__instance.Format, (ExecutionContext)(object)context, "webp");
int num = ExecutionContextExtensions.Evaluate<int>(__instance.Quality, (ExecutionContext)(object)context, 200);
RenderTask renderSettings = cam.GetRenderSettings(val);
if (WorldExtensions.IsUserspace(((Worker)cam).World))
{
UserRoot root = CS$<>8__locals10.world.LocalUser.Root;
if (root == null)
{
Log.LogError((object)"You have no user root? How did you click the button wtf");
return ((Continuation)(ref __instance.OnFailed)).Target;
}
renderSettings.position = ((Component)root).Slot.LocalPointToGlobal(ref renderSettings.position);
renderSettings.rotation = ((Component)root).Slot.LocalRotationToGlobal(ref renderSettings.rotation);
}
if (renderSettings.excludeObjects == null || WorldExtensions.IsUserspace(((Worker)cam).World))
{
renderSettings.excludeObjects = new List<Slot>();
}
InteractionHandler.GetLaserRoots((global::System.Collections.Generic.IEnumerable<User>)CS$<>8__locals10.world.AllUsers, renderSettings.excludeObjects);
CS$<>8__locals10.texture = await CS$<>8__locals10.world.Render.RenderToAsset(renderSettings, text, num);
((ComponentBase<Component>)(object)cam).RunSynchronously((Action)([AsyncStateMachine(typeof(<>c__DisplayClass0_1.<<Prefix>b__1>d))] () =>
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass0_1.<<Prefix>b__1>d <<Prefix>b__1>d = default(<>c__DisplayClass0_1.<<Prefix>b__1>d);
<<Prefix>b__1>d.<>t__builder = AsyncVoidMethodBuilder.Create();
<<Prefix>b__1>d.<>4__this = CS$<>8__locals10;
<<Prefix>b__1>d.<>1__state = -1;
((AsyncVoidMethodBuilder)(ref <<Prefix>b__1>d.<>t__builder)).Start<<>c__DisplayClass0_1.<<Prefix>b__1>d>(ref <<Prefix>b__1>d);
}), false);
if (CS$<>8__locals10.texture != (Uri)null)
{
ExecutionContextExtensions.Write<Uri>(__instance.RenderedAssetURL, CS$<>8__locals10.texture, (ExecutionContext)(object)context);
return ((Continuation)(ref __instance.OnRendered)).Target;
}
return ((Continuation)(ref __instance.OnFailed)).Target;
}));
return false;
}
return true;
}
public static void SetupMetadataFromWorld(PhotoMetadata meta, World wld)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
((SyncField<string>)(object)((AssetMetadata)meta).LocationName).Value = wld.Name;
((SyncField<Uri>)(object)((AssetMetadata)meta).LocationURL).Value = wld.RecordURL;
((AssetMetadata)meta).LocationHost.Target = wld.HostUser;
((SyncField<SessionAccessLevel?>)(object)((AssetMetadata)meta).LocationAccessLevel).Value = wld.AccessLevel;
((SyncField<bool?>)(object)((AssetMetadata)meta).LocationHiddenFromListing).Value = wld.HideFromListing;
((SyncField<global::System.DateTime>)(object)((AssetMetadata)meta).TimeTaken).Value = global::System.DateTime.UtcNow;
((AssetMetadata)meta).TakenBy.Target = ((Worker)meta).LocalUser;
((SyncField<string>)(object)((AssetMetadata)meta).AppVersion).Value = ((Worker)meta).Engine.VersionString;
Enumerator<RefID, User> enumerator = wld.AllUsers.GetEnumerator();
try
{
while (enumerator.MoveNext())
{
User current = enumerator.Current;
UserInfo val = ((SyncElementList<UserInfo>)(object)((AssetMetadata)meta).UserInfos).Add();
val.User.Target = current;
((SyncField<global::System.DateTime>)(object)val.SessionJoinTimestamp).Value = current.SessionJoinTimestamp;
((SyncField<bool>)(object)val.IsPresent).Value = current.IsPresent;
((SyncField<bool>)(object)val.IsInVR).Value = current.VR_Active;
if (current.Root != null)
{
((SyncField<float3>)(object)val.HeadPosition).Value = current.Root.HeadPosition;
((SyncField<floatQ>)(object)val.HeadOrientation).Value = current.Root.HeadRotation;
}
}
}
finally
{
((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
}
((SyncField<float3>)(object)((AssetMetadata)meta).TakenGlobalPosition).Value = ((Component)meta).Slot.GlobalPosition;
((SyncField<floatQ>)(object)((AssetMetadata)meta).TakenGlobalRotation).Value = ((Component)meta).Slot.GlobalRotation;
((SyncField<float3>)(object)((AssetMetadata)meta).TakenGlobalScale).Value = ((Component)meta).Slot.GlobalScale;
}
}
internal static ManualLogSource Log;
public override void Load()
{
Log = ((BasePlugin)this).Log;
((BasePlugin)this).HarmonyInstance.PatchAll();
}
}
public static class PluginMetadata
{
public const string GUID = "art0007i.SimplePictureCapture";
public const string NAME = "SimplePictureCapture";
public const string VERSION = "1.0.2";
public const string AUTHORS = "art0007i";
public const string REPOSITORY_URL = "https://github.com/art0007i/SimplePictureCapture";
}