public EnergyBarWrapper(EnergyBar bBar, EnergyBar cBar)
 {
     bullsBar = bBar.GetComponent<EnergyBar>();
     cleotsBar = cBar.GetComponent<EnergyBar>();
     // Take that h-bar.
     myTI  = new CultureInfo("en-US",false).TextInfo;
 }
		public CaseInsensitiveHashCodeProvider (CultureInfo culture)
		{
			if (culture == null)
 				throw new ArgumentNullException ("culture");
			if (!AreEqual (culture, CultureInfo.InvariantCulture))
				m_text = culture.TextInfo;
		}
 public CaseInsensitiveHashCodeProvider(CultureInfo culture) {
     if (culture==null) {
         throw new ArgumentNullException("culture");
     }
     Contract.EndContractBlock();
     m_text = culture.TextInfo;
 }
Пример #4
0
    public string[] GetLocation(string prefixText, int count)
    {
        List <string> lst = new List <string>();

        MongoCollection <BasicInfo> objCollection = BaseClass.db.GetCollection <BasicInfo>("c_BasicInfo");
        var query = Query.Matches("HomeTown", BsonRegularExpression.Create(new System.Text.RegularExpressions.Regex("^(?i)" + prefixText + "")));

        var cursor = objCollection.Find(query);

        cursor.Limit = 5;
        System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;

        System.Globalization.TextInfo txtInfo = cultureInfo.TextInfo;
        foreach (var item in cursor)
        {
            lst.Add(txtInfo.ToTitleCase(item.HomeTown));
        }

        /* var query2 = Query.Matches("HomeTown", BsonRegularExpression.Create(new System.Text.RegularExpressions.Regex("^(?i)" + prefixText + "")));
         *
         * var cursor2 = objCollection.Find(query2);
         * cursor2.Limit = 5;
         * foreach (var item in cursor)
         * {
         *   lst.Add(item.HomeTown);
         *
         * }*/
        return(lst.Distinct().Take(5).ToArray());
    }
Пример #5
0
    public static string GetMixedCase(string myString)
    {
        System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
        System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;
        string mixedCaseString = textInfo.ToTitleCase(myString.ToLower());

        return(mixedCaseString);
    }
	public CaseInsensitiveHashCodeProvider(CultureInfo culture)
			{
				if(culture == null)
				{
					throw new ArgumentNullException("culture");
				}
				info = culture.TextInfo;
			}
		public MarkdownService(IContentProvider contentProvider)
        {
            ContentProvider = contentProvider;

            _markdown = new MarkdownSharp.Markdown(CreateMarkdownOptions());

            _invariantTextInfo = CultureInfo.InvariantCulture.TextInfo;

			Tranformers = new Tranformers();
        }
Пример #8
0
 public static string ToTitleCase(this string mText)
 {
     if (mText == null)
     {
         return("");
     }
     System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
     System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;
     // TextInfo.ToTitleCase only operates on the string if is all lower case, otherwise it returns the string unchanged.
     return(textInfo.ToTitleCase(mText.ToLower()));
 }
Пример #9
0
    public static string ToPascalCase(this String str)
    {
        if (str == null)
        {
            return("");
        }
        System.Globalization.TextInfo textInfo = System.Globalization.CultureInfo.CurrentUICulture.TextInfo;
        string result = textInfo.ToTitleCase(str.Trim().Replace("-", " ")).Replace(" ", "");

        return(result);
    }
Пример #10
0
        public static string FormaAcronym(this string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return(s);
            }

            System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
            System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;

            return(textInfo.ToTitleCase(s.ToUpper()));
        }
Пример #11
0
	private void CompareProperties (TextInfo t1, TextInfo t2, bool compareReadOnly)
	{
		Assert.AreEqual (t1.ANSICodePage, t2.ANSICodePage, "ANSICodePage");
		Assert.AreEqual (t1.EBCDICCodePage, t2.EBCDICCodePage, "EBCDICCodePage");
		Assert.AreEqual (t1.ListSeparator, t2.ListSeparator, "ListSeparator");
		Assert.AreEqual (t1.MacCodePage, t2.MacCodePage, "MacCodePage");
		Assert.AreEqual (t1.OEMCodePage, t2.OEMCodePage, "OEMCodePage");
		Assert.AreEqual (t1.CultureName, t2.CultureName, "CultureName");
		if (compareReadOnly)
			Assert.AreEqual (t1.IsReadOnly, t2.IsReadOnly, "IsReadOnly");
//FIXME		Assert.AreEqual (t1.IsRightToLeft, t2.IsRightToLeft, "IsRightToLeft");
		Assert.AreEqual (t1.LCID, t2.LCID, "LCID");
	}
Пример #12
0
    // IsValidIPAddress
    #endregion

    #region ToTitleCase

    /// <summary>
    /// Converts the specified string to title case (except for words that are entirely in uppercase, which are considered to be acronyms).
    /// </summary>
    /// <param name="mText"></param>
    /// <returns></returns>
    public static string ToTitleCase(this string mText)
    {
        if (mText.IsNullOrEmpty())
        {
            return(mText);
        }

        // get globalization info
        System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
        System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;

        // convert to title case
        return(textInfo.ToTitleCase(mText));
    }
    public void MessageInfo(string LabelInfo, int TypeInfo)
    {
        LeanTween.scale(gameObject, Vector3.one, 0f);

        System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
        System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;

        Label.text = textInfo.ToUpper(LabelInfo);
        switch (TypeInfo)
        {
        case 1: Btn3.gameObject.SetActive(false); Btn2.gameObject.SetActive(true); break;

        case 2: Btn2.gameObject.SetActive(false); Btn3.gameObject.SetActive(false); break;

        default: Btn2.gameObject.SetActive(true); Btn3.gameObject.SetActive(true); break;
        }
    }
Пример #14
0
        /// <summary>
        /// Converts given string to first letter to upper and others to lower. Returns null if value is null.
        /// </summary>
        /// <param name="value">The value to be converted.</param>
        /// <param name="culture">The culture to be used while converting.</param>
        /// <returns>String</returns>
        public static string ToTitleCase(this string value, string culture = "tr-TR")
        {
            if (value.IsNull())
            {
                return(null);
            }

            value = value.Trim();
            if (value.Length > 0)
            {
                System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo(culture);
                System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;
                value = textInfo.ToLower(value);
                value = textInfo.ToTitleCase(value);
            }

            return(value);
        }
	// Constructors.
	public ResourceWriter(Stream stream)
			{
				if(stream == null)
				{
					throw new ArgumentNullException("stream");
				}
				else if(!stream.CanWrite)
				{
					throw new ArgumentException
						(_("IO_NotSupp_Write"), "stream");
				}
				this.stream = stream;
				generateDone = false;
				table = new Hashtable();
				ignoreCaseNames = new Hashtable();
				types = new ArrayList();
				info = CultureInfo.InvariantCulture.TextInfo;
			}
        public bool SendMailAsVisitor(ViewModels.MailViewModel model)
        {
            System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
            System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;
            string      ad     = textInfo.ToTitleCase(model.ad);
            string      soyad  = textInfo.ToTitleCase(model.soyad);
            MailMessage ePosta = new MailMessage();

            ePosta.From = new MailAddress("*****@*****.**");
            //
            ePosta.To.Add("*****@*****.**");
            //

            //
            ePosta.Subject = "Ziyaretçi Mesajı";
            //
            ePosta.Body = ad + " " + soyad + "[" + model.email + "]" + " ziyaretçisinden mesaj;"
                          + Environment.NewLine
                          + Environment.NewLine
                          + model.mesaj;
            //
            SmtpClient smtp = new SmtpClient();

            //
            smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "159654357456");
            smtp.Port        = 587;
            smtp.Host        = "smtp.gmail.com";
            smtp.EnableSsl   = true;
            object userState = ePosta;

            try
            {
                smtp.SendAsync(ePosta, (object)ePosta);
                return(true);
            }
            catch (SmtpException ex)
            {
                throw new SmtpException(ex.ToString());
            }
        }
Пример #17
0
        ////////////////////////////////////////////////////////////////////////
        //
        //  Equals
        //
        //  Implements Object.Equals().  Returns a boolean indicating whether
        //  or not object refers to the same CultureInfo as the current instance.
        //
        ////////////////////////////////////////////////////////////////////////

        /// <include file='doc\TextInfo.uex' path='docs/doc[@for="TextInfo.Equals"]/*' />
        public override bool Equals(Object obj)
        {
            //
            //  See if the object name is the same as the TextInfo object.
            //
            if ((obj != null) && (obj is TextInfo))
            {
                TextInfo textInfo = (TextInfo)obj;

                //
                //  See if the member variables are equal.  If so, then
                //  return true.
                //
                if (this.m_win32LangID == textInfo.m_win32LangID)
                {
                    return(true);
                }
            }

            //
            //  Objects are not the same, so return false.
            //
            return(false);
        }
Пример #18
0
 public virtual int LastIndexOf(string source, char value, int startIndex, int count, CompareOptions options)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if ((((options & ~(CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase)) != CompareOptions.None) && (options != CompareOptions.Ordinal)) && (options != CompareOptions.OrdinalIgnoreCase))
     {
         throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
     }
     if ((source.Length == 0) && ((startIndex == -1) || (startIndex == 0)))
     {
         return(-1);
     }
     if ((startIndex < 0) || (startIndex > source.Length))
     {
         throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index"));
     }
     if (startIndex == source.Length)
     {
         startIndex--;
         if (count > 0)
         {
             count--;
         }
     }
     if ((count < 0) || (((startIndex - count) + 1) < 0))
     {
         throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_Count"));
     }
     if (options == CompareOptions.OrdinalIgnoreCase)
     {
         return(TextInfo.LastIndexOfStringOrdinalIgnoreCase(source, value.ToString(), startIndex, count));
     }
     return(InternalFindNLSStringEx(this.m_dataHandle, this.m_sortName, GetNativeCompareFlags(options) | 0x800000, source, count, startIndex, new string(value, 1), 1));
 }
Пример #19
0
        private void ConstructInvariant()
        {
            m_lcid = InvariantCultureId;

            /* NumberFormatInfo defaults to the invariant data */
            m_numInfo = NumberFormatInfo.InvariantInfo;
            /* DateTimeFormatInfo defaults to the invariant data */
            m_dateTimeInfo = DateTimeFormatInfo.InvariantInfo;

            if (!m_isReadOnly)
            {
                m_numInfo      = (NumberFormatInfo)m_numInfo.Clone();
                m_dateTimeInfo = (DateTimeFormatInfo)m_dateTimeInfo.Clone();
            }

            m_textInfo = new TextInfo(this, InvariantCultureId);

            m_name        = "";
            m_displayName = m_englishName = m_nativeName = "Invariant Language (Invariant Country)";
            m_iso3lang    = "IVL";
            m_iso2lang    = "iv";
            m_icuName     = "en_US_POSIX";
            m_win3lang    = "IVL";
        }
Пример #20
0
        public virtual int GetHashCode(string source, CompareOptions options)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (options == CompareOptions.Ordinal)
            {
                return(source.GetHashCode());
            }

            if (options == CompareOptions.OrdinalIgnoreCase)
            {
                return(TextInfo.GetHashCodeOrdinalIgnoreCase(source));
            }

            //
            // GetHashCodeOfString does more parameters validation. basically will throw when
            // having Ordinal, OrdinalIgnoreCase and StringSort
            //

            return(GetHashCodeOfString(source, options));
        }
Пример #21
0
        /// <summary>
        /// ���캯����
        /// </summary>
        public ButtonEx()
            : base(HtmlTextWriterTag.Input)
        {
            this.Width = new Unit("70px");
            this.CssClass = "ButtonFlat";

            this.textInfo = Thread.CurrentThread.CurrentCulture.TextInfo;
        }
 // Token: 0x06003084 RID: 12420 RVA: 0x000B9B3A File Offset: 0x000B7D3A
 internal static int GetHashCodeOrdinalIgnoreCase(string s)
 {
     return(TextInfo.GetHashCodeOrdinalIgnoreCase(s, false, 0L));
 }
        public override bool Equals(object obj)
        {
            TextInfo textInfo = obj as TextInfo;

            return(textInfo != null && this.CultureName.Equals(textInfo.CultureName));
        }
 internal static int CompareOrdinalIgnoreCase(string str1, string str2)
 {
     return(TextInfo.InternalCompareStringOrdinalIgnoreCase(str1, 0, str2, 0, str1.Length, str2.Length));
 }
Пример #25
0
		public static TextInfo ReadOnly (TextInfo textInfo)
		{
			if (textInfo == null)
				throw new ArgumentNullException ("textInfo");

			TextInfo ti = new TextInfo (textInfo);
			ti.m_isReadOnly = true;
			return ti;
		}
		static bool AreEqual (TextInfo info, CultureInfo culture)
		{
#if !NET_2_1
			return info.LCID == culture.LCID;
#else
			return info.CultureName == culture.Name;
#endif
		}
Пример #27
0
 public string IlkHarfleriBuyut(string metin)
 {
     System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
     System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;
     return(textInfo.ToTitleCase(metin));
 }
Пример #28
0
        /// <summary>将指定字符串转换为标题大写(全部大写将被视为首字母缩写的词不包含在内)。</summary>
        /// <returns>转换为标题大写的指定字符串。</returns>
        /// <param name="str">转换为标题大写的字符串。</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="str" /> is null. </exception>
        public string ToTitleCase(string str)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (str.Length == 0)
            {
                return(str);
            }
            StringBuilder result = new StringBuilder();
            string        str1   = (string)null;
            int           index1;

            for (int index2 = 0; index2 < str.Length; index2 = index1 + 1)
            {
                int             charLength;
                UnicodeCategory unicodeCategory1 = CharUnicodeInfo.InternalGetUnicodeCategory(str, index2, out charLength);
                if (char.CheckLetter(unicodeCategory1))
                {
                    index1 = this.AddTitlecaseLetter(ref result, ref str, index2, charLength) + 1;
                    int  startIndex = index1;
                    bool flag       = unicodeCategory1 == UnicodeCategory.LowercaseLetter;
                    while (index1 < str.Length)
                    {
                        UnicodeCategory unicodeCategory2 = CharUnicodeInfo.InternalGetUnicodeCategory(str, index1, out charLength);
                        if (TextInfo.IsLetterCategory(unicodeCategory2))
                        {
                            if (unicodeCategory2 == UnicodeCategory.LowercaseLetter)
                            {
                                flag = true;
                            }
                            index1 += charLength;
                        }
                        else if ((int)str[index1] == 39)
                        {
                            ++index1;
                            if (flag)
                            {
                                if (str1 == null)
                                {
                                    str1 = this.ToLower(str);
                                }
                                result.Append(str1, startIndex, index1 - startIndex);
                            }
                            else
                            {
                                result.Append(str, startIndex, index1 - startIndex);
                            }
                            startIndex = index1;
                            flag       = true;
                        }
                        else if (!TextInfo.IsWordSeparator(unicodeCategory2))
                        {
                            index1 += charLength;
                        }
                        else
                        {
                            break;
                        }
                    }
                    int count = index1 - startIndex;
                    if (count > 0)
                    {
                        if (flag)
                        {
                            if (str1 == null)
                            {
                                str1 = this.ToLower(str);
                            }
                            result.Append(str1, startIndex, count);
                        }
                        else
                        {
                            result.Append(str, startIndex, count);
                        }
                    }
                    if (index1 < str.Length)
                    {
                        index1 = TextInfo.AddNonLetter(ref result, ref str, index1, charLength);
                    }
                }
                else
                {
                    index1 = TextInfo.AddNonLetter(ref result, ref str, index2, charLength);
                }
            }
            return(result.ToString());
        }
//		readonly byte [] contractionFlags = new byte [16];

		// This array is internally used inside IndexOf() to store
		// "no need to check" ASCII characters.
		//
		// Now that it should be thread safe, this array is allocated
		// at every time.
//		byte [] neverMatchFlags = new byte [128 / 8];

		#region .ctor() and split functions

		public SimpleCollator (CultureInfo culture)
		{
			lcid = culture.LCID;
			textInfo = culture.TextInfo;

			unsafe {
				SetCJKTable (culture, ref cjkIndexer,
					ref cjkCatTable, ref cjkLv1Table,
					ref cjkLv2Indexer, ref cjkLv2Table);
			}

			// Get tailoring info
			TailoringInfo t = null;
			for (CultureInfo ci = culture; ci.LCID != 127; ci = ci.Parent) {
				t = Uni.GetTailoringInfo (ci.LCID);
				if (t != null)
					break;
			}
			if (t == null) // then use invariant
				t = Uni.GetTailoringInfo (127);

			frenchSort = t.FrenchSort;
			Uni.BuildTailoringTables (culture, t, ref contractions,
				ref level2Maps);
			unsafeFlags = new byte [UnsafeFlagLength];
			foreach (Contraction c in contractions) {
				if (c.Source.Length > 1)
					foreach (char ch in c.Source)
						unsafeFlags [(int) ch / 8 ]
							|= (byte) (1 << ((int) ch & 7));
//				for (int i = 0; i < c.Source.Length; i++) {
//					int ch = c.Source [i];
//					if (ch > 127)
//						continue;
//					contractionFlags [ch / 8] |= (byte) (1 << (ch & 7));
//				}
			}
			if (lcid != 127)
				foreach (Contraction c in invariant.contractions) {
					if (c.Source.Length > 1)
						foreach (char ch in c.Source)
							unsafeFlags [(int) ch / 8 ] 
								|= (byte) (1 << ((int) ch & 7));
//					for (int i = 0; i < c.Source.Length; i++) {
//						int ch = c.Source [i];
//						if (ch > 127)
//							continue;
//						contractionFlags [ch / 8] |= (byte) (1 << (ch & 7));
//					}
				}

			// FIXME: Since tailorings are mostly for latin
			// (and in some cases Cyrillic) characters, it would
			// be much better for performance to store "start 
			// indexes" for > 370 (culture-specific letters).

/*
// dump tailoring table
Console.WriteLine ("******** building table for {0} : contractions - {1} diacritical - {2}",
culture.LCID, contractions.Length, level2Maps.Length);
foreach (Contraction c in contractions) {
foreach (char cc in c.Source)
Console.Write ("{0:X4} ", (int) cc);
Console.WriteLine (" -> '{0}'", c.Replacement);
}
*/
		}
Пример #30
0
        // Constructor called by SQL Server's special munged culture - creates a culture with
        // a TextInfo and CompareInfo that come from a supplied alternate source. This object
        // is ALWAYS read-only.
        // Note that we really cannot use an LCID version of this override as the cached
        // name we create for it has to include both names, and the logic for this is in
        // the GetCultureInfo override *only*.
        internal CultureInfo(String cultureName, String textAndCompareCultureName)
        {
            if (cultureName==null) {
                throw new ArgumentNullException("cultureName",
                    Environment.GetResourceString("ArgumentNull_String"));
            }

            this.m_cultureTableRecord = CultureTableRecord.GetCultureTableRecord(cultureName, false);
            this.cultureID = this.m_cultureTableRecord.ActualCultureID;
            this.m_name = this.m_cultureTableRecord.ActualName;            

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);

            this.compareInfo = altCulture.CompareInfo;
            this.textInfo = altCulture.TextInfo;
        }
 public CaseInsensitiveHashCodeProvider()
 {
     this.m_text = CultureInfo.CurrentCulture.TextInfo;
 }
    public static TextInfo ReadOnly(TextInfo textInfo)
    {
      Contract.Ensures(Contract.Result<System.Globalization.TextInfo>() != null);

      return default(TextInfo);
    }
		TextInfo m_text; // must match MS name for serialization

		// Public instance constructor
		public CaseInsensitiveHashCodeProvider ()
		{
			CultureInfo culture = CultureInfo.CurrentCulture;
			if (!AreEqual (culture, CultureInfo.InvariantCulture))
				m_text = CultureInfo.CurrentCulture.TextInfo;
		}
Пример #34
0
 public PermissionTokenKeyComparer()
 {
     _caseSensitiveComparer = new Comparer(CultureInfo.InvariantCulture);
     _info = CultureInfo.InvariantCulture.TextInfo;
 }
Пример #35
0
 public static TextInfo ReadOnly(TextInfo textInfo) 
 {
     if (textInfo == null)       { throw new ArgumentNullException("textInfo"); }
     if (textInfo.IsReadOnly)    { return (textInfo); }
     
     TextInfo clonedTextInfo = (TextInfo)(textInfo.MemberwiseClone());
     clonedTextInfo.SetReadOnlyState(true);
     
     return (clonedTextInfo);
 }
Пример #36
0
 public static int OrdinalLastIndexOfIgnoreCase(String source, String value, int startIndex, int count)
 {
     return(TextInfo.LastIndexOfStringOrdinalIgnoreCase(source, value, startIndex, count));
 }
Пример #37
0
		private void ConstructInvariant (bool read_only)
		{
			cultureID = InvariantCultureId;

			/* NumberFormatInfo defaults to the invariant data */
			numInfo=NumberFormatInfo.InvariantInfo;

			if (!read_only) {
				numInfo = (NumberFormatInfo) numInfo.Clone ();
			}

			textInfo = CreateTextInfo (read_only);

			m_name=String.Empty;
			englishname=
			nativename="Invariant Language (Invariant Country)";
			iso3lang="IVL";
			iso2lang="iv";
			win3lang="IVL";
			default_calendar_type = 1 << CalendarTypeBits | (int) GregorianCalendarTypes.Localized;
		}
Пример #38
0
 public static int GetHashCodeOrdinalIgnoreCase(string source)
 {
     return(TextInfo.GetHashCodeOrdinalIgnoreCase(source));
 }
Пример #39
0
		private TextInfo (TextInfo textInfo)
		{
			m_win32LangID = textInfo.m_win32LangID;
			m_nDataItem = textInfo.m_nDataItem;
			m_useUserOverride = textInfo.m_useUserOverride;
			m_listSeparator = textInfo.ListSeparator;
			customCultureName = textInfo.CultureName;
			ci = textInfo.ci;
			handleDotI = textInfo.handleDotI;
			data = textInfo.data;
		}
Пример #40
0
 public static string ToTitleCase(this string text)
 {
     System.Globalization.CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
     System.Globalization.TextInfo    textInfo    = cultureInfo.TextInfo;
     return(textInfo.ToTitleCase(text));
 }
 internal static bool TryFastFindStringOrdinalIgnoreCase(int searchFlags, string source, int startIndex, string value, int count, ref int foundIndex)
 {
     return(TextInfo.InternalTryFindStringOrdinalIgnoreCase(searchFlags, source, count, startIndex, value, value.Length, ref foundIndex));
 }
Пример #42
0
        /// <summary>
        /// Converts the specified string to titlecase. 
        /// </summary>

        public static string ToTitleCase(this string str, TextInfo info)
        {
            return (info ?? CultureInfo.CurrentCulture.TextInfo).ToTitleCase(str);
        }
 internal static int CompareOrdinalIgnoreCaseEx(string strA, int indexA, string strB, int indexB, int lengthA, int lengthB)
 {
     return(TextInfo.InternalCompareStringOrdinalIgnoreCase(strA, indexA, strB, indexB, lengthA, lengthB));
 }
Пример #44
0
 /// <summary>
 /// Create a cloned readonly instance or return the input one if it is
 /// readonly.
 /// </summary>
 public static TextInfo ReadOnly(TextInfo textInfo !!)
 {
     if (textInfo.IsReadOnly)
        /// <summary>Converts the specified string to title case (except for words that are entirely in uppercase, which are considered to be acronyms).</summary>
        /// <param name="str">The string to convert to title case. </param>
        /// <returns>The specified string converted to title case.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        ///         <paramref name="str" /> is <see langword="null" />. </exception>
        // Token: 0x060030A3 RID: 12451 RVA: 0x000B9EFC File Offset: 0x000B80FC
        public string ToTitleCase(string str)
        {
            if (str == null)
            {
                throw new ArgumentNullException("str");
            }
            if (str.Length == 0)
            {
                return(str);
            }
            StringBuilder stringBuilder = new StringBuilder();
            string        text          = null;

            for (int i = 0; i < str.Length; i++)
            {
                int             num;
                UnicodeCategory unicodeCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out num);
                if (char.CheckLetter(unicodeCategory))
                {
                    i = this.AddTitlecaseLetter(ref stringBuilder, ref str, i, num) + 1;
                    int  num2 = i;
                    bool flag = unicodeCategory == UnicodeCategory.LowercaseLetter;
                    while (i < str.Length)
                    {
                        unicodeCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out num);
                        if (TextInfo.IsLetterCategory(unicodeCategory))
                        {
                            if (unicodeCategory == UnicodeCategory.LowercaseLetter)
                            {
                                flag = true;
                            }
                            i += num;
                        }
                        else if (str[i] == '\'')
                        {
                            i++;
                            if (flag)
                            {
                                if (text == null)
                                {
                                    text = this.ToLower(str);
                                }
                                stringBuilder.Append(text, num2, i - num2);
                            }
                            else
                            {
                                stringBuilder.Append(str, num2, i - num2);
                            }
                            num2 = i;
                            flag = true;
                        }
                        else
                        {
                            if (TextInfo.IsWordSeparator(unicodeCategory))
                            {
                                break;
                            }
                            i += num;
                        }
                    }
                    int num3 = i - num2;
                    if (num3 > 0)
                    {
                        if (flag)
                        {
                            if (text == null)
                            {
                                text = this.ToLower(str);
                            }
                            stringBuilder.Append(text, num2, num3);
                        }
                        else
                        {
                            stringBuilder.Append(str, num2, num3);
                        }
                    }
                    if (i < str.Length)
                    {
                        i = TextInfo.AddNonLetter(ref stringBuilder, ref str, i, num);
                    }
                }
                else
                {
                    i = TextInfo.AddNonLetter(ref stringBuilder, ref str, i, num);
                }
            }
            return(stringBuilder.ToString());
        }
Пример #46
0
        private void formLauncher_Load(object sender, EventArgs e)
        {
            textInfo = cultureInfo.TextInfo;

            // Check for updates
            Debug.LogLine("[Update] Checking for updates");
            UpdateFile updater = new UpdateFile();
            bool updateSuccess = updater.ReadXmlFromInterweb("http://www.xobanimot.com/snakebite/update/update.xml");
            if (updateSuccess)
            {
                if (updater.SnakeBite.Version.AsVersion() > ModManager.GetSBVersion())
                {
                    Debug.LogLine(String.Format("Update found! Version {0} is available", updater.SnakeBite.Version.AsVersion()));
                    labelUpdate.Text = String.Format("SnakeBite version {0} now available!", updater.SnakeBite.Version.AsString());
                    labelUpdate.Show();
                } else
                {
                    Debug.LogLine("No update found");
                }
            }

            // Retrieve and display version info
            var MGSVersionInfo = FileVersionInfo.GetVersionInfo(Properties.Settings.Default.InstallPath + "\\mgsvtpp.exe");

            string SBVersion = Application.ProductVersion;
            string MGSVersion = MGSVersionInfo.ProductVersion;

            // Update version text
            string VersionText = String.Format("MGSV {0} / SB {1}", MGSVersion, SBVersion);
            labelVersion.Text = VersionText;
            UpdateVersionLabel();

            UpdateModToggle();

            SetupTheme();

            // Fade in form
            Opacity = 0;
            int duration = 100;//in milliseconds
            int steps = 30;
            Timer timer = new Timer();
            timer.Interval = duration / steps;

            int currentStep = 0;
            timer.Tick += (arg1, arg2) =>
            {
                Opacity = ((double)currentStep) / steps;
                currentStep++;

                if (Opacity == 1)
                {
                    timer.Stop();
                    timer.Dispose();
                }
            };

            timer.Start();
        }
Пример #47
0
        // Constructor called by SQL Server's special munged culture - creates a culture with
        // a TextInfo and CompareInfo that come from a supplied alternate source. This object
        // is ALWAYS read-only.
        // Note that we really cannot use an LCID version of this override as the cached
        // name we create for it has to include both names, and the logic for this is in
        // the GetCultureInfo override *only*.
        internal CultureInfo(String cultureName, String textAndCompareCultureName)
        {
            if (cultureName==null) {
                throw new ArgumentNullException("cultureName",
                    Environment.GetResourceString("ArgumentNull_String"));
            }
            Contract.EndContractBlock();

            this.m_cultureData = CultureData.GetCultureData(cultureName, false);
            if (this.m_cultureData == null)
                throw new CultureNotFoundException(
                    "cultureName", cultureName, Environment.GetResourceString("Argument_CultureNotSupported"));
            
            this.m_name = this.m_cultureData.CultureName;            

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);
            this.compareInfo = altCulture.CompareInfo;
            this.textInfo = altCulture.TextInfo;
        }
Пример #48
0
        public CultureAndRegionInfoBuilder(CultureInfo templateCulture,
                                           Object templateRegion,
                                           String language, String region,
                                           String suffix, CulturePrefix prefix)
#endif
        {
            if (templateCulture == null)
            {
                throw new ArgumentNullException("templateCulture");
            }
            if (templateRegion == null)
            {
                throw new ArgumentNullException("templateRegion");
            }

            // Copy the original property values out of the templates.
            availableCalendars       = templateCulture.OptionalCalendars;
            consoleFallbackUICulture = templateCulture;
            cultureName      = templateCulture.Name;
            dateTimeFormat   = templateCulture.DateTimeFormat;
            isNeutralCulture = templateCulture.IsNeutralCulture;
                        #if CONFIG_REFLECTION
            lcid = templateCulture.LCID;
                        #else
            lcid = templateCulture.GetHashCode();
                        #endif
            numberFormat = templateCulture.NumberFormat;
            parent       = templateCulture.Parent;
            textInfo     = templateCulture.TextInfo;
                        #if CONFIG_FRAMEWORK_1_2
            keyboardLayoutID = templateCulture.KeyboardLayoutID;
            //lineOrientation = templateCulture.LineOrientation; // TODO
                        #endif
                        #if CONFIG_REFLECTION
            cultureEnglishName         = templateCulture.EnglishName;
            cultureNativeName          = templateCulture.NativeName;
            threeLetterISOLanguageName =
                templateCulture.ThreeLetterISOLanguageName;
            threeLetterWindowsLanguageName =
                templateCulture.ThreeLetterWindowsLanguageName;
            twoLetterISOLanguageName =
                templateCulture.TwoLetterISOLanguageName;
                        #endif
                        #if !ECMA_COMPAT
                        #if CONFIG_FRAMEWORK_2_0
            geoId = templateRegion.GeoId;
                        #else
            geoId = templateRegion.GetHashCode();
                        #endif
                        #if CONFIG_FRAMEWORK_2_0
            currencyEnglishName = templateRegion.CurrencyEnglishName;
            currencyNativeName  = templateRegion.CurrencyNativeName;
                        #endif
            currencySymbol           = templateRegion.CurrencySymbol;
            isMetric                 = templateRegion.IsMetric;
            isoCurrencySymbol        = templateRegion.ISOCurrencySymbol;
            regionEnglishName        = templateRegion.EnglishName;
            regionName               = templateRegion.Name;
            regionNativeName         = templateRegion.DisplayName;
            threeLetterISORegionName =
                templateRegion.ThreeLetterISORegionName;
            threeLetterWindowsRegionName =
                templateRegion.ThreeLetterWindowsRegionName;
            twoLetterISORegionName =
                templateRegion.TwoLetterISORegionName;
                        #endif

            // Override the names if necessary.
            String prefixValue;
            if (prefix == CulturePrefix.IANA)
            {
                prefixValue = "i-";
            }
            else if (prefix == CulturePrefix.PrivateUse)
            {
                prefixValue = "x-";
            }
            else
            {
                prefixValue = "";
            }
            if (language == null || language.Length == 0)
            {
                language = cultureName;
            }
            cultureName = prefixValue + language + suffix;
                        #if CONFIG_REFLECTION
            cultureEnglishName = cultureName;
            cultureNativeName  = cultureName;
                        #endif
                        #if !ECMA_COMPAT
            if (region == null || region.Length == 0)
            {
                region = regionName;
            }
            regionName        = prefixValue + region + suffix;
            regionEnglishName = regionName;
            regionNativeName  = regionName;
                        #endif
        }
Пример #49
0
 public InInsertMacro()
 {
     textInfo = cultureInfo.TextInfo;
 }
Пример #50
0
 private void ConstructFromFile(string name)
 {
     string fileName = Environment.CultureDirectory + Path.DirectorySeparatorStr + name;
     try {
         using (StreamReader s = File.OpenText(fileName)) {
             this.name = s.ReadLine();
             this.lcid = int.Parse(s.ReadLine().Substring(2), NumberStyles.HexNumber);
             this.parentName = s.ReadLine();
             this.englishName = s.ReadLine();
             this.nativeName = s.ReadLine();
             this.displayName = s.ReadLine();
             this.twoLetterISOLanguageName = s.ReadLine();
             this.threeLetterISOLanguageName = s.ReadLine();
             this.threeLetterWindowsLanguageName = s.ReadLine();
             string calendarName = s.ReadLine(); // Calendar
             s.ReadLine(); // Optional calendars
             this.cultureTypes = (CultureTypes)int.Parse(s.ReadLine());
             this.ietfLanguageTag = s.ReadLine();
             this.isNeutralCulture = bool.Parse(s.ReadLine());
             this.textInfo = new TextInfo(this, s);
             if (!this.isNeutralCulture) {
                 this.numberFormatInfo = new NumberFormatInfo(s);
                 this.dateTimeFormat = new DateTimeFormatInfo(s, calendarName);
             } else {
                 this.numberFormatInfo = null;
                 this.dateTimeFormat = null;
             }
         }
     } catch (FileNotFoundException) {
         throw new ArgumentException(string.Format("{0} is not a valid culture", name));
     }
     lock (shareByName) {
         shareByName.Add(name.ToLowerInvariant(), this);
     }
 }
Пример #51
0
		private unsafe TextInfo CreateTextInfo (bool readOnly)
		{
			TextInfo tempTextInfo = new TextInfo (this.m_cultureData);
			tempTextInfo.SetReadOnlyState (readOnly);
			return tempTextInfo;
		}
Пример #52
0
        private void CopyFrom(CultureInfo ci)
        {
            this.name = ci.name;
            this.lcid = ci.lcid;
            this.parent = ci.parent;
            this.englishName = ci.englishName;
            this.nativeName = ci.nativeName;
            this.displayName = ci.displayName;
            this.twoLetterISOLanguageName = ci.twoLetterISOLanguageName;
            this.threeLetterISOLanguageName = ci.threeLetterISOLanguageName;
            this.threeLetterWindowsLanguageName = ci.threeLetterWindowsLanguageName;
            this.cultureTypes = ci.cultureTypes;
            this.ietfLanguageTag = ci.ietfLanguageTag;
            this.isNeutralCulture = ci.isNeutralCulture;

            this.textInfo = ci.textInfo;
            this.numberFormatInfo = ci.numberFormatInfo;
            this.dateTimeFormat = ci.dateTimeFormat;
        }
	// Constructors.
	public CaseInsensitiveHashCodeProvider()
			{
				info = CultureInfo.CurrentCulture.TextInfo;
			}
Пример #54
0
 public string ToTitleCase(string inputString)
 {
     System.Globalization.TextInfo txtInfo = System.Globalization.CultureInfo.CurrentCulture.TextInfo;
     return(txtInfo.ToTitleCase(inputString));
 }
Пример #55
0
        // Constructor called by SQL Server's special munged culture - creates a culture with
        // a TextInfo and CompareInfo that come from a supplied alternate source. This object
        // is ALWAYS read-only.
        // Note that we really cannot use an LCID version of this override as the cached
        // name we create for it has to include both names, and the logic for this is in
        // the GetCultureInfo override *only*.
        internal CultureInfo(String cultureName, String textAndCompareCultureName)
        {
            if (cultureName == null)
            {
                throw new ArgumentNullException("cultureName",SR.ArgumentNull_String);
            }
            Contract.EndContractBlock();

            m_cultureData = CultureData.GetCultureData(cultureName, false);
            if (m_cultureData == null)
                throw new CultureNotFoundException("cultureName", cultureName, SR.Argument_CultureNotSupported);
            
            m_name = m_cultureData.CultureName;

            CultureInfo altCulture = GetCultureInfo(textAndCompareCultureName);
            compareInfo = altCulture.CompareInfo;
            textInfo = altCulture.TextInfo;
        }
        public static TextInfo ReadOnly(TextInfo textInfo)
        {
            Contract.Ensures(Contract.Result <System.Globalization.TextInfo>() != null);

            return(default(TextInfo));
        }
Пример #57
0
        internal static TextInfo ReadOnly(TextInfo textInfo)
        {
            if (textInfo == null) { throw new ArgumentNullException("textInfo"); }
            Contract.EndContractBlock();
            if (textInfo.IsReadOnly) { return (textInfo); }

            TextInfo clonedTextInfo = (TextInfo)(textInfo.MemberwiseClone());
            clonedTextInfo.SetReadOnlyState(true);

            return (clonedTextInfo);
        }
Пример #58
0
		private void ConstructInvariant (bool read_only)
		{
			cultureID = InvariantCultureId;

			/* NumberFormatInfo defaults to the invariant data */
			numInfo=NumberFormatInfo.InvariantInfo;
			/* DateTimeFormatInfo defaults to the invariant data */
			dateTimeInfo=DateTimeFormatInfo.InvariantInfo;

			if (!read_only) {
				numInfo = (NumberFormatInfo) numInfo.Clone ();
				dateTimeInfo = (DateTimeFormatInfo) dateTimeInfo.Clone ();
			}

			textInfo = CreateTextInfo (read_only);

			m_name=String.Empty;
			displayname=
			englishname=
			nativename="Invariant Language (Invariant Country)";
			iso3lang="IVL";
			iso2lang="iv";
			icu_name="en_US_POSIX";
			win3lang="IVL";
		}