Пример #1
0
        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            PercentFormat f = obj as PercentFormat;

            return(f != null &&
                   UseLocale == f.UseLocale &&
                   DecimalDigits == f.DecimalDigits &&
                   DecimalSeparator == f.DecimalSeparator &&
                   GroupSeparator == f.GroupSeparator &&
                   PercentSymbol == f.PercentSymbol &&
                   PositivePattern == f.PositivePattern &&
                   NegativePattern == f.NegativePattern);
        }
Пример #2
0
        /// <inheritdoc/>
        public override FormatBase Clone()
        {
            PercentFormat result = new PercentFormat();

            result.UseLocale        = UseLocale;
            result.DecimalDigits    = DecimalDigits;
            result.DecimalSeparator = DecimalSeparator;
            result.GroupSeparator   = GroupSeparator;
            result.PercentSymbol    = PercentSymbol;
            result.PositivePattern  = PositivePattern;
            result.NegativePattern  = NegativePattern;
            return(result);
        }
Пример #3
0
        internal override void Serialize(FRWriter writer, string prefix, FormatBase format)
        {
            base.Serialize(writer, prefix, format);
            PercentFormat c = format as PercentFormat;

            if (c == null || UseLocale != c.UseLocale)
            {
                writer.WriteBool(prefix + "UseLocale", UseLocale);
            }
            if (c == null || DecimalDigits != c.DecimalDigits)
            {
                writer.WriteInt(prefix + "DecimalDigits", DecimalDigits);
            }

            if (!UseLocale)
            {
                if (c == null || DecimalSeparator != c.DecimalSeparator)
                {
                    writer.WriteStr(prefix + "DecimalSeparator", DecimalSeparator);
                }
                if (c == null || GroupSeparator != c.GroupSeparator)
                {
                    writer.WriteStr(prefix + "GroupSeparator", GroupSeparator);
                }
                if (c == null || PercentSymbol != c.PercentSymbol)
                {
                    writer.WriteStr(prefix + "PercentSymbol", PercentSymbol);
                }
                if (c == null || PositivePattern != c.PositivePattern)
                {
                    writer.WriteInt(prefix + "PositivePattern", PositivePattern);
                }
                if (c == null || NegativePattern != c.NegativePattern)
                {
                    writer.WriteInt(prefix + "NegativePattern", NegativePattern);
                }
            }
        }