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
+646
View File
@@ -0,0 +1,646 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;
namespace System.Globalization
{
/// <summary>Defines text properties and behaviors, such as casing, that are specific to a writing system. </summary>
// Token: 0x0200019A RID: 410
[ComVisible(true)]
[MonoTODO("IDeserializationCallback isn't implemented.")]
[Serializable]
public class TextInfo : ICloneable, IDeserializationCallback
{
// Token: 0x060014D6 RID: 5334 RVA: 0x00050068 File Offset: 0x0004E268
internal unsafe TextInfo(CultureInfo ci, int lcid, void* data, bool read_only)
{
this.m_isReadOnly = read_only;
this.m_win32LangID = lcid;
this.ci = ci;
if (data != null)
{
this.data = *(TextInfo.Data*)data;
}
else
{
this.data = default(TextInfo.Data);
this.data.list_sep = 44;
}
CultureInfo cultureInfo = ci;
while (cultureInfo.Parent != null && cultureInfo.Parent.LCID != 127 && cultureInfo.Parent != cultureInfo)
{
cultureInfo = cultureInfo.Parent;
}
if (cultureInfo != null)
{
int lcid2 = cultureInfo.LCID;
if (lcid2 == 31 || lcid2 == 44)
{
this.handleDotI = true;
}
}
}
// Token: 0x060014D7 RID: 5335 RVA: 0x0005012C File Offset: 0x0004E32C
private TextInfo(TextInfo textInfo)
{
this.m_win32LangID = textInfo.m_win32LangID;
this.m_nDataItem = textInfo.m_nDataItem;
this.m_useUserOverride = textInfo.m_useUserOverride;
this.m_listSeparator = textInfo.ListSeparator;
this.customCultureName = textInfo.CultureName;
this.ci = textInfo.ci;
this.handleDotI = textInfo.handleDotI;
this.data = textInfo.data;
}
/// <summary>Raises the deserialization event when deserialization is complete.</summary>
/// <param name="sender">The source of the deserialization event. </param>
// Token: 0x060014D8 RID: 5336 RVA: 0x000501A0 File Offset: 0x0004E3A0
[MonoTODO]
void IDeserializationCallback.OnDeserialization(object sender)
{
}
/// <summary>Gets the American National Standards Institute (ANSI) code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</summary>
/// <returns>The ANSI code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</returns>
// Token: 0x170003B1 RID: 945
// (get) Token: 0x060014D9 RID: 5337 RVA: 0x000501A4 File Offset: 0x0004E3A4
public virtual int ANSICodePage
{
get
{
return this.data.ansi;
}
}
/// <summary>Gets the Extended Binary Coded Decimal Interchange Code (EBCDIC) code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</summary>
/// <returns>The EBCDIC code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</returns>
// Token: 0x170003B2 RID: 946
// (get) Token: 0x060014DA RID: 5338 RVA: 0x000501C0 File Offset: 0x0004E3C0
public virtual int EBCDICCodePage
{
get
{
return this.data.ebcdic;
}
}
/// <summary>Gets the culture identifier for the culture associated with the current <see cref="T:System.Globalization.TextInfo" /> object.</summary>
/// <returns>A number that identifies the culture from which the current <see cref="T:System.Globalization.TextInfo" /> object was created.</returns>
// Token: 0x170003B3 RID: 947
// (get) Token: 0x060014DB RID: 5339 RVA: 0x000501DC File Offset: 0x0004E3DC
[ComVisible(false)]
public int LCID
{
get
{
return this.m_win32LangID;
}
}
/// <summary>Gets or sets the string that separates items in a list.</summary>
/// <returns>The string that separates items in a list.</returns>
/// <exception cref="T:System.ArgumentNullException">The value in a set operation is null.</exception>
/// <exception cref="T:System.InvalidOperationException">In a set operation, the current <see cref="T:System.Globalization.TextInfo" /> object is read-only.</exception>
// Token: 0x170003B4 RID: 948
// (get) Token: 0x060014DC RID: 5340 RVA: 0x000501E4 File Offset: 0x0004E3E4
// (set) Token: 0x060014DD RID: 5341 RVA: 0x00050220 File Offset: 0x0004E420
public virtual string ListSeparator
{
get
{
if (this.m_listSeparator == null)
{
this.m_listSeparator = ((char)this.data.list_sep).ToString();
}
return this.m_listSeparator;
}
[ComVisible(false)]
set
{
this.m_listSeparator = value;
}
}
/// <summary>Gets the Macintosh code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</summary>
/// <returns>The Macintosh code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</returns>
// Token: 0x170003B5 RID: 949
// (get) Token: 0x060014DE RID: 5342 RVA: 0x0005022C File Offset: 0x0004E42C
public virtual int MacCodePage
{
get
{
return this.data.mac;
}
}
/// <summary>Gets the original equipment manufacturer (OEM) code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</summary>
/// <returns>The OEM code page used by the writing system represented by the current <see cref="T:System.Globalization.TextInfo" />.</returns>
// Token: 0x170003B6 RID: 950
// (get) Token: 0x060014DF RID: 5343 RVA: 0x00050248 File Offset: 0x0004E448
public virtual int OEMCodePage
{
get
{
return this.data.oem;
}
}
/// <summary>Gets the name of the culture associated with the current <see cref="T:System.Globalization.TextInfo" /> object.</summary>
/// <returns>The name of a culture. </returns>
// Token: 0x170003B7 RID: 951
// (get) Token: 0x060014E0 RID: 5344 RVA: 0x00050264 File Offset: 0x0004E464
[ComVisible(false)]
public string CultureName
{
get
{
if (this.customCultureName == null)
{
this.customCultureName = this.ci.Name;
}
return this.customCultureName;
}
}
/// <summary>Gets a value indicating whether the current <see cref="T:System.Globalization.TextInfo" /> object is read-only.</summary>
/// <returns>true if the current <see cref="T:System.Globalization.TextInfo" /> object is read-only; otherwise, false.</returns>
// Token: 0x170003B8 RID: 952
// (get) Token: 0x060014E1 RID: 5345 RVA: 0x00050294 File Offset: 0x0004E494
[ComVisible(false)]
public bool IsReadOnly
{
get
{
return this.m_isReadOnly;
}
}
/// <summary>Gets a value indicating whether the current <see cref="T:System.Globalization.TextInfo" /> object represents a writing system where text flows from right to left.</summary>
/// <returns>true if text flows from right to left; otherwise, false.</returns>
// Token: 0x170003B9 RID: 953
// (get) Token: 0x060014E2 RID: 5346 RVA: 0x0005029C File Offset: 0x0004E49C
[ComVisible(false)]
public bool IsRightToLeft
{
get
{
int win32LangID = this.m_win32LangID;
return win32LangID == 1 || win32LangID == 13 || win32LangID == 32 || win32LangID == 41 || win32LangID == 90 || win32LangID == 101 || win32LangID == 1025 || win32LangID == 1037 || win32LangID == 1056 || win32LangID == 1065 || win32LangID == 1114 || win32LangID == 1125 || win32LangID == 2049 || win32LangID == 3073 || win32LangID == 4097 || win32LangID == 5121 || win32LangID == 6145 || win32LangID == 7169 || win32LangID == 8193 || win32LangID == 9217 || win32LangID == 10241 || win32LangID == 11265 || win32LangID == 12289 || win32LangID == 13313 || win32LangID == 14337 || win32LangID == 15361 || win32LangID == 16385;
}
}
/// <summary>Determines whether the specified object represents the same writing system as the current <see cref="T:System.Globalization.TextInfo" /> object.</summary>
/// <returns>true if <paramref name="obj" /> represents the same writing system as the current <see cref="T:System.Globalization.TextInfo" />; otherwise, false.</returns>
/// <param name="obj">The object to compare with the current <see cref="T:System.Globalization.TextInfo" />. </param>
// Token: 0x060014E3 RID: 5347 RVA: 0x000503D0 File Offset: 0x0004E5D0
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
TextInfo textInfo = obj as TextInfo;
return textInfo != null && textInfo.m_win32LangID == this.m_win32LangID && textInfo.ci == this.ci;
}
/// <summary>Serves as a hash function for the current <see cref="T:System.Globalization.TextInfo" />, suitable for hashing algorithms and data structures, such as a hash table.</summary>
/// <returns>A hash code for the current <see cref="T:System.Globalization.TextInfo" />.</returns>
// Token: 0x060014E4 RID: 5348 RVA: 0x0005041C File Offset: 0x0004E61C
public override int GetHashCode()
{
return this.m_win32LangID;
}
/// <summary>Returns a string that represents the current <see cref="T:System.Globalization.TextInfo" />.</summary>
/// <returns>A string that represents the current <see cref="T:System.Globalization.TextInfo" />.</returns>
// Token: 0x060014E5 RID: 5349 RVA: 0x00050424 File Offset: 0x0004E624
public override string ToString()
{
return "TextInfo - " + this.m_win32LangID;
}
/// <summary>Converts the specified string to titlecase.</summary>
/// <returns>The specified string converted to titlecase.</returns>
/// <param name="str">The string to convert to titlecase. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="str" /> is null. </exception>
// Token: 0x060014E6 RID: 5350 RVA: 0x0005043C File Offset: 0x0004E63C
public string ToTitleCase(string str)
{
if (str == null)
{
throw new ArgumentNullException("str");
}
StringBuilder stringBuilder = null;
int i = 0;
int num = 0;
while (i < str.Length)
{
if (char.IsLetter(str[i++]))
{
i--;
char c = this.ToTitleCase(str[i]);
bool flag = true;
if (c == str[i])
{
flag = false;
bool flag2 = true;
int num2 = i;
while (++i < str.Length)
{
if (char.IsWhiteSpace(str[i]))
{
break;
}
c = this.ToTitleCase(str[i]);
if (c != str[i])
{
flag2 = false;
break;
}
}
if (flag2)
{
continue;
}
i = num2;
while (++i < str.Length)
{
if (char.IsWhiteSpace(str[i]))
{
break;
}
if (this.ToLower(str[i]) != str[i])
{
flag = true;
i = num2;
break;
}
}
}
if (flag)
{
if (stringBuilder == null)
{
stringBuilder = new StringBuilder(str.Length);
}
stringBuilder.Append(str, num, i - num);
stringBuilder.Append(this.ToTitleCase(str[i]));
num = i + 1;
while (++i < str.Length)
{
if (char.IsWhiteSpace(str[i]))
{
break;
}
stringBuilder.Append(this.ToLower(str[i]));
}
num = i;
}
}
}
if (stringBuilder != null)
{
stringBuilder.Append(str, num, str.Length - num);
}
return (stringBuilder == null) ? str : stringBuilder.ToString();
}
/// <summary>Converts the specified character to lowercase.</summary>
/// <returns>The specified character converted to lowercase.</returns>
/// <param name="c">The character to convert to lowercase. </param>
// Token: 0x060014E7 RID: 5351 RVA: 0x0005060C File Offset: 0x0004E80C
public virtual char ToLower(char c)
{
if (c < '@' || ('`' < c && c < '\u0080'))
{
return c;
}
if ('A' <= c && c <= 'Z' && (!this.handleDotI || c != 'I'))
{
return c + ' ';
}
if (this.ci == null || this.ci.LCID == 127)
{
return char.ToLowerInvariant(c);
}
switch (c)
{
case 'Dž':
return 'dž';
default:
switch (c)
{
case 'ϒ':
return 'υ';
case 'ϓ':
return 'ύ';
case 'ϔ':
return 'ϋ';
default:
if (c != 'I')
{
if (c == 'İ')
{
return 'i';
}
if (c == 'Nj')
{
return 'nj';
}
if (c == 'Dz')
{
return 'dz';
}
}
else if (this.handleDotI)
{
return 'ı';
}
return char.ToLowerInvariant(c);
}
break;
case 'Lj':
return 'lj';
}
}
/// <summary>Converts the specified character to uppercase.</summary>
/// <returns>The specified character converted to uppercase.</returns>
/// <param name="c">The character to convert to uppercase. </param>
// Token: 0x060014E8 RID: 5352 RVA: 0x00050730 File Offset: 0x0004E930
public virtual char ToUpper(char c)
{
if (c < '`')
{
return c;
}
if ('a' <= c && c <= 'z' && (!this.handleDotI || c != 'i'))
{
return c - ' ';
}
if (this.ci == null || this.ci.LCID == 127)
{
return char.ToUpperInvariant(c);
}
switch (c)
{
case 'ϐ':
return 'Β';
case 'ϑ':
return 'Θ';
default:
switch (c)
{
case 'Dž':
return 'DŽ';
default:
if (c == 'ϰ')
{
return 'Κ';
}
if (c != 'ϱ')
{
if (c != 'i')
{
if (c == 'ı')
{
return 'I';
}
if (c == 'Nj')
{
return 'NJ';
}
if (c == 'Dz')
{
return 'DZ';
}
if (c == 'ΐ')
{
return 'Ϊ';
}
if (c == 'ΰ')
{
return 'Ϋ';
}
}
else if (this.handleDotI)
{
return 'İ';
}
return char.ToUpperInvariant(c);
}
return 'Ρ';
case 'Lj':
return 'LJ';
}
break;
case 'ϕ':
return 'Φ';
case 'ϖ':
return 'Π';
}
}
// Token: 0x060014E9 RID: 5353 RVA: 0x0005089C File Offset: 0x0004EA9C
private char ToTitleCase(char c)
{
switch (c)
{
case 'DŽ':
case 'Dž':
case 'dž':
return 'Dž';
case 'LJ':
case 'Lj':
case 'lj':
return 'Lj';
case 'NJ':
case 'Nj':
case 'nj':
return 'Nj';
default:
switch (c)
{
case 'DZ':
case 'Dz':
case 'dz':
return 'Dz';
default:
if (('' <= c && c <= 'ⅿ') || ('ⓐ' <= c && c <= 'ⓩ'))
{
return c;
}
return this.ToUpper(c);
}
break;
}
}
/// <summary>Converts the specified string to lowercase.</summary>
/// <returns>The specified string converted to lowercase.</returns>
/// <param name="str">The string to convert to lowercase. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="str" /> is null. </exception>
// Token: 0x060014EA RID: 5354 RVA: 0x00050948 File Offset: 0x0004EB48
public unsafe virtual string ToLower(string str)
{
if (str == null)
{
throw new ArgumentNullException("str");
}
if (str.Length == 0)
{
return string.Empty;
}
string text = string.InternalAllocateStr(str.Length);
fixed (string text2 = str)
{
fixed (char* ptr = text2 + RuntimeHelpers.OffsetToStringData / 2)
{
fixed (string text3 = text)
{
fixed (char* ptr2 = text3 + RuntimeHelpers.OffsetToStringData / 2)
{
char* ptr3 = ptr2;
char* ptr4 = ptr;
for (int i = 0; i < str.Length; i++)
{
*ptr3 = this.ToLower(*ptr4);
ptr4++;
ptr3++;
}
text2 = null;
text3 = null;
return text;
}
}
}
}
}
/// <summary>Converts the specified string to uppercase.</summary>
/// <returns>The specified string converted to uppercase.</returns>
/// <param name="str">The string to convert to uppercase. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="str" /> is null. </exception>
// Token: 0x060014EB RID: 5355 RVA: 0x000509DC File Offset: 0x0004EBDC
public unsafe virtual string ToUpper(string str)
{
if (str == null)
{
throw new ArgumentNullException("str");
}
if (str.Length == 0)
{
return string.Empty;
}
string text = string.InternalAllocateStr(str.Length);
fixed (string text2 = str)
{
fixed (char* ptr = text2 + RuntimeHelpers.OffsetToStringData / 2)
{
fixed (string text3 = text)
{
fixed (char* ptr2 = text3 + RuntimeHelpers.OffsetToStringData / 2)
{
char* ptr3 = ptr2;
char* ptr4 = ptr;
for (int i = 0; i < str.Length; i++)
{
*ptr3 = this.ToUpper(*ptr4);
ptr4++;
ptr3++;
}
text2 = null;
text3 = null;
return text;
}
}
}
}
}
/// <summary>Returns a read-only version of the specified <see cref="T:System.Globalization.TextInfo" /> object.</summary>
/// <returns>The <see cref="T:System.Globalization.TextInfo" /> object specified by the <paramref name="textInfo" /> parameter, if <paramref name="textInfo" /> is read-only.-or-A read-only memberwise clone of the <see cref="T:System.Globalization.TextInfo" /> object specified by <paramref name="textInfo" />, if <paramref name="textInfo" /> is not read-only.</returns>
/// <param name="textInfo">A <see cref="T:System.Globalization.TextInfo" /> object.</param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="textInfo" /> is null.</exception>
// Token: 0x060014EC RID: 5356 RVA: 0x00050A70 File Offset: 0x0004EC70
[ComVisible(false)]
public static TextInfo ReadOnly(TextInfo textInfo)
{
if (textInfo == null)
{
throw new ArgumentNullException("textInfo");
}
return new TextInfo(textInfo)
{
m_isReadOnly = true
};
}
/// <summary>Creates a new object that is a copy of the current <see cref="T:System.Globalization.TextInfo" /> object.</summary>
/// <returns>A new instance of <see cref="T:System.Object" /> that is the memberwise clone of the current <see cref="T:System.Globalization.TextInfo" /> object.</returns>
// Token: 0x060014ED RID: 5357 RVA: 0x00050AA0 File Offset: 0x0004ECA0
[ComVisible(false)]
public virtual object Clone()
{
return new TextInfo(this);
}
// Token: 0x040005E6 RID: 1510
private string m_listSeparator;
// Token: 0x040005E7 RID: 1511
private bool m_isReadOnly;
// Token: 0x040005E8 RID: 1512
private string customCultureName;
// Token: 0x040005E9 RID: 1513
[NonSerialized]
private int m_nDataItem;
// Token: 0x040005EA RID: 1514
private bool m_useUserOverride;
// Token: 0x040005EB RID: 1515
private int m_win32LangID;
// Token: 0x040005EC RID: 1516
[NonSerialized]
private readonly CultureInfo ci;
// Token: 0x040005ED RID: 1517
[NonSerialized]
private readonly bool handleDotI;
// Token: 0x040005EE RID: 1518
[NonSerialized]
private readonly TextInfo.Data data;
// Token: 0x0200019B RID: 411
private struct Data
{
// Token: 0x040005EF RID: 1519
public int ansi;
// Token: 0x040005F0 RID: 1520
public int ebcdic;
// Token: 0x040005F1 RID: 1521
public int mac;
// Token: 0x040005F2 RID: 1522
public int oem;
// Token: 0x040005F3 RID: 1523
public byte list_sep;
}
}
}