private void SetupSpellBook_Load(object sender, EventArgs e)
        {
            var ti = new CultureInfo("en-ZA", false).TextInfo;
            txtAddonAuthor.Text = ti.ToTitleCase(Environment.UserName);

            var machineName = new string(Environment.MachineName.Where(char.IsLetter).ToArray()).ToLower();
            txtAddonName.Text = ti.ToTitleCase(machineName);

            txtAddonAuthor.Text = SpellBook.AddonAuthor;
            txtAddonName.Text = ConfigFile.ReadValue("PixelMagic", "AddonName");

            cmbKeyBind.DataSource = Enum.GetNames(typeof(WoW.Keys));

            try
            {
                var intVer = SpellBook.InterfaceVersion.Replace("\n", "").Replace("\r", "");

                foreach (var item in cmbWowVersion.Items)
                {
                    if (item.ToString().Contains(intVer)) cmbWowVersion.SelectedItem = item;
                }
            }
            catch(Exception ex)
            {
                // Do nothing - ignore
            }
            
            dgSpells.DataSource = SpellBook.dtSpells;
            dgAuras.DataSource = SpellBook.dtAuras;
        }
        public WordView(CGRect frame, string title, string value)
        {
            Init();
            Frame = frame;

            var textInfo = new CultureInfo("en-US",false).TextInfo;

            title = textInfo.ToTitleCase(title);
            value = textInfo.ToTitleCase(value);

            //Title label
            _title = new UILabel(new CGRect(0, 45, frame.Width, 50))
            {
                TextAlignment = UITextAlignment.Center,
                TextColor = "3C3C3C".ToUIColor(),
                Font = UIFont.FromName("Raleway-SemiBold", 32),
                Text = title
            };
            Add(_title);

            //Word label
            _word = new UILabel(new CGRect(0, 108, frame.Width, 59))
            {
                TextAlignment = UITextAlignment.Center,
                TextColor = "3C3C3C".ToUIColor(),
                Font = UIFont.FromName("Raleway-Regular", 32),
                Text = value
            };
            Add(_word);
        }
        public ActionResult AjaxAction(string nome, string sobrenome)
        {
            Thread.Sleep(3000);
            var ti = new CultureInfo("pt-BR").TextInfo;
            var nomeFormatado = string.Format("{0} {1}", ti.ToTitleCase(nome), ti.ToTitleCase(sobrenome));

            return PartialView("PartialNomes", nomeFormatado);
        }
	public void TitleCase ()
	{
		TextInfo ti = new CultureInfo ("en-US", false).TextInfo;

		Assert.AreEqual (" The Dog", ti.ToTitleCase (" the dog"));
		Assert.AreEqual (" The Dude", ti.ToTitleCase (" The Dude"));
		Assert.AreEqual ("La Guerra Yla Paz", ti.ToTitleCase ("la Guerra yLa pAz"));
		Assert.AreEqual ("\tTab\tAnd\tPeace", ti.ToTitleCase ("\ttab\taNd\tpeaCE"));
	}
示例#5
0
	public void TitleCase ()
	{
		TextInfo ti = new CultureInfo ("en-US", false).TextInfo;

		Assert.AreEqual (" The Dog", ti.ToTitleCase (" the dog"), "#1");
		Assert.AreEqual (" The Dude", ti.ToTitleCase (" The Dude"), "#2");
		Assert.AreEqual ("La Guerra Yla Paz", ti.ToTitleCase ("la Guerra yLa pAz"), "#3");
		Assert.AreEqual ("\tTab\tAnd\tPeace", ti.ToTitleCase ("\ttab\taNd\tpeaCE"), "#4");
		Assert.AreEqual ("This_Is\uFE58A\u0095String\u06D4With\uFE33Separators", ti.ToTitleCase ("this_is\uFE58a\u0095string\u06D4with\uFE33separators"), "#5");
	}
        static ActorNameGenerator()
        {
            TextInfo myTI = new CultureInfo("en-gb", false).TextInfo;

            //Load everything
            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "HumanNames" + Path.DirectorySeparatorChar + "FemaleNames.txt"))
            {
                femaleHuman.AddRange(reader.ReadToEnd().ToLower().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "HumanNames" + Path.DirectorySeparatorChar + "MaleNames.txt"))
            {
                maleHuman.AddRange(reader.ReadToEnd().ToLower().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "HumanNames" + Path.DirectorySeparatorChar + "Surnames.txt"))
            {
                humanSurname.AddRange(reader.ReadToEnd().ToLower().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "OrcNames" + Path.DirectorySeparatorChar + "FirstName.txt"))
            {
                orcName.AddRange(reader.ReadToEnd().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "OrcNames" + Path.DirectorySeparatorChar + "SurnameAft.txt"))
            {
                orcSurnameAft.AddRange(reader.ReadToEnd().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            using (TextReader reader = new StreamReader(folderPath + Path.DirectorySeparatorChar + "OrcNames" + Path.DirectorySeparatorChar + "SurnameFore.txt"))
            {
                orcSurnameFore.AddRange(reader.ReadToEnd().Replace("\r", "").Split('\n').Where(r => !String.IsNullOrEmpty(r)));
            }

            //Title case all of them
            for (int i = 0; i < femaleHuman.Count; i++)
            {
                femaleHuman[i] = myTI.ToTitleCase(femaleHuman[i]);
            }

            for (int i = 0; i < maleHuman.Count; i++)
            {
                maleHuman[i] = myTI.ToTitleCase(maleHuman[i]);
            }

            for (int i = 0; i < humanSurname.Count; i++)
            {
                humanSurname[i] = myTI.ToTitleCase(humanSurname[i]);
            }

            random = new Random();
        }
示例#7
0
 public static string Capitalize(this string original, bool onlyFirst=false, string culture="en-US")
 {
     TextInfo textInfo = new CultureInfo(culture, false).TextInfo;
     original = original.Trim();
     if (string.IsNullOrWhiteSpace(original))
         return null;
     if (onlyFirst && original.Length != 1)
     {
         return textInfo.ToTitleCase(original.Substring(0, 1)) + original.Substring(1);
     }
     else
     {
         return textInfo.ToTitleCase(original);
     }
 }
示例#8
0
        public MIFieldValue(string field, string value, string prefix)
        {
            Value = value;
            TextInfo ti = new CultureInfo("en-US", false).TextInfo;
            string tempName = string.Empty;

            foreach (char c in field)
            {
                if (Char.IsLetterOrDigit(c))
                {
                    tempName += c;
                }
                else if (c == '(' || c == ')')
                {
                    continue;
                }
                else
                {
                    tempName += " ";
                }
            }
            tempName = ti.ToTitleCase(tempName.Trim()).Replace(" ", "");
            FieldWithoutPadding = string.Format("{0}_{1}", prefix, tempName);
            Field = string.Format("{0}{1}{2}", paddingChar, FieldWithoutPadding, paddingChar);
        }
        public IEnumerable<SelectListItem> GetMonthsListForDropDown()
        {
            var textInfo = new CultureInfo("en-US", false).TextInfo;
            var items = new List<SelectListItem>();
            //var selFirstListItem = new SelectListItem { Value = "", Text = "--- Choose ---" };
            //items.Add(selFirstListItem);

            var selItems = new List<SelectListItem>();
            if (DateTimeFormatInfo
                .CurrentInfo != null)
            {
                selItems = DateTimeFormatInfo
                    .CurrentInfo
                    .MonthNames
                    .Select((monthName, index) =>
                        new SelectListItem
                        {
                            Value = (index + 1).ToString(CultureInfo.InvariantCulture),
                            Text = textInfo.ToTitleCase(monthName)
                        }).Where(p => p.Text != "").ToList();

            }
            selItems = DateTimeFormatInfo
            .InvariantInfo
            .MonthNames
            .Select((monthName, index) =>
                new SelectListItem
                {
                    Value = (index + 1).ToString(CultureInfo.InvariantCulture),
                    Text = monthName
                }).Where(p => p.Text != "").ToList();

            items.AddRange(selItems);
            return items;
        }
示例#10
0
        public string ConvertToTitleCase(string title)
        {
            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            title = textInfo.ToTitleCase(title);

            return title;
        }
示例#11
0
        public static async Task<long?> GetPrimePlatSellOrders(string primeName)
        {
            CacheEntry<long?> cacheItem;
            if (_marketCache.TryGetValue(primeName, out cacheItem))
            {
                if (!cacheItem.IsExpired(_expirationTimespan))
                {
                    return cacheItem.Value;
                }
            }

            var textInfo = new CultureInfo("en-US", false).TextInfo;

            var partName = textInfo.ToTitleCase(primeName.ToLower());

            if (_removeBPSuffixPhrases.Any(suffix => partName.EndsWith(suffix + " Blueprint")))
            {
                partName = partName.Replace(" Blueprint", "");
            }

            // Since Warframe.Market is still using the term Helmet instead of the new one, TODO: this might change
            partName = partName.Replace("Neuroptics", "Helmet");

            if (_fixedQueryStrings.ContainsKey(partName))
            {
                //Some of Warframe.Market's query strings are mangled (extra spaces, misspellings, words missing) fix them manually...
                partName = _fixedQueryStrings[partName];
            }

            string jsonData;
            using (var client = new WebClient())
            {
                var uri = new Uri(_baseUrl + Uri.EscapeDataString(partName));

                try
                {
                    jsonData = await client.DownloadStringTaskAsync(uri);

                    dynamic result = JsonConvert.DeserializeObject(jsonData);

                    // when the server responds anything that is not 200 (HTTP OK) don't bother doing something else
                    if (result.code != 200)
                    {
                        Debug.WriteLine($"Error with {partName}, Status Code: {result.code.Value}");
                        _marketCache[primeName] = new CacheEntry<long?>(null);
                        return null;
                    }

                    IEnumerable<dynamic> sellOrders = result.response.sell;
                    long? smallestPrice = sellOrders.Where(order => order.online_status).Min(order => order.price);

                    _marketCache[primeName] = new CacheEntry<long?>(smallestPrice);
                    return smallestPrice;
                }
                catch
                {
                    return null;
                }
            }            
        }
示例#12
0
        static void Main(string[] args)
        {
            var syntaxTree = SyntaxTree.ParseFile("Person.cs");

            var allNodes = syntaxTree.GetRoot().DescendantNodes();

            var fields = allNodes.OfType<FieldDeclarationSyntax>().SelectMany(
                f => f.Declaration.Variables.Select(
                    v => v.Identifier.ValueText)).ToList();

            var methods = allNodes.OfType<MethodDeclarationSyntax>().Select(
                m => m.Identifier.ValueText);

            var textInfo = new CultureInfo("nb-NO").TextInfo;

            foreach (var field in fields)
            {
                var trimmedAndCapitalizedFieldName = textInfo.ToTitleCase(field.TrimStart('_'));

                var getterName = "Get" + trimmedAndCapitalizedFieldName;
                var setterName = "Set" + trimmedAndCapitalizedFieldName;

                if (methods.Contains(getterName))
                    Console.WriteLine("there seems to be a getter for field '{0}': {1}", field, getterName);

                if (methods.Contains(setterName))
                    Console.WriteLine("there seems to be a setter for field '{0}': {1}", field, setterName);
            }

            Console.Read();
        }
示例#13
0
	// Use this for initialization
	void Start () {

		if (string.IsNullOrEmpty(JumpToLevel)) {
			logger.LogError("Level", "Naming Error");
		}
		System.Globalization.TextInfo textInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo;
		JumpToLevel = textInfo.ToTitleCase(JumpToLevel);
	}
示例#14
0
        private static string SetCase(this string InputText)
        {
            TextInfo _textInfo = new CultureInfo(CultureInfo.CurrentCulture.ToString(), false).TextInfo;

            string _output = _textInfo.ToTitleCase(InputText.ToLower());

            return _output;
        }
示例#15
0
		public void UpdateCell (Part part)
		{
			var bottomText = string.Format ("{0} {1} {2} {3}", part.Year, part.Make, part.Model, part.Interchange);

			TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
			TopLabel.Text = textInfo.ToTitleCase (part.PartName.ToLower ());
			BottomLabel.Text = bottomText;
			RightLabel.Text = string.Format ("${0}", part.Price);
		}
示例#16
0
        private static string ToTitleCase(string texto, bool manterOqueJaEstiverMaiusculo)
        {
            texto = texto.Trim();

            if (!manterOqueJaEstiverMaiusculo) texto = texto.ToLower();

            TextInfo textInfo = new CultureInfo("pt-BR", false).TextInfo;
            return textInfo.ToTitleCase(texto);
        }
示例#17
0
        public static string ToCamelCase(this String input)
        {
            if (input == null) return "";

            var textInfo = new CultureInfo("en-US", false).TextInfo;
            var result = textInfo.ToTitleCase(input.Trim()).Replace(" ", "");

            return result;
        }
示例#18
0
 /// <summary>
 /// Pretifies a Vendor Name string passed into it
 /// </summary>
 /// <param name="provider">The name of the Vendor to format</param>
 /// <returns>A foramatted string of the Vendor's name</returns>
 public static string formatProvider(string provider)
 {
     TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
     return textInfo
                 .ToTitleCase(provider.ToLower())
                 .Replace("Llc", "LLC")
                 .Replace("L.p", "L.P")
                 .Replace("At&T", "AT&T")
                 .Replace("Tw", "TW");
 }
示例#19
0
        public static string ToCamelCase(string text)
        {
            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            string camelCase = Regex.Replace(text, "(\\B[A-Z])", " $1");
            string titleCase = textInfo.ToTitleCase(camelCase.Replace("_", " "));

            string result = titleCase.Replace(" ", string.Empty);

            return result;
        }
        public static String toProper(String columnString) {

            // Creates a TextInfo object from which the method will apply the casing rules
            var myTI = new CultureInfo("en-US", false).TextInfo;

            // Constructs the proper cased string
            var retval = myTI.ToTitleCase(myTI.ToLower(columnString));

            // Returns the String to the caller
            return retval;

        } // End of Method declaration
        /// <summary>
        /// Create data using list of movies
        /// </summary>
        /// <param name="movies">List of movies to create data from</param>
        /// <returns>Data of string type</returns>
        private static string CreateDataFromList()
        {
            var detailStr = string.Empty;
            var textInfo = new CultureInfo("en-US", false).TextInfo;

            foreach (var movieDetail in movies)
            {
                detailStr = string.Concat(detailStr, "==== MOVIE DETAIL ====");
                detailStr = string.Concat(detailStr, "\r\n\r\n");
                                     
                detailStr = string.Concat(detailStr, "Name: ", textInfo.ToTitleCase(movieDetail.Name), "\r\n");
                detailStr = string.Concat(detailStr, "Runtime (minutes): ", movieDetail.Runtime, "\r\n");
                detailStr = string.Concat(detailStr, "Language: ", movieDetail.Language, "\r\n");
                detailStr = string.Concat(detailStr, "LeadActor: ", textInfo.ToTitleCase(movieDetail.LeadActor), "\r\n");
                detailStr = string.Concat(detailStr, "Genre: ", textInfo.ToTitleCase(movieDetail.Genre), "\r\n");
                                       
                detailStr = string.Concat(detailStr, "\r\n\r\n");
            }

            return detailStr;
        }
示例#22
0
 public static string ConvertTitleCase(string value)
 {
     TextInfo txtInfo = new CultureInfo("en-US", false).TextInfo;
     try
     {
         return txtInfo.ToTitleCase(value.ToLower());
     }
     catch
     {
         return value;
     }
 }
示例#23
0
文件: Utils.cs 项目: giopl/space-gym
        /*
         * Helper Method to transform text to title case used for names
         * Param: String
         *
         */
        public static string ToTitleCase(string text)
        {
            System.Globalization.TextInfo myTI = new System.Globalization.CultureInfo("en-US", false).TextInfo;

            if (String.IsNullOrEmpty(text))
            {
                return(string.Empty);
            }


            return(myTI.ToTitleCase(text.Trim().ToLower()));
        }
		static string GetHiearchySafeName (string val, string defaultValue) {
			if (string.IsNullOrEmpty(val)) {
				return defaultValue;
			}

			// Capitalize each first letter
			TextInfo txt = new CultureInfo("en-US", false).TextInfo;
			val = txt.ToTitleCase(val); // Uppercase letters
			val = val.Replace(" ", ""); // Strip spaces
			val = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9 -]").Replace(val, ""); // Strip non-alphanumeric
			return val;
			
		}
示例#25
0
文件: Utils.cs 项目: giopl/space-gym
        /// <summary>
        /// verifies if string is empty, replaces with NA
        /// </summary>
        /// <param name="text">text to verify</param>
        /// <param name="ToTitleCase">if text is to be converted to TitleCase</param>
        /// <returns></returns>
        public static string ReplaceNullWithNA(string text, bool ToTitleCase = false)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                return("N/A");
            }

            if (ToTitleCase)
            {
                System.Globalization.TextInfo myTI = new System.Globalization.CultureInfo("en-US", false).TextInfo;
                return(myTI.ToTitleCase(text.Trim().ToLower()));
            }

            return(text);
        }
示例#26
0
    public void flush()
    {
        System.Console.WriteLine("FLSH!!!!!!!!!");

        string tag = this.obj.dicTag ["tag"];

        System.Globalization.TextInfo tf = new System.Globalization.CultureInfo("en-US", false).TextInfo;

        string className = "Novel." + tf.ToTitleCase(tag) + "Component";

        Debug.Log(className);

        //Novel.Bg_removeComponent

        AbstractComponent test = new Novel.Bg_removeComponent();

        Debug.Log(test);
        Debug.Log(test.GetType().FullName);

        className = test.GetType().FullName;

        //リフレクションで動的型付け 
        Type masterType = Type.GetType(className);

        Debug.Log(masterType);

        AbstractComponent cmp;

        cmp = (AbstractComponent)Activator.CreateInstance(masterType);

        this.obj.dicParamDefault = cmp.originalParam;

        Dictionary <string, string> tmpDic = new Dictionary <string, string> ();
        List <string> l = cmp.arrayVitalParam;

        for (var i = 0; i < l.Count; i++)
        {
            string vital = l [i];
            tmpDic [vital] = "yes";
        }

        this.obj.dicParamVital = tmpDic;
        //必須パラメータとかデフォルト値を取得

        this.arrDoc.Add(this.obj);
        this.obj    = new DocObject();
        this.status = "";
    }
示例#27
0
        public Aroma(string line)
        {
            Columns cm = new Columns(line);

            float volTmp, vol = 0;

            this.Id = cm.Id;
            this.BareTitleEng = TitleTools.RemoveVolume(cm.TitleEng, out vol);
            this.BareTitleRus = TitleTools.RemoveVolume(cm.TitleRus, out volTmp);

            TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
            BareTitleEng = textInfo.ToTitleCase(BareTitleEng.ToLower());

            textInfo = new CultureInfo("ru-RU", false).TextInfo;
            BareTitleRus = textInfo.ToTitleCase(BareTitleRus.ToLower());

            this.Volume = vol;
            this.IsTester = TitleTools.IsTester(cm.TitleEng);
            this.Brand = cm.Category;

            string category = cm.Category
                .Replace("&", "_")
                .Replace(".", "_")
                .Replace(" ", "_")
                .ToLower();

            this.Url = "http://www.vikinora.ru/parfumeria/" + category + "/" + cm.Url + "/";

            string imageUrl = "http://www.vikinora.ru" + cm.ImageUrl;

            if (cm.ImageUrl != string.Empty)
            {
                string[] parts = cm.ImageUrl.Split('/');
                string fileName = parts[parts.Length - 1];

                string[] fileNameParts = fileName.Split('.');
                string onlyName = fileNameParts[0];

                this.ImageUrl = "d:\\Projects\\VikinoraDirect\\data\\img\\" + onlyName + ".jpg";
            }
            else
            {
                this.ImageUrl = string.Empty;
            }
        }
示例#28
0
文件: Utils.cs 项目: giopl/space-gym
        /// <summary>
        /// Replaces the underscore in enum names Ex. Work_In_Progress --> Work In Progress
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string EnumToString(string text, bool toTitleCase = false)
        {
            System.Globalization.TextInfo myTI = new System.Globalization.CultureInfo("en-US", false).TextInfo;

            if (String.IsNullOrEmpty(text))
            {
                return(string.Empty);
            }

            if (toTitleCase)
            {
                return(myTI.ToTitleCase(text.Trim().ToLower()).Replace('_', ' '));
            }
            else
            {
                return(text.Replace('_', ' '));
            }
        }
示例#29
0
		static RecordTypes()
		{
			s_lookup = new Dictionary<string, DnsRecordType>()
			{
				{ "A",     DnsRecordType.A     },
				{ "AAAA",  DnsRecordType.AAAA  },
				{ "NS",    DnsRecordType.NS    },
				{ "MX",    DnsRecordType.MX    },
				{ "CNAME", DnsRecordType.CNAME },
				{ "SOA",   DnsRecordType.SOA   },
				{ "TXT",   DnsRecordType.TXT   },
				{ "SRV",   DnsRecordType.SRV   },
			};

			TextInfo ti = new CultureInfo( "en-US", false ).TextInfo;

			s_lookupInv = s_lookup
				.ToDictionary( kvp => kvp.Value, kvp => ti.ToTitleCase( kvp.Key ) );
		}
示例#30
0
        public static string UpperFirstLetter(this string source, UpperFirstLetterOptions options)
        {
            if(source.IsNullOrEmpty(true))
            {
                return source;
            }
            if (options == UpperFirstLetterOptions.UseToTitle)
            {
                TextInfo myTi = new CultureInfo("en-US", false).TextInfo;
                return myTi.ToTitleCase(source);
            }
            else
            {
                char[] delimiterChars = {' ', ',', '.', ':', '\t'};
                var sourceCharArray = source.ToCharArray();
                var rtValue = string.Empty;
                for (int i = 0; i < sourceCharArray.Length; i++)
                {
                    if (i == 0)
                    {
                        sourceCharArray[i] = sourceCharArray[i].ToString().ToUpper()[0];
                    }
                    else
                    {
                        if (delimiterChars.Contains(sourceCharArray[i - 1]))
                        {
                            sourceCharArray[i] = sourceCharArray[i].ToString().ToUpper()[0];
                        }
                        else
                        {
                            if (options == UpperFirstLetterOptions.UpperWordsFirstLetterLowerOthers)
                            {
                                sourceCharArray[i] = sourceCharArray[i].ToString().ToLower()[0];
                            }
                        }
                    }
                    rtValue = rtValue + sourceCharArray[i];
                }

                return rtValue;
            }
        }
示例#31
0
        /// <summary>
        /// This function takes in an unformatted string and returns it by changing to proper case, adding/removing relevant spaces
        /// </summary>
        /// <param name="unformatted">The string to be formatted</param>
        /// <returns></returns>
        public static string FormatString(string unformatted)
        {
            #region Convert string to Title/Proper case
            string formatted;
            TextInfo ti = new CultureInfo("en-US", false).TextInfo;
            unformatted = unformatted.ToLower();
            formatted = ti.ToTitleCase(unformatted);
            String finalstring = "";
            string[] Newformat = formatted.Split(' ');
            foreach (string words in Newformat)
            {
                finalstring += words;
            }
            #endregion

            //Add spaces
            string Str = "";
            int i = 0;
            //Looping through each letter of finalstring
            foreach (char character in finalstring)
            {
                Str += character;
                if (i < finalstring.Length - 2)
                {
                    char nextCharacter = char.Parse(finalstring.Substring(i + 1, 1));
                    //To add spaces before capital letters
                    if (character != '(' && char.IsUpper(nextCharacter))
                    {
                        Str += " ";
                    }

                    //To add spaces after '.'
                    if (character == '.' && nextCharacter != ')' && nextCharacter != ' ')
                    {
                        Str += " ";
                    }
                    i++;
                }
            }
            return Str;
        }
示例#32
0
        private void buttonCreateCategory_Click(object sender, EventArgs e)
        {
            if (!textBoxCreateCategory.HasText())
            {
                labelCreateCategoryMessage.Text = @"Please specify a category.";
                labelCreateCategoryMessage.Visible = true;
                return;
            }

            var category = textBoxCreateCategory.CleanText();

            var textInfo = new CultureInfo("en-US", false).TextInfo;
            category = textInfo.ToTitleCase(category);

            KeywordRepository.CreateCategory(category);

            ReloadForm();

            labelCreateCategoryMessage.Text = @"category created";
            labelCreateCategoryMessage.Visible = true;
        }
        /// <summary>
        /// Gets the file description of a proces and returns it formatted
        /// (shortened if neccessary)
        /// </summary>
        /// <param name="process"></param>
        /// <returns></returns>
        public static string GetFileDescription(string process)
        {
            var fileDesc = GetFileDescriptionFromProcess(process);

            // to title case
            var textInfo = new CultureInfo("en-US", false).TextInfo;
            fileDesc = textInfo.ToTitleCase(fileDesc.ToLower());

            // shorten file description if necessary
            if (fileDesc == null)
            {
                fileDesc = process;
                if (fileDesc.Length > 20)
                    fileDesc = "..." + fileDesc.Substring(fileDesc.Length - 17);
            }
            else if (fileDesc.Length > 20)
            {
                fileDesc = fileDesc.Substring(0, 17) + "...";
            }

            return fileDesc;
        }
示例#34
0
 static void process(string infile,string outfile)
 {
     StreamReader input = new StreamReader(infile);
     ushort startdef = 0x001F;
     ushort enddef = 0xFFFC;
     List<ushort> exp = new List<ushort>();
     exp.Add(0x0080);
     exp.Add(0x0081);
     exp.Add(0x0084);
     exp.Add(0x0099);
     StringBuilder rcfile = new StringBuilder();
     string line;
     TextInfo casefix = new CultureInfo("en-US", false).TextInfo;
     while ((line = input.ReadLine()) != null)
     {
         StringBuilder templine = new StringBuilder();
         int i = 1;
         string[] items = line.Split(';');
         ushort ucode = ushort.Parse(items[0], System.Globalization.NumberStyles.HexNumber);
         if (ucode <= startdef || (ucode < 0x00A0 && ucode > 0x007E))
             i = 10;
         if (exp.Contains(ucode))
             continue;
         templine.Append("    " +ucode.ToString() + " \"" + items[i] + "\" \n");
         rcfile.Append(casefix.ToTitleCase(templine.ToString().ToLower()));
         if (ucode == enddef)
             break;
     }
     using (StreamWriter output = new StreamWriter(outfile))
     {
         //finishing touches
         rcfile.Replace("Cjk", "CJK");
         //specifics
         rcfile.Replace(" (Nel)", "").Replace(" (Cr)", "").Replace(" (Ff)", "").Replace(" (Lf)", "");
         output.Write(rcfile.ToString());
     }
 }