示例#1
0
        protected override string FormatObject(string format, object arg, IFormatProvider formatProvider)
        {
            ByteQuantifiedSize byteQuantifiedSize = (ByteQuantifiedSize)arg;

            if (byteQuantifiedSize.ToGB() > 0UL)
            {
                return(Strings.ByteQuantifiedSizeAsGB(byteQuantifiedSize.ToGB()));
            }
            if (byteQuantifiedSize.ToMB() > 0UL)
            {
                return(Strings.ByteQuantifiedSizeAsMB(byteQuantifiedSize.ToMB()));
            }
            return(Strings.ByteQuantifiedSizeAsKB(byteQuantifiedSize.ToKB()));
        }
 public static string ToAppropriateUnitFormatString(this ByteQuantifiedSize size, string valueFormat)
 {
     if (size.ToTB() > 0UL)
     {
         return(string.Format(OwaOptionStrings.MailboxUsageUnitTB, string.Format(CultureInfo.InvariantCulture, valueFormat, new object[]
         {
             size.ToBytes() / 1099511627776.0
         })));
     }
     if (size.ToGB() > 0UL)
     {
         return(string.Format(OwaOptionStrings.MailboxUsageUnitGB, string.Format(CultureInfo.InvariantCulture, valueFormat, new object[]
         {
             size.ToBytes() / 1073741824.0
         })));
     }
     if (size.ToMB() > 0UL)
     {
         return(string.Format(OwaOptionStrings.MailboxUsageUnitMB, string.Format(CultureInfo.InvariantCulture, valueFormat, new object[]
         {
             size.ToBytes() / 1048576.0
         })));
     }
     if (size.ToKB() > 0UL)
     {
         return(string.Format(OwaOptionStrings.MailboxUsageUnitKB, string.Format(CultureInfo.InvariantCulture, valueFormat, new object[]
         {
             size.ToBytes() / 1024.0
         })));
     }
     return(string.Format(CultureInfo.InvariantCulture, OwaOptionStrings.MailboxUsageUnitB, new object[]
     {
         size.ToBytes()
     }));
 }