Files
2026-06-04 11:42:34 +02:00

179 lines
9.0 KiB
C#

using System;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
namespace System
{
/// <summary>The exception that is thrown when the file image of a dynamic link library (DLL) or an executable program is invalid. </summary>
/// <filterpriority>2</filterpriority>
// Token: 0x0200063F RID: 1599
[ComVisible(true)]
[Serializable]
public class BadImageFormatException : SystemException
{
/// <summary>Initializes a new instance of the <see cref="T:System.BadImageFormatException" /> class.</summary>
// Token: 0x06003B38 RID: 15160 RVA: 0x000C9D84 File Offset: 0x000C7F84
public BadImageFormatException()
: base(Locale.GetText("Format of the executable (.exe) or library (.dll) is invalid."))
{
base.HResult = -2147024885;
}
/// <summary>Initializes a new instance of the <see cref="T:System.BadImageFormatException" /> class with a specified error message.</summary>
/// <param name="message">The message that describes the error. </param>
// Token: 0x06003B39 RID: 15161 RVA: 0x000C9DA4 File Offset: 0x000C7FA4
public BadImageFormatException(string message)
: base(message)
{
base.HResult = -2147024885;
}
/// <summary>Initializes a new instance of the <see cref="T:System.BadImageFormatException" /> class with serialized data.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
// Token: 0x06003B3A RID: 15162 RVA: 0x000C9DB8 File Offset: 0x000C7FB8
protected BadImageFormatException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
this.fileName = info.GetString("BadImageFormat_FileName");
this.fusionLog = info.GetString("BadImageFormat_FusionLog");
}
/// <summary>Initializes a new instance of the <see cref="T:System.BadImageFormatException" /> 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 a null reference, the current exception is raised in a catch block that handles the inner exception. </param>
// Token: 0x06003B3B RID: 15163 RVA: 0x000C9DF0 File Offset: 0x000C7FF0
public BadImageFormatException(string message, Exception inner)
: base(message, inner)
{
base.HResult = -2147024885;
}
/// <summary>Initializes a new instance of the <see cref="T:System.BadImageFormatException" /> class with a specified error message and file name.</summary>
/// <param name="message">A message that describes the error. </param>
/// <param name="fileName">The full name of the file with the invalid image. </param>
// Token: 0x06003B3C RID: 15164 RVA: 0x000C9E08 File Offset: 0x000C8008
public BadImageFormatException(string message, string fileName)
: base(message)
{
this.fileName = fileName;
base.HResult = -2147024885;
}
/// <summary>Initializes a new instance of the <see cref="T:System.BadImageFormatException" /> 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="fileName">The full name of the file with the invalid image. </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: 0x06003B3D RID: 15165 RVA: 0x000C9E24 File Offset: 0x000C8024
public BadImageFormatException(string message, string fileName, Exception inner)
: base(message, inner)
{
this.fileName = fileName;
base.HResult = -2147024885;
}
/// <summary>Gets the error message and the name of the file that caused this exception.</summary>
/// <returns>A string containing the error message and the name of the file that caused this exception.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B58 RID: 2904
// (get) Token: 0x06003B3E RID: 15166 RVA: 0x000C9E40 File Offset: 0x000C8040
public override string Message
{
get
{
if (this.message == null)
{
return string.Format(CultureInfo.CurrentCulture, "Could not load file or assembly '{0}' or one of its dependencies. An attempt was made to load a program with an incorrect format.", new object[] { this.fileName });
}
return base.Message;
}
}
/// <summary>Gets the name of the file that causes this exception.</summary>
/// <returns>The name of the file with the invalid image, or a null reference if no file name was passed to the constructor for the current instance.</returns>
/// <filterpriority>2</filterpriority>
// Token: 0x17000B59 RID: 2905
// (get) Token: 0x06003B3F RID: 15167 RVA: 0x000C9E80 File Offset: 0x000C8080
public string FileName
{
get
{
return this.fileName;
}
}
/// <summary>Gets the log file that describes why an assembly load failed.</summary>
/// <returns>A String containing errors reported by the assembly cache.</returns>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
/// </PermissionSet>
// Token: 0x17000B5A RID: 2906
// (get) Token: 0x06003B40 RID: 15168 RVA: 0x000C9E88 File Offset: 0x000C8088
[MonoTODO("Probably not entirely correct. fusionLog needs to be set somehow (we are probably missing internal constuctor)")]
public string FusionLog
{
get
{
return this.fusionLog;
}
}
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the file name, assembly cache log, and additional exception information.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
/// </PermissionSet>
// Token: 0x06003B41 RID: 15169 RVA: 0x000C9E90 File Offset: 0x000C8090
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("BadImageFormat_FileName", this.fileName);
info.AddValue("BadImageFormat_FusionLog", this.fusionLog);
}
/// <summary>Returns the fully qualified name of this exception and possibly the error message, the name of the inner exception, and the stack trace.</summary>
/// <returns>A string containing the fully qualified name of this exception and possibly the error message, the name of the inner exception, and the stack trace.</returns>
/// <filterpriority>2</filterpriority>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
/// </PermissionSet>
// Token: 0x06003B42 RID: 15170 RVA: 0x000C9EC8 File Offset: 0x000C80C8
public override string ToString()
{
StringBuilder stringBuilder = new StringBuilder(this.GetType().FullName);
stringBuilder.AppendFormat(": {0}", this.Message);
if (this.fileName != null && this.fileName.Length > 0)
{
stringBuilder.Append(Environment.NewLine);
stringBuilder.AppendFormat("File name: '{0}'", this.fileName);
}
if (this.InnerException != null)
{
stringBuilder.AppendFormat(" ---> {0}", this.InnerException);
}
if (this.StackTrace != null)
{
stringBuilder.Append(Environment.NewLine);
stringBuilder.Append(this.StackTrace);
}
return stringBuilder.ToString();
}
// Token: 0x040017BD RID: 6077
private const int Result = -2147024885;
// Token: 0x040017BE RID: 6078
private string fileName;
// Token: 0x040017BF RID: 6079
private string fusionLog;
}
}