コード例 #1
0
ファイル: EventStore.cs プロジェクト: mikesavior/elmcity
        public static ZonelessEventStore ZonedToZoneless(string id, Calinfo calinfo, ZonedEventStore es_zoned)
        {
            var es_zoneless = new ZonelessEventStore(calinfo);

            foreach (var evt in es_zoned.events)
            {
                es_zoneless.AddEvent(evt.title, evt.url, evt.source, evt.lat, evt.lon, evt.dtstart.LocalTime, evt.dtend.LocalTime, evt.allday, evt.categories, evt.description, evt.location);
            }
            ZonelessEventStore.Finalize(calinfo, es_zoneless);
            return(es_zoneless);
        }
コード例 #2
0
ファイル: EventStore.cs プロジェクト: mikesavior/elmcity
        public static void CombineZonedEventStoresToZonelessEventStore(string id, Dictionary <string, string> settings)
        {
            var bs      = BlobStorage.MakeDefaultBlobStorage();
            var calinfo = new Calinfo(id);

            var lists_of_zoned_events = new List <List <ZonedEvent> >();

            var ical_uri = BlobStorage.MakeAzureBlobUri(container: id, name: id + "." + SourceType.ical + ".zoned.obj", use_cdn: false);

            DeserializeZoned(ical_uri, lists_of_zoned_events);

            //if (calinfo.hub_type == HubType.where.ToString())
            if (calinfo.hub_enum == HubType.where)
            {
                Uri non_ical_uri;
                //foreach (var type in non_ical_types)
                foreach (NonIcalType type in Enum.GetValues(typeof(CalendarAggregator.NonIcalType)))
                {
                    if (Utils.UseNonIcalService(type, settings, calinfo) == false)
                    {
                        continue;
                    }
                    non_ical_uri = BlobStorage.MakeAzureBlobUri(container: id, name: id + "." + type + ".zoned.obj", use_cdn: false);
                    if (BlobStorage.ExistsBlob(non_ical_uri))                     // // might not exist, e.g. if facebook=no in hub metadata
                    {
                        DeserializeZoned(non_ical_uri, lists_of_zoned_events);
                    }
                }
            }

            var es_zoneless = new ZonelessEventStore(calinfo);

            // combine the various List<ZonedEvent> objects into our new ZonelessEventStore
            // always add the local time
            foreach (var list in lists_of_zoned_events)
            {
                foreach (var evt in list)
                {
                    es_zoneless.AddEvent(evt.title, evt.url, evt.source, evt.lat, evt.lon, evt.dtstart.LocalTime, evt.dtend.LocalTime, evt.allday, evt.categories, evt.description, evt.location);
                }
            }

            ZonelessEventStore.Finalize(calinfo, es_zoneless);
        }