Inheritance: ICloneable
Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the Culture class
 /// </summary>
 /// <param name="cultureData">The CultureData for this language/script/region/variant</param>
 public Culture(CultureData cultureData)
 {
     this.casingNoParents                    = cultureData.Casing;
     this.charactersNoParents                = cultureData.Characters;
     this.datesNoParents                     = cultureData.Dates;
     this.delimitersNoParents                = cultureData.Delimiters;
     this.Identity                           = cultureData.Identity;
     this.languageDisplayNamesNoParents      = cultureData.LanguageDisplayNames;
     this.layoutNoParents                    = cultureData.Layout;
     this.listPatternsNoParents              = cultureData.ListPatterns;
     this.messagesNoParents                  = cultureData.Messages;
     this.numbersNoParents                   = cultureData.Numbers;
     this.regionDisplayNamesNoParents        = cultureData.RegionDisplayNames;
     this.ruleBasedNumberFormattingNoParents = cultureData.RuleBasedNumberFormatting;
     this.scriptDisplayNamesNoParents        = cultureData.ScriptDisplayNames;
     this.unitPatternSetsNoParents           = cultureData.UnitPatternSets;
 }
Exemplo n.º 2
0
        /// <summary>
        /// GetDelimiters gets the resolved Delimiters
        /// </summary>
        /// <returns>The resolved Delimiters</returns>
        private Delimiters GetDelimiters()
        {
            Delimiters delimiters = null;

            if (this.delimitersNoParents != null)
            {
                delimiters = (Delimiters)this.delimitersNoParents.Clone();
            }

            Culture[] parentCultures = this.GetParents();
            foreach (Culture parentCulture in parentCultures)
            {
                delimiters = Delimiters.Combine(delimiters, parentCulture.delimitersNoParents);
            }

            return(delimiters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Combine combines a child with a parent as necessary and returns the combined object
        /// </summary>
        /// <param name="combinedDelimiters">The child object</param>
        /// <param name="parentDelimiters">The parent object</param>
        /// <returns>The combined object</returns>
        public static Delimiters Combine(Delimiters combinedDelimiters, Delimiters parentDelimiters)
        {
            if (combinedDelimiters == null && parentDelimiters == null)
            {
                return null;
            }
            else if (combinedDelimiters == null)
            {
                return (Delimiters)parentDelimiters.Clone();
            }
            else if (parentDelimiters == null)
            {
                return combinedDelimiters;
            }

            if (combinedDelimiters.QuotationStart == null)
            {
                combinedDelimiters.QuotationStart = parentDelimiters.QuotationStart;
            }

            if (combinedDelimiters.QuotationEnd == null)
            {
                combinedDelimiters.QuotationEnd = parentDelimiters.QuotationEnd;
            }

            if (combinedDelimiters.AlternateQuotationStart == null)
            {
                combinedDelimiters.AlternateQuotationStart = parentDelimiters.AlternateQuotationStart;
            }

            if (combinedDelimiters.AlternateQuotationEnd == null)
            {
                combinedDelimiters.AlternateQuotationEnd = parentDelimiters.AlternateQuotationEnd;
            }

            return combinedDelimiters;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Combine combines a child with a parent as necessary and returns the combined object
        /// </summary>
        /// <param name="combinedDelimiters">The child object</param>
        /// <param name="parentDelimiters">The parent object</param>
        /// <returns>The combined object</returns>
        public static Delimiters Combine(Delimiters combinedDelimiters, Delimiters parentDelimiters)
        {
            if (combinedDelimiters == null && parentDelimiters == null)
            {
                return(null);
            }
            else if (combinedDelimiters == null)
            {
                return((Delimiters)parentDelimiters.Clone());
            }
            else if (parentDelimiters == null)
            {
                return(combinedDelimiters);
            }

            if (combinedDelimiters.QuotationStart == null)
            {
                combinedDelimiters.QuotationStart = parentDelimiters.QuotationStart;
            }

            if (combinedDelimiters.QuotationEnd == null)
            {
                combinedDelimiters.QuotationEnd = parentDelimiters.QuotationEnd;
            }

            if (combinedDelimiters.AlternateQuotationStart == null)
            {
                combinedDelimiters.AlternateQuotationStart = parentDelimiters.AlternateQuotationStart;
            }

            if (combinedDelimiters.AlternateQuotationEnd == null)
            {
                combinedDelimiters.AlternateQuotationEnd = parentDelimiters.AlternateQuotationEnd;
            }

            return(combinedDelimiters);
        }