예제 #1
0
 internal void ProcessUpdate(Lightstreamer.DotNet.Client.ServerUpdateEvent values, int itemPos, int itemIndex)
 {
     string name = null;
     ItemInfo info;
     if (this.extInfo != null)
     {
         if ((itemIndex < 0) || (itemIndex >= this.extInfo.items.Length))
         {
             throw new PushServerException(2);
         }
         name = this.extInfo.items[itemIndex];
     }
     lock (this.itemInfos)
     {
         if (this.unsubscrDone)
         {
             return;
         }
         while (this.itemInfos.Count <= itemIndex)
         {
             this.itemInfos.Add(null);
         }
         info = (ItemInfo) this.itemInfos[itemIndex];
         if (info == null)
         {
             if (this.isCommandLogic)
             {
                 info = new CommandLogicItemInfo(this, itemPos, name);
             }
             else
             {
                 info = new ItemInfo(this, itemPos, name);
             }
             this.itemInfos[itemIndex] = info;
         }
     }
     if (values.EOS)
     {
         info.snapshotPending = false;
         try
         {
             this.listener.OnSnapshotEnd(itemPos, name);
         }
         catch (Exception)
         {
         }
     }
     else if (values.Overflow > 0)
     {
         if (!this.baseInfo.hasUnfilteredData())
         {
             throw new PushServerException(7);
         }
         actionsLogger.Warn("Got notification of updates lost for item " + info);
         try
         {
             this.listener.OnRawUpdatesLost(itemPos, name, values.Overflow);
         }
         catch (Exception)
         {
         }
     }
     else
     {
         if ((this.extInfo != null) && (values.Size != this.extInfo.fields.Length))
         {
             throw new PushServerException(3);
         }
         string[] array = values.Array;
         if (actionsLogger.IsDebugEnabled)
         {
             actionsLogger.Debug(string.Concat(new object[] { "Got event for item ", info, " with values ", CollectionsSupport.ToString(array) }));
         }
         bool snapshotPending = info.snapshotPending;
         string[] prevState = info.Update(array);
         if (prevState != null)
         {
             IUpdateInfo update = new UpdateInfoImpl(info, prevState, array, snapshotPending);
             if (actionsLogger.IsDebugEnabled)
             {
                 actionsLogger.Debug(string.Concat(new object[] { "Notifying event for item ", info, " with values ", update }));
             }
             try
             {
                 this.listener.OnUpdate(itemPos, name, update);
             }
             catch (Exception)
             {
             }
         }
     }
 }
        internal void ProcessUpdate(Lightstreamer.DotNet.Client.ServerUpdateEvent values, int itemPos, int itemIndex)
        {
            string   name = null;
            ItemInfo info;

            if (this.extInfo != null)
            {
                if ((itemIndex < 0) || (itemIndex >= this.extInfo.items.Length))
                {
                    throw new PushServerException(2);
                }
                name = this.extInfo.items[itemIndex];
            }
            lock (this.itemInfos)
            {
                if (this.unsubscrDone)
                {
                    return;
                }
                while (this.itemInfos.Count <= itemIndex)
                {
                    this.itemInfos.Add(null);
                }
                info = (ItemInfo)this.itemInfos[itemIndex];
                if (info == null)
                {
                    if (this.isCommandLogic)
                    {
                        info = new CommandLogicItemInfo(this, itemPos, name);
                    }
                    else
                    {
                        info = new ItemInfo(this, itemPos, name);
                    }
                    this.itemInfos[itemIndex] = info;
                }
            }
            if (values.EOS)
            {
                info.snapshotPending = false;
                try
                {
                    this.listener.OnSnapshotEnd(itemPos, name);
                }
                catch (Exception)
                {
                }
            }
            else if (values.Overflow > 0)
            {
                if (!this.baseInfo.hasUnfilteredData())
                {
                    throw new PushServerException(7);
                }
                actionsLogger.Warn("Got notification of updates lost for item " + info);
                try
                {
                    this.listener.OnRawUpdatesLost(itemPos, name, values.Overflow);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                if ((this.extInfo != null) && (values.Size != this.extInfo.fields.Length))
                {
                    throw new PushServerException(3);
                }
                string[] array = values.Array;
                if (actionsLogger.IsDebugEnabled)
                {
                    actionsLogger.Debug(string.Concat(new object[] { "Got event for item ", info, " with values ", CollectionsSupport.ToString(array) }));
                }
                bool     snapshotPending = info.snapshotPending;
                string[] prevState       = info.Update(array);
                if (prevState != null)
                {
                    UpdateInfo update = new UpdateInfo(info, prevState, array, snapshotPending);
                    if (actionsLogger.IsDebugEnabled)
                    {
                        actionsLogger.Debug(string.Concat(new object[] { "Notifying event for item ", info, " with values ", update }));
                    }
                    try
                    {
                        this.listener.OnUpdate(itemPos, name, update);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }