Esempio n. 1
0
        internal override void ToBinary(BinaryPropertyListWriter outPlist)
        {
            switch (GetNSNumberType())
            {
            case INTEGER:
            {
                if (ToLong() < 0)
                {
                    outPlist.Write(0x13);
                    outPlist.WriteBytes(ToLong(), 8);
                }
                else if (ToLong() <= 0xff)
                {
                    outPlist.Write(0x10);
                    outPlist.WriteBytes(ToLong(), 1);
                }
                else if (ToLong() <= 0xffff)
                {
                    outPlist.Write(0x11);
                    outPlist.WriteBytes(ToLong(), 2);
                }
                else if (ToLong() <= 0xffffffffL)
                {
                    outPlist.Write(0x12);
                    outPlist.WriteBytes(ToLong(), 4);
                }
                else
                {
                    outPlist.Write(0x13);
                    outPlist.WriteBytes(ToLong(), 8);
                }

                break;
            }

            case REAL:
            {
                outPlist.Write(0x23);
                outPlist.WriteDouble(ToDouble());
                break;
            }

            case BOOLEAN:
            {
                outPlist.Write(ToBool() ? 0x09 : 0x08);
                break;
            }
            }
        }
Esempio n. 2
0
 internal override void ToBinary(BinaryPropertyListWriter outPlist)
 {
     switch (GetNSNumberType())
     {
         case INTEGER:
             {
                 if (ToLong() < 0)
                 {
                     outPlist.Write(0x13);
                     outPlist.WriteBytes(ToLong(), 8);
                 }
                 else if (ToLong() <= 0xff)
                 {
                     outPlist.Write(0x10);
                     outPlist.WriteBytes(ToLong(), 1);
                 }
                 else if (ToLong() <= 0xffff)
                 {
                     outPlist.Write(0x11);
                     outPlist.WriteBytes(ToLong(), 2);
                 }
                 else if (ToLong() <= 0xffffffffL)
                 {
                     outPlist.Write(0x12);
                     outPlist.WriteBytes(ToLong(), 4);
                 }
                 else
                 {
                     outPlist.Write(0x13);
                     outPlist.WriteBytes(ToLong(), 8);
                 }
                 break;
             }
         case REAL:
             {
                 outPlist.Write(0x23);
                 outPlist.WriteDouble(ToDouble());
                 break;
             }
         case BOOLEAN:
             {
                 outPlist.Write(ToBool() ? 0x09 : 0x08);
                 break;
             }
     }
 }
Esempio n. 3
0
 internal override void ToBinary(BinaryPropertyListWriter outPlist)
 {
     outPlist.Write(0x33);
     outPlist.WriteDouble((date - EPOCH).TotalSeconds);
 }
Esempio n. 4
0
 internal override void ToBinary(BinaryPropertyListWriter outPlist)
 {
     outPlist.Write(0x33);
     outPlist.WriteDouble((date - EPOCH).TotalSeconds);
 }