using System; using System.Collections; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using Mono.Globalization.Unicode; namespace System.Globalization { /// Implements a set of methods for culture-sensitive string comparisons. // Token: 0x0200017C RID: 380 [ComVisible(true)] [Serializable] public class CompareInfo : IDeserializationCallback { // Token: 0x06001241 RID: 4673 RVA: 0x00047F48 File Offset: 0x00046148 private CompareInfo() { } // Token: 0x06001242 RID: 4674 RVA: 0x00047F50 File Offset: 0x00046150 internal CompareInfo(CultureInfo ci) { this.culture = ci.LCID; if (CompareInfo.UseManagedCollation) { object obj = CompareInfo.monitor; lock (obj) { if (CompareInfo.collators == null) { CompareInfo.collators = new Hashtable(); } this.collator = (SimpleCollator)CompareInfo.collators[ci.LCID]; if (this.collator == null) { this.collator = new SimpleCollator(ci); CompareInfo.collators[ci.LCID] = this.collator; } } } else { this.icu_name = ci.IcuName; this.construct_compareinfo(this.icu_name); } } /// Runs when the entire object graph has been deserialized. /// The object that initiated the callback. // Token: 0x06001244 RID: 4676 RVA: 0x00048070 File Offset: 0x00046270 void IDeserializationCallback.OnDeserialization(object sender) { if (CompareInfo.UseManagedCollation) { this.collator = new SimpleCollator(new CultureInfo(this.culture)); } else { try { this.construct_compareinfo(this.icu_name); } catch { } } } // Token: 0x1700030C RID: 780 // (get) Token: 0x06001245 RID: 4677 RVA: 0x000480D8 File Offset: 0x000462D8 internal static bool UseManagedCollation { get { return CompareInfo.useManagedCollation; } } // Token: 0x06001246 RID: 4678 [MethodImpl(MethodImplOptions.InternalCall)] private extern void construct_compareinfo(string locale); // Token: 0x06001247 RID: 4679 [MethodImpl(MethodImplOptions.InternalCall)] private extern void free_internal_collator(); // Token: 0x06001248 RID: 4680 [MethodImpl(MethodImplOptions.InternalCall)] private extern int internal_compare(string str1, int offset1, int length1, string str2, int offset2, int length2, CompareOptions options); // Token: 0x06001249 RID: 4681 [MethodImpl(MethodImplOptions.InternalCall)] private extern void assign_sortkey(object key, string source, CompareOptions options); // Token: 0x0600124A RID: 4682 [MethodImpl(MethodImplOptions.InternalCall)] private extern int internal_index(string source, int sindex, int count, char value, CompareOptions options, bool first); // Token: 0x0600124B RID: 4683 [MethodImpl(MethodImplOptions.InternalCall)] private extern int internal_index(string source, int sindex, int count, string value, CompareOptions options, bool first); /// Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. // Token: 0x0600124C RID: 4684 RVA: 0x000480E0 File Offset: 0x000462E0 ~CompareInfo() { this.free_internal_collator(); } // Token: 0x0600124D RID: 4685 RVA: 0x0004811C File Offset: 0x0004631C private int internal_compare_managed(string str1, int offset1, int length1, string str2, int offset2, int length2, CompareOptions options) { return this.collator.Compare(str1, offset1, length1, str2, offset2, length2, options); } // Token: 0x0600124E RID: 4686 RVA: 0x00048140 File Offset: 0x00046340 private int internal_compare_switch(string str1, int offset1, int length1, string str2, int offset2, int length2, CompareOptions options) { return (!CompareInfo.UseManagedCollation) ? this.internal_compare(str1, offset1, length1, str2, offset2, length2, options) : this.internal_compare_managed(str1, offset1, length1, str2, offset2, length2, options); } /// Compares two strings. /// Value Condition zero The two strings are equal. less than zero is less than . greater than zero is greater than . /// The first string to compare. /// The second string to compare. // Token: 0x0600124F RID: 4687 RVA: 0x00048180 File Offset: 0x00046380 public virtual int Compare(string string1, string string2) { return this.Compare(string1, string2, CompareOptions.None); } /// Compares two strings using the specified value. /// Value Condition zero The two strings are equal. less than zero is less than . greater than zero is greater than . /// The first string to compare. /// The second string to compare. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , , and . /// /// contains an invalid value. // Token: 0x06001250 RID: 4688 RVA: 0x0004818C File Offset: 0x0004638C public virtual int Compare(string string1, string string2, CompareOptions options) { if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.StringSort | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (string1 == null) { if (string2 == null) { return 0; } return -1; } else { if (string2 == null) { return 1; } if (string1.Length == 0 && string2.Length == 0) { return 0; } return this.internal_compare_switch(string1, 0, string1.Length, string2, 0, string2.Length, options); } } /// Compares the end section of a string with the end section of another string. /// Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of . /// The first string to compare. /// The zero-based index of the character in at which to start comparing. /// The second string to compare. /// The zero-based index of the character in at which to start comparing. /// /// or is less than zero.-or- is greater than or equal to the number of characters in .-or- is greater than or equal to the number of characters in . // Token: 0x06001251 RID: 4689 RVA: 0x000481F8 File Offset: 0x000463F8 public virtual int Compare(string string1, int offset1, string string2, int offset2) { return this.Compare(string1, offset1, string2, offset2, CompareOptions.None); } /// Compares the end section of a string with the end section of another string using the specified value. /// Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of . /// The first string to compare. /// The zero-based index of the character in at which to start comparing. /// The second string to compare. /// The zero-based index of the character in at which to start comparing. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , , and . /// /// or is less than zero.-or- is greater than or equal to the number of characters in .-or- is greater than or equal to the number of characters in . /// /// contains an invalid value. // Token: 0x06001252 RID: 4690 RVA: 0x00048208 File Offset: 0x00046408 public virtual int Compare(string string1, int offset1, string string2, int offset2, CompareOptions options) { if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.StringSort | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (string1 == null) { if (string2 == null) { return 0; } return -1; } else { if (string2 == null) { return 1; } if ((string1.Length == 0 || offset1 == string1.Length) && (string2.Length == 0 || offset2 == string2.Length)) { return 0; } if (offset1 < 0 || offset2 < 0) { throw new ArgumentOutOfRangeException("Offsets must not be less than zero"); } if (offset1 > string1.Length) { throw new ArgumentOutOfRangeException("Offset1 is greater than or equal to the length of string1"); } if (offset2 > string2.Length) { throw new ArgumentOutOfRangeException("Offset2 is greater than or equal to the length of string2"); } return this.internal_compare_switch(string1, offset1, string1.Length - offset1, string2, offset2, string2.Length - offset2, options); } } /// Compares a section of one string with a section of another string. /// Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of . /// The first string to compare. /// The zero-based index of the character in at which to start comparing. /// The number of consecutive characters in to compare. /// The second string to compare. /// The zero-based index of the character in at which to start comparing. /// The number of consecutive characters in to compare. /// /// or or or is less than zero.-or- is greater than or equal to the number of characters in .-or- is greater than or equal to the number of characters in .-or- is greater than the number of characters from to the end of .-or- is greater than the number of characters from to the end of . // Token: 0x06001253 RID: 4691 RVA: 0x000482E0 File Offset: 0x000464E0 public virtual int Compare(string string1, int offset1, int length1, string string2, int offset2, int length2) { return this.Compare(string1, offset1, length1, string2, offset2, length2, CompareOptions.None); } /// Compares a section of one string with a section of another string using the specified value. /// Value Condition zero The two strings are equal. less than zero The specified section of is less than the specified section of . greater than zero The specified section of is greater than the specified section of . /// The first string to compare. /// The zero-based index of the character in at which to start comparing. /// The number of consecutive characters in to compare. /// The second string to compare. /// The zero-based index of the character in at which to start comparing. /// The number of consecutive characters in to compare. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , , and . /// /// or or or is less than zero.-or- is greater than or equal to the number of characters in .-or- is greater than or equal to the number of characters in .-or- is greater than the number of characters from to the end of .-or- is greater than the number of characters from to the end of . /// /// contains an invalid value. // Token: 0x06001254 RID: 4692 RVA: 0x00048300 File Offset: 0x00046500 public virtual int Compare(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options) { if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.StringSort | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (string1 == null) { if (string2 == null) { return 0; } return -1; } else { if (string2 == null) { return 1; } if ((string1.Length == 0 || offset1 == string1.Length || length1 == 0) && (string2.Length == 0 || offset2 == string2.Length || length2 == 0)) { return 0; } if (offset1 < 0 || length1 < 0 || offset2 < 0 || length2 < 0) { throw new ArgumentOutOfRangeException("Offsets and lengths must not be less than zero"); } if (offset1 > string1.Length) { throw new ArgumentOutOfRangeException("Offset1 is greater than or equal to the length of string1"); } if (offset2 > string2.Length) { throw new ArgumentOutOfRangeException("Offset2 is greater than or equal to the length of string2"); } if (length1 > string1.Length - offset1) { throw new ArgumentOutOfRangeException("Length1 is greater than the number of characters from offset1 to the end of string1"); } if (length2 > string2.Length - offset2) { throw new ArgumentOutOfRangeException("Length2 is greater than the number of characters from offset2 to the end of string2"); } return this.internal_compare_switch(string1, offset1, length1, string2, offset2, length2, options); } } /// Determines whether the specified object is equal to the current object. /// true if the specified object is equal to the current ; otherwise, false. /// The object to compare with the current . // Token: 0x06001255 RID: 4693 RVA: 0x00048420 File Offset: 0x00046620 public override bool Equals(object value) { CompareInfo compareInfo = value as CompareInfo; return compareInfo != null && compareInfo.culture == this.culture; } /// Initializes a new object that is associated with the culture with the specified identifier. /// A new object associated with the culture with the specified identifier and using string comparison methods in the current . /// An integer representing the culture identifier. // Token: 0x06001256 RID: 4694 RVA: 0x0004844C File Offset: 0x0004664C public static CompareInfo GetCompareInfo(int culture) { return new CultureInfo(culture).CompareInfo; } /// Initializes a new object that is associated with the culture with the specified name. /// A new object associated with the culture with the specified identifier and using string comparison methods in the current . /// A string representing the culture name. /// /// is null. /// /// is an invalid culture name. // Token: 0x06001257 RID: 4695 RVA: 0x0004845C File Offset: 0x0004665C public static CompareInfo GetCompareInfo(string name) { if (name == null) { throw new ArgumentNullException("name"); } return new CultureInfo(name).CompareInfo; } /// Initializes a new object that is associated with the specified culture and that uses string comparison methods in the specified . /// A new object associated with the culture with the specified identifier and using string comparison methods in the current . /// An integer representing the culture identifier. /// An that contains the string comparison methods to use. /// /// is null. /// /// is of an invalid type. // Token: 0x06001258 RID: 4696 RVA: 0x0004847C File Offset: 0x0004667C public static CompareInfo GetCompareInfo(int culture, Assembly assembly) { if (assembly == null) { throw new ArgumentNullException("assembly"); } if (assembly != typeof(object).Module.Assembly) { throw new ArgumentException("Assembly is an invalid type"); } return CompareInfo.GetCompareInfo(culture); } /// Initializes a new object that is associated with the specified culture and that uses string comparison methods in the specified . /// A new object associated with the culture with the specified identifier and using string comparison methods in the current . /// A string representing the culture name. /// An that contains the string comparison methods to use. /// /// is null.-or- is null. /// /// is an invalid culture name.-or- is of an invalid type. // Token: 0x06001259 RID: 4697 RVA: 0x000484C8 File Offset: 0x000466C8 public static CompareInfo GetCompareInfo(string name, Assembly assembly) { if (name == null) { throw new ArgumentNullException("name"); } if (assembly == null) { throw new ArgumentNullException("assembly"); } if (assembly != typeof(object).Module.Assembly) { throw new ArgumentException("Assembly is an invalid type"); } return CompareInfo.GetCompareInfo(name); } /// Serves as a hash function for the current for hashing algorithms and data structures, such as a hash table. /// A hash code for the current . // Token: 0x0600125A RID: 4698 RVA: 0x00048524 File Offset: 0x00046724 public override int GetHashCode() { return this.LCID; } /// Gets the sort key for the specified string. /// The object that contains the sort key for the specified string. /// The string for which a object is obtained. /// /// /// // Token: 0x0600125B RID: 4699 RVA: 0x0004852C File Offset: 0x0004672C public virtual SortKey GetSortKey(string source) { return this.GetSortKey(source, CompareOptions.None); } /// Gets a object for the specified string using the specified value. /// The object that contains the sort key for the specified string. /// The string for which a object is obtained. /// The value that define how the sort key is calculated. is a bitwise combination of one or more of the following values: , , , , , and . /// /// contains an invalid value. /// /// /// // Token: 0x0600125C RID: 4700 RVA: 0x00048538 File Offset: 0x00046738 public virtual SortKey GetSortKey(string source, CompareOptions options) { if (options == CompareOptions.OrdinalIgnoreCase || options == CompareOptions.Ordinal) { throw new ArgumentException("Now allowed CompareOptions.", "options"); } if (CompareInfo.UseManagedCollation) { return this.collator.GetSortKey(source, options); } SortKey sortKey = new SortKey(this.culture, source, options); this.assign_sortkey(sortKey, source, options); return sortKey; } /// Searches for the specified character and returns the zero-based index of the first occurrence within the entire source string. /// The zero-based index of the first occurrence of within the entire , if found; otherwise, -1. /// The string to search. /// The character to locate within . /// /// is null. // Token: 0x0600125D RID: 4701 RVA: 0x000485A4 File Offset: 0x000467A4 public virtual int IndexOf(string source, char value) { return this.IndexOf(source, value, 0, source.Length, CompareOptions.None); } /// Searches for the specified substring and returns the zero-based index of the first occurrence within the entire source string. /// The zero-based index of the first occurrence of within the entire , if found; otherwise, -1. /// The string to search. /// The string to locate within . /// /// is null.-or- is null. // Token: 0x0600125E RID: 4702 RVA: 0x000485C4 File Offset: 0x000467C4 public virtual int IndexOf(string source, string value) { return this.IndexOf(source, value, 0, source.Length, CompareOptions.None); } /// Searches for the specified character and returns the zero-based index of the first occurrence within the entire source string using the specified value. /// The zero-based index of the first occurrence of within the entire using the specified value, if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The value that defines how the strings should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null. /// /// contains an invalid value. // Token: 0x0600125F RID: 4703 RVA: 0x000485E4 File Offset: 0x000467E4 public virtual int IndexOf(string source, char value, CompareOptions options) { return this.IndexOf(source, value, 0, source.Length, options); } /// Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string. /// The zero-based index of the first occurrence of within the section of that extends from to the end of , if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the search. /// /// is null. /// /// is outside the range of valid indexes for . // Token: 0x06001260 RID: 4704 RVA: 0x00048604 File Offset: 0x00046804 public virtual int IndexOf(string source, char value, int startIndex) { return this.IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None); } /// Searches for the specified substring and returns the zero-based index of the first occurrence within the entire source string using the specified value. /// The zero-based index of the first occurrence of within the entire using the specified value, if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// contains an invalid value. // Token: 0x06001261 RID: 4705 RVA: 0x00048624 File Offset: 0x00046824 public virtual int IndexOf(string source, string value, CompareOptions options) { return this.IndexOf(source, value, 0, source.Length, options); } /// Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string. /// The zero-based index of the first occurrence of within the section of that extends from to the end of , if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the search. /// /// is null.-or- is null. /// /// is outside the range of valid indexes for . // Token: 0x06001262 RID: 4706 RVA: 0x00048644 File Offset: 0x00046844 public virtual int IndexOf(string source, string value, int startIndex) { return this.IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None); } /// Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string using the specified value. /// The zero-based index of the first occurrence of within the section of that extends from to the end of using the specified value, if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null. /// /// is outside the range of valid indexes for . /// /// contains an invalid value. // Token: 0x06001263 RID: 4707 RVA: 0x00048664 File Offset: 0x00046864 public virtual int IndexOf(string source, char value, int startIndex, CompareOptions options) { return this.IndexOf(source, value, startIndex, source.Length - startIndex, options); } /// Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements. /// The zero-based index of the first occurrence of within the section of that starts at and contains the number of elements specified by , if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the search. /// The number of elements in the section to search. /// /// is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . // Token: 0x06001264 RID: 4708 RVA: 0x00048684 File Offset: 0x00046884 public virtual int IndexOf(string source, char value, int startIndex, int count) { return this.IndexOf(source, value, startIndex, count, CompareOptions.None); } /// Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that extends from the specified index to the end of the string using the specified value. /// The zero-based index of the first occurrence of within the section of that extends from to the end of using the specified value, if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// is outside the range of valid indexes for . /// /// contains an invalid value. // Token: 0x06001265 RID: 4709 RVA: 0x00048694 File Offset: 0x00046894 public virtual int IndexOf(string source, string value, int startIndex, CompareOptions options) { return this.IndexOf(source, value, startIndex, source.Length - startIndex, options); } /// Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements. /// The zero-based index of the first occurrence of within the section of that starts at and contains the number of elements specified by , if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the search. /// The number of elements in the section to search. /// /// is null.-or- is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . // Token: 0x06001266 RID: 4710 RVA: 0x000486B4 File Offset: 0x000468B4 public virtual int IndexOf(string source, string value, int startIndex, int count) { return this.IndexOf(source, value, startIndex, count, CompareOptions.None); } // Token: 0x06001267 RID: 4711 RVA: 0x000486C4 File Offset: 0x000468C4 private int internal_index_managed(string s, int sindex, int count, char c, CompareOptions opt, bool first) { return (!first) ? this.collator.LastIndexOf(s, c, sindex, count, opt) : this.collator.IndexOf(s, c, sindex, count, opt); } // Token: 0x06001268 RID: 4712 RVA: 0x00048704 File Offset: 0x00046904 private int internal_index_switch(string s, int sindex, int count, char c, CompareOptions opt, bool first) { return (!CompareInfo.UseManagedCollation || (first && opt == CompareOptions.Ordinal)) ? this.internal_index(s, sindex, count, c, opt, first) : this.internal_index_managed(s, sindex, count, c, opt, first); } /// Searches for the specified character and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements using the specified value. /// The zero-based index of the first occurrence of within the section of that starts at and contains the number of elements specified by , using the specified value, if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the search. /// The number of elements in the section to search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . /// /// contains an invalid value. // Token: 0x06001269 RID: 4713 RVA: 0x00048754 File Offset: 0x00046954 public virtual int IndexOf(string source, char value, int startIndex, int count, CompareOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (startIndex < 0) { throw new ArgumentOutOfRangeException("startIndex"); } if (count < 0 || source.Length - startIndex < count) { throw new ArgumentOutOfRangeException("count"); } if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (count == 0) { return -1; } if ((options & CompareOptions.Ordinal) != CompareOptions.None) { for (int i = startIndex; i < startIndex + count; i++) { if (source[i] == value) { return i; } } return -1; } return this.internal_index_switch(source, startIndex, count, value, options, true); } // Token: 0x0600126A RID: 4714 RVA: 0x0004880C File Offset: 0x00046A0C private int internal_index_managed(string s1, int sindex, int count, string s2, CompareOptions opt, bool first) { return (!first) ? this.collator.LastIndexOf(s1, s2, sindex, count, opt) : this.collator.IndexOf(s1, s2, sindex, count, opt); } // Token: 0x0600126B RID: 4715 RVA: 0x0004884C File Offset: 0x00046A4C private int internal_index_switch(string s1, int sindex, int count, string s2, CompareOptions opt, bool first) { return (!CompareInfo.UseManagedCollation || (first && opt == CompareOptions.Ordinal)) ? this.internal_index(s1, sindex, count, s2, opt, first) : this.internal_index_managed(s1, sindex, count, s2, opt, first); } /// Searches for the specified substring and returns the zero-based index of the first occurrence within the section of the source string that starts at the specified index and contains the specified number of elements using the specified value. /// The zero-based index of the first occurrence of within the section of that starts at and contains the number of elements specified by , using the specified value, if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the search. /// The number of elements in the section to search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . /// /// contains an invalid value. // Token: 0x0600126C RID: 4716 RVA: 0x0004889C File Offset: 0x00046A9C public virtual int IndexOf(string source, string value, int startIndex, int count, CompareOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (value == null) { throw new ArgumentNullException("value"); } if (startIndex < 0) { throw new ArgumentOutOfRangeException("startIndex"); } if (count < 0 || source.Length - startIndex < count) { throw new ArgumentOutOfRangeException("count"); } if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (value.Length == 0) { return startIndex; } if (count == 0) { return -1; } return this.internal_index_switch(source, startIndex, count, value, options, true); } /// Determines whether the specified source string starts with the specified prefix. /// true if the length of is less than or equal to the length of and starts with ; otherwise, false. /// The string to search in. /// The string to compare with the beginning of . /// /// is null.-or- is null. // Token: 0x0600126D RID: 4717 RVA: 0x00048940 File Offset: 0x00046B40 public virtual bool IsPrefix(string source, string prefix) { return this.IsPrefix(source, prefix, CompareOptions.None); } /// Determines whether the specified source string starts with the specified prefix using the specified value. /// true if the length of is less than or equal to the length of and starts with ; otherwise, false. /// The string to search in. /// The string to compare with the beginning of . /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// contains an invalid value. // Token: 0x0600126E RID: 4718 RVA: 0x0004894C File Offset: 0x00046B4C public virtual bool IsPrefix(string source, string prefix, CompareOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (prefix == null) { throw new ArgumentNullException("prefix"); } if (CompareInfo.UseManagedCollation) { return this.collator.IsPrefix(source, prefix, options); } return source.Length >= prefix.Length && this.Compare(source, 0, prefix.Length, prefix, 0, prefix.Length, options) == 0; } /// Determines whether the specified source string ends with the specified suffix. /// true if the length of is less than or equal to the length of and ends with ; otherwise, false. /// The string to search in. /// The string to compare with the end of . /// /// is null.-or- is null. // Token: 0x0600126F RID: 4719 RVA: 0x000489C4 File Offset: 0x00046BC4 public virtual bool IsSuffix(string source, string suffix) { return this.IsSuffix(source, suffix, CompareOptions.None); } /// Determines whether the specified source string ends with the specified suffix using the specified value. /// true if the length of is less than or equal to the length of and ends with ; otherwise, false. /// The string to search in. /// The string to compare with the end of . /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// contains an invalid value. // Token: 0x06001270 RID: 4720 RVA: 0x000489D0 File Offset: 0x00046BD0 public virtual bool IsSuffix(string source, string suffix, CompareOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (suffix == null) { throw new ArgumentNullException("suffix"); } if (CompareInfo.UseManagedCollation) { return this.collator.IsSuffix(source, suffix, options); } return source.Length >= suffix.Length && this.Compare(source, source.Length - suffix.Length, suffix.Length, suffix, 0, suffix.Length, options) == 0; } /// Searches for the specified character and returns the zero-based index of the last occurrence within the entire source string. /// The zero-based index of the last occurrence of within the entire , if found; otherwise, -1. /// The string to search. /// The character to locate within . /// /// is null. // Token: 0x06001271 RID: 4721 RVA: 0x00048A54 File Offset: 0x00046C54 public virtual int LastIndexOf(string source, char value) { return this.LastIndexOf(source, value, source.Length - 1, source.Length, CompareOptions.None); } /// Searches for the specified substring and returns the zero-based index of the last occurrence within the entire source string. /// The zero-based index of the last occurrence of within the entire , if found; otherwise, -1. /// The string to search. /// The string to locate within . /// /// is null.-or- is null. // Token: 0x06001272 RID: 4722 RVA: 0x00048A78 File Offset: 0x00046C78 public virtual int LastIndexOf(string source, string value) { return this.LastIndexOf(source, value, source.Length - 1, source.Length, CompareOptions.None); } /// Searches for the specified character and returns the zero-based index of the last occurrence within the entire source string using the specified value. /// The zero-based index of the last occurrence of within the entire using the specified value, if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null. /// /// contains an invalid value. // Token: 0x06001273 RID: 4723 RVA: 0x00048A9C File Offset: 0x00046C9C public virtual int LastIndexOf(string source, char value, CompareOptions options) { return this.LastIndexOf(source, value, source.Length - 1, source.Length, options); } /// Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index. /// The zero-based index of the last occurrence of within the section of that extends from the beginning of to , if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the backward search. /// /// is null. /// /// is outside the range of valid indexes for . // Token: 0x06001274 RID: 4724 RVA: 0x00048AC0 File Offset: 0x00046CC0 public virtual int LastIndexOf(string source, char value, int startIndex) { return this.LastIndexOf(source, value, startIndex, startIndex + 1, CompareOptions.None); } /// Searches for the specified substring and returns the zero-based index of the last occurrence within the entire source string using the specified value. /// The zero-based index of the last occurrence of within the entire using the specified value, if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// contains an invalid value. // Token: 0x06001275 RID: 4725 RVA: 0x00048AD0 File Offset: 0x00046CD0 public virtual int LastIndexOf(string source, string value, CompareOptions options) { return this.LastIndexOf(source, value, source.Length - 1, source.Length, options); } /// Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index. /// The zero-based index of the last occurrence of within the section of that extends from the beginning of to , if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the backward search. /// /// is null.-or- is null. /// /// is outside the range of valid indexes for . // Token: 0x06001276 RID: 4726 RVA: 0x00048AF4 File Offset: 0x00046CF4 public virtual int LastIndexOf(string source, string value, int startIndex) { return this.LastIndexOf(source, value, startIndex, startIndex + 1, CompareOptions.None); } /// Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index using the specified value. /// The zero-based index of the last occurrence of within the section of that extends from the beginning of to using the specified value, if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the backward search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null. /// /// is outside the range of valid indexes for . /// /// contains an invalid value. // Token: 0x06001277 RID: 4727 RVA: 0x00048B04 File Offset: 0x00046D04 public virtual int LastIndexOf(string source, char value, int startIndex, CompareOptions options) { return this.LastIndexOf(source, value, startIndex, startIndex + 1, options); } /// Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index. /// The zero-based index of the last occurrence of within the section of that contains the number of elements specified by and ends at , if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the backward search. /// The number of elements in the section to search. /// /// is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . // Token: 0x06001278 RID: 4728 RVA: 0x00048B14 File Offset: 0x00046D14 public virtual int LastIndexOf(string source, char value, int startIndex, int count) { return this.LastIndexOf(source, value, startIndex, count, CompareOptions.None); } /// Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that extends from the beginning of the string to the specified index using the specified value. /// The zero-based index of the last occurrence of within the section of that extends from the beginning of to using the specified value, if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the backward search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// is outside the range of valid indexes for . /// /// contains an invalid value. // Token: 0x06001279 RID: 4729 RVA: 0x00048B24 File Offset: 0x00046D24 public virtual int LastIndexOf(string source, string value, int startIndex, CompareOptions options) { return this.LastIndexOf(source, value, startIndex, startIndex + 1, options); } /// Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index. /// The zero-based index of the last occurrence of within the section of that contains the number of elements specified by and ends at , if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the backward search. /// The number of elements in the section to search. /// /// is null.-or- is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . // Token: 0x0600127A RID: 4730 RVA: 0x00048B34 File Offset: 0x00046D34 public virtual int LastIndexOf(string source, string value, int startIndex, int count) { return this.LastIndexOf(source, value, startIndex, count, CompareOptions.None); } /// Searches for the specified character and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index using the specified value. /// The zero-based index of the last occurrence of within the section of that contains the number of elements specified by and ends at using the specified value, if found; otherwise, -1. /// The string to search. /// The character to locate within . /// The zero-based starting index of the backward search. /// The number of elements in the section to search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . /// /// contains an invalid value. // Token: 0x0600127B RID: 4731 RVA: 0x00048B44 File Offset: 0x00046D44 public virtual int LastIndexOf(string source, char value, int startIndex, int count, CompareOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (startIndex < 0) { throw new ArgumentOutOfRangeException("startIndex"); } if (count < 0 || startIndex - count < -1) { throw new ArgumentOutOfRangeException("count"); } if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (count == 0) { return -1; } if ((options & CompareOptions.Ordinal) != CompareOptions.None) { for (int i = startIndex; i > startIndex - count; i--) { if (source[i] == value) { return i; } } return -1; } return this.internal_index_switch(source, startIndex, count, value, options, false); } /// Searches for the specified substring and returns the zero-based index of the last occurrence within the section of the source string that contains the specified number of elements and ends at the specified index using the specified value. /// The zero-based index of the last occurrence of within the section of that contains the number of elements specified by and ends at using the specified value, if found; otherwise, -1. /// The string to search. /// The string to locate within . /// The zero-based starting index of the backward search. /// The number of elements in the section to search. /// The value that defines how and should be compared. is either the value used by itself, or the bitwise combination of one or more of the following values: , , , , and . /// /// is null.-or- is null. /// /// is outside the range of valid indexes for .-or- is less than zero.-or- and do not specify a valid section in . /// /// contains an invalid value. // Token: 0x0600127C RID: 4732 RVA: 0x00048BF8 File Offset: 0x00046DF8 public virtual int LastIndexOf(string source, string value, int startIndex, int count, CompareOptions options) { if (source == null) { throw new ArgumentNullException("source"); } if (value == null) { throw new ArgumentNullException("value"); } if (startIndex < 0) { throw new ArgumentOutOfRangeException("startIndex"); } if (count < 0 || startIndex - count < -1) { throw new ArgumentOutOfRangeException("count"); } if ((options & (CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) != options) { throw new ArgumentException("options"); } if (count == 0) { return -1; } if (value.Length == 0) { return 0; } return this.internal_index_switch(source, startIndex, count, value, options, false); } /// Indicates whether a specified Unicode character is sortable. /// true if the parameter is sortable; otherwise, false. /// A Unicode character. // Token: 0x0600127D RID: 4733 RVA: 0x00048C98 File Offset: 0x00046E98 [ComVisible(false)] public static bool IsSortable(char ch) { return MSCompatUnicodeTable.IsSortable((int)ch); } /// Indicates whether a specified Unicode string is sortable. /// true if the parameter is not an empty string ("") and all the Unicode characters in are sortable; otherwise, false. /// A string of zero or more Unicode characters. /// /// is null. // Token: 0x0600127E RID: 4734 RVA: 0x00048CA0 File Offset: 0x00046EA0 [ComVisible(false)] public static bool IsSortable(string text) { return MSCompatUnicodeTable.IsSortable(text); } /// Returns a string that represents the current . /// A string that represents the current . // Token: 0x0600127F RID: 4735 RVA: 0x00048CA8 File Offset: 0x00046EA8 public override string ToString() { return "CompareInfo - " + this.culture; } /// Gets the properly formed culture identifier for the current . /// The properly formed culture identifier for the current . // Token: 0x1700030D RID: 781 // (get) Token: 0x06001280 RID: 4736 RVA: 0x00048CC0 File Offset: 0x00046EC0 public int LCID { get { return this.culture; } } /// Gets the name of the culture used for sorting operations by this object. /// The name of a culture. // Token: 0x1700030E RID: 782 // (get) Token: 0x06001281 RID: 4737 RVA: 0x00048CC8 File Offset: 0x00046EC8 [ComVisible(false)] public virtual string Name { get { return this.icu_name; } } // Token: 0x040004C2 RID: 1218 private const CompareOptions ValidCompareOptions_NoStringSort = CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase; // Token: 0x040004C3 RID: 1219 private const CompareOptions ValidCompareOptions = CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.StringSort | CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase; // Token: 0x040004C4 RID: 1220 private static readonly bool useManagedCollation = Environment.internalGetEnvironmentVariable("MONO_DISABLE_MANAGED_COLLATION") != "yes" && MSCompatUnicodeTable.IsReady; // Token: 0x040004C5 RID: 1221 private int culture; // Token: 0x040004C6 RID: 1222 [NonSerialized] private string icu_name; // Token: 0x040004C7 RID: 1223 private int win32LCID; // Token: 0x040004C8 RID: 1224 private string m_name; // Token: 0x040004C9 RID: 1225 [NonSerialized] private SimpleCollator collator; // Token: 0x040004CA RID: 1226 private static Hashtable collators; // Token: 0x040004CB RID: 1227 [NonSerialized] private static object monitor = new object(); } }