System.Runtime.Serialization.Plists.BinaryPlistWriter.AddDate C# (CSharp) Method

AddDate() private method

Adds a date to the internal object table.
private AddDate ( System.DateTime value ) : int
value System.DateTime The value to add.
return int
        private int AddDate(DateTime value)
        {
            if (!this.uniques.Contains(value))
            {
                int index = this.objectTable.Count;
                byte[] buffer = BitConverter.GetBytes(value.ToUniversalTime().Subtract(ReferenceDate).TotalSeconds);

                if (BitConverter.IsLittleEndian)
                {
                    Array.Reverse(buffer);
                }

                BinaryPlistItem item = new BinaryPlistItem(value);
                item.Marker.Add((byte)0x33);
                item.SetByteValue(buffer);

                this.objectTable.Add(item);
                this.objectTableSize += item.Size;

                this.uniques.SetIndex(value, index);
                return index;
            }

            return this.uniques.GetIndex(value);
        }