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
+41
View File
@@ -0,0 +1,41 @@
using System;
namespace System.Resources
{
// Token: 0x0200028B RID: 651
internal class ICONDIRENTRY
{
// Token: 0x060020D8 RID: 8408 RVA: 0x00078920 File Offset: 0x00076B20
public override string ToString()
{
return string.Concat(new object[] { "ICONDIRENTRY (", this.bWidth, "x", this.bHeight, " ", this.wBitCount, " bpp)" });
}
// Token: 0x04000BB7 RID: 2999
public byte bWidth;
// Token: 0x04000BB8 RID: 3000
public byte bHeight;
// Token: 0x04000BB9 RID: 3001
public byte bColorCount;
// Token: 0x04000BBA RID: 3002
public byte bReserved;
// Token: 0x04000BBB RID: 3003
public short wPlanes;
// Token: 0x04000BBC RID: 3004
public short wBitCount;
// Token: 0x04000BBD RID: 3005
public int dwBytesInRes;
// Token: 0x04000BBE RID: 3006
public int dwImageOffset;
// Token: 0x04000BBF RID: 3007
public byte[] image;
}
}
@@ -0,0 +1,21 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Provides the base functionality to read data from resource files.</summary>
// Token: 0x02000272 RID: 626
[ComVisible(true)]
public interface IResourceReader : IEnumerable, IDisposable
{
/// <summary>Closes the resource reader after releasing any resources associated with it.</summary>
// Token: 0x06002023 RID: 8227
void Close();
/// <summary>Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> of the resources for this reader.</summary>
/// <returns>A dictionary enumerator for the resources for this reader.</returns>
// Token: 0x06002024 RID: 8228
IDictionaryEnumerator GetEnumerator();
}
}
@@ -0,0 +1,40 @@
using System;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Provides functionality to write resources to an output file or stream.</summary>
// Token: 0x02000273 RID: 627
[ComVisible(true)]
public interface IResourceWriter : IDisposable
{
/// <summary>Adds an 8-bit unsigned integer array as a named resource to the list of resources to be written.</summary>
/// <param name="name">Name of a resource. </param>
/// <param name="value">Value of a resource as an 8-bit unsigned integer array. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
// Token: 0x06002025 RID: 8229
void AddResource(string name, byte[] value);
/// <summary>Adds a named resource of type <see cref="T:System.Object" /> to the list of resources to be written.</summary>
/// <param name="name">The name of the resource. </param>
/// <param name="value">The value of the resource. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
// Token: 0x06002026 RID: 8230
void AddResource(string name, object value);
/// <summary>Adds a named resource of type <see cref="T:System.String" /> to the list of resources to be written.</summary>
/// <param name="name">The name of the resource. </param>
/// <param name="value">The value of the resource. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="name" /> parameter is null. </exception>
// Token: 0x06002027 RID: 8231
void AddResource(string name, string value);
/// <summary>Closes the underlying resource file or stream, ensuring all the data has been written to the file.</summary>
// Token: 0x06002028 RID: 8232
void Close();
/// <summary>Writes all the resources added by the <see cref="M:System.Resources.IResourceWriter.AddResource(System.String,System.String)" /> method to the output file or stream.</summary>
// Token: 0x06002029 RID: 8233
void Generate();
}
}
@@ -0,0 +1,46 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Resources
{
/// <summary>The exception thrown if the main assembly does not contain the resources for the neutral culture, and they are required because of a missing appropriate satellite assembly.</summary>
// Token: 0x02000274 RID: 628
[ComVisible(true)]
[Serializable]
public class MissingManifestResourceException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingManifestResourceException" /> class with default properties.</summary>
// Token: 0x0600202A RID: 8234 RVA: 0x00074D5C File Offset: 0x00072F5C
public MissingManifestResourceException()
: base(Locale.GetText("The assembly does not contain the resources for the required culture."))
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingManifestResourceException" /> class with the specified error message.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
// Token: 0x0600202B RID: 8235 RVA: 0x00074D70 File Offset: 0x00072F70
public MissingManifestResourceException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingManifestResourceException" /> class from serialized data.</summary>
/// <param name="info">The object that holds the serialized object data. </param>
/// <param name="context">The contextual information about the source or destination of the exception. </param>
// Token: 0x0600202C RID: 8236 RVA: 0x00074D7C File Offset: 0x00072F7C
protected MissingManifestResourceException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingManifestResourceException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
/// <param name="message">The error message that explains the reason for the exception. </param>
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
// Token: 0x0600202D RID: 8237 RVA: 0x00074D88 File Offset: 0x00072F88
public MissingManifestResourceException(string message, Exception inner)
: base(message, inner)
{
}
}
}
@@ -0,0 +1,71 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Resources
{
/// <summary>The exception that is thrown when the satellite assembly for the resources of the neutral culture is missing.</summary>
// Token: 0x02000275 RID: 629
[ComVisible(true)]
[Serializable]
public class MissingSatelliteAssemblyException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingSatelliteAssemblyException" /> class with default properties.</summary>
// Token: 0x0600202E RID: 8238 RVA: 0x00074D94 File Offset: 0x00072F94
public MissingSatelliteAssemblyException()
: base(Locale.GetText("The satellite assembly was not found for the required culture."))
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingSatelliteAssemblyException" /> class with the specified error message. </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
// Token: 0x0600202F RID: 8239 RVA: 0x00074DA8 File Offset: 0x00072FA8
public MissingSatelliteAssemblyException(string message)
: base(message)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingSatelliteAssemblyException" /> class with a specified error message and the name of a neutral culture. </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="cultureName">The name of the neutral culture.</param>
// Token: 0x06002030 RID: 8240 RVA: 0x00074DB4 File Offset: 0x00072FB4
public MissingSatelliteAssemblyException(string message, string cultureName)
: base(message)
{
this.culture = cultureName;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingSatelliteAssemblyException" /> class from serialized data. </summary>
/// <param name="info">The object that holds the serialized object data.</param>
/// <param name="context">The contextual information about the source or destination of the exception.</param>
// Token: 0x06002031 RID: 8241 RVA: 0x00074DC4 File Offset: 0x00072FC4
protected MissingSatelliteAssemblyException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.MissingSatelliteAssemblyException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception. </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception.</param>
// Token: 0x06002032 RID: 8242 RVA: 0x00074DD0 File Offset: 0x00072FD0
public MissingSatelliteAssemblyException(string message, Exception inner)
: base(message, inner)
{
}
/// <summary>Gets the name of a neutral culture. </summary>
/// <returns>A <see cref="T:System.String" /> object with the name of the neutral culture.</returns>
// Token: 0x17000604 RID: 1540
// (get) Token: 0x06002033 RID: 8243 RVA: 0x00074DDC File Offset: 0x00072FDC
public string CultureName
{
get
{
return this.culture;
}
}
// Token: 0x04000B45 RID: 2885
private string culture;
}
}
+66
View File
@@ -0,0 +1,66 @@
using System;
namespace System.Resources
{
// Token: 0x02000284 RID: 644
internal class NameOrId
{
// Token: 0x0600209E RID: 8350 RVA: 0x00077A20 File Offset: 0x00075C20
public NameOrId(string name)
{
this.name = name;
}
// Token: 0x0600209F RID: 8351 RVA: 0x00077A30 File Offset: 0x00075C30
public NameOrId(int id)
{
this.id = id;
}
// Token: 0x17000613 RID: 1555
// (get) Token: 0x060020A0 RID: 8352 RVA: 0x00077A40 File Offset: 0x00075C40
public bool IsName
{
get
{
return this.name != null;
}
}
// Token: 0x17000614 RID: 1556
// (get) Token: 0x060020A1 RID: 8353 RVA: 0x00077A50 File Offset: 0x00075C50
public string Name
{
get
{
return this.name;
}
}
// Token: 0x17000615 RID: 1557
// (get) Token: 0x060020A2 RID: 8354 RVA: 0x00077A58 File Offset: 0x00075C58
public int Id
{
get
{
return this.id;
}
}
// Token: 0x060020A3 RID: 8355 RVA: 0x00077A60 File Offset: 0x00075C60
public override string ToString()
{
if (this.name != null)
{
return "Name(" + this.name + ")";
}
return "Id(" + this.id + ")";
}
// Token: 0x04000BA0 RID: 2976
private string name;
// Token: 0x04000BA1 RID: 2977
private int id;
}
}
@@ -0,0 +1,73 @@
using System;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Informs the <see cref="T:System.Resources.ResourceManager" /> of the neutral culture of an assembly. This class cannot be inherited.</summary>
// Token: 0x02000276 RID: 630
[AttributeUsage(AttributeTargets.Assembly)]
[ComVisible(true)]
public sealed class NeutralResourcesLanguageAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.NeutralResourcesLanguageAttribute" /> class.</summary>
/// <param name="cultureName">The name of the culture that the current assembly's neutral resources were written in. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="cultureName" /> parameter is null. </exception>
// Token: 0x06002034 RID: 8244 RVA: 0x00074DE4 File Offset: 0x00072FE4
public NeutralResourcesLanguageAttribute(string cultureName)
{
if (cultureName == null)
{
throw new ArgumentNullException("culture is null");
}
this.culture = cultureName;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.NeutralResourcesLanguageAttribute" /> class with the specified ultimate resource fallback location.</summary>
/// <param name="cultureName">The name of the culture that the current assembly's neutral resources were written in.</param>
/// <param name="location">An <see cref="T:System.Resources.UltimateResourceFallbackLocation" /> enumeration value indicating the location from which to retrieve neutral fallback resources.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="cultureName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="location" /> is not a member of <see cref="T:System.Resources.UltimateResourceFallbackLocation" />.</exception>
// Token: 0x06002035 RID: 8245 RVA: 0x00074E04 File Offset: 0x00073004
public NeutralResourcesLanguageAttribute(string cultureName, UltimateResourceFallbackLocation location)
{
if (cultureName == null)
{
throw new ArgumentNullException("culture is null");
}
this.culture = cultureName;
this.loc = location;
}
/// <summary>Gets the culture name.</summary>
/// <returns>A <see cref="T:System.String" /> with the name of the default culture for the main assembly.</returns>
// Token: 0x17000605 RID: 1541
// (get) Token: 0x06002036 RID: 8246 RVA: 0x00074E2C File Offset: 0x0007302C
public string CultureName
{
get
{
return this.culture;
}
}
/// <summary>Gets the location for the <see cref="T:System.Resources.ResourceManager" /> class to use to retrieve neutral resources by using the resource fallback process.</summary>
/// <returns>The value of the <see cref="T:System.Resources.UltimateResourceFallbackLocation" /> enumeration that indicates the location (main assembly or satellite) from which to retrieve neutral resources.</returns>
// Token: 0x17000606 RID: 1542
// (get) Token: 0x06002037 RID: 8247 RVA: 0x00074E34 File Offset: 0x00073034
public UltimateResourceFallbackLocation Location
{
get
{
return this.loc;
}
}
// Token: 0x04000B46 RID: 2886
private string culture;
// Token: 0x04000B47 RID: 2887
private UltimateResourceFallbackLocation loc;
}
}
@@ -0,0 +1,49 @@
using System;
namespace System.Resources
{
// Token: 0x02000278 RID: 632
internal enum PredefinedResourceType
{
// Token: 0x04000B56 RID: 2902
Null,
// Token: 0x04000B57 RID: 2903
String,
// Token: 0x04000B58 RID: 2904
Bool,
// Token: 0x04000B59 RID: 2905
Char,
// Token: 0x04000B5A RID: 2906
Byte,
// Token: 0x04000B5B RID: 2907
SByte,
// Token: 0x04000B5C RID: 2908
Int16,
// Token: 0x04000B5D RID: 2909
UInt16,
// Token: 0x04000B5E RID: 2910
Int32,
// Token: 0x04000B5F RID: 2911
UInt32,
// Token: 0x04000B60 RID: 2912
Int64,
// Token: 0x04000B61 RID: 2913
UInt64,
// Token: 0x04000B62 RID: 2914
Single,
// Token: 0x04000B63 RID: 2915
Double,
// Token: 0x04000B64 RID: 2916
Decimal,
// Token: 0x04000B65 RID: 2917
DateTime,
// Token: 0x04000B66 RID: 2918
TimeSpan,
// Token: 0x04000B67 RID: 2919
ByteArray = 32,
// Token: 0x04000B68 RID: 2920
Stream,
// Token: 0x04000B69 RID: 2921
FistCustom = 64
}
}
@@ -0,0 +1,677 @@
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Provides convenient access to culture-specific resources at run time.</summary>
// Token: 0x02000277 RID: 631
[ComVisible(true)]
[Serializable]
public class ResourceManager
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceManager" /> class with default values.</summary>
// Token: 0x06002038 RID: 8248 RVA: 0x00074E3C File Offset: 0x0007303C
protected ResourceManager()
{
}
/// <summary>Creates a <see cref="T:System.Resources.ResourceManager" /> that looks up resources in satellite assemblies based on information from the specified <see cref="T:System.Type" />.</summary>
/// <param name="resourceSource">A <see cref="T:System.Type" /> from which the <see cref="T:System.Resources.ResourceManager" /> derives all information for finding .resources files. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="resourceSource" /> parameter is null. </exception>
// Token: 0x06002039 RID: 8249 RVA: 0x00074E54 File Offset: 0x00073054
public ResourceManager(Type resourceSource)
{
if (resourceSource == null)
{
throw new ArgumentNullException("resourceSource");
}
this.resourceSource = resourceSource;
this.BaseNameField = resourceSource.Name;
this.MainAssembly = resourceSource.Assembly;
this.ResourceSets = ResourceManager.GetResourceSets(this.MainAssembly, this.BaseNameField);
this.neutral_culture = ResourceManager.GetNeutralResourcesLanguage(this.MainAssembly);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceManager" /> class that looks up resources contained in files with the specified root name using the given assembly.</summary>
/// <param name="baseName">The root name of the resource file without its extension and along with any fully qualified namespace name. For example, the root name for the resource file named "MyApplication.MyResource.en-US.resources" is "MyApplication.MyResource".</param>
/// <param name="assembly">The main assembly for the resources. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="baseName" /> or <paramref name="assembly" /> parameter is null. </exception>
// Token: 0x0600203A RID: 8250 RVA: 0x00074ED0 File Offset: 0x000730D0
public ResourceManager(string baseName, Assembly assembly)
{
if (baseName == null)
{
throw new ArgumentNullException("baseName");
}
if (assembly == null)
{
throw new ArgumentNullException("assembly");
}
this.BaseNameField = baseName;
this.MainAssembly = assembly;
this.ResourceSets = ResourceManager.GetResourceSets(this.MainAssembly, this.BaseNameField);
this.neutral_culture = ResourceManager.GetNeutralResourcesLanguage(this.MainAssembly);
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceManager" /> class that looks up resources contained in files derived from the specified root name using the given <see cref="T:System.Reflection.Assembly" />.</summary>
/// <param name="baseName">The root name of the resource file without its extension and along with any fully qualified namespace name. For example, the root name for the resource file named "MyApplication.MyResource.en-US.resources" is "MyApplication.MyResource". </param>
/// <param name="assembly">The main assembly for the resources. </param>
/// <param name="usingResourceSet">The <see cref="T:System.Type" /> of the custom <see cref="T:System.Resources.ResourceSet" /> to use. If null, the default runtime <see cref="T:System.Resources.ResourceSet" /> is used. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="usingResourceset" /> is not a derived class of <see cref="T:System.Resources.ResourceSet" />. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="baseName" /> or <paramref name="assembly" /> parameter is null. </exception>
// Token: 0x0600203B RID: 8251 RVA: 0x00074F4C File Offset: 0x0007314C
public ResourceManager(string baseName, Assembly assembly, Type usingResourceSet)
{
if (baseName == null)
{
throw new ArgumentNullException("baseName");
}
if (assembly == null)
{
throw new ArgumentNullException("assembly");
}
this.BaseNameField = baseName;
this.MainAssembly = assembly;
this.ResourceSets = ResourceManager.GetResourceSets(this.MainAssembly, this.BaseNameField);
this.resourceSetType = this.CheckResourceSetType(usingResourceSet, true);
this.neutral_culture = ResourceManager.GetNeutralResourcesLanguage(this.MainAssembly);
}
// Token: 0x0600203C RID: 8252 RVA: 0x00074FD8 File Offset: 0x000731D8
private ResourceManager(string baseName, string resourceDir, Type usingResourceSet)
{
if (baseName == null)
{
throw new ArgumentNullException("baseName");
}
if (resourceDir == null)
{
throw new ArgumentNullException("resourceDir");
}
this.BaseNameField = baseName;
this.resourceDir = resourceDir;
this.resourceSetType = this.CheckResourceSetType(usingResourceSet, false);
this.ResourceSets = ResourceManager.GetResourceSets(this.MainAssembly, this.BaseNameField);
}
// Token: 0x0600203E RID: 8254 RVA: 0x0007507C File Offset: 0x0007327C
private static Hashtable GetResourceSets(Assembly assembly, string basename)
{
Hashtable resourceCache = ResourceManager.ResourceCache;
Hashtable hashtable2;
lock (resourceCache)
{
string text = string.Empty;
if (assembly != null)
{
text = assembly.FullName;
}
else
{
text = basename.GetHashCode().ToString() + "@@";
}
if (basename != null && basename != string.Empty)
{
text = text + "!" + basename;
}
else
{
text = text + "!" + text.GetHashCode();
}
Hashtable hashtable = ResourceManager.ResourceCache[text] as Hashtable;
if (hashtable == null)
{
hashtable = Hashtable.Synchronized(new Hashtable());
ResourceManager.ResourceCache[text] = hashtable;
}
hashtable2 = hashtable;
}
return hashtable2;
}
// Token: 0x0600203F RID: 8255 RVA: 0x00075168 File Offset: 0x00073368
private Type CheckResourceSetType(Type usingResourceSet, bool verifyType)
{
if (usingResourceSet == null)
{
return this.resourceSetType;
}
if (verifyType && !typeof(ResourceSet).IsAssignableFrom(usingResourceSet))
{
throw new ArgumentException("Type parameter must refer to a subclass of ResourceSet.", "usingResourceSet");
}
return usingResourceSet;
}
/// <summary>Returns a <see cref="T:System.Resources.ResourceManager" /> that searches a specific directory for resources instead of in the assembly manifest.</summary>
/// <returns>The newly created <see cref="T:System.Resources.ResourceManager" /> that searches a specific directory for resources instead of in the assembly manifest.</returns>
/// <param name="baseName">The root name of the resources. For example, the root name for the resource file named "MyResource.en-US.resources" is "MyResource". </param>
/// <param name="resourceDir">The name of the directory to search for the resources. </param>
/// <param name="usingResourceSet">The <see cref="T:System.Type" /> of the custom <see cref="T:System.Resources.ResourceSet" /> to use. If null, the default runtime <see cref="T:System.Resources.ResourceSet" /> is used. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="baseName" /> or <paramref name="resourceDir" /> parameter is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet>
// Token: 0x06002040 RID: 8256 RVA: 0x000751A4 File Offset: 0x000733A4
public static ResourceManager CreateFileBasedResourceManager(string baseName, string resourceDir, Type usingResourceSet)
{
return new ResourceManager(baseName, resourceDir, usingResourceSet);
}
/// <summary>Gets the root name of the resource files that the <see cref="T:System.Resources.ResourceManager" /> searches for resources.</summary>
/// <returns>The root name of the resource files that the <see cref="T:System.Resources.ResourceManager" /> searches for resources.</returns>
// Token: 0x17000607 RID: 1543
// (get) Token: 0x06002041 RID: 8257 RVA: 0x000751B0 File Offset: 0x000733B0
public virtual string BaseName
{
get
{
return this.BaseNameField;
}
}
/// <summary>Gets or sets a Boolean value indicating whether the current instance of ResourceManager allows case-insensitive resource lookups in the <see cref="M:System.Resources.ResourceManager.GetString(System.String)" /> and <see cref="M:System.Resources.ResourceManager.GetObject(System.String)" /> methods.</summary>
/// <returns>A Boolean value indicating whether the case of the resource names should be ignored.</returns>
// Token: 0x17000608 RID: 1544
// (get) Token: 0x06002042 RID: 8258 RVA: 0x000751B8 File Offset: 0x000733B8
// (set) Token: 0x06002043 RID: 8259 RVA: 0x000751C0 File Offset: 0x000733C0
public virtual bool IgnoreCase
{
get
{
return this.ignoreCase;
}
set
{
this.ignoreCase = value;
}
}
/// <summary>Gets the <see cref="T:System.Type" /> of the <see cref="T:System.Resources.ResourceSet" /> the <see cref="T:System.Resources.ResourceManager" /> uses to construct a <see cref="T:System.Resources.ResourceSet" /> object.</summary>
/// <returns>The <see cref="T:System.Type" /> of the <see cref="T:System.Resources.ResourceSet" /> the <see cref="T:System.Resources.ResourceManager" /> uses to construct a <see cref="T:System.Resources.ResourceSet" /> object.</returns>
// Token: 0x17000609 RID: 1545
// (get) Token: 0x06002044 RID: 8260 RVA: 0x000751CC File Offset: 0x000733CC
public virtual Type ResourceSetType
{
get
{
return this.resourceSetType;
}
}
/// <summary>Returns the value of the specified <see cref="T:System.Object" /> resource.</summary>
/// <returns>The value of the resource localized for the caller's current culture settings. If a match is not possible, null is returned. The resource value can be null.</returns>
/// <param name="name">The name of the resource to get. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Resources.MissingManifestResourceException">No usable set of resources has been found, and there are no neutral culture resources. </exception>
// Token: 0x06002045 RID: 8261 RVA: 0x000751D4 File Offset: 0x000733D4
public virtual object GetObject(string name)
{
return this.GetObject(name, null);
}
/// <summary>Gets the value of the <see cref="T:System.Object" /> resource localized for the specified culture.</summary>
/// <returns>The value of the resource, localized for the specified culture. If a "best match" is not possible, null is returned.</returns>
/// <param name="name">The name of the resource to get. </param>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> object that represents the culture for which the resource is localized. Note that if the resource is not localized for this culture, the lookup will fall back using the culture's <see cref="P:System.Globalization.CultureInfo.Parent" /> property, stopping after checking in the neutral culture.If this value is null, the <see cref="T:System.Globalization.CultureInfo" /> is obtained using the culture's <see cref="P:System.Globalization.CultureInfo.CurrentUICulture" /> property. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Resources.MissingManifestResourceException">No usable set of resources have been found, and there are no neutral culture resources. </exception>
// Token: 0x06002046 RID: 8262 RVA: 0x000751E0 File Offset: 0x000733E0
public virtual object GetObject(string name, CultureInfo culture)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (culture == null)
{
culture = CultureInfo.CurrentUICulture;
}
lock (this)
{
ResourceSet resourceSet = this.InternalGetResourceSet(culture, true, true);
object obj;
if (resourceSet != null)
{
obj = resourceSet.GetObject(name, this.ignoreCase);
if (obj != null)
{
return obj;
}
}
for (;;)
{
culture = culture.Parent;
resourceSet = this.InternalGetResourceSet(culture, true, true);
if (resourceSet != null)
{
obj = resourceSet.GetObject(name, this.ignoreCase);
if (obj != null)
{
break;
}
}
if (culture.Equals(this.neutral_culture) || culture.Equals(CultureInfo.InvariantCulture))
{
goto IL_A7;
}
}
return obj;
IL_A7:;
}
return null;
}
/// <summary>Gets the <see cref="T:System.Resources.ResourceSet" /> for a particular culture.</summary>
/// <returns>The specified <see cref="T:System.Resources.ResourceSet" />.</returns>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> to look for. </param>
/// <param name="createIfNotExists">If true and if the <see cref="T:System.Resources.ResourceSet" /> has not been loaded yet, load it. </param>
/// <param name="tryParents">If the <see cref="T:System.Resources.ResourceSet" /> cannot be loaded, try parent <see cref="T:System.Globalization.CultureInfo" /> objects to see if they exist. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="culture" /> parameter is null. </exception>
// Token: 0x06002047 RID: 8263 RVA: 0x000752C0 File Offset: 0x000734C0
public virtual ResourceSet GetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
{
if (culture == null)
{
throw new ArgumentNullException("culture");
}
ResourceSet resourceSet;
lock (this)
{
resourceSet = this.InternalGetResourceSet(culture, createIfNotExists, tryParents);
}
return resourceSet;
}
/// <summary>Returns the value of the specified <see cref="T:System.String" /> resource.</summary>
/// <returns>The value of the resource localized for the caller's current culture settings. If a match is not possible, null is returned.</returns>
/// <param name="name">The name of the resource to get. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.InvalidOperationException">The value of the specified resource is not a string. </exception>
/// <exception cref="T:System.Resources.MissingManifestResourceException">No usable set of resources has been found, and there are no neutral culture resources. </exception>
// Token: 0x06002048 RID: 8264 RVA: 0x00075320 File Offset: 0x00073520
public virtual string GetString(string name)
{
return this.GetString(name, null);
}
/// <summary>Gets the value of the <see cref="T:System.String" /> resource localized for the specified culture.</summary>
/// <returns>The value of the resource localized for the specified culture. If a best match is not possible, null is returned.</returns>
/// <param name="name">The name of the resource to get. </param>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> object that represents the culture for which the resource is localized. Note that if the resource is not localized for this culture, the lookup will fall back using the current thread's <see cref="P:System.Globalization.CultureInfo.Parent" /> property, stopping after looking in the neutral culture.If this value is null, the <see cref="T:System.Globalization.CultureInfo" /> is obtained using the current thread's <see cref="P:System.Globalization.CultureInfo.CurrentUICulture" /> property. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.InvalidOperationException">The value of the specified resource is not a <see cref="T:System.String" />. </exception>
/// <exception cref="T:System.Resources.MissingManifestResourceException">No usable set of resources has been found, and there are no neutral culture resources. </exception>
// Token: 0x06002049 RID: 8265 RVA: 0x0007532C File Offset: 0x0007352C
public virtual string GetString(string name, CultureInfo culture)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (culture == null)
{
culture = CultureInfo.CurrentUICulture;
}
lock (this)
{
ResourceSet resourceSet = this.InternalGetResourceSet(culture, true, true);
string text;
if (resourceSet != null)
{
text = resourceSet.GetString(name, this.ignoreCase);
if (text != null)
{
return text;
}
}
for (;;)
{
culture = culture.Parent;
resourceSet = this.InternalGetResourceSet(culture, true, true);
if (resourceSet != null)
{
text = resourceSet.GetString(name, this.ignoreCase);
if (text != null)
{
break;
}
}
if (culture.Equals(this.neutral_culture) || culture.Equals(CultureInfo.InvariantCulture))
{
goto IL_A7;
}
}
return text;
IL_A7:;
}
return null;
}
/// <summary>Generates the name for the resource file for the given <see cref="T:System.Globalization.CultureInfo" />.</summary>
/// <returns>The name that can be used for a resource file for the given <see cref="T:System.Globalization.CultureInfo" />.</returns>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> for which a resource file name is constructed. </param>
// Token: 0x0600204A RID: 8266 RVA: 0x0007540C File Offset: 0x0007360C
protected virtual string GetResourceFileName(CultureInfo culture)
{
if (culture.Equals(CultureInfo.InvariantCulture))
{
return this.BaseNameField + ".resources";
}
return this.BaseNameField + "." + culture.Name + ".resources";
}
// Token: 0x0600204B RID: 8267 RVA: 0x00075458 File Offset: 0x00073658
private string GetResourceFilePath(CultureInfo culture)
{
if (this.resourceDir != null)
{
return Path.Combine(this.resourceDir, this.GetResourceFileName(culture));
}
return this.GetResourceFileName(culture);
}
// Token: 0x0600204C RID: 8268 RVA: 0x00075480 File Offset: 0x00073680
private Stream GetManifestResourceStreamNoCase(Assembly ass, string fn)
{
string manifestResourceName = this.GetManifestResourceName(fn);
foreach (string text in ass.GetManifestResourceNames())
{
if (string.Compare(manifestResourceName, text, true, CultureInfo.InvariantCulture) == 0)
{
return ass.GetManifestResourceStream(text);
}
}
return null;
}
/// <summary>Returns an <see cref="T:System.IO.UnmanagedMemoryStream" /> object from the specified resource.</summary>
/// <returns>An <see cref="T:System.IO.UnmanagedMemoryStream" /> object.</returns>
/// <param name="name">The name of a resource.</param>
/// <exception cref="T:System.InvalidOperationException">The value of the specified resource is not a <see cref="T:System.IO.MemoryStream" /> object.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null.</exception>
/// <exception cref="T:System.Resources.MissingManifestResourceException">No usable set of resources is found, and there are no neutral resources.</exception>
// Token: 0x0600204D RID: 8269 RVA: 0x000754D0 File Offset: 0x000736D0
[CLSCompliant(false)]
[ComVisible(false)]
public UnmanagedMemoryStream GetStream(string name)
{
return this.GetStream(name, null);
}
/// <summary>Returns an <see cref="T:System.IO.UnmanagedMemoryStream" /> object from the specified resource, using the specified culture.</summary>
/// <returns>An <see cref="T:System.IO.UnmanagedMemoryStream" /> object.</returns>
/// <param name="name">The name of a resource.</param>
/// <param name="culture">A <see cref="T:System.Globalization.CultureInfo" /> object that specifies the culture to use for the resource lookup. If <paramref name="culture" /> is null, the culture for the current thread is used.</param>
/// <exception cref="T:System.InvalidOperationException">The value of the specified resource is not a <see cref="T:System.IO.MemoryStream" /> object.</exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" /> is null.</exception>
/// <exception cref="T:System.Resources.MissingManifestResourceException">No usable set of resources is found, and there are no neutral resources.</exception>
// Token: 0x0600204E RID: 8270 RVA: 0x000754DC File Offset: 0x000736DC
[CLSCompliant(false)]
[ComVisible(false)]
public UnmanagedMemoryStream GetStream(string name, CultureInfo culture)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (culture == null)
{
culture = CultureInfo.CurrentUICulture;
}
ResourceSet resourceSet = this.InternalGetResourceSet(culture, true, true);
return resourceSet.GetStream(name, this.ignoreCase);
}
/// <summary>Provides the implementation for finding a <see cref="T:System.Resources.ResourceSet" />.</summary>
/// <returns>The specified <see cref="T:System.Resources.ResourceSet" />.</returns>
/// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> to look for. </param>
/// <param name="createIfNotExists">If true and if the <see cref="T:System.Resources.ResourceSet" /> has not been loaded yet, load it. </param>
/// <param name="tryParents">If the <see cref="T:System.Resources.ResourceSet" /> cannot be loaded, try parent <see cref="T:System.Globalization.CultureInfo" /> objects to see if they exist. </param>
/// <exception cref="T:System.Resources.MissingManifestResourceException">The main assembly does not contain a .resources file and it is required to look up a resource. </exception>
/// <exception cref="T:System.ExecutionEngineException">There was an internal error in the runtime.</exception>
/// <exception cref="T:System.Resources.MissingSatelliteAssemblyException">The satellite assembly associated with <paramref name="culture" /> could not be located.</exception>
// Token: 0x0600204F RID: 8271 RVA: 0x00075520 File Offset: 0x00073720
protected virtual ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
{
if (culture == null)
{
throw new ArgumentNullException("key");
}
ResourceSet resourceSet = (ResourceSet)this.ResourceSets[culture];
if (resourceSet != null)
{
return resourceSet;
}
if (ResourceManager.NonExistent.Contains(culture))
{
return null;
}
if (this.MainAssembly != null)
{
CultureInfo cultureInfo = culture;
if (culture.Equals(this.neutral_culture))
{
cultureInfo = CultureInfo.InvariantCulture;
}
Stream stream = null;
string resourceFileName = this.GetResourceFileName(cultureInfo);
if (!cultureInfo.Equals(CultureInfo.InvariantCulture))
{
Version satelliteContractVersion = ResourceManager.GetSatelliteContractVersion(this.MainAssembly);
try
{
Assembly satelliteAssemblyNoThrow = this.MainAssembly.GetSatelliteAssemblyNoThrow(cultureInfo, satelliteContractVersion);
if (satelliteAssemblyNoThrow != null)
{
stream = satelliteAssemblyNoThrow.GetManifestResourceStream(resourceFileName);
if (stream == null)
{
stream = this.GetManifestResourceStreamNoCase(satelliteAssemblyNoThrow, resourceFileName);
}
}
}
catch (Exception)
{
}
}
else
{
stream = this.MainAssembly.GetManifestResourceStream(this.resourceSource, resourceFileName);
if (stream == null)
{
stream = this.GetManifestResourceStreamNoCase(this.MainAssembly, resourceFileName);
}
}
if (stream != null && createIfNotExists)
{
object[] array = new object[] { stream };
resourceSet = (ResourceSet)Activator.CreateInstance(this.resourceSetType, array);
}
else if (cultureInfo.Equals(CultureInfo.InvariantCulture))
{
throw this.AssemblyResourceMissing(resourceFileName);
}
}
else if (this.resourceDir != null || this.BaseNameField != null)
{
string resourceFilePath = this.GetResourceFilePath(culture);
if (createIfNotExists && File.Exists(resourceFilePath))
{
object[] array2 = new object[] { resourceFilePath };
resourceSet = (ResourceSet)Activator.CreateInstance(this.resourceSetType, array2);
}
else if (culture.Equals(CultureInfo.InvariantCulture))
{
string text = string.Format("Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.{0}baseName: {1} locationInfo: {2} fileName: {3}", new object[]
{
Environment.NewLine,
this.BaseNameField,
"<null>",
this.GetResourceFileName(culture)
});
throw new MissingManifestResourceException(text);
}
}
if (resourceSet == null && tryParents && !culture.Equals(CultureInfo.InvariantCulture))
{
resourceSet = this.InternalGetResourceSet(culture.Parent, createIfNotExists, tryParents);
}
if (resourceSet != null)
{
this.ResourceSets[culture] = resourceSet;
}
else
{
ResourceManager.NonExistent[culture] = culture;
}
return resourceSet;
}
/// <summary>Tells the <see cref="T:System.Resources.ResourceManager" /> to call <see cref="M:System.Resources.ResourceSet.Close" /> on all <see cref="T:System.Resources.ResourceSet" /> objects and release all resources.</summary>
// Token: 0x06002050 RID: 8272 RVA: 0x00075778 File Offset: 0x00073978
public virtual void ReleaseAllResources()
{
lock (this)
{
foreach (object obj in this.ResourceSets.Values)
{
ResourceSet resourceSet = (ResourceSet)obj;
resourceSet.Close();
}
this.ResourceSets.Clear();
}
}
/// <summary>Returns the <see cref="T:System.Globalization.CultureInfo" /> for the main assembly's neutral resources by reading the value of the <see cref="T:System.Resources.NeutralResourcesLanguageAttribute" /> on a specified <see cref="T:System.Reflection.Assembly" />.</summary>
/// <returns>The culture from the <see cref="T:System.Resources.NeutralResourcesLanguageAttribute" />, if found; otherwise, <see cref="P:System.Globalization.CultureInfo.InvariantCulture" />.</returns>
/// <param name="a">The assembly for which to return a <see cref="T:System.Globalization.CultureInfo" />. </param>
// Token: 0x06002051 RID: 8273 RVA: 0x00075824 File Offset: 0x00073A24
protected static CultureInfo GetNeutralResourcesLanguage(Assembly a)
{
object[] customAttributes = a.GetCustomAttributes(typeof(NeutralResourcesLanguageAttribute), false);
if (customAttributes.Length == 0)
{
return CultureInfo.InvariantCulture;
}
NeutralResourcesLanguageAttribute neutralResourcesLanguageAttribute = (NeutralResourcesLanguageAttribute)customAttributes[0];
return new CultureInfo(neutralResourcesLanguageAttribute.CultureName);
}
/// <summary>Returns the <see cref="T:System.Version" /> specified by the <see cref="T:System.Resources.SatelliteContractVersionAttribute" /> in the given assembly.</summary>
/// <returns>The satellite contract <see cref="T:System.Version" /> of the given assembly, or null if no version was found.</returns>
/// <param name="a">The <see cref="T:System.Reflection.Assembly" /> for which to look up the <see cref="T:System.Resources.SatelliteContractVersionAttribute" />. </param>
/// <exception cref="T:System.ArgumentException">The <see cref="T:System.Version" /> found in the assembly <paramref name="a" /> is invalid. </exception>
// Token: 0x06002052 RID: 8274 RVA: 0x00075868 File Offset: 0x00073A68
protected static Version GetSatelliteContractVersion(Assembly a)
{
object[] customAttributes = a.GetCustomAttributes(typeof(SatelliteContractVersionAttribute), false);
if (customAttributes.Length == 0)
{
return null;
}
SatelliteContractVersionAttribute satelliteContractVersionAttribute = (SatelliteContractVersionAttribute)customAttributes[0];
return new Version(satelliteContractVersionAttribute.Version);
}
/// <summary>Gets or sets the location from which to retrieve neutral fallback resources.</summary>
/// <returns>One of the <see cref="T:System.Resources.UltimateResourceFallbackLocation" /> values.</returns>
// Token: 0x1700060A RID: 1546
// (get) Token: 0x06002053 RID: 8275 RVA: 0x000758A8 File Offset: 0x00073AA8
// (set) Token: 0x06002054 RID: 8276 RVA: 0x000758B0 File Offset: 0x00073AB0
[MonoTODO("the property exists but is not respected")]
protected UltimateResourceFallbackLocation FallbackLocation
{
get
{
return this.fallbackLocation;
}
set
{
this.fallbackLocation = value;
}
}
// Token: 0x06002055 RID: 8277 RVA: 0x000758BC File Offset: 0x00073ABC
private MissingManifestResourceException AssemblyResourceMissing(string fileName)
{
AssemblyName assemblyName = ((this.MainAssembly == null) ? null : this.MainAssembly.GetName());
string manifestResourceName = this.GetManifestResourceName(fileName);
string text = string.Format("Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"{0}\" was correctly embedded or linked into assembly \"{1}\" at compile time, or that all the satellite assemblies required are loadable and fully signed.", manifestResourceName, (assemblyName == null) ? string.Empty : assemblyName.Name);
throw new MissingManifestResourceException(text);
}
// Token: 0x06002056 RID: 8278 RVA: 0x00075918 File Offset: 0x00073B18
private string GetManifestResourceName(string fn)
{
string text;
if (this.resourceSource != null)
{
if (this.resourceSource.Namespace != null && this.resourceSource.Namespace.Length > 0)
{
text = this.resourceSource.Namespace + "." + fn;
}
else
{
text = fn;
}
}
else
{
text = fn;
}
return text;
}
// Token: 0x04000B48 RID: 2888
private static Hashtable ResourceCache = new Hashtable();
// Token: 0x04000B49 RID: 2889
private static Hashtable NonExistent = Hashtable.Synchronized(new Hashtable());
/// <summary>A constant readonly value indicating the version of resource file headers that the current implementation of <see cref="T:System.Resources.ResourceManager" /> can interpret and produce.</summary>
// Token: 0x04000B4A RID: 2890
public static readonly int HeaderVersionNumber = 1;
/// <summary>Holds the number used to identify resource files.</summary>
// Token: 0x04000B4B RID: 2891
public static readonly int MagicNumber = -1091581234;
/// <summary>Indicates the root name of the resource files that the <see cref="T:System.Resources.ResourceManager" /> searches for resources.</summary>
// Token: 0x04000B4C RID: 2892
protected string BaseNameField;
/// <summary>Indicates the main <see cref="T:System.Reflection.Assembly" /> that contains the resources.</summary>
// Token: 0x04000B4D RID: 2893
protected Assembly MainAssembly;
/// <summary>Contains a <see cref="T:System.Collections.Hashtable" /> that returns a mapping from cultures to <see cref="T:System.Resources.ResourceSet" /> objects.</summary>
// Token: 0x04000B4E RID: 2894
protected Hashtable ResourceSets;
// Token: 0x04000B4F RID: 2895
private bool ignoreCase;
// Token: 0x04000B50 RID: 2896
private Type resourceSource;
// Token: 0x04000B51 RID: 2897
private Type resourceSetType = typeof(RuntimeResourceSet);
// Token: 0x04000B52 RID: 2898
private string resourceDir;
// Token: 0x04000B53 RID: 2899
private CultureInfo neutral_culture;
// Token: 0x04000B54 RID: 2900
private UltimateResourceFallbackLocation fallbackLocation;
}
}
+725
View File
@@ -0,0 +1,725 @@
using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
namespace System.Resources
{
/// <summary>Enumerates .resources files and streams, reading sequential resource name and value pairs.</summary>
// Token: 0x02000279 RID: 633
[ComVisible(true)]
public sealed class ResourceReader : IEnumerable, IDisposable, IResourceReader
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceReader" /> class for the specified stream.</summary>
/// <param name="stream">The input stream for reading resources. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="stream" /> is not readable. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="stream" /> parameter is null. </exception>
/// <exception cref="T:System.IO.IOException">An I/O error has occurred while accessing <paramref name="stream" />. </exception>
// Token: 0x06002057 RID: 8279 RVA: 0x00075980 File Offset: 0x00073B80
public ResourceReader(Stream stream)
{
if (stream == null)
{
throw new ArgumentNullException("stream");
}
if (!stream.CanRead)
{
throw new ArgumentException("Stream was not readable.");
}
this.reader = new BinaryReader(stream, Encoding.UTF8);
this.formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File | StreamingContextStates.Persistence));
this.ReadHeaders();
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceReader" /> class for the specified resource file.</summary>
/// <param name="fileName">The path of the resource file to be read. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="fileName" /> parameter is null. </exception>
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found. </exception>
/// <exception cref="T:System.IO.IOException">An I/O error has occurred. </exception>
/// <exception cref="T:System.BadImageFormatException">The resource file has an invalid format. For example, the length of the file is zero.</exception>
// Token: 0x06002058 RID: 8280 RVA: 0x000759FC File Offset: 0x00073BFC
public ResourceReader(string fileName)
{
this.reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read));
this.formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File | StreamingContextStates.Persistence));
this.ReadHeaders();
}
/// <summary>Returns an enumerator for this <see cref="T:System.Resources.ResourceReader" />.</summary>
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> for this <see cref="T:System.Resources.ResourceReader" />.</returns>
/// <exception cref="T:System.InvalidOperationException">The reader has already been closed, and thus cannot be accessed. </exception>
// Token: 0x06002059 RID: 8281 RVA: 0x00075A54 File Offset: 0x00073C54
IEnumerator IEnumerable.GetEnumerator()
{
return ((IResourceReader)this).GetEnumerator();
}
/// <summary>Releases the resources used by the <see cref="T:System.Resources.ResourceReader" />.</summary>
// Token: 0x0600205A RID: 8282 RVA: 0x00075A5C File Offset: 0x00073C5C
void IDisposable.Dispose()
{
this.Dispose(true);
}
// Token: 0x0600205B RID: 8283 RVA: 0x00075A68 File Offset: 0x00073C68
private void ReadHeaders()
{
try
{
int num = this.reader.ReadInt32();
if (num != ResourceManager.MagicNumber)
{
throw new ArgumentException(string.Format("Stream is not a valid .resources file, magic=0x{0:x}", num));
}
int num2 = this.reader.ReadInt32();
int num3 = this.reader.ReadInt32();
if (num2 > ResourceManager.HeaderVersionNumber)
{
this.reader.BaseStream.Seek((long)num3, SeekOrigin.Current);
}
else
{
string text = this.reader.ReadString();
if (!text.StartsWith("System.Resources.ResourceReader"))
{
throw new NotSupportedException("This .resources file requires reader class " + text);
}
string text2 = this.reader.ReadString();
if (!text2.StartsWith(typeof(ResourceSet).FullName) && !text2.StartsWith("System.Resources.RuntimeResourceSet"))
{
throw new NotSupportedException("This .resources file requires set class " + text2);
}
}
this.resource_ver = this.reader.ReadInt32();
if (this.resource_ver != 1 && this.resource_ver != 2)
{
throw new NotSupportedException("This .resources file requires unsupported set class version: " + this.resource_ver.ToString());
}
this.resourceCount = this.reader.ReadInt32();
this.typeCount = this.reader.ReadInt32();
this.typeNames = new string[this.typeCount];
for (int i = 0; i < this.typeCount; i++)
{
this.typeNames[i] = this.reader.ReadString();
}
int num4 = (int)(this.reader.BaseStream.Position & 7L);
int num5 = 0;
if (num4 != 0)
{
num5 = 8 - num4;
}
for (int j = 0; j < num5; j++)
{
byte b = this.reader.ReadByte();
if ((char)b != "PAD"[j % 3])
{
throw new ArgumentException("Malformed .resources file (padding values incorrect)");
}
}
this.hashes = new int[this.resourceCount];
for (int k = 0; k < this.resourceCount; k++)
{
this.hashes[k] = this.reader.ReadInt32();
}
long[] array = new long[this.resourceCount];
for (int l = 0; l < this.resourceCount; l++)
{
array[l] = (long)this.reader.ReadInt32();
}
this.dataSectionOffset = this.reader.ReadInt32();
this.nameSectionOffset = this.reader.BaseStream.Position;
long position = this.reader.BaseStream.Position;
this.infos = new ResourceReader.ResourceInfo[this.resourceCount];
for (int m = 0; m < this.resourceCount; m++)
{
this.CreateResourceInfo(array[m], ref this.infos[m]);
}
this.reader.BaseStream.Seek(position, SeekOrigin.Begin);
}
catch (EndOfStreamException ex)
{
throw new ArgumentException("Stream is not a valid .resources file! It was possibly truncated.", ex);
}
}
// Token: 0x0600205C RID: 8284 RVA: 0x00075DA8 File Offset: 0x00073FA8
private void CreateResourceInfo(long position, ref ResourceReader.ResourceInfo info)
{
long num = position + this.nameSectionOffset;
this.reader.BaseStream.Seek(num, SeekOrigin.Begin);
int num2 = this.Read7BitEncodedInt();
byte[] array = new byte[num2];
this.reader.Read(array, 0, num2);
string @string = Encoding.Unicode.GetString(array);
long num3 = (long)(this.reader.ReadInt32() + this.dataSectionOffset);
this.reader.BaseStream.Seek(num3, SeekOrigin.Begin);
int num4 = this.Read7BitEncodedInt();
info = new ResourceReader.ResourceInfo(@string, this.reader.BaseStream.Position, num4);
}
// Token: 0x0600205D RID: 8285 RVA: 0x00075E44 File Offset: 0x00074044
private int Read7BitEncodedInt()
{
int num = 0;
int num2 = 0;
byte b;
do
{
b = this.reader.ReadByte();
num |= (int)(b & 127) << num2;
num2 += 7;
}
while ((b & 128) == 128);
return num;
}
// Token: 0x0600205E RID: 8286 RVA: 0x00075E84 File Offset: 0x00074084
private object ReadValueVer2(int type_index)
{
switch (type_index)
{
case 0:
return null;
case 1:
return this.reader.ReadString();
case 2:
return this.reader.ReadBoolean();
case 3:
return (char)this.reader.ReadUInt16();
case 4:
return this.reader.ReadByte();
case 5:
return this.reader.ReadSByte();
case 6:
return this.reader.ReadInt16();
case 7:
return this.reader.ReadUInt16();
case 8:
return this.reader.ReadInt32();
case 9:
return this.reader.ReadUInt32();
case 10:
return this.reader.ReadInt64();
case 11:
return this.reader.ReadUInt64();
case 12:
return this.reader.ReadSingle();
case 13:
return this.reader.ReadDouble();
case 14:
return this.reader.ReadDecimal();
case 15:
return new DateTime(this.reader.ReadInt64());
case 16:
return new TimeSpan(this.reader.ReadInt64());
case 32:
return this.reader.ReadBytes(this.reader.ReadInt32());
case 33:
{
byte[] array = new byte[this.reader.ReadUInt32()];
this.reader.Read(array, 0, array.Length);
return new MemoryStream(array);
}
}
type_index -= 64;
return this.ReadNonPredefinedValue(Type.GetType(this.typeNames[type_index], true));
}
// Token: 0x0600205F RID: 8287 RVA: 0x00076098 File Offset: 0x00074298
private object ReadValueVer1(Type type)
{
if (type == typeof(string))
{
return this.reader.ReadString();
}
if (type == typeof(int))
{
return this.reader.ReadInt32();
}
if (type == typeof(byte))
{
return this.reader.ReadByte();
}
if (type == typeof(double))
{
return this.reader.ReadDouble();
}
if (type == typeof(short))
{
return this.reader.ReadInt16();
}
if (type == typeof(long))
{
return this.reader.ReadInt64();
}
if (type == typeof(sbyte))
{
return this.reader.ReadSByte();
}
if (type == typeof(float))
{
return this.reader.ReadSingle();
}
if (type == typeof(TimeSpan))
{
return new TimeSpan(this.reader.ReadInt64());
}
if (type == typeof(ushort))
{
return this.reader.ReadUInt16();
}
if (type == typeof(uint))
{
return this.reader.ReadUInt32();
}
if (type == typeof(ulong))
{
return this.reader.ReadUInt64();
}
if (type == typeof(decimal))
{
return this.reader.ReadDecimal();
}
if (type == typeof(DateTime))
{
return new DateTime(this.reader.ReadInt64());
}
return this.ReadNonPredefinedValue(type);
}
// Token: 0x06002060 RID: 8288 RVA: 0x00076280 File Offset: 0x00074480
private object ReadNonPredefinedValue(Type exp_type)
{
object obj = this.formatter.Deserialize(this.reader.BaseStream);
if (obj.GetType() != exp_type)
{
throw new InvalidOperationException("Deserialized object is wrong type");
}
return obj;
}
// Token: 0x06002061 RID: 8289 RVA: 0x000762BC File Offset: 0x000744BC
private void LoadResourceValues(ResourceReader.ResourceCacheItem[] store)
{
object obj = this.readerLock;
lock (obj)
{
for (int i = 0; i < this.resourceCount; i++)
{
ResourceReader.ResourceInfo resourceInfo = this.infos[i];
if (resourceInfo.TypeIndex == -1)
{
store[i] = new ResourceReader.ResourceCacheItem(resourceInfo.ResourceName, null);
}
else
{
this.reader.BaseStream.Seek(resourceInfo.ValuePosition, SeekOrigin.Begin);
object obj2;
if (this.resource_ver == 2)
{
obj2 = this.ReadValueVer2(resourceInfo.TypeIndex);
}
else
{
obj2 = this.ReadValueVer1(Type.GetType(this.typeNames[resourceInfo.TypeIndex], true));
}
store[i] = new ResourceReader.ResourceCacheItem(resourceInfo.ResourceName, obj2);
}
}
}
}
// Token: 0x06002062 RID: 8290 RVA: 0x000763C0 File Offset: 0x000745C0
internal unsafe UnmanagedMemoryStream ResourceValueAsStream(string name, int index)
{
ResourceReader.ResourceInfo resourceInfo = this.infos[index];
if (resourceInfo.TypeIndex != 33)
{
throw new InvalidOperationException(string.Format("Resource '{0}' was not a Stream. Use GetObject() instead.", name));
}
object obj = this.readerLock;
UnmanagedMemoryStream unmanagedMemoryStream2;
lock (obj)
{
this.reader.BaseStream.Seek(resourceInfo.ValuePosition, SeekOrigin.Begin);
long num = (long)this.reader.ReadInt32();
UnmanagedMemoryStream unmanagedMemoryStream = this.reader.BaseStream as UnmanagedMemoryStream;
if (unmanagedMemoryStream != null)
{
unmanagedMemoryStream2 = new UnmanagedMemoryStream(unmanagedMemoryStream.PositionPointer, num);
}
else
{
IntPtr ptr = Marshal.AllocHGlobal((int)num);
byte* ptr2 = (byte*)ptr.ToPointer();
UnmanagedMemoryStream unmanagedMemoryStream3 = new UnmanagedMemoryStream(ptr2, num, num, FileAccess.ReadWrite);
unmanagedMemoryStream3.Closed += delegate(object o, EventArgs e)
{
Marshal.FreeHGlobal(ptr);
};
byte[] array = new byte[(num >= 1024L) ? 1024L : num];
while (num > 0L)
{
int num2 = this.reader.Read(array, 0, (int)Math.Min((long)array.Length, num));
if (num2 == 0)
{
throw new FormatException("The resource data is corrupt. Resource stream ended");
}
unmanagedMemoryStream3.Write(array, 0, num2);
num -= (long)num2;
}
unmanagedMemoryStream3.Seek(0L, SeekOrigin.Begin);
unmanagedMemoryStream2 = unmanagedMemoryStream3;
}
}
return unmanagedMemoryStream2;
}
/// <summary>Releases all operating system resources associated with this <see cref="T:System.Resources.ResourceReader" />.</summary>
// Token: 0x06002063 RID: 8291 RVA: 0x0007654C File Offset: 0x0007474C
public void Close()
{
this.Dispose(true);
}
/// <summary>Returns an enumerator for this <see cref="T:System.Resources.ResourceReader" />.</summary>
/// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for this <see cref="T:System.Resources.ResourceReader" />.</returns>
/// <exception cref="T:System.ObjectDisposedException">The reader has been closed or disposed, and cannot be accessed. </exception>
// Token: 0x06002064 RID: 8292 RVA: 0x00076558 File Offset: 0x00074758
public IDictionaryEnumerator GetEnumerator()
{
if (this.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
return new ResourceReader.ResourceEnumerator(this);
}
/// <summary>Retrieves the type name and data content of a named resource from an open resource file or stream.</summary>
/// <param name="resourceName">The name of a resource.</param>
/// <param name="resourceType">When this method returns, contains a string that is the type name of the retrieved type. This parameter is passed uninitialized.</param>
/// <param name="resourceData">When this method returns, contains a byte array that is the binary representation of the retrieved type. This parameter is passed uninitialized.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="resourceName" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="resourceName" /> does not exist.</exception>
/// <exception cref="T:System.FormatException">The retrieved resource data is corrupted.</exception>
/// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Resources.ResourceReader" /> object is not initialized. The probable cause is that the <see cref="T:System.Resources.ResourceReader" /> object is closed.</exception>
// Token: 0x06002065 RID: 8293 RVA: 0x00076578 File Offset: 0x00074778
public void GetResourceData(string resourceName, out string resourceType, out byte[] resourceData)
{
if (resourceName == null)
{
throw new ArgumentNullException("resourceName");
}
ResourceReader.ResourceEnumerator resourceEnumerator = new ResourceReader.ResourceEnumerator(this);
while (resourceEnumerator.MoveNext())
{
if ((string)resourceEnumerator.Key == resourceName)
{
this.GetResourceDataAt(resourceEnumerator.Index, out resourceType, out resourceData);
return;
}
}
throw new ArgumentException(string.Format("Specified resource not found: {0}", resourceName));
}
// Token: 0x06002066 RID: 8294 RVA: 0x000765E4 File Offset: 0x000747E4
private void GetResourceDataAt(int index, out string resourceType, out byte[] data)
{
ResourceReader.ResourceInfo resourceInfo = this.infos[index];
int typeIndex = resourceInfo.TypeIndex;
if (typeIndex == -1)
{
throw new FormatException("The resource data is corrupt");
}
object obj = this.readerLock;
lock (obj)
{
this.reader.BaseStream.Seek(resourceInfo.ValuePosition, SeekOrigin.Begin);
long position = this.reader.BaseStream.Position;
if (this.resource_ver == 2)
{
if (typeIndex >= 64)
{
int num = typeIndex - 64;
if (num >= this.typeNames.Length)
{
throw new FormatException("The resource data is corrupt. Invalid index to types");
}
resourceType = this.typeNames[num];
}
else
{
resourceType = "ResourceTypeCode." + (PredefinedResourceType)typeIndex;
}
this.ReadValueVer2(typeIndex);
}
else
{
resourceType = "ResourceTypeCode.Null";
this.ReadValueVer1(Type.GetType(this.typeNames[typeIndex], true));
}
int num2 = (int)(this.reader.BaseStream.Position - position);
this.reader.BaseStream.Seek((long)(-(long)num2), SeekOrigin.Current);
data = new byte[num2];
this.reader.BaseStream.Read(data, 0, num2);
}
}
// Token: 0x06002067 RID: 8295 RVA: 0x00076748 File Offset: 0x00074948
private void Dispose(bool disposing)
{
if (disposing && this.reader != null)
{
this.reader.Close();
}
this.reader = null;
this.hashes = null;
this.infos = null;
this.typeNames = null;
this.cache = null;
}
// Token: 0x04000B6A RID: 2922
private BinaryReader reader;
// Token: 0x04000B6B RID: 2923
private object readerLock = new object();
// Token: 0x04000B6C RID: 2924
private IFormatter formatter;
// Token: 0x04000B6D RID: 2925
internal int resourceCount;
// Token: 0x04000B6E RID: 2926
private int typeCount;
// Token: 0x04000B6F RID: 2927
private string[] typeNames;
// Token: 0x04000B70 RID: 2928
private int[] hashes;
// Token: 0x04000B71 RID: 2929
private ResourceReader.ResourceInfo[] infos;
// Token: 0x04000B72 RID: 2930
private int dataSectionOffset;
// Token: 0x04000B73 RID: 2931
private long nameSectionOffset;
// Token: 0x04000B74 RID: 2932
private int resource_ver;
// Token: 0x04000B75 RID: 2933
private ResourceReader.ResourceCacheItem[] cache;
// Token: 0x04000B76 RID: 2934
private object cache_lock = new object();
// Token: 0x0200027A RID: 634
private struct ResourceInfo
{
// Token: 0x06002068 RID: 8296 RVA: 0x00076794 File Offset: 0x00074994
public ResourceInfo(string resourceName, long valuePosition, int type_index)
{
this.ValuePosition = valuePosition;
this.ResourceName = resourceName;
this.TypeIndex = type_index;
}
// Token: 0x04000B77 RID: 2935
public readonly long ValuePosition;
// Token: 0x04000B78 RID: 2936
public readonly string ResourceName;
// Token: 0x04000B79 RID: 2937
public readonly int TypeIndex;
}
// Token: 0x0200027B RID: 635
private struct ResourceCacheItem
{
// Token: 0x06002069 RID: 8297 RVA: 0x000767AC File Offset: 0x000749AC
public ResourceCacheItem(string name, object value)
{
this.ResourceName = name;
this.ResourceValue = value;
}
// Token: 0x04000B7A RID: 2938
public readonly string ResourceName;
// Token: 0x04000B7B RID: 2939
public readonly object ResourceValue;
}
// Token: 0x0200027C RID: 636
internal sealed class ResourceEnumerator : IEnumerator, IDictionaryEnumerator
{
// Token: 0x0600206A RID: 8298 RVA: 0x000767BC File Offset: 0x000749BC
internal ResourceEnumerator(ResourceReader readerToEnumerate)
{
this.reader = readerToEnumerate;
this.FillCache();
}
// Token: 0x1700060B RID: 1547
// (get) Token: 0x0600206B RID: 8299 RVA: 0x000767D8 File Offset: 0x000749D8
public int Index
{
get
{
return this.index;
}
}
// Token: 0x1700060C RID: 1548
// (get) Token: 0x0600206C RID: 8300 RVA: 0x000767E0 File Offset: 0x000749E0
public DictionaryEntry Entry
{
get
{
if (this.reader.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
if (this.index < 0)
{
throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
}
return new DictionaryEntry(this.Key, this.Value);
}
}
// Token: 0x1700060D RID: 1549
// (get) Token: 0x0600206D RID: 8301 RVA: 0x00076830 File Offset: 0x00074A30
public object Key
{
get
{
if (this.reader.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
if (this.index < 0)
{
throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
}
return this.reader.cache[this.index].ResourceName;
}
}
// Token: 0x1700060E RID: 1550
// (get) Token: 0x0600206E RID: 8302 RVA: 0x0007688C File Offset: 0x00074A8C
public object Value
{
get
{
if (this.reader.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
if (this.index < 0)
{
throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
}
return this.reader.cache[this.index].ResourceValue;
}
}
// Token: 0x1700060F RID: 1551
// (get) Token: 0x0600206F RID: 8303 RVA: 0x000768E8 File Offset: 0x00074AE8
public UnmanagedMemoryStream ValueAsStream
{
get
{
if (this.reader.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
if (this.index < 0)
{
throw new InvalidOperationException("Enumeration has not started. Call MoveNext.");
}
return this.reader.ResourceValueAsStream((string)this.Key, this.index);
}
}
// Token: 0x17000610 RID: 1552
// (get) Token: 0x06002070 RID: 8304 RVA: 0x00076944 File Offset: 0x00074B44
public object Current
{
get
{
return this.Entry;
}
}
// Token: 0x06002071 RID: 8305 RVA: 0x00076954 File Offset: 0x00074B54
public bool MoveNext()
{
if (this.reader.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
if (this.finished)
{
return false;
}
if (++this.index < this.reader.resourceCount)
{
return true;
}
this.finished = true;
return false;
}
// Token: 0x06002072 RID: 8306 RVA: 0x000769B4 File Offset: 0x00074BB4
public void Reset()
{
if (this.reader.reader == null)
{
throw new InvalidOperationException("ResourceReader is closed.");
}
this.index = -1;
this.finished = false;
}
// Token: 0x06002073 RID: 8307 RVA: 0x000769E0 File Offset: 0x00074BE0
private void FillCache()
{
if (this.reader.cache != null)
{
return;
}
object cache_lock = this.reader.cache_lock;
lock (cache_lock)
{
if (this.reader.cache == null)
{
ResourceReader.ResourceCacheItem[] array = new ResourceReader.ResourceCacheItem[this.reader.resourceCount];
this.reader.LoadResourceValues(array);
this.reader.cache = array;
}
}
}
// Token: 0x04000B7C RID: 2940
private ResourceReader reader;
// Token: 0x04000B7D RID: 2941
private int index = -1;
// Token: 0x04000B7E RID: 2942
private bool finished;
}
}
}
+290
View File
@@ -0,0 +1,290 @@
using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Stores all the resources localized for one particular culture, ignoring all other cultures, including any fallback rules.</summary>
// Token: 0x0200027D RID: 637
[ComVisible(true)]
[Serializable]
public class ResourceSet : IEnumerable, IDisposable
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceSet" /> class with default properties.</summary>
// Token: 0x06002074 RID: 8308 RVA: 0x00076A78 File Offset: 0x00074C78
protected ResourceSet()
{
this.Table = new Hashtable();
this.resources_read = true;
}
/// <summary>Creates a new instance of the <see cref="T:System.Resources.ResourceSet" /> class using the specified resource reader.</summary>
/// <param name="reader">The reader that will be used. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="reader" /> parameter is null. </exception>
// Token: 0x06002075 RID: 8309 RVA: 0x00076A94 File Offset: 0x00074C94
public ResourceSet(IResourceReader reader)
{
if (reader == null)
{
throw new ArgumentNullException("reader");
}
this.Table = new Hashtable();
this.Reader = reader;
}
/// <summary>Creates a new instance of the <see cref="T:System.Resources.ResourceSet" /> class using the system default <see cref="T:System.Resources.ResourceReader" /> that reads resources from the given stream.</summary>
/// <param name="stream">The <see cref="T:System.IO.Stream" /> of resources to be read. The stream should refer to an existing resources file. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="stream" /> is not readable. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="stream" /> parameter is null. </exception>
// Token: 0x06002076 RID: 8310 RVA: 0x00076AC0 File Offset: 0x00074CC0
public ResourceSet(Stream stream)
{
this.Table = new Hashtable();
this.Reader = new ResourceReader(stream);
}
// Token: 0x06002077 RID: 8311 RVA: 0x00076AE0 File Offset: 0x00074CE0
internal ResourceSet(UnmanagedMemoryStream stream)
{
this.Table = new Hashtable();
this.Reader = new ResourceReader(stream);
}
/// <summary>Creates a new instance of the <see cref="T:System.Resources.ResourceSet" /> class using the system default <see cref="T:System.Resources.ResourceReader" /> that opens and reads resources from the given file.</summary>
/// <param name="fileName">Resource file to read. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="fileName" /> parameter is null. </exception>
// Token: 0x06002078 RID: 8312 RVA: 0x00076B00 File Offset: 0x00074D00
public ResourceSet(string fileName)
{
this.Table = new Hashtable();
this.Reader = new ResourceReader(fileName);
}
/// <summary>Returns an <see cref="T:System.Collections.IEnumerator" /> object to avoid a race condition with Dispose. This member is not intended to be used directly from your code.</summary>
/// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for the current <see cref="T:System.Resources.ResourceSet" /> object.</returns>
// Token: 0x06002079 RID: 8313 RVA: 0x00076B20 File Offset: 0x00074D20
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary>Closes and releases any resources used by this <see cref="T:System.Resources.ResourceSet" />.</summary>
// Token: 0x0600207A RID: 8314 RVA: 0x00076B28 File Offset: 0x00074D28
public virtual void Close()
{
this.Dispose();
}
/// <summary>Disposes of the resources (other than memory) used by the current instance of <see cref="T:System.Resources.ResourceSet" />.</summary>
// Token: 0x0600207B RID: 8315 RVA: 0x00076B30 File Offset: 0x00074D30
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Releases resources (other than memory) associated with the current instance, closing internal managed objects if requested.</summary>
/// <param name="disposing">Indicates whether the objects contained in the current instance should be explicitly closed. </param>
// Token: 0x0600207C RID: 8316 RVA: 0x00076B40 File Offset: 0x00074D40
protected virtual void Dispose(bool disposing)
{
if (disposing && this.Reader != null)
{
this.Reader.Close();
}
this.Reader = null;
this.Table = null;
this.disposed = true;
}
/// <summary>Returns the preferred resource reader class for this kind of <see cref="T:System.Resources.ResourceSet" />.</summary>
/// <returns>Returns the <see cref="T:System.Type" /> for the preferred resource reader for this kind of <see cref="T:System.Resources.ResourceSet" />.</returns>
// Token: 0x0600207D RID: 8317 RVA: 0x00076B74 File Offset: 0x00074D74
public virtual Type GetDefaultReader()
{
return typeof(ResourceReader);
}
/// <summary>Returns the preferred resource writer class for this kind of <see cref="T:System.Resources.ResourceSet" />.</summary>
/// <returns>Returns the <see cref="T:System.Type" /> for the preferred resource writer for this kind of <see cref="T:System.Resources.ResourceSet" />.</returns>
// Token: 0x0600207E RID: 8318 RVA: 0x00076B80 File Offset: 0x00074D80
public virtual Type GetDefaultWriter()
{
return typeof(ResourceWriter);
}
/// <summary>Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> that can iterate through the <see cref="T:System.Resources.ResourceSet" />.</summary>
/// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for this <see cref="T:System.Resources.ResourceSet" />.</returns>
/// <exception cref="T:System.ObjectDisposedException">The resource set has been closed or disposed. </exception>
// Token: 0x0600207F RID: 8319 RVA: 0x00076B8C File Offset: 0x00074D8C
[ComVisible(false)]
public virtual IDictionaryEnumerator GetEnumerator()
{
if (this.disposed)
{
throw new ObjectDisposedException("ResourceSet is closed.");
}
this.ReadResources();
return this.Table.GetEnumerator();
}
// Token: 0x06002080 RID: 8320 RVA: 0x00076BB8 File Offset: 0x00074DB8
private object GetObjectInternal(string name, bool ignoreCase)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (this.disposed)
{
throw new ObjectDisposedException("ResourceSet is closed.");
}
this.ReadResources();
object obj = this.Table[name];
if (obj != null)
{
return obj;
}
if (ignoreCase)
{
foreach (object obj2 in this.Table)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj2;
string text = (string)dictionaryEntry.Key;
if (string.Compare(text, name, true, CultureInfo.InvariantCulture) == 0)
{
return dictionaryEntry.Value;
}
}
}
return null;
}
/// <summary>Searches for a resource object with the specified name.</summary>
/// <returns>The requested resource.</returns>
/// <param name="name">Case-sensitive name of the resource to search for. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.ObjectDisposedException">The object has been closed or disposed.</exception>
// Token: 0x06002081 RID: 8321 RVA: 0x00076C9C File Offset: 0x00074E9C
public virtual object GetObject(string name)
{
return this.GetObjectInternal(name, false);
}
/// <summary>Searches for a resource object with the specified name in a case-insensitive manner, if requested.</summary>
/// <returns>The requested resource.</returns>
/// <param name="name">Name of the resource to search for. </param>
/// <param name="ignoreCase">Indicates whether the case of the specified name should be ignored. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.ObjectDisposedException">The object has been closed or disposed.</exception>
// Token: 0x06002082 RID: 8322 RVA: 0x00076CA8 File Offset: 0x00074EA8
public virtual object GetObject(string name, bool ignoreCase)
{
return this.GetObjectInternal(name, ignoreCase);
}
// Token: 0x06002083 RID: 8323 RVA: 0x00076CB4 File Offset: 0x00074EB4
private string GetStringInternal(string name, bool ignoreCase)
{
object @object = this.GetObject(name, ignoreCase);
if (@object == null)
{
return null;
}
string text = @object as string;
if (text == null)
{
throw new InvalidOperationException(string.Format("Resource '{0}' is not a String. Use GetObject instead.", name));
}
return text;
}
/// <summary>Searches for a <see cref="T:System.String" /> resource with the specified name.</summary>
/// <returns>The value of a resource, if the value is a <see cref="T:System.String" />.</returns>
/// <param name="name">Name of the resource to search for. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.ObjectDisposedException">The object has been closed or disposed.</exception>
// Token: 0x06002084 RID: 8324 RVA: 0x00076CF4 File Offset: 0x00074EF4
public virtual string GetString(string name)
{
return this.GetStringInternal(name, false);
}
/// <summary>Searches for a <see cref="T:System.String" /> resource with the specified name in a case-insensitive manner, if requested.</summary>
/// <returns>The value of a resource, if the value is a <see cref="T:System.String" />.</returns>
/// <param name="name">Name of the resource to search for. </param>
/// <param name="ignoreCase">Indicates whether the case of the case of the specified name should be ignored. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.ObjectDisposedException">The object has been closed or disposed.</exception>
// Token: 0x06002085 RID: 8325 RVA: 0x00076D00 File Offset: 0x00074F00
public virtual string GetString(string name, bool ignoreCase)
{
return this.GetStringInternal(name, ignoreCase);
}
/// <summary>Reads all the resources and stores them in a <see cref="T:System.Collections.Hashtable" /> indicated in the <see cref="F:System.Resources.ResourceSet.Table" /> property.</summary>
// Token: 0x06002086 RID: 8326 RVA: 0x00076D0C File Offset: 0x00074F0C
protected virtual void ReadResources()
{
if (this.resources_read)
{
return;
}
if (this.Reader == null)
{
throw new ObjectDisposedException("ResourceSet is closed.");
}
Hashtable table = this.Table;
lock (table)
{
if (!this.resources_read)
{
IDictionaryEnumerator enumerator = this.Reader.GetEnumerator();
enumerator.Reset();
while (enumerator.MoveNext())
{
this.Table.Add(enumerator.Key, enumerator.Value);
}
this.resources_read = true;
}
}
}
// Token: 0x06002087 RID: 8327 RVA: 0x00076DC0 File Offset: 0x00074FC0
internal UnmanagedMemoryStream GetStream(string name, bool ignoreCase)
{
if (this.Reader == null)
{
throw new ObjectDisposedException("ResourceSet is closed.");
}
IDictionaryEnumerator enumerator = this.Reader.GetEnumerator();
enumerator.Reset();
while (enumerator.MoveNext())
{
if (string.Compare(name, (string)enumerator.Key, ignoreCase) == 0)
{
return ((ResourceReader.ResourceEnumerator)enumerator).ValueAsStream;
}
}
return null;
}
/// <summary>Indicates the <see cref="T:System.Resources.IResourceReader" /> used to read the resources.</summary>
// Token: 0x04000B7F RID: 2943
[NonSerialized]
protected IResourceReader Reader;
/// <summary>The <see cref="T:System.Collections.Hashtable" /> in which the resources are stored.</summary>
// Token: 0x04000B80 RID: 2944
protected Hashtable Table;
// Token: 0x04000B81 RID: 2945
private bool resources_read;
// Token: 0x04000B82 RID: 2946
[NonSerialized]
private bool disposed;
}
}
+483
View File
@@ -0,0 +1,483 @@
using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
namespace System.Resources
{
/// <summary>Writes resources in the system-default format to an output file or an output stream. This class cannot be inherited.</summary>
// Token: 0x0200027E RID: 638
[ComVisible(true)]
public sealed class ResourceWriter : IDisposable, IResourceWriter
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceWriter" /> class that writes the resources to the provided stream.</summary>
/// <param name="stream">The output stream. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="stream" /> parameter is not writable. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="stream" /> parameter is null. </exception>
// Token: 0x06002088 RID: 8328 RVA: 0x00076E2C File Offset: 0x0007502C
public ResourceWriter(Stream stream)
{
if (stream == null)
{
throw new ArgumentNullException("stream");
}
if (!stream.CanWrite)
{
throw new ArgumentException("Stream was not writable.");
}
this.stream = stream;
}
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.ResourceWriter" /> class that writes the resources to the specified file.</summary>
/// <param name="fileName">The output file name. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="fileName" /> parameter is null. </exception>
// Token: 0x06002089 RID: 8329 RVA: 0x00076E80 File Offset: 0x00075080
public ResourceWriter(string fileName)
{
if (fileName == null)
{
throw new ArgumentNullException("fileName");
}
this.stream = new FileStream(fileName, FileMode.Create, FileAccess.Write);
}
/// <summary>Adds a named resource specified as a byte array to the list of resources to be written.</summary>
/// <param name="name">The name of the resource. </param>
/// <param name="value">Value of the resource as an 8-bit unsigned integer array. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> (or a name that varies only by capitalization) has already been added to this <see cref="T:System.Resources.ResourceWriter" />. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Resources.ResourceWriter" /> has been closed and its <see cref="T:System.Collections.Hashtable" /> is unavailable. </exception>
// Token: 0x0600208A RID: 8330 RVA: 0x00076EB8 File Offset: 0x000750B8
public void AddResource(string name, byte[] value)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (this.resources == null)
{
throw new InvalidOperationException("The resource writer has already been closed and cannot be edited");
}
if (this.resources[name] != null)
{
throw new ArgumentException("Resource already present: " + name);
}
this.resources.Add(name, value);
}
/// <summary>Adds a named resource specified as an object to the list of resources to be written.</summary>
/// <param name="name">The name of the resource. </param>
/// <param name="value">The value of the resource. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> (or a name that varies only by capitalization) has already been added to this <see cref="T:System.Resources.ResourceWriter" />. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Resources.ResourceWriter" /> has been closed and its <see cref="T:System.Collections.Hashtable" /> is unavailable. </exception>
// Token: 0x0600208B RID: 8331 RVA: 0x00076F1C File Offset: 0x0007511C
public void AddResource(string name, object value)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (this.resources == null)
{
throw new InvalidOperationException("The resource writer has already been closed and cannot be edited");
}
if (this.resources[name] != null)
{
throw new ArgumentException("Resource already present: " + name);
}
this.resources.Add(name, value);
}
/// <summary>Adds a <see cref="T:System.String" /> resource to the list of resources to be written.</summary>
/// <param name="name">The name of the resource. </param>
/// <param name="value">The value of the resource. </param>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> (or a name that varies only by capitalization) has already been added to this ResourceWriter. </exception>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Resources.ResourceWriter" /> has been closed and its <see cref="T:System.Collections.Hashtable" /> is unavailable. </exception>
// Token: 0x0600208C RID: 8332 RVA: 0x00076F80 File Offset: 0x00075180
public void AddResource(string name, string value)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (this.resources == null)
{
throw new InvalidOperationException("The resource writer has already been closed and cannot be edited");
}
if (this.resources[name] != null)
{
throw new ArgumentException("Resource already present: " + name);
}
this.resources.Add(name, value);
}
/// <summary>Saves the resources to the output stream and then closes it.</summary>
/// <exception cref="T:System.IO.IOException">An I/O error has occurred. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An error has occurred during serialization of the object. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x0600208D RID: 8333 RVA: 0x00076FE4 File Offset: 0x000751E4
public void Close()
{
this.Dispose(true);
}
/// <summary>Allows users to close the resource file or stream, explicitly releasing resources.</summary>
/// <exception cref="T:System.IO.IOException">An I/O error has occurred. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An error has occurred during serialization of the object. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x0600208E RID: 8334 RVA: 0x00076FF0 File Offset: 0x000751F0
public void Dispose()
{
this.Dispose(true);
}
// Token: 0x0600208F RID: 8335 RVA: 0x00076FFC File Offset: 0x000751FC
private void Dispose(bool disposing)
{
if (disposing)
{
if (this.resources != null)
{
this.Generate();
}
if (this.stream != null)
{
this.stream.Close();
}
GC.SuppressFinalize(this);
}
this.resources = null;
this.stream = null;
}
/// <summary>Adds a unit of data as a resource to the list of resources to be written. </summary>
/// <param name="name">A name that identifies the resource that contains the added data.</param>
/// <param name="typeName">The type name of the added data.</param>
/// <param name="serializedData">A byte array that contains the binary representation of the added data.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="name" />, <paramref name="typeName" />, or <paramref name="serializedData" /> is null.</exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="name" /> (or a name that varies only by capitalization) has already been added to this <see cref="T:System.Resources.ResourceWriter" /> object. </exception>
/// <exception cref="T:System.InvalidOperationException">The current <see cref="T:System.Resources.ResourceWriter" /> object is not initialized. The probable cause is that the <see cref="T:System.Resources.ResourceWriter" /> object is closed.</exception>
// Token: 0x06002090 RID: 8336 RVA: 0x0007704C File Offset: 0x0007524C
public void AddResourceData(string name, string typeName, byte[] serializedData)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (typeName == null)
{
throw new ArgumentNullException("typeName");
}
if (serializedData == null)
{
throw new ArgumentNullException("serializedData");
}
this.AddResource(name, new ResourceWriter.TypeByNameObject(typeName, serializedData));
}
/// <summary>Saves all resources to the output stream in the system default format.</summary>
/// <exception cref="T:System.IO.IOException">An I/O error occurred. </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">An error occurred during serialization of the object. </exception>
/// <exception cref="T:System.InvalidOperationException">This <see cref="T:System.Resources.ResourceWriter" /> has been closed and its <see cref="T:System.Collections.Hashtable" /> is unavailable. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
/// </PermissionSet>
// Token: 0x06002091 RID: 8337 RVA: 0x0007709C File Offset: 0x0007529C
public void Generate()
{
if (this.resources == null)
{
throw new InvalidOperationException("The resource writer has already been closed and cannot be edited");
}
BinaryWriter binaryWriter = new BinaryWriter(this.stream, Encoding.UTF8);
IFormatter formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.File | StreamingContextStates.Persistence));
binaryWriter.Write(ResourceManager.MagicNumber);
binaryWriter.Write(ResourceManager.HeaderVersionNumber);
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter2 = new BinaryWriter(memoryStream, Encoding.UTF8);
binaryWriter2.Write(typeof(ResourceReader).AssemblyQualifiedName);
binaryWriter2.Write(typeof(RuntimeResourceSet).FullName);
int num = (int)memoryStream.Length;
binaryWriter.Write(num);
binaryWriter.Write(memoryStream.GetBuffer(), 0, num);
MemoryStream memoryStream2 = new MemoryStream();
BinaryWriter binaryWriter3 = new BinaryWriter(memoryStream2, Encoding.Unicode);
MemoryStream memoryStream3 = new MemoryStream();
BinaryWriter binaryWriter4 = new BinaryWriter(memoryStream3, Encoding.UTF8);
ArrayList arrayList = new ArrayList();
int[] array = new int[this.resources.Count];
int[] array2 = new int[this.resources.Count];
int num2 = 0;
IDictionaryEnumerator enumerator = this.resources.GetEnumerator();
while (enumerator.MoveNext())
{
array[num2] = this.GetHash((string)enumerator.Key);
array2[num2] = (int)binaryWriter3.BaseStream.Position;
binaryWriter3.Write((string)enumerator.Key);
binaryWriter3.Write((int)binaryWriter4.BaseStream.Position);
if (enumerator.Value == null)
{
this.Write7BitEncodedInt(binaryWriter4, -1);
num2++;
}
else
{
ResourceWriter.TypeByNameObject typeByNameObject = enumerator.Value as ResourceWriter.TypeByNameObject;
Type type = ((typeByNameObject == null) ? enumerator.Value.GetType() : null);
object obj = ((typeByNameObject == null) ? type : typeByNameObject.TypeName);
switch ((type == null || type.IsEnum) ? TypeCode.Empty : Type.GetTypeCode(type))
{
case TypeCode.SByte:
case TypeCode.Byte:
case TypeCode.Int16:
case TypeCode.UInt16:
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Single:
case TypeCode.Double:
case TypeCode.Decimal:
case TypeCode.DateTime:
case TypeCode.String:
break;
case (TypeCode)17:
goto IL_22E;
default:
goto IL_22E;
}
IL_2A1:
if (typeByNameObject != null)
{
binaryWriter4.Write(typeByNameObject.Value);
}
else if (type == typeof(byte))
{
binaryWriter4.Write(4);
binaryWriter4.Write((byte)enumerator.Value);
}
else if (type == typeof(decimal))
{
binaryWriter4.Write(14);
binaryWriter4.Write((decimal)enumerator.Value);
}
else if (type == typeof(DateTime))
{
binaryWriter4.Write(15);
binaryWriter4.Write(((DateTime)enumerator.Value).Ticks);
}
else if (type == typeof(double))
{
binaryWriter4.Write(13);
binaryWriter4.Write((double)enumerator.Value);
}
else if (type == typeof(short))
{
binaryWriter4.Write(6);
binaryWriter4.Write((short)enumerator.Value);
}
else if (type == typeof(int))
{
binaryWriter4.Write(8);
binaryWriter4.Write((int)enumerator.Value);
}
else if (type == typeof(long))
{
binaryWriter4.Write(10);
binaryWriter4.Write((long)enumerator.Value);
}
else if (type == typeof(sbyte))
{
binaryWriter4.Write(5);
binaryWriter4.Write((sbyte)enumerator.Value);
}
else if (type == typeof(float))
{
binaryWriter4.Write(12);
binaryWriter4.Write((float)enumerator.Value);
}
else if (type == typeof(string))
{
binaryWriter4.Write(1);
binaryWriter4.Write((string)enumerator.Value);
}
else if (type == typeof(TimeSpan))
{
binaryWriter4.Write(16);
binaryWriter4.Write(((TimeSpan)enumerator.Value).Ticks);
}
else if (type == typeof(ushort))
{
binaryWriter4.Write(7);
binaryWriter4.Write((ushort)enumerator.Value);
}
else if (type == typeof(uint))
{
binaryWriter4.Write(9);
binaryWriter4.Write((uint)enumerator.Value);
}
else if (type == typeof(ulong))
{
binaryWriter4.Write(11);
binaryWriter4.Write((ulong)enumerator.Value);
}
else if (type == typeof(byte[]))
{
binaryWriter4.Write(32);
byte[] array3 = (byte[])enumerator.Value;
binaryWriter4.Write((uint)array3.Length);
binaryWriter4.Write(array3, 0, array3.Length);
}
else if (type == typeof(MemoryStream))
{
binaryWriter4.Write(33);
byte[] array4 = ((MemoryStream)enumerator.Value).ToArray();
binaryWriter4.Write((uint)array4.Length);
binaryWriter4.Write(array4, 0, array4.Length);
}
else
{
formatter.Serialize(binaryWriter4.BaseStream, enumerator.Value);
}
num2++;
continue;
IL_22E:
if (type == typeof(TimeSpan))
{
goto IL_2A1;
}
if (type == typeof(MemoryStream))
{
goto IL_2A1;
}
if (type == typeof(byte[]))
{
goto IL_2A1;
}
if (!arrayList.Contains(obj))
{
arrayList.Add(obj);
}
this.Write7BitEncodedInt(binaryWriter4, 64 + arrayList.IndexOf(obj));
goto IL_2A1;
}
}
Array.Sort<int, int>(array, array2);
binaryWriter.Write(2);
binaryWriter.Write(this.resources.Count);
binaryWriter.Write(arrayList.Count);
foreach (object obj2 in arrayList)
{
if (obj2 is Type)
{
binaryWriter.Write(((Type)obj2).AssemblyQualifiedName);
}
else
{
binaryWriter.Write((string)obj2);
}
}
int num3 = (int)(binaryWriter.BaseStream.Position & 7L);
int num4 = 0;
if (num3 != 0)
{
num4 = 8 - num3;
}
for (int i = 0; i < num4; i++)
{
binaryWriter.Write((byte)"PAD"[i % 3]);
}
for (int j = 0; j < this.resources.Count; j++)
{
binaryWriter.Write(array[j]);
}
for (int k = 0; k < this.resources.Count; k++)
{
binaryWriter.Write(array2[k]);
}
int num5 = (int)binaryWriter.BaseStream.Position + (int)memoryStream2.Length + 4;
binaryWriter.Write(num5);
binaryWriter.Write(memoryStream2.GetBuffer(), 0, (int)memoryStream2.Length);
binaryWriter.Write(memoryStream3.GetBuffer(), 0, (int)memoryStream3.Length);
binaryWriter3.Close();
binaryWriter4.Close();
binaryWriter.Flush();
this.resources = null;
}
// Token: 0x06002092 RID: 8338 RVA: 0x000778A8 File Offset: 0x00075AA8
private int GetHash(string name)
{
uint num = 5381U;
for (int i = 0; i < name.Length; i++)
{
num = ((num << 5) + num) ^ (uint)name[i];
}
return (int)num;
}
// Token: 0x06002093 RID: 8339 RVA: 0x000778E4 File Offset: 0x00075AE4
private void Write7BitEncodedInt(BinaryWriter writer, int value)
{
do
{
int num = (value >> 7) & 33554431;
byte b = (byte)(value & 127);
if (num != 0)
{
b |= 128;
}
writer.Write(b);
value = num;
}
while (value != 0);
}
// Token: 0x17000611 RID: 1553
// (get) Token: 0x06002094 RID: 8340 RVA: 0x00077920 File Offset: 0x00075B20
internal Stream Stream
{
get
{
return this.stream;
}
}
// Token: 0x04000B83 RID: 2947
private SortedList resources = new SortedList(StringComparer.OrdinalIgnoreCase);
// Token: 0x04000B84 RID: 2948
private Stream stream;
// Token: 0x0200027F RID: 639
private class TypeByNameObject
{
// Token: 0x06002095 RID: 8341 RVA: 0x00077928 File Offset: 0x00075B28
public TypeByNameObject(string typeName, byte[] value)
{
this.TypeName = typeName;
this.Value = (byte[])value.Clone();
}
// Token: 0x04000B85 RID: 2949
public readonly string TypeName;
// Token: 0x04000B86 RID: 2950
public readonly byte[] Value;
}
}
}
@@ -0,0 +1,55 @@
using System;
using System.IO;
namespace System.Resources
{
// Token: 0x02000280 RID: 640
[Serializable]
internal class RuntimeResourceSet : ResourceSet
{
// Token: 0x06002096 RID: 8342 RVA: 0x00077948 File Offset: 0x00075B48
public RuntimeResourceSet(UnmanagedMemoryStream stream)
: base(stream)
{
}
// Token: 0x06002097 RID: 8343 RVA: 0x00077954 File Offset: 0x00075B54
public RuntimeResourceSet(Stream stream)
: base(stream)
{
}
// Token: 0x06002098 RID: 8344 RVA: 0x00077960 File Offset: 0x00075B60
public RuntimeResourceSet(string fileName)
: base(fileName)
{
}
// Token: 0x06002099 RID: 8345 RVA: 0x0007796C File Offset: 0x00075B6C
public override object GetObject(string name)
{
if (this.Reader == null)
{
throw new ObjectDisposedException("ResourceSet is closed.");
}
return this.CloneDisposableObjectIfPossible(base.GetObject(name));
}
// Token: 0x0600209A RID: 8346 RVA: 0x00077994 File Offset: 0x00075B94
public override object GetObject(string name, bool ignoreCase)
{
if (this.Reader == null)
{
throw new ObjectDisposedException("ResourceSet is closed.");
}
return this.CloneDisposableObjectIfPossible(base.GetObject(name, ignoreCase));
}
// Token: 0x0600209B RID: 8347 RVA: 0x000779C8 File Offset: 0x00075BC8
private object CloneDisposableObjectIfPossible(object value)
{
ICloneable cloneable = value as ICloneable;
return (cloneable == null || !(value is IDisposable)) ? value : cloneable.Clone();
}
}
}
@@ -0,0 +1,36 @@
using System;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Instructs the <see cref="T:System.Resources.ResourceManager" /> to ask for a particular version of a satellite assembly to simplify updates of the main assembly of an application.</summary>
// Token: 0x02000281 RID: 641
[AttributeUsage(AttributeTargets.Assembly)]
[ComVisible(true)]
public sealed class SatelliteContractVersionAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="T:System.Resources.SatelliteContractVersionAttribute" /> class.</summary>
/// <param name="version">A <see cref="T:System.String" /> with the version of the satellite assemblies to load. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="version" /> parameter is null. </exception>
// Token: 0x0600209C RID: 8348 RVA: 0x000779FC File Offset: 0x00075BFC
public SatelliteContractVersionAttribute(string version)
{
this.ver = new Version(version);
}
/// <summary>Gets the version of the satellite assemblies with the required resources.</summary>
/// <returns>A <see cref="T:System.String" /> containing the version of the satellite assemblies with the required resources.</returns>
// Token: 0x17000612 RID: 1554
// (get) Token: 0x0600209D RID: 8349 RVA: 0x00077A10 File Offset: 0x00075C10
public string Version
{
get
{
return this.ver.ToString();
}
}
// Token: 0x04000B87 RID: 2951
private Version ver;
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
namespace System.Resources
{
/// <summary>Specifies the assembly for the <see cref="T:System.Resources.ResourceManager" /> class to use to retrieve neutral resources by using the Packaging and Deploying Resources.</summary>
// Token: 0x02000282 RID: 642
[ComVisible(true)]
[Serializable]
public enum UltimateResourceFallbackLocation
{
/// <summary>Fallback resources are located in the main assembly.</summary>
// Token: 0x04000B89 RID: 2953
MainAssembly,
/// <summary>Fallback resources are located in a satellite assembly in the location specified by the <see cref="P:System.Resources.NeutralResourcesLanguageAttribute.Location" /> property.</summary>
// Token: 0x04000B8A RID: 2954
Satellite
}
}
@@ -0,0 +1,35 @@
using System;
using System.IO;
namespace System.Resources
{
// Token: 0x02000286 RID: 646
internal class Win32EncodedResource : Win32Resource
{
// Token: 0x060020AC RID: 8364 RVA: 0x00077B68 File Offset: 0x00075D68
internal Win32EncodedResource(NameOrId type, NameOrId name, int language, byte[] data)
: base(type, name, language)
{
this.data = data;
}
// Token: 0x1700061A RID: 1562
// (get) Token: 0x060020AD RID: 8365 RVA: 0x00077B7C File Offset: 0x00075D7C
public byte[] Data
{
get
{
return this.data;
}
}
// Token: 0x060020AE RID: 8366 RVA: 0x00077B84 File Offset: 0x00075D84
public override void WriteTo(Stream s)
{
s.Write(this.data, 0, this.data.Length);
}
// Token: 0x04000BA5 RID: 2981
private byte[] data;
}
}
@@ -0,0 +1,43 @@
using System;
using System.IO;
namespace System.Resources
{
// Token: 0x02000288 RID: 648
internal class Win32GroupIconResource : Win32Resource
{
// Token: 0x060020B2 RID: 8370 RVA: 0x00077BDC File Offset: 0x00075DDC
public Win32GroupIconResource(int id, int language, Win32IconResource[] icons)
: base(Win32ResourceType.RT_GROUP_ICON, id, language)
{
this.icons = icons;
}
// Token: 0x060020B3 RID: 8371 RVA: 0x00077BF0 File Offset: 0x00075DF0
public override void WriteTo(Stream s)
{
using (BinaryWriter binaryWriter = new BinaryWriter(s))
{
binaryWriter.Write(0);
binaryWriter.Write(1);
binaryWriter.Write((short)this.icons.Length);
for (int i = 0; i < this.icons.Length; i++)
{
Win32IconResource win32IconResource = this.icons[i];
ICONDIRENTRY icon = win32IconResource.Icon;
binaryWriter.Write(icon.bWidth);
binaryWriter.Write(icon.bHeight);
binaryWriter.Write(icon.bColorCount);
binaryWriter.Write(0);
binaryWriter.Write(icon.wPlanes);
binaryWriter.Write(icon.wBitCount);
binaryWriter.Write(icon.image.Length);
binaryWriter.Write((short)win32IconResource.Name.Id);
}
}
}
// Token: 0x04000BA7 RID: 2983
private Win32IconResource[] icons;
}
}
@@ -0,0 +1,65 @@
using System;
using System.IO;
namespace System.Resources
{
// Token: 0x0200028C RID: 652
internal class Win32IconFileReader
{
// Token: 0x060020D9 RID: 8409 RVA: 0x00078984 File Offset: 0x00076B84
public Win32IconFileReader(Stream s)
{
this.iconFile = s;
}
// Token: 0x060020DA RID: 8410 RVA: 0x00078994 File Offset: 0x00076B94
public ICONDIRENTRY[] ReadIcons()
{
ICONDIRENTRY[] array2;
using (BinaryReader binaryReader = new BinaryReader(this.iconFile))
{
int num = (int)binaryReader.ReadInt16();
int num2 = (int)binaryReader.ReadInt16();
if (num != 0 || num2 != 1)
{
throw new Exception("Invalid .ico file format");
}
long num3 = (long)binaryReader.ReadInt16();
ICONDIRENTRY[] array = new ICONDIRENTRY[num3];
int num4 = 0;
while ((long)num4 < num3)
{
ICONDIRENTRY icondirentry = new ICONDIRENTRY();
icondirentry.bWidth = binaryReader.ReadByte();
icondirentry.bHeight = binaryReader.ReadByte();
icondirentry.bColorCount = binaryReader.ReadByte();
icondirentry.bReserved = binaryReader.ReadByte();
icondirentry.wPlanes = binaryReader.ReadInt16();
icondirentry.wBitCount = binaryReader.ReadInt16();
int num5 = binaryReader.ReadInt32();
int num6 = binaryReader.ReadInt32();
icondirentry.image = new byte[num5];
long position = this.iconFile.Position;
this.iconFile.Position = (long)num6;
this.iconFile.Read(icondirentry.image, 0, num5);
this.iconFile.Position = position;
if (icondirentry.wPlanes == 0)
{
icondirentry.wPlanes = (short)((int)icondirentry.image[12] | ((int)icondirentry.image[13] << 8));
}
if (icondirentry.wBitCount == 0)
{
icondirentry.wBitCount = (short)((int)icondirentry.image[14] | ((int)icondirentry.image[15] << 8));
}
array[num4] = icondirentry;
num4++;
}
array2 = array;
}
return array2;
}
// Token: 0x04000BC0 RID: 3008
private Stream iconFile;
}
}
@@ -0,0 +1,35 @@
using System;
using System.IO;
namespace System.Resources
{
// Token: 0x02000287 RID: 647
internal class Win32IconResource : Win32Resource
{
// Token: 0x060020AF RID: 8367 RVA: 0x00077B9C File Offset: 0x00075D9C
public Win32IconResource(int id, int language, ICONDIRENTRY icon)
: base(Win32ResourceType.RT_ICON, id, language)
{
this.icon = icon;
}
// Token: 0x1700061B RID: 1563
// (get) Token: 0x060020B0 RID: 8368 RVA: 0x00077BB0 File Offset: 0x00075DB0
public ICONDIRENTRY Icon
{
get
{
return this.icon;
}
}
// Token: 0x060020B1 RID: 8369 RVA: 0x00077BB8 File Offset: 0x00075DB8
public override void WriteTo(Stream s)
{
s.Write(this.icon.image, 0, this.icon.image.Length);
}
// Token: 0x04000BA6 RID: 2982
private ICONDIRENTRY icon;
}
}
@@ -0,0 +1,123 @@
using System;
using System.Collections;
using System.IO;
using System.Text;
namespace System.Resources
{
// Token: 0x0200028A RID: 650
internal class Win32ResFileReader
{
// Token: 0x060020D1 RID: 8401 RVA: 0x00078724 File Offset: 0x00076924
public Win32ResFileReader(Stream s)
{
this.res_file = s;
}
// Token: 0x060020D2 RID: 8402 RVA: 0x00078734 File Offset: 0x00076934
private int read_int16()
{
int num = this.res_file.ReadByte();
if (num == -1)
{
return -1;
}
int num2 = this.res_file.ReadByte();
if (num2 == -1)
{
return -1;
}
return num | (num2 << 8);
}
// Token: 0x060020D3 RID: 8403 RVA: 0x00078770 File Offset: 0x00076970
private int read_int32()
{
int num = this.read_int16();
if (num == -1)
{
return -1;
}
int num2 = this.read_int16();
if (num2 == -1)
{
return -1;
}
return num | (num2 << 16);
}
// Token: 0x060020D4 RID: 8404 RVA: 0x000787A4 File Offset: 0x000769A4
private void read_padding()
{
while (this.res_file.Position % 4L != 0L)
{
this.read_int16();
}
}
// Token: 0x060020D5 RID: 8405 RVA: 0x000787C8 File Offset: 0x000769C8
private NameOrId read_ordinal()
{
int num = this.read_int16();
if ((num & 65535) != 0)
{
int num2 = this.read_int16();
return new NameOrId(num2);
}
byte[] array = new byte[16];
int num3 = 0;
for (;;)
{
int num4 = this.read_int16();
if (num4 == 0)
{
break;
}
if (num3 == array.Length)
{
byte[] array2 = new byte[array.Length * 2];
Array.Copy(array, array2, array.Length);
array = array2;
}
array[num3] = (byte)(num4 >> 8);
array[num3 + 1] = (byte)(num4 & 255);
num3 += 2;
}
return new NameOrId(new string(Encoding.Unicode.GetChars(array, 0, num3)));
}
// Token: 0x060020D6 RID: 8406 RVA: 0x00078870 File Offset: 0x00076A70
public ICollection ReadResources()
{
ArrayList arrayList = new ArrayList();
for (;;)
{
this.read_padding();
int num = this.read_int32();
if (num == -1)
{
break;
}
this.read_int32();
NameOrId nameOrId = this.read_ordinal();
NameOrId nameOrId2 = this.read_ordinal();
this.read_padding();
this.read_int32();
this.read_int16();
int num2 = this.read_int16();
this.read_int32();
this.read_int32();
if (num != 0)
{
byte[] array = new byte[num];
this.res_file.Read(array, 0, num);
arrayList.Add(new Win32EncodedResource(nameOrId, nameOrId2, num2, array));
}
}
return arrayList;
}
// Token: 0x04000BB6 RID: 2998
private Stream res_file;
}
}
@@ -0,0 +1,87 @@
using System;
using System.IO;
namespace System.Resources
{
// Token: 0x02000285 RID: 645
internal abstract class Win32Resource
{
// Token: 0x060020A4 RID: 8356 RVA: 0x00077AA0 File Offset: 0x00075CA0
internal Win32Resource(NameOrId type, NameOrId name, int language)
{
this.type = type;
this.name = name;
this.language = language;
}
// Token: 0x060020A5 RID: 8357 RVA: 0x00077AC0 File Offset: 0x00075CC0
internal Win32Resource(Win32ResourceType type, int name, int language)
{
this.type = new NameOrId((int)type);
this.name = new NameOrId(name);
this.language = language;
}
// Token: 0x17000616 RID: 1558
// (get) Token: 0x060020A6 RID: 8358 RVA: 0x00077AE8 File Offset: 0x00075CE8
public Win32ResourceType ResourceType
{
get
{
if (this.type.IsName)
{
return (Win32ResourceType)(-1);
}
return (Win32ResourceType)this.type.Id;
}
}
// Token: 0x17000617 RID: 1559
// (get) Token: 0x060020A7 RID: 8359 RVA: 0x00077B08 File Offset: 0x00075D08
public NameOrId Name
{
get
{
return this.name;
}
}
// Token: 0x17000618 RID: 1560
// (get) Token: 0x060020A8 RID: 8360 RVA: 0x00077B10 File Offset: 0x00075D10
public NameOrId Type
{
get
{
return this.type;
}
}
// Token: 0x17000619 RID: 1561
// (get) Token: 0x060020A9 RID: 8361 RVA: 0x00077B18 File Offset: 0x00075D18
public int Language
{
get
{
return this.language;
}
}
// Token: 0x060020AA RID: 8362
public abstract void WriteTo(Stream s);
// Token: 0x060020AB RID: 8363 RVA: 0x00077B20 File Offset: 0x00075D20
public override string ToString()
{
return string.Concat(new object[] { "Win32Resource (Kind=", this.ResourceType, ", Name=", this.name, ")" });
}
// Token: 0x04000BA2 RID: 2978
private NameOrId type;
// Token: 0x04000BA3 RID: 2979
private NameOrId name;
// Token: 0x04000BA4 RID: 2980
private int language;
}
}
@@ -0,0 +1,49 @@
using System;
namespace System.Resources
{
// Token: 0x02000283 RID: 643
internal enum Win32ResourceType
{
// Token: 0x04000B8C RID: 2956
RT_CURSOR = 1,
// Token: 0x04000B8D RID: 2957
RT_FONT = 8,
// Token: 0x04000B8E RID: 2958
RT_BITMAP = 2,
// Token: 0x04000B8F RID: 2959
RT_ICON,
// Token: 0x04000B90 RID: 2960
RT_MENU,
// Token: 0x04000B91 RID: 2961
RT_DIALOG,
// Token: 0x04000B92 RID: 2962
RT_STRING,
// Token: 0x04000B93 RID: 2963
RT_FONTDIR,
// Token: 0x04000B94 RID: 2964
RT_ACCELERATOR = 9,
// Token: 0x04000B95 RID: 2965
RT_RCDATA,
// Token: 0x04000B96 RID: 2966
RT_MESSAGETABLE,
// Token: 0x04000B97 RID: 2967
RT_GROUP_CURSOR,
// Token: 0x04000B98 RID: 2968
RT_GROUP_ICON = 14,
// Token: 0x04000B99 RID: 2969
RT_VERSION = 16,
// Token: 0x04000B9A RID: 2970
RT_DLGINCLUDE,
// Token: 0x04000B9B RID: 2971
RT_PLUGPLAY = 19,
// Token: 0x04000B9C RID: 2972
RT_VXD,
// Token: 0x04000B9D RID: 2973
RT_ANICURSOR,
// Token: 0x04000B9E RID: 2974
RT_ANIICON,
// Token: 0x04000B9F RID: 2975
RT_HTML
}
}
@@ -0,0 +1,438 @@
using System;
using System.Collections;
using System.IO;
using System.Text;
namespace System.Resources
{
// Token: 0x02000289 RID: 649
internal class Win32VersionResource : Win32Resource
{
// Token: 0x060020B4 RID: 8372 RVA: 0x00077CDC File Offset: 0x00075EDC
public Win32VersionResource(int id, int language, bool compilercontext)
: base(Win32ResourceType.RT_VERSION, id, language)
{
this.signature = (long)((ulong)(-17890115));
this.struct_version = 65536;
this.file_flags_mask = 63;
this.file_flags = 0;
this.file_os = 4;
this.file_type = 2;
this.file_subtype = 0;
this.file_date = 0L;
this.file_lang = ((!compilercontext) ? 127 : 0);
this.file_codepage = 1200;
this.properties = new Hashtable();
string text = ((!compilercontext) ? " " : string.Empty);
foreach (string text2 in this.WellKnownProperties)
{
this.properties[text2] = text;
}
this.LegalCopyright = " ";
this.FileDescription = " ";
}
// Token: 0x1700061C RID: 1564
// (get) Token: 0x060020B5 RID: 8373 RVA: 0x00077E04 File Offset: 0x00076004
// (set) Token: 0x060020B6 RID: 8374 RVA: 0x00077E94 File Offset: 0x00076094
public string Version
{
get
{
return string.Concat(new object[]
{
string.Empty,
this.file_version >> 48,
".",
(this.file_version >> 32) & 65535L,
".",
(this.file_version >> 16) & 65535L,
".",
this.file_version & 65535L
});
}
set
{
long[] array = new long[4];
if (value != null)
{
string[] array2 = value.Split(new char[] { '.' });
try
{
for (int i = 0; i < array2.Length; i++)
{
if (i < array.Length)
{
array[i] = (long)int.Parse(array2[i]);
}
}
}
catch (FormatException)
{
}
}
this.file_version = (array[0] << 48) | (array[1] << 32) | ((array[2] << 16) + array[3]);
this.properties["FileVersion"] = this.Version;
}
}
// Token: 0x1700061D RID: 1565
public virtual string this[string key]
{
set
{
this.properties[key] = value;
}
}
// Token: 0x1700061E RID: 1566
// (get) Token: 0x060020B8 RID: 8376 RVA: 0x00077F54 File Offset: 0x00076154
// (set) Token: 0x060020B9 RID: 8377 RVA: 0x00077F6C File Offset: 0x0007616C
public virtual string Comments
{
get
{
return (string)this.properties["Comments"];
}
set
{
this.properties["Comments"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x1700061F RID: 1567
// (get) Token: 0x060020BA RID: 8378 RVA: 0x00077F9C File Offset: 0x0007619C
// (set) Token: 0x060020BB RID: 8379 RVA: 0x00077FB4 File Offset: 0x000761B4
public virtual string CompanyName
{
get
{
return (string)this.properties["CompanyName"];
}
set
{
this.properties["CompanyName"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000620 RID: 1568
// (get) Token: 0x060020BC RID: 8380 RVA: 0x00077FE4 File Offset: 0x000761E4
// (set) Token: 0x060020BD RID: 8381 RVA: 0x00077FFC File Offset: 0x000761FC
public virtual string LegalCopyright
{
get
{
return (string)this.properties["LegalCopyright"];
}
set
{
this.properties["LegalCopyright"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000621 RID: 1569
// (get) Token: 0x060020BE RID: 8382 RVA: 0x0007802C File Offset: 0x0007622C
// (set) Token: 0x060020BF RID: 8383 RVA: 0x00078044 File Offset: 0x00076244
public virtual string LegalTrademarks
{
get
{
return (string)this.properties["LegalTrademarks"];
}
set
{
this.properties["LegalTrademarks"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000622 RID: 1570
// (get) Token: 0x060020C0 RID: 8384 RVA: 0x00078074 File Offset: 0x00076274
// (set) Token: 0x060020C1 RID: 8385 RVA: 0x0007808C File Offset: 0x0007628C
public virtual string OriginalFilename
{
get
{
return (string)this.properties["OriginalFilename"];
}
set
{
this.properties["OriginalFilename"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000623 RID: 1571
// (get) Token: 0x060020C2 RID: 8386 RVA: 0x000780BC File Offset: 0x000762BC
// (set) Token: 0x060020C3 RID: 8387 RVA: 0x000780D4 File Offset: 0x000762D4
public virtual string ProductName
{
get
{
return (string)this.properties["ProductName"];
}
set
{
this.properties["ProductName"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000624 RID: 1572
// (get) Token: 0x060020C4 RID: 8388 RVA: 0x00078104 File Offset: 0x00076304
// (set) Token: 0x060020C5 RID: 8389 RVA: 0x0007811C File Offset: 0x0007631C
public virtual string ProductVersion
{
get
{
return (string)this.properties["ProductVersion"];
}
set
{
if (value == null || value.Length == 0)
{
value = " ";
}
long[] array = new long[4];
string[] array2 = value.Split(new char[] { '.' });
try
{
for (int i = 0; i < array2.Length; i++)
{
if (i < array.Length)
{
array[i] = (long)int.Parse(array2[i]);
}
}
}
catch (FormatException)
{
}
this.properties["ProductVersion"] = value;
this.product_version = (array[0] << 48) | (array[1] << 32) | ((array[2] << 16) + array[3]);
}
}
// Token: 0x17000625 RID: 1573
// (get) Token: 0x060020C6 RID: 8390 RVA: 0x000781DC File Offset: 0x000763DC
// (set) Token: 0x060020C7 RID: 8391 RVA: 0x000781F4 File Offset: 0x000763F4
public virtual string InternalName
{
get
{
return (string)this.properties["InternalName"];
}
set
{
this.properties["InternalName"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000626 RID: 1574
// (get) Token: 0x060020C8 RID: 8392 RVA: 0x00078224 File Offset: 0x00076424
// (set) Token: 0x060020C9 RID: 8393 RVA: 0x0007823C File Offset: 0x0007643C
public virtual string FileDescription
{
get
{
return (string)this.properties["FileDescription"];
}
set
{
this.properties["FileDescription"] = ((!(value == string.Empty)) ? value : " ");
}
}
// Token: 0x17000627 RID: 1575
// (get) Token: 0x060020CA RID: 8394 RVA: 0x0007826C File Offset: 0x0007646C
// (set) Token: 0x060020CB RID: 8395 RVA: 0x00078274 File Offset: 0x00076474
public virtual int FileLanguage
{
get
{
return this.file_lang;
}
set
{
this.file_lang = value;
}
}
// Token: 0x17000628 RID: 1576
// (get) Token: 0x060020CC RID: 8396 RVA: 0x00078280 File Offset: 0x00076480
// (set) Token: 0x060020CD RID: 8397 RVA: 0x00078298 File Offset: 0x00076498
public virtual string FileVersion
{
get
{
return (string)this.properties["FileVersion"];
}
set
{
if (value == null || value.Length == 0)
{
value = " ";
}
long[] array = new long[4];
string[] array2 = value.Split(new char[] { '.' });
try
{
for (int i = 0; i < array2.Length; i++)
{
if (i < array.Length)
{
array[i] = (long)int.Parse(array2[i]);
}
}
}
catch (FormatException)
{
}
this.properties["FileVersion"] = value;
this.file_version = (array[0] << 48) | (array[1] << 32) | ((array[2] << 16) + array[3]);
}
}
// Token: 0x060020CE RID: 8398 RVA: 0x00078358 File Offset: 0x00076558
private void emit_padding(BinaryWriter w)
{
Stream baseStream = w.BaseStream;
if (baseStream.Position % 4L != 0L)
{
w.Write(0);
}
}
// Token: 0x060020CF RID: 8399 RVA: 0x00078384 File Offset: 0x00076584
private void patch_length(BinaryWriter w, long len_pos)
{
Stream baseStream = w.BaseStream;
long position = baseStream.Position;
baseStream.Position = len_pos;
w.Write((short)(position - len_pos));
baseStream.Position = position;
}
// Token: 0x060020D0 RID: 8400 RVA: 0x000783B8 File Offset: 0x000765B8
public override void WriteTo(Stream ms)
{
using (BinaryWriter binaryWriter = new BinaryWriter(ms, Encoding.Unicode))
{
binaryWriter.Write(0);
binaryWriter.Write(52);
binaryWriter.Write(0);
binaryWriter.Write("VS_VERSION_INFO".ToCharArray());
binaryWriter.Write(0);
this.emit_padding(binaryWriter);
binaryWriter.Write((uint)this.signature);
binaryWriter.Write(this.struct_version);
binaryWriter.Write((int)(this.file_version >> 32));
binaryWriter.Write((int)(this.file_version & (long)((ulong)(-1))));
binaryWriter.Write((int)(this.product_version >> 32));
binaryWriter.Write((int)(this.product_version & (long)((ulong)(-1))));
binaryWriter.Write(this.file_flags_mask);
binaryWriter.Write(this.file_flags);
binaryWriter.Write(this.file_os);
binaryWriter.Write(this.file_type);
binaryWriter.Write(this.file_subtype);
binaryWriter.Write((int)(this.file_date >> 32));
binaryWriter.Write((int)(this.file_date & (long)((ulong)(-1))));
this.emit_padding(binaryWriter);
long position = ms.Position;
binaryWriter.Write(0);
binaryWriter.Write(0);
binaryWriter.Write(1);
binaryWriter.Write("VarFileInfo".ToCharArray());
binaryWriter.Write(0);
if (ms.Position % 4L != 0L)
{
binaryWriter.Write(0);
}
long position2 = ms.Position;
binaryWriter.Write(0);
binaryWriter.Write(4);
binaryWriter.Write(0);
binaryWriter.Write("Translation".ToCharArray());
binaryWriter.Write(0);
if (ms.Position % 4L != 0L)
{
binaryWriter.Write(0);
}
binaryWriter.Write((short)this.file_lang);
binaryWriter.Write((short)this.file_codepage);
this.patch_length(binaryWriter, position2);
this.patch_length(binaryWriter, position);
long position3 = ms.Position;
binaryWriter.Write(0);
binaryWriter.Write(0);
binaryWriter.Write(1);
binaryWriter.Write("StringFileInfo".ToCharArray());
this.emit_padding(binaryWriter);
long position4 = ms.Position;
binaryWriter.Write(0);
binaryWriter.Write(0);
binaryWriter.Write(1);
binaryWriter.Write(string.Format("{0:x4}{1:x4}", this.file_lang, this.file_codepage).ToCharArray());
this.emit_padding(binaryWriter);
foreach (object obj in this.properties.Keys)
{
string text = (string)obj;
string text2 = (string)this.properties[text];
long position5 = ms.Position;
binaryWriter.Write(0);
binaryWriter.Write((short)(text2.ToCharArray().Length + 1));
binaryWriter.Write(1);
binaryWriter.Write(text.ToCharArray());
binaryWriter.Write(0);
this.emit_padding(binaryWriter);
binaryWriter.Write(text2.ToCharArray());
binaryWriter.Write(0);
this.emit_padding(binaryWriter);
this.patch_length(binaryWriter, position5);
}
this.patch_length(binaryWriter, position4);
this.patch_length(binaryWriter, position3);
this.patch_length(binaryWriter, 0L);
}
}
// Token: 0x04000BA8 RID: 2984
public string[] WellKnownProperties = new string[] { "Comments", "CompanyName", "FileVersion", "InternalName", "LegalTrademarks", "OriginalFilename", "ProductName", "ProductVersion" };
// Token: 0x04000BA9 RID: 2985
private long signature;
// Token: 0x04000BAA RID: 2986
private int struct_version;
// Token: 0x04000BAB RID: 2987
private long file_version;
// Token: 0x04000BAC RID: 2988
private long product_version;
// Token: 0x04000BAD RID: 2989
private int file_flags_mask;
// Token: 0x04000BAE RID: 2990
private int file_flags;
// Token: 0x04000BAF RID: 2991
private int file_os;
// Token: 0x04000BB0 RID: 2992
private int file_type;
// Token: 0x04000BB1 RID: 2993
private int file_subtype;
// Token: 0x04000BB2 RID: 2994
private long file_date;
// Token: 0x04000BB3 RID: 2995
private int file_lang;
// Token: 0x04000BB4 RID: 2996
private int file_codepage;
// Token: 0x04000BB5 RID: 2997
private Hashtable properties;
}
}