Beispiel #1
0
        public static void AddSubscription(PersistentSubscription subscription)
        {
            Load(FileName);
            foreach (PersistentSubscription ps in Store)
            {
                if (IsSame(ps, subscription))
                {
                    return;
                }
            }
            Store.Add(subscription);

            Save(FileName);
        }
Beispiel #2
0
        static PersistentSubscription[] Convert(PublishSubscribeDataSet.PersistentSubscribersDataTable subscribers)
        {
            Converter <PublishSubscribeDataSet.PersistentSubscribersRow, PersistentSubscription> converter;

            converter = delegate(PublishSubscribeDataSet.PersistentSubscribersRow row)
            {
                PersistentSubscription subscription = new PersistentSubscription();
                subscription.Address        = row.Address;
                subscription.EventsContract = row.Contract;
                subscription.EventOperation = row.Operation;
                return(subscription);
            };
            return(DataTableHelper.ToArray(subscribers, converter));
        }
Beispiel #3
0
        public static void RemoveSubscription(PersistentSubscription subscription)
        {
            Load(FileName);
            PersistentSubscription item = null;

            foreach (PersistentSubscription ps in Store)
            {
                if (IsSame(ps, subscription))
                {
                    item = ps;
                }
            }
            if (item != null)
            {
                Store.Remove(item);
            }
            Save(FileName);
        }
Beispiel #4
0
        static PersistentSubscription[] Convert(PublishSubscribeDataSet.PersistentSubscribersDataTable subscribers)
        {
            Converter <PublishSubscribeDataSet.PersistentSubscribersRow, PersistentSubscription> converter;

            converter = delegate(PublishSubscribeDataSet.PersistentSubscribersRow row)
            {
                PersistentSubscription subscription = new PersistentSubscription();
                subscription.Address        = row.Address;
                subscription.EventsContract = row.Contract;
                subscription.EventOperation = row.Operation;
                return(subscription);
            };
            if (subscribers.Rows.Count == 0)
            {
                return(new PersistentSubscription[] {});
            }
            return(Collection.UnsafeToArray(subscribers.Rows, converter));
        }
Beispiel #5
0
 static bool IsSame(PersistentSubscription ps1, PersistentSubscription ps2)
 {
     return(ps1.Address == ps2.Address && ps1.EventOperation == ps2.EventOperation && ps1.EventsContract == ps2.EventsContract);
 }
Beispiel #6
0
        static void RemovePersistent(string address, string eventsContract, string eventOperation)
        {
            PersistentSubscription ps = new PersistentSubscription(address, eventsContract, eventOperation);

            SubscriptionsStore.RemoveSubscription(ps);
        }