예제 #1
0
        private void EnsureProperties()
        {
            if (string.IsNullOrEmpty(UID))
            {
                // Create a new UID for the component
                UID = new UIDFactory().Build();
            }

            if (!Properties.ContainsKey("SEQUENCE"))
            {
                Sequence = 0;
            }

            if (Created == 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.
                DateTime now = DateTime.Now;
                Created = new iCalDateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second);
            }

            if (DTStamp == null)
            {
                DTStamp = Created.Copy <IDateTime>();
            }
        }