/// <summary>
        /// Creates suggestions for the given pattern info
        /// </summary>
        /// <param name="rule">the change rules that give order to the suggestions</param>
        /// <param name="pi">the pattern info object to create suggestions for</param>
        /// <returns></returns>
        private static string[] CreateGeneralNumberSuggestions(NumberChangeRule rule, GeneralNumberInfo pi)
        {
            if (pi == null)
            {
                return(new string[0]);
            }

            var lstSug = new List <string>();

            string fracStr    = pi.IsFraction ? pi.FractionString : null;
            string fracStrPer = fracStr == null ? null : ParsingUtils.ConvertNumber2Persian(fracStr);

            double value = pi.GetValue();

            if (pi.IsFraction)
            {
                value = Math.Round(value, 3);
            }
            string f20Normalized    = MathUtils.NormalizeForF20Format(value.ToString("F20"));
            string f20Currency      = MathUtils.InsertThousandSeperator(f20Normalized);
            bool   addCurrency      = (f20Normalized != f20Currency);
            string f20NormalizedPer = ParsingUtils.ConvertNumber2Persian(f20Normalized);
            string f20CurrencyPer   = ParsingUtils.ConvertNumber2Persian(f20Currency);

            string strWritten;

            if (!NumberToPersianString.TryConvertNumberToPersianString(value, out strWritten))
            {
                strWritten = null;
            }

            var inpFormat = NumberChangeRule.InputFormats.Letters;
            var inpLang   = NumberChangeRule.InputDigitLanguages.None;

            KeyValuePair <NumberChangeRule.OutputFormats, NumberChangeRule.OutputDigitLanguages>?sugPrior = null;

            if (rule != null)
            {
                if (rule.ContainsKey(inpFormat, inpLang))
                {
                    sugPrior = rule.GetValueForKey(inpFormat, inpLang);
                }
                else if (rule.ContainsKey(inpFormat, NumberChangeRule.InputDigitLanguages.Persian))
                {
                    sugPrior = rule.GetValueForKey(inpFormat, NumberChangeRule.InputDigitLanguages.Persian);
                }
            }

            // now giving orders

            if (sugPrior != null)
            {
                if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.FloatingPoint &&
                    sugPrior.Value.Value == NumberChangeRule.OutputDigitLanguages.Persian)
                {
                    // add in persian digits
                    lstSug.Add(f20NormalizedPer);
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }

                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }

                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStrPer);
                        lstSug.Add(fracStr);
                    }

                    // add in english digits
                    lstSug.Add(f20Normalized);
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }
                }
                else if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.FloatingPointWithSep &&
                         sugPrior.Value.Value == NumberChangeRule.OutputDigitLanguages.Persian)
                {
                    // add in persian digits
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }
                    lstSug.Add(f20NormalizedPer);

                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }

                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStrPer);
                        lstSug.Add(fracStr);
                    }

                    // add in english digits
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }
                    lstSug.Add(f20Normalized);
                }
                else if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.Fractional &&
                         sugPrior.Value.Value == NumberChangeRule.OutputDigitLanguages.Persian)
                {
                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStrPer);
                        lstSug.Add(fracStr);
                    }

                    // add in persian digits
                    lstSug.Add(f20NormalizedPer);
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }

                    // add in english digits
                    lstSug.Add(f20Normalized);
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }

                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }
                }
                else if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.Letters)
                {
                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }

                    // add in persian digits
                    lstSug.Add(f20NormalizedPer);
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }

                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStrPer);
                        lstSug.Add(fracStr);
                    }

                    // add in english digits
                    lstSug.Add(f20Normalized);
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }
                }
                else if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.FloatingPoint &&
                         sugPrior.Value.Value == NumberChangeRule.OutputDigitLanguages.English)
                {
                    // add in english digits
                    lstSug.Add(f20Normalized);
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }

                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStr);
                        lstSug.Add(fracStrPer);
                    }

                    // add in persian digits
                    lstSug.Add(f20NormalizedPer);
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }

                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }
                }
                else if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.FloatingPointWithSep &&
                         sugPrior.Value.Value == NumberChangeRule.OutputDigitLanguages.English)
                {
                    // add in english digits
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }
                    lstSug.Add(f20Normalized);

                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }

                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStr);
                        lstSug.Add(fracStrPer);
                    }

                    // add in persian digits
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }
                    lstSug.Add(f20NormalizedPer);
                }
                else if (sugPrior.Value.Key == NumberChangeRule.OutputFormats.Fractional &&
                         sugPrior.Value.Value == NumberChangeRule.OutputDigitLanguages.English)
                {
                    // add fractions
                    if (!String.IsNullOrEmpty(fracStr))
                    {
                        lstSug.Add(fracStr);
                        lstSug.Add(fracStrPer);
                    }

                    // add in english digits
                    lstSug.Add(f20Normalized);
                    if (addCurrency)
                    {
                        lstSug.Add(f20Currency);
                    }

                    // add in persian digits
                    lstSug.Add(f20NormalizedPer);
                    if (addCurrency)
                    {
                        lstSug.Add(f20CurrencyPer);
                    }

                    // add the number in letters
                    if (!String.IsNullOrEmpty(strWritten))
                    {
                        lstSug.Add(strWritten);
                    }
                }
            }

            if (lstSug.Count <= 0)
            {
                // add fractions
                if (!String.IsNullOrEmpty(fracStr))
                {
                    lstSug.Add(fracStrPer);
                    lstSug.Add(fracStr);
                }

                // add in persian digits
                lstSug.Add(f20NormalizedPer);
                if (addCurrency)
                {
                    lstSug.Add(f20CurrencyPer);
                }

                // add in english digits
                lstSug.Add(f20Normalized);
                if (addCurrency)
                {
                    lstSug.Add(f20Currency);
                }

                // add the number in letters
                if (!String.IsNullOrEmpty(strWritten))
                {
                    lstSug.Add(strWritten);
                }
            }

            return(lstSug.ToArray());
        }
        private static string CreateGeneralNumberSuggestionFor(GeneralNumberInfo pi, KeyValuePair <NumberChangeRule.OutputFormats, NumberChangeRule.OutputDigitLanguages> ruleValue)
        {
            if (pi == null)
            {
                return(null);
            }

            string fracStr    = pi.IsFraction ? pi.FractionString : null;
            string fracStrPer = fracStr == null ? null : ParsingUtils.ConvertNumber2Persian(fracStr);

            double value = pi.GetValue();

            if (pi.IsFraction)
            {
                value = Math.Round(value, 3);
            }
            string f20Normalized    = MathUtils.NormalizeForF20Format(value.ToString("F20"));
            string f20Currency      = MathUtils.InsertThousandSeperator(f20Normalized);
            bool   addCurrency      = (f20Normalized != f20Currency);
            string f20NormalizedPer = ParsingUtils.ConvertNumber2Persian(f20Normalized);
            string f20CurrencyPer   = ParsingUtils.ConvertNumber2Persian(f20Currency);

            string strWritten;

            if (!NumberToPersianString.TryConvertNumberToPersianString(value, out strWritten))
            {
                strWritten = null;
            }

            // now giving orders

            if (ruleValue.Key == NumberChangeRule.OutputFormats.FloatingPoint &&
                ruleValue.Value == NumberChangeRule.OutputDigitLanguages.Persian)
            {
                // add in persian digits
                return(f20NormalizedPer);
            }
            else if (ruleValue.Key == NumberChangeRule.OutputFormats.FloatingPointWithSep &&
                     ruleValue.Value == NumberChangeRule.OutputDigitLanguages.Persian)
            {
                return(f20CurrencyPer);
            }
            else if (ruleValue.Key == NumberChangeRule.OutputFormats.Fractional &&
                     ruleValue.Value == NumberChangeRule.OutputDigitLanguages.Persian)
            {
                return(fracStrPer);
            }
            else if (ruleValue.Key == NumberChangeRule.OutputFormats.Letters)
            {
                return(strWritten);
            }
            else if (ruleValue.Key == NumberChangeRule.OutputFormats.FloatingPoint &&
                     ruleValue.Value == NumberChangeRule.OutputDigitLanguages.English)
            {
                return(f20Normalized);
            }
            else if (ruleValue.Key == NumberChangeRule.OutputFormats.FloatingPointWithSep &&
                     ruleValue.Value == NumberChangeRule.OutputDigitLanguages.English)
            {
                return(f20Currency);
            }
            else if (ruleValue.Key == NumberChangeRule.OutputFormats.Fractional &&
                     ruleValue.Value == NumberChangeRule.OutputDigitLanguages.English)
            {
                return(fracStr);
            }

            return(null);
        }