示例#1
0
        protected void WriteUid(BinaryWriter writer, Uid uid)
        {
            if (uid == null)
            {
                writer.Write(0L);
                return;
            }

            writer.Write(uid.UID);
            writer.Write(UidFactory.GetFamily(uid).GetHashCode());
        }
示例#2
0
        private void EnsureProperties()
        {
            if (string.IsNullOrEmpty(Uid))
            {
                // Create a new UID for the component
                Uid = new UidFactory().Build();
            }

            // NOTE: removed setting the 'CREATED' property here since it breaks serialization.
            // See https://sourceforge.net/projects/dday-ical/forums/forum/656447/topic/3754354
            if (DtStamp == null)
            {
                // Here, we don't simply set to DateTime.Now because DateTime.Now contains milliseconds, and
                // the iCalendar standard doesn't care at all about milliseconds.  Therefore, when comparing
                // two calendars, one generated, and one loaded from file, they may be functionally identical,
                // but be determined to be different due to millisecond differences.
                var now = DateTime.Now;
                DtStamp = new CalDateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
            }
        }