This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,61 @@
using System;
using System.Diagnostics;
namespace System.Runtime.Versioning
{
/// <summary>Specifies the resource consumed by the member of a class. This class cannot be inherited.</summary>
// Token: 0x0200049A RID: 1178
[Conditional("RESOURCE_ANNOTATION_WORK")]
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, Inherited = false)]
public sealed class ResourceConsumptionAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Versioning.ResourceConsumptionAttribute" /> class specifying the scope of the consumed resource. </summary>
/// <param name="resourceScope">The <see cref="T:System.Runtime.Versioning.ResourceScope" /> for the consumed resource.</param>
// Token: 0x06002C94 RID: 11412 RVA: 0x00092AF8 File Offset: 0x00090CF8
public ResourceConsumptionAttribute(ResourceScope resourceScope)
{
this.resource = resourceScope;
this.consumption = resourceScope;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Versioning.ResourceConsumptionAttribute" /> class specifying the scope of the consumed resource and the scope of how it is consumed.</summary>
/// <param name="resourceScope">The <see cref="T:System.Runtime.Versioning.ResourceScope" /> for the consumed resource.</param>
/// <param name="consumptionScope">The <see cref="T:System.Runtime.Versioning.ResourceScope" /> used by this member.</param>
// Token: 0x06002C95 RID: 11413 RVA: 0x00092B10 File Offset: 0x00090D10
public ResourceConsumptionAttribute(ResourceScope resourceScope, ResourceScope consumptionScope)
{
this.resource = resourceScope;
this.consumption = consumptionScope;
}
/// <summary>Gets the consumption scope for this member.</summary>
/// <returns>A <see cref="T:System.Runtime.Versioning.ResourceScope" /> object specifying the resource scope used by this member.</returns>
// Token: 0x170008B1 RID: 2225
// (get) Token: 0x06002C96 RID: 11414 RVA: 0x00092B28 File Offset: 0x00090D28
public ResourceScope ConsumptionScope
{
get
{
return this.consumption;
}
}
/// <summary>Gets the resource scope for the consumed resource.</summary>
/// <returns>A <see cref="T:System.Runtime.Versioning.ResourceScope" /> object specifying the resource scope of the consumed member.</returns>
// Token: 0x170008B2 RID: 2226
// (get) Token: 0x06002C97 RID: 11415 RVA: 0x00092B30 File Offset: 0x00090D30
public ResourceScope ResourceScope
{
get
{
return this.resource;
}
}
// Token: 0x04001148 RID: 4424
private ResourceScope resource;
// Token: 0x04001149 RID: 4425
private ResourceScope consumption;
}
}
@@ -0,0 +1,35 @@
using System;
using System.Diagnostics;
namespace System.Runtime.Versioning
{
/// <summary>Specifies the resource exposure for a member of a class. This class cannot be inherited.</summary>
// Token: 0x0200049B RID: 1179
[Conditional("RESOURCE_ANNOTATION_WORK")]
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, Inherited = false)]
public sealed class ResourceExposureAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Versioning.ResourceExposureAttribute" /> class with the specified exposure level.</summary>
/// <param name="exposureLevel">The scope of the resource.</param>
// Token: 0x06002C98 RID: 11416 RVA: 0x00092B38 File Offset: 0x00090D38
public ResourceExposureAttribute(ResourceScope exposureLevel)
{
this.exposure = exposureLevel;
}
/// <summary>Gets the resource exposure scope.</summary>
/// <returns>A <see cref="T:System.Runtime.Versioning.ResourceScope" /> object.</returns>
// Token: 0x170008B3 RID: 2227
// (get) Token: 0x06002C99 RID: 11417 RVA: 0x00092B48 File Offset: 0x00090D48
public ResourceScope ResourceExposureLevel
{
get
{
return this.exposure;
}
}
// Token: 0x0400114A RID: 4426
private ResourceScope exposure;
}
}
@@ -0,0 +1,32 @@
using System;
namespace System.Runtime.Versioning
{
/// <summary>Identifies the scope of a sharable resource.</summary>
// Token: 0x0200049C RID: 1180
[Flags]
public enum ResourceScope
{
/// <summary>There is no shared state.</summary>
// Token: 0x0400114C RID: 4428
None = 0,
/// <summary>The state is shared by objects within the machine.</summary>
// Token: 0x0400114D RID: 4429
Machine = 1,
/// <summary>The state is shared within a process.</summary>
// Token: 0x0400114E RID: 4430
Process = 2,
/// <summary>The state is shared by objects within an <see cref="T:System.AppDomain" />.</summary>
// Token: 0x0400114F RID: 4431
AppDomain = 4,
/// <summary>The state is shared by objects within a library.</summary>
// Token: 0x04001150 RID: 4432
Library = 8,
/// <summary>The resource is visible to only the type.</summary>
// Token: 0x04001151 RID: 4433
Private = 16,
/// <summary>The resource is visible at an assembly scope.</summary>
// Token: 0x04001152 RID: 4434
Assembly = 32
}
}
@@ -0,0 +1,155 @@
using System;
namespace System.Runtime.Versioning
{
/// <summary>Provides methods to aid developers in writing version-safe code. This class cannot be inherited.</summary>
// Token: 0x0200049D RID: 1181
public static class VersioningHelper
{
// Token: 0x06002C9A RID: 11418 RVA: 0x00092B50 File Offset: 0x00090D50
private static int GetDomainId()
{
return 0;
}
// Token: 0x06002C9B RID: 11419 RVA: 0x00092B54 File Offset: 0x00090D54
private static int GetProcessId()
{
return 0;
}
// Token: 0x06002C9C RID: 11420 RVA: 0x00092B58 File Offset: 0x00090D58
private static string SafeName(string name, bool process, bool appdomain)
{
if (process && appdomain)
{
return string.Concat(new string[]
{
name,
"_",
VersioningHelper.GetProcessId().ToString(),
"_",
VersioningHelper.GetDomainId().ToString()
});
}
if (process)
{
return name + "_" + VersioningHelper.GetProcessId().ToString();
}
if (appdomain)
{
return name + "_" + VersioningHelper.GetDomainId().ToString();
}
return name;
}
// Token: 0x06002C9D RID: 11421 RVA: 0x00092BF0 File Offset: 0x00090DF0
private static string ConvertFromMachine(string name, ResourceScope to, Type type)
{
switch (to)
{
case ResourceScope.Machine:
return VersioningHelper.SafeName(name, false, false);
case ResourceScope.Process:
return VersioningHelper.SafeName(name, true, false);
case ResourceScope.AppDomain:
return VersioningHelper.SafeName(name, true, true);
}
throw new ArgumentException("to");
}
// Token: 0x06002C9E RID: 11422 RVA: 0x00092C44 File Offset: 0x00090E44
private static string ConvertFromProcess(string name, ResourceScope to, Type type)
{
if (to < ResourceScope.Process || to >= ResourceScope.Private)
{
throw new ArgumentException("to");
}
bool flag = (to & ResourceScope.AppDomain) == ResourceScope.AppDomain;
return VersioningHelper.SafeName(name, false, flag);
}
// Token: 0x06002C9F RID: 11423 RVA: 0x00092C7C File Offset: 0x00090E7C
private static string ConvertFromAppDomain(string name, ResourceScope to, Type type)
{
if (to < ResourceScope.AppDomain || to >= ResourceScope.Private)
{
throw new ArgumentException("to");
}
return VersioningHelper.SafeName(name, false, false);
}
/// <summary>Returns a version-safe name based on the specified resource name and the intended resource consumption source.</summary>
/// <returns>A version-safe name.</returns>
/// <param name="name">The name of the resource.</param>
/// <param name="from">The scope of the resource.</param>
/// <param name="to">The desired resource consumption scope.</param>
// Token: 0x06002CA0 RID: 11424 RVA: 0x00092CAC File Offset: 0x00090EAC
[MonoTODO("process id is always 0")]
public static string MakeVersionSafeName(string name, ResourceScope from, ResourceScope to)
{
return VersioningHelper.MakeVersionSafeName(name, from, to, null);
}
/// <summary>Returns a version-safe name based on the specified resource name, the intended resource consumption scope, and the type using the resource.</summary>
/// <returns>A version-safe name.</returns>
/// <param name="name">The name of the resource.</param>
/// <param name="from">The beginning of the scope range.</param>
/// <param name="to">The end of the scope range.</param>
/// <param name="type">The <see cref="T:System.Type" /> of the resource.</param>
/// <exception cref="T:System.ArgumentException">The values for <paramref name="from " />and <paramref name="to " />are invalid. The resource type in the <see cref="T:System.Runtime.Versioning.ResourceScope" /> enumeration is going from a more restrictive resource type to a more general resource type.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="type " />is null.</exception>
// Token: 0x06002CA1 RID: 11425 RVA: 0x00092CB8 File Offset: 0x00090EB8
[MonoTODO("type?")]
public static string MakeVersionSafeName(string name, ResourceScope from, ResourceScope to, Type type)
{
if ((from & ResourceScope.Private) != ResourceScope.None)
{
to &= ~(ResourceScope.Private | ResourceScope.Assembly);
}
else if ((from & ResourceScope.Assembly) != ResourceScope.None)
{
to &= ~ResourceScope.Assembly;
}
string text = ((name != null) ? name : string.Empty);
switch (from)
{
case ResourceScope.Machine:
break;
case ResourceScope.Process:
goto IL_8F;
default:
switch (from)
{
case ResourceScope.Machine | ResourceScope.Private:
break;
case ResourceScope.Process | ResourceScope.Private:
goto IL_8F;
default:
switch (from)
{
case ResourceScope.Machine | ResourceScope.Assembly:
goto IL_86;
case ResourceScope.Process | ResourceScope.Assembly:
goto IL_8F;
case ResourceScope.AppDomain | ResourceScope.Assembly:
goto IL_98;
}
throw new ArgumentException("from");
case ResourceScope.AppDomain | ResourceScope.Private:
goto IL_98;
}
break;
case ResourceScope.AppDomain:
goto IL_98;
}
IL_86:
return VersioningHelper.ConvertFromMachine(text, to, type);
IL_8F:
return VersioningHelper.ConvertFromProcess(text, to, type);
IL_98:
return VersioningHelper.ConvertFromAppDomain(text, to, type);
}
}
}