scripts
This commit is contained in:
@@ -0,0 +1,334 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net.Mime
|
||||
{
|
||||
/// <summary>Represents a MIME protocol Content-Disposition header.</summary>
|
||||
// Token: 0x0200014E RID: 334
|
||||
public class ContentDisposition
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mime.ContentDisposition" /> class with a <see cref="P:System.Net.Mime.ContentDisposition.DispositionType" /> of <see cref="F:System.Net.Mime.DispositionTypeNames.Attachment" />. </summary>
|
||||
// Token: 0x06000B6C RID: 2924 RVA: 0x00023020 File Offset: 0x00021220
|
||||
public ContentDisposition()
|
||||
: this("attachment")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mime.ContentDisposition" /> class with the specified disposition information.</summary>
|
||||
/// <param name="disposition">A <see cref="T:System.Net.Mime.DispositionTypeNames" /> value that contains the disposition.</param>
|
||||
/// <exception cref="T:System.FormatException">
|
||||
/// <paramref name="disposition" /> is null or equal to <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
// Token: 0x06000B6D RID: 2925 RVA: 0x00023030 File Offset: 0x00021230
|
||||
public ContentDisposition(string disposition)
|
||||
{
|
||||
if (disposition == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
if (disposition.Length < 1)
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
this.Size = -1L;
|
||||
try
|
||||
{
|
||||
int num = disposition.IndexOf(';');
|
||||
if (num < 0)
|
||||
{
|
||||
this.dispositionType = disposition.Trim();
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] array = disposition.Split(new char[] { ';' });
|
||||
this.dispositionType = array[0].Trim();
|
||||
for (int i = 1; i < array.Length; i++)
|
||||
{
|
||||
this.Parse(array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000B6E RID: 2926 RVA: 0x00023100 File Offset: 0x00021300
|
||||
private void Parse(string pair)
|
||||
{
|
||||
if (pair == null || pair.Length < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] array = pair.Split(new char[] { '=' });
|
||||
if (array.Length == 2)
|
||||
{
|
||||
this.parameters.Add(array[0].Trim(), array[1].Trim());
|
||||
return;
|
||||
}
|
||||
throw new FormatException();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the creation date for a file attachment.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> value that indicates the file creation date; otherwise, <see cref="F:System.DateTime.MinValue" /> if no date was specified.</returns>
|
||||
// Token: 0x170002DB RID: 731
|
||||
// (get) Token: 0x06000B6F RID: 2927 RVA: 0x00023164 File Offset: 0x00021364
|
||||
// (set) Token: 0x06000B70 RID: 2928 RVA: 0x000231A8 File Offset: 0x000213A8
|
||||
public DateTime CreationDate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.parameters.ContainsKey("creation-date"))
|
||||
{
|
||||
return DateTime.ParseExact(this.parameters["creation-date"], "dd MMM yyyy HH':'mm':'ss zz00", null);
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > DateTime.MinValue)
|
||||
{
|
||||
this.parameters["creation-date"] = value.ToString("dd MMM yyyy HH':'mm':'ss zz00");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.parameters.Remove("modification-date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the disposition type for an e-mail attachment.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the disposition type. The value is not restricted but is typically one of the <see cref="P:System.Net.Mime.ContentDisposition.DispositionType" /> values.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is equal to <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
// Token: 0x170002DC RID: 732
|
||||
// (get) Token: 0x06000B71 RID: 2929 RVA: 0x000231F8 File Offset: 0x000213F8
|
||||
// (set) Token: 0x06000B72 RID: 2930 RVA: 0x00023200 File Offset: 0x00021400
|
||||
public string DispositionType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.dispositionType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
if (value.Length < 1)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
this.dispositionType = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the suggested file name for an e-mail attachment.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the file name. </returns>
|
||||
// Token: 0x170002DD RID: 733
|
||||
// (get) Token: 0x06000B73 RID: 2931 RVA: 0x00023228 File Offset: 0x00021428
|
||||
// (set) Token: 0x06000B74 RID: 2932 RVA: 0x0002323C File Offset: 0x0002143C
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters["filename"];
|
||||
}
|
||||
set
|
||||
{
|
||||
this.parameters["filename"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that determines the disposition type (Inline or Attachment) for an e-mail attachment.</summary>
|
||||
/// <returns>true if content in the attachment is presented inline as part of the e-mail body; otherwise, false. </returns>
|
||||
// Token: 0x170002DE RID: 734
|
||||
// (get) Token: 0x06000B75 RID: 2933 RVA: 0x00023250 File Offset: 0x00021450
|
||||
// (set) Token: 0x06000B76 RID: 2934 RVA: 0x0002326C File Offset: 0x0002146C
|
||||
public bool Inline
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Compare(this.dispositionType, "inline", true, CultureInfo.InvariantCulture) == 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
this.dispositionType = "inline";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dispositionType = "attachment";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the modification date for a file attachment.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> value that indicates the file modification date; otherwise, <see cref="F:System.DateTime.MinValue" /> if no date was specified.</returns>
|
||||
// Token: 0x170002DF RID: 735
|
||||
// (get) Token: 0x06000B77 RID: 2935 RVA: 0x00023290 File Offset: 0x00021490
|
||||
// (set) Token: 0x06000B78 RID: 2936 RVA: 0x000232D4 File Offset: 0x000214D4
|
||||
public DateTime ModificationDate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.parameters.ContainsKey("modification-date"))
|
||||
{
|
||||
return DateTime.ParseExact(this.parameters["modification-date"], "dd MMM yyyy HH':'mm':'ss zz00", null);
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > DateTime.MinValue)
|
||||
{
|
||||
this.parameters["modification-date"] = value.ToString("dd MMM yyyy HH':'mm':'ss zz00");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.parameters.Remove("modification-date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the parameters included in the Content-Disposition header represented by this instance.</summary>
|
||||
/// <returns>A writable <see cref="T:System.Collections.Specialized.StringDictionary" /> that contains parameter name/value pairs.</returns>
|
||||
// Token: 0x170002E0 RID: 736
|
||||
// (get) Token: 0x06000B79 RID: 2937 RVA: 0x00023324 File Offset: 0x00021524
|
||||
public global::System.Collections.Specialized.StringDictionary Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the read date for a file attachment.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> value that indicates the file read date; otherwise, <see cref="F:System.DateTime.MinValue" /> if no date was specified.</returns>
|
||||
// Token: 0x170002E1 RID: 737
|
||||
// (get) Token: 0x06000B7A RID: 2938 RVA: 0x0002332C File Offset: 0x0002152C
|
||||
// (set) Token: 0x06000B7B RID: 2939 RVA: 0x00023370 File Offset: 0x00021570
|
||||
public DateTime ReadDate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.parameters.ContainsKey("read-date"))
|
||||
{
|
||||
return DateTime.ParseExact(this.parameters["read-date"], "dd MMM yyyy HH':'mm':'ss zz00", null);
|
||||
}
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > DateTime.MinValue)
|
||||
{
|
||||
this.parameters["read-date"] = value.ToString("dd MMM yyyy HH':'mm':'ss zz00");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.parameters.Remove("read-date");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the size of a file attachment.</summary>
|
||||
/// <returns>A <see cref="T:System.Int32" /> that specifies the number of bytes in the file attachment. The default value is -1, which indicates that the file size is unknown.</returns>
|
||||
// Token: 0x170002E2 RID: 738
|
||||
// (get) Token: 0x06000B7C RID: 2940 RVA: 0x000233C0 File Offset: 0x000215C0
|
||||
// (set) Token: 0x06000B7D RID: 2941 RVA: 0x000233F0 File Offset: 0x000215F0
|
||||
public long Size
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.parameters.ContainsKey("size"))
|
||||
{
|
||||
return long.Parse(this.parameters["size"]);
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value > -1L)
|
||||
{
|
||||
this.parameters["size"] = value.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.parameters.Remove("size");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the content-disposition header of the specified <see cref="T:System.Net.Mime.ContentDisposition" /> object is equal to the content-disposition header of this object.</summary>
|
||||
/// <returns>true if the content-disposition headers are the same; otherwise false.</returns>
|
||||
/// <param name="rparam">The <see cref="T:System.Net.Mime.ContentDisposition" /> object to compare with this object.</param>
|
||||
// Token: 0x06000B7E RID: 2942 RVA: 0x00023434 File Offset: 0x00021634
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this.Equals(obj as ContentDisposition);
|
||||
}
|
||||
|
||||
// Token: 0x06000B7F RID: 2943 RVA: 0x00023444 File Offset: 0x00021644
|
||||
private bool Equals(ContentDisposition other)
|
||||
{
|
||||
return other != null && this.ToString() == other.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Determines the hash code of the specified <see cref="T:System.Net.Mime.ContentDisposition" /> object</summary>
|
||||
/// <returns>An integer hash value.</returns>
|
||||
// Token: 0x06000B80 RID: 2944 RVA: 0x00023460 File Offset: 0x00021660
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.ToString().GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>Returns a <see cref="T:System.String" /> representation of this instance.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the property values for this instance.</returns>
|
||||
// Token: 0x06000B81 RID: 2945 RVA: 0x00023470 File Offset: 0x00021670
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append(this.DispositionType.ToLower());
|
||||
if (this.Parameters != null && this.Parameters.Count > 0)
|
||||
{
|
||||
foreach (object obj in this.Parameters)
|
||||
{
|
||||
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
|
||||
if (dictionaryEntry.Value != null && dictionaryEntry.Value.ToString().Length > 0)
|
||||
{
|
||||
stringBuilder.Append("; ");
|
||||
stringBuilder.Append(dictionaryEntry.Key);
|
||||
stringBuilder.Append("=");
|
||||
string text = dictionaryEntry.Key.ToString();
|
||||
string text2 = dictionaryEntry.Value.ToString();
|
||||
bool flag = (text == "filename" && text2.IndexOf(' ') != -1) || text.EndsWith("date");
|
||||
if (flag)
|
||||
{
|
||||
stringBuilder.Append("\"");
|
||||
}
|
||||
stringBuilder.Append(text2);
|
||||
if (flag)
|
||||
{
|
||||
stringBuilder.Append("\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x04000B74 RID: 2932
|
||||
private const string rfc822 = "dd MMM yyyy HH':'mm':'ss zz00";
|
||||
|
||||
// Token: 0x04000B75 RID: 2933
|
||||
private string dispositionType;
|
||||
|
||||
// Token: 0x04000B76 RID: 2934
|
||||
private global::System.Collections.Specialized.StringDictionary parameters = new global::System.Collections.Specialized.StringDictionary();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,321 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net.Mime
|
||||
{
|
||||
/// <summary>Represents a MIME protocol Content-Type header.</summary>
|
||||
// Token: 0x0200014F RID: 335
|
||||
public class ContentType
|
||||
{
|
||||
/// <summary>Initializes a new default instance of the <see cref="T:System.Net.Mime.ContentType" /> class. </summary>
|
||||
// Token: 0x06000B82 RID: 2946 RVA: 0x000235E4 File Offset: 0x000217E4
|
||||
public ContentType()
|
||||
{
|
||||
this.mediaType = "application/octet-stream";
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mime.ContentType" /> class using the specified string. </summary>
|
||||
/// <param name="contentType">A <see cref="T:System.String" />, for example, "text/plain; charset=us-ascii", that contains the MIME media type, subtype, and optional parameters.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="contentType" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="contentType" /> is <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
/// <exception cref="T:System.FormatException">
|
||||
/// <paramref name="contentType" /> is in a form that cannot be parsed.</exception>
|
||||
// Token: 0x06000B83 RID: 2947 RVA: 0x00023604 File Offset: 0x00021804
|
||||
public ContentType(string contentType)
|
||||
{
|
||||
if (contentType == null)
|
||||
{
|
||||
throw new ArgumentNullException("contentType");
|
||||
}
|
||||
if (contentType.Length < 1)
|
||||
{
|
||||
throw new ArgumentException("contentType");
|
||||
}
|
||||
int num = contentType.IndexOf(';');
|
||||
if (num > 0)
|
||||
{
|
||||
string[] array = contentType.Split(new char[] { ';' });
|
||||
this.MediaType = array[0].Trim();
|
||||
for (int i = 1; i < array.Length; i++)
|
||||
{
|
||||
this.Parse(array[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.MediaType = contentType.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000B85 RID: 2949 RVA: 0x000236C4 File Offset: 0x000218C4
|
||||
private void Parse(string pair)
|
||||
{
|
||||
if (pair == null || pair.Length < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string[] array = pair.Split(new char[] { '=' });
|
||||
if (array.Length == 2)
|
||||
{
|
||||
this.parameters.Add(array[0].Trim(), array[1].Trim());
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170002E3 RID: 739
|
||||
// (get) Token: 0x06000B86 RID: 2950 RVA: 0x0002371C File Offset: 0x0002191C
|
||||
private static Encoding UTF8Unmarked
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ContentType.utf8unmarked == null)
|
||||
{
|
||||
ContentType.utf8unmarked = new UTF8Encoding(false);
|
||||
}
|
||||
return ContentType.utf8unmarked;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value of the boundary parameter included in the Content-Type header represented by this instance.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the value associated with the boundary parameter.</returns>
|
||||
// Token: 0x170002E4 RID: 740
|
||||
// (get) Token: 0x06000B87 RID: 2951 RVA: 0x00023738 File Offset: 0x00021938
|
||||
// (set) Token: 0x06000B88 RID: 2952 RVA: 0x0002374C File Offset: 0x0002194C
|
||||
public string Boundary
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters["boundary"];
|
||||
}
|
||||
set
|
||||
{
|
||||
this.parameters["boundary"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value of the charset parameter included in the Content-Type header represented by this instance.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the value associated with the charset parameter.</returns>
|
||||
// Token: 0x170002E5 RID: 741
|
||||
// (get) Token: 0x06000B89 RID: 2953 RVA: 0x00023760 File Offset: 0x00021960
|
||||
// (set) Token: 0x06000B8A RID: 2954 RVA: 0x00023774 File Offset: 0x00021974
|
||||
public string CharSet
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters["charset"];
|
||||
}
|
||||
set
|
||||
{
|
||||
this.parameters["charset"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the media type value included in the Content-Type header represented by this instance.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the media type and subtype value. This value does not include the semicolon (;) separator that follows the subtype.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">The value specified for a set operation is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The value specified for a set operation is <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
/// <exception cref="T:System.FormatException">The value specified for a set operation is in a form that cannot be parsed.</exception>
|
||||
// Token: 0x170002E6 RID: 742
|
||||
// (get) Token: 0x06000B8B RID: 2955 RVA: 0x00023788 File Offset: 0x00021988
|
||||
// (set) Token: 0x06000B8C RID: 2956 RVA: 0x00023790 File Offset: 0x00021990
|
||||
public string MediaType
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.mediaType;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
if (value.Length < 1)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
if (value.IndexOf('/') < 1)
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
if (value.IndexOf(';') != -1)
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
this.mediaType = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the value of the name parameter included in the Content-Type header represented by this instance.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the value associated with the name parameter. </returns>
|
||||
// Token: 0x170002E7 RID: 743
|
||||
// (get) Token: 0x06000B8D RID: 2957 RVA: 0x000237EC File Offset: 0x000219EC
|
||||
// (set) Token: 0x06000B8E RID: 2958 RVA: 0x00023800 File Offset: 0x00021A00
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters["name"];
|
||||
}
|
||||
set
|
||||
{
|
||||
this.parameters["name"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the dictionary that contains the parameters included in the Content-Type header represented by this instance.</summary>
|
||||
/// <returns>A writable <see cref="T:System.Collections.Specialized.StringDictionary" /> that contains name and value pairs.</returns>
|
||||
// Token: 0x170002E8 RID: 744
|
||||
// (get) Token: 0x06000B8F RID: 2959 RVA: 0x00023814 File Offset: 0x00021A14
|
||||
public global::System.Collections.Specialized.StringDictionary Parameters
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.parameters;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the content-type header of the specified <see cref="T:System.Net.Mime.ContentType" /> object is equal to the content-type header of this object.</summary>
|
||||
/// <returns>true if the content-type headers are the same; otherwise false.</returns>
|
||||
/// <param name="rparam">The <see cref="T:System.Net.Mime.ContentType" /> object to compare with this object.</param>
|
||||
// Token: 0x06000B90 RID: 2960 RVA: 0x0002381C File Offset: 0x00021A1C
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this.Equals(obj as ContentType);
|
||||
}
|
||||
|
||||
// Token: 0x06000B91 RID: 2961 RVA: 0x0002382C File Offset: 0x00021A2C
|
||||
private bool Equals(ContentType other)
|
||||
{
|
||||
return other != null && this.ToString() == other.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Determines the hash code of the specified <see cref="T:System.Net.Mime.ContentType" /> object</summary>
|
||||
/// <returns>An integer hash value.</returns>
|
||||
// Token: 0x06000B92 RID: 2962 RVA: 0x00023848 File Offset: 0x00021A48
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.ToString().GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>Returns a string representation of this <see cref="T:System.Net.Mime.ContentType" /> object.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the current settings for this <see cref="T:System.Net.Mime.ContentType" />.</returns>
|
||||
// Token: 0x06000B93 RID: 2963 RVA: 0x00023858 File Offset: 0x00021A58
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
Encoding encoding = ((this.CharSet == null) ? Encoding.UTF8 : Encoding.GetEncoding(this.CharSet));
|
||||
stringBuilder.Append(this.MediaType);
|
||||
if (this.Parameters != null && this.Parameters.Count > 0)
|
||||
{
|
||||
foreach (object obj in this.parameters)
|
||||
{
|
||||
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
|
||||
if (dictionaryEntry.Value != null && dictionaryEntry.Value.ToString().Length > 0)
|
||||
{
|
||||
stringBuilder.Append("; ");
|
||||
stringBuilder.Append(dictionaryEntry.Key);
|
||||
stringBuilder.Append("=");
|
||||
stringBuilder.Append(ContentType.WrapIfEspecialsExist(ContentType.EncodeSubjectRFC2047(dictionaryEntry.Value as string, encoding)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06000B94 RID: 2964 RVA: 0x00023980 File Offset: 0x00021B80
|
||||
private static string WrapIfEspecialsExist(string s)
|
||||
{
|
||||
s = s.Replace("\"", "\\\"");
|
||||
if (s.IndexOfAny(ContentType.especials) >= 0)
|
||||
{
|
||||
return '"' + s + '"';
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// Token: 0x06000B95 RID: 2965 RVA: 0x000239BC File Offset: 0x00021BBC
|
||||
internal static Encoding GuessEncoding(string s)
|
||||
{
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
if (s[i] >= '\u0080')
|
||||
{
|
||||
return ContentType.UTF8Unmarked;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06000B96 RID: 2966 RVA: 0x000239F8 File Offset: 0x00021BF8
|
||||
internal static TransferEncoding GuessTransferEncoding(Encoding enc)
|
||||
{
|
||||
if (Encoding.ASCII.Equals(enc))
|
||||
{
|
||||
return TransferEncoding.SevenBit;
|
||||
}
|
||||
if (Encoding.UTF8.CodePage == enc.CodePage || Encoding.Unicode.CodePage == enc.CodePage)
|
||||
{
|
||||
return TransferEncoding.Base64;
|
||||
}
|
||||
return TransferEncoding.QuotedPrintable;
|
||||
}
|
||||
|
||||
// Token: 0x06000B97 RID: 2967 RVA: 0x00023A44 File Offset: 0x00021C44
|
||||
internal static string To2047(byte[] bytes)
|
||||
{
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
foreach (byte b in bytes)
|
||||
{
|
||||
if (b > 127 || b == 9)
|
||||
{
|
||||
stringWriter.Write("=");
|
||||
stringWriter.Write(Convert.ToString(b, 16).ToUpper());
|
||||
}
|
||||
else
|
||||
{
|
||||
stringWriter.Write(Convert.ToChar(b));
|
||||
}
|
||||
}
|
||||
return stringWriter.GetStringBuilder().ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06000B98 RID: 2968 RVA: 0x00023ABC File Offset: 0x00021CBC
|
||||
internal static string EncodeSubjectRFC2047(string s, Encoding enc)
|
||||
{
|
||||
if (s == null || Encoding.ASCII.Equals(enc))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
if (s[i] >= '\u0080')
|
||||
{
|
||||
string text = ContentType.To2047(enc.GetBytes(s));
|
||||
return string.Concat(new string[] { "=?", enc.HeaderName, "?Q?", text, "?=" });
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// Token: 0x04000B77 RID: 2935
|
||||
private static Encoding utf8unmarked;
|
||||
|
||||
// Token: 0x04000B78 RID: 2936
|
||||
private string mediaType;
|
||||
|
||||
// Token: 0x04000B79 RID: 2937
|
||||
private global::System.Collections.Specialized.StringDictionary parameters = new global::System.Collections.Specialized.StringDictionary();
|
||||
|
||||
// Token: 0x04000B7A RID: 2938
|
||||
private static readonly char[] especials = new char[]
|
||||
{
|
||||
'(', ')', '<', '>', '@', ',', ';', ':', '<', '>',
|
||||
'/', '[', ']', '?', '.', '='
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace System.Net.Mime
|
||||
{
|
||||
/// <summary>Supplies the strings used to specify the disposition type for an e-mail attachment.</summary>
|
||||
// Token: 0x02000150 RID: 336
|
||||
public static class DispositionTypeNames
|
||||
{
|
||||
/// <summary>Specifies that the attachment is to be displayed as a file attached to the e-mail message.</summary>
|
||||
// Token: 0x04000B7B RID: 2939
|
||||
public const string Attachment = "attachment";
|
||||
|
||||
/// <summary>Specifies that the attachment is to be displayed as part of the e-mail message body.</summary>
|
||||
// Token: 0x04000B7C RID: 2940
|
||||
public const string Inline = "inline";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
|
||||
namespace System.Net.Mime
|
||||
{
|
||||
/// <summary>Specifies the media type information for an e-mail message attachment.</summary>
|
||||
// Token: 0x02000151 RID: 337
|
||||
public static class MediaTypeNames
|
||||
{
|
||||
/// <summary>Specifies the kind of application data in an e-mail message attachment.</summary>
|
||||
// Token: 0x02000152 RID: 338
|
||||
public static class Application
|
||||
{
|
||||
// Token: 0x04000B7D RID: 2941
|
||||
private const string prefix = "application/";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Application" /> data is not interpreted.</summary>
|
||||
// Token: 0x04000B7E RID: 2942
|
||||
public const string Octet = "application/octet-stream";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Application" /> data is in Portable Document Format (PDF).</summary>
|
||||
// Token: 0x04000B7F RID: 2943
|
||||
public const string Pdf = "application/pdf";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Application" /> data is in Rich Text Format (RTF).</summary>
|
||||
// Token: 0x04000B80 RID: 2944
|
||||
public const string Rtf = "application/rtf";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Application" /> data is a SOAP document.</summary>
|
||||
// Token: 0x04000B81 RID: 2945
|
||||
public const string Soap = "application/soap+xml";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Application" /> data is compressed.</summary>
|
||||
// Token: 0x04000B82 RID: 2946
|
||||
public const string Zip = "application/zip";
|
||||
}
|
||||
|
||||
/// <summary>Specifies the type of image data in an e-mail message attachment.</summary>
|
||||
// Token: 0x02000153 RID: 339
|
||||
public static class Image
|
||||
{
|
||||
// Token: 0x04000B83 RID: 2947
|
||||
private const string prefix = "image/";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Image" /> data is in Graphics Interchange Format (GIF).</summary>
|
||||
// Token: 0x04000B84 RID: 2948
|
||||
public const string Gif = "image/gif";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Image" /> data is in Joint Photographic Experts Group (JPEG) format.</summary>
|
||||
// Token: 0x04000B85 RID: 2949
|
||||
public const string Jpeg = "image/jpeg";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Image" /> data is in Tagged Image File Format (TIFF).</summary>
|
||||
// Token: 0x04000B86 RID: 2950
|
||||
public const string Tiff = "image/tiff";
|
||||
}
|
||||
|
||||
/// <summary>Specifies the type of text data in an e-mail message attachment.</summary>
|
||||
// Token: 0x02000154 RID: 340
|
||||
public static class Text
|
||||
{
|
||||
// Token: 0x04000B87 RID: 2951
|
||||
private const string prefix = "text/";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Text" /> data is in HTML format.</summary>
|
||||
// Token: 0x04000B88 RID: 2952
|
||||
public const string Html = "text/html";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Text" /> data is in plain text format.</summary>
|
||||
// Token: 0x04000B89 RID: 2953
|
||||
public const string Plain = "text/plain";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Text" /> data is in Rich Text Format (RTF).</summary>
|
||||
// Token: 0x04000B8A RID: 2954
|
||||
public const string RichText = "text/richtext";
|
||||
|
||||
/// <summary>Specifies that the <see cref="T:System.Net.Mime.MediaTypeNames.Text" /> data is in XML format.</summary>
|
||||
// Token: 0x04000B8B RID: 2955
|
||||
public const string Xml = "text/xml";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace System.Net.Mime
|
||||
{
|
||||
/// <summary>Specifies the Content-Transfer-Encoding header information for an e-mail message attachment.</summary>
|
||||
// Token: 0x02000155 RID: 341
|
||||
public enum TransferEncoding
|
||||
{
|
||||
/// <summary>Encodes data that consists of printable characters in the US-ASCII character set. See RFC 2406 Section 6.7.</summary>
|
||||
// Token: 0x04000B8D RID: 2957
|
||||
QuotedPrintable,
|
||||
/// <summary>Encodes stream-based data. See RFC 2406 Section 6.8.</summary>
|
||||
// Token: 0x04000B8E RID: 2958
|
||||
Base64,
|
||||
/// <summary>Used for data that is not encoded. The data is in 7-bit US-ASCII characters with a total line length of no longer than 1000 characters. See RFC2406 Section 2.7.</summary>
|
||||
// Token: 0x04000B8F RID: 2959
|
||||
SevenBit,
|
||||
/// <summary>Indicates that the transfer encoding is unknown.</summary>
|
||||
// Token: 0x04000B90 RID: 2960
|
||||
Unknown = -1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user