Ejemplo n.º 1
0
        public BSONObjectID(uint epochSeconds, uint machineId, ushort processId, uint counter)
        {
            if (machineId >= THREE_BYTES_UINT_THRESHOLD || counter >= THREE_BYTES_UINT_THRESHOLD)
            {
                throw new BSONException(StringConsts.BSON_THREE_BYTES_UINT_ERROR.Args("machineId and counter") + "  BSONObjectID.ctor(machineId>=2^24 | counter>=2^24)");
            }

            var bytes = new byte[DATA_LENGTH];

            BinUtils.WriteUInt32(bytes, epochSeconds);
            BinUtils.WriteUInt24(bytes, machineId, 4);
            BinUtils.WriteUInt16(bytes, processId, 7);
            BinUtils.WriteUInt24(bytes, counter, 9);
            Bytes = bytes;
        }
Ejemplo n.º 2
0
 protected internal override void WriteValueToStream(Stream stream)
 {
     BinUtils.WriteUInt32(stream, Value.Increment);
     BinUtils.WriteUInt32(stream, Value.EpochSeconds);
 }