Exemplo n.º 1
0
 public virtual void DoUpdate(ServerUpdateEvent values)
 {
     int itemCode = values.ItemCode;
     if ((itemCode <= 0) || (itemCode > this.table.items.Length))
     {
         throw new PushServerException(2);
     }
     ProcessUpdate(values, itemCode - 1, this.table, this.listener);
 }
Exemplo n.º 2
0
 internal static void ProcessUpdate(ServerUpdateEvent values, int itemIndex, ExtendedTableInfo table, IExtendedTableListener listener)
 {
     string item = table.items[itemIndex];
     if (values.EOS)
     {
         try
         {
             listener.OnSnapshotEnd(item);
         }
         catch (Exception)
         {
         }
     }
     else if (values.Overflow > 0)
     {
         if (!table.hasUnfilteredData())
         {
             throw new PushServerException(7);
         }
         actionsLogger.Warn("Got notification of updates lost for item " + item);
         try
         {
             listener.OnRawUpdatesLost(item, values.Overflow);
         }
         catch (Exception)
         {
         }
     }
     else
     {
         if (values.Size != table.fields.Length)
         {
             throw new PushServerException(3);
         }
         IDictionary map = values.GetMap(table.fields);
         if (actionsLogger.IsDebugEnabled)
         {
             actionsLogger.Debug("Got event for item " + item + " with values " + CollectionsSupport.ToString(map));
         }
         try
         {
             listener.OnUpdate(item, map);
         }
         catch (Exception)
         {
         }
     }
 }
Exemplo n.º 3
0
 private static void ProcessFastUpdate(ServerUpdateEvent values, int itemIndex, ExtendedTableInfo table, IFastItemsListener listener)
 {
     if (values.EOS)
     {
         try
         {
             listener.OnSnapshotEnd(itemIndex + 1);
         }
         catch (Exception)
         {
         }
     }
     else if (values.Overflow > 0)
     {
         if (!table.hasUnfilteredData())
         {
             throw new PushServerException(7);
         }
         try
         {
             listener.OnRawUpdatesLost(itemIndex + 1, values.Overflow);
         }
         catch (Exception)
         {
         }
     }
     else
     {
         if (values.Size != table.fields.Length)
         {
             throw new PushServerException(3);
         }
         string[] array = values.Array;
         if (actionsLogger.IsDebugEnabled)
         {
             actionsLogger.Debug("Got event for item " + table.items[itemIndex] + " with values " + CollectionsSupport.ToString(array) + " for fields " + CollectionsSupport.ToString(table.fields));
         }
         try
         {
             listener.OnUpdate(itemIndex + 1, array);
         }
         catch (Exception)
         {
         }
     }
 }
Exemplo n.º 4
0
 public virtual void DoUpdate(ServerUpdateEvent values)
 {
     int itemCode = values.ItemCode;
     if (values.EOS)
     {
         try
         {
             this.listener.OnSnapshotEnd(itemCode);
         }
         catch (Exception)
         {
         }
     }
     else if (values.Overflow > 0)
     {
         if (!this.table.hasUnfilteredData())
         {
             throw new PushServerException(7);
         }
         try
         {
             this.listener.OnRawUpdatesLost(itemCode, values.Overflow);
         }
         catch (Exception)
         {
         }
     }
     else
     {
         string[] array = values.Array;
         if (actionsLogger.IsDebugEnabled)
         {
             actionsLogger.Debug(string.Concat(new object[] { "Got event for item n\x00b0", itemCode, " in group ", this.table.group, " with values ", CollectionsSupport.ToString(array) }));
         }
         try
         {
             this.listener.OnUpdate(itemCode, array);
         }
         catch (Exception)
         {
         }
     }
 }
Exemplo n.º 5
0
 internal virtual ServerUpdateEvent ParsePushData(string pushData)
 {
     string str;
     int index = pushData.IndexOf('|');
     string str2 = null;
     if (index == -1)
     {
         int num2 = pushData.LastIndexOf(',');
         if (num2 == -1)
         {
             throw new PushServerException(5, pushData);
         }
         str = pushData.Substring(0, num2);
         str2 = pushData.Substring(num2 + 1);
     }
     else
     {
         str = pushData.Substring(0, index);
     }
     int length = str.IndexOf(',');
     if (length == -1)
     {
         throw new PushServerException(5, pushData);
     }
     string tableCode = str.Substring(0, length);
     str = str.Substring(length + 1);
     if (str2 == null)
     {
         ServerUpdateEvent event2 = new ServerUpdateEvent(tableCode, str);
         while (index < pushData.Length)
         {
             int num5 = pushData.IndexOf('|', index + 1);
             if (num5 == -1)
             {
                 num5 = pushData.Length;
             }
             if (num5 == (index + 1))
             {
                 event2.AddValue(ServerUpdateEvent.UNCHANGED);
             }
             else
             {
                 string src = pushData.Substring(index + 1, num5 - (index + 1));
                 if ((src.Length == 1) && (src[0] == '$'))
                 {
                     event2.AddValue("");
                 }
                 else if ((src.Length == 1) && (src[0] == '#'))
                 {
                     event2.AddValue(null);
                 }
                 else if ((src[0] == '$') || (src[0] == '#'))
                 {
                     event2.AddValue(DeUNIcode(src.Substring(1)));
                 }
                 else
                 {
                     event2.AddValue(DeUNIcode(src));
                 }
             }
             index = num5;
         }
         if (protLogger.IsDebugEnabled)
         {
             protLogger.Debug("Read " + event2);
         }
         return event2;
     }
     if (str2.Equals("EOS"))
     {
         return new ServerUpdateEvent(tableCode, str, true);
     }
     if (str2.StartsWith("OV"))
     {
         try
         {
             return new ServerUpdateEvent(tableCode, str, int.Parse(str2.Substring("OV".Length)));
         }
         catch (Exception)
         {
             throw new PushServerException(5, pushData);
         }
     }
     throw new PushServerException(5, pushData);
 }
Exemplo n.º 6
0
 public virtual void DoUpdate(ServerUpdateEvent values)
 {
     throw new PushServerException(12);
 }
Exemplo n.º 7
0
 public virtual void DoUpdate(ServerUpdateEvent values)
 {
     if (values.ItemCode != 1)
     {
         throw new PushServerException(2);
     }
     if (this.enclosingInstance.managerWithListener != null)
     {
         this.enclosingInstance.managerWithListener.ProcessUpdate(values, this.itemIndex + 1, this.itemIndex);
     }
     else if (this.enclosingInstance.extListener != null)
     {
         ExtendedTableManager.ProcessUpdate(values, this.itemIndex, this.enclosingInstance.table, this.enclosingInstance.extListener);
     }
     else
     {
         VirtualTableManager.ProcessFastUpdate(values, this.itemIndex, this.enclosingInstance.table, this.enclosingInstance.fastListener);
     }
 }
Exemplo n.º 8
0
 internal void ProcessUpdate(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)
             {
             }
         }
     }
 }
Exemplo n.º 9
0
 public virtual void DoUpdate(ServerUpdateEvent values)
 {
     int itemCode = values.ItemCode;
     int itemIndex = itemCode - 1;
     this.ProcessUpdate(values, itemCode, itemIndex);
 }
Exemplo n.º 10
0
 public virtual bool OnUpdate(ITableManager table, ServerUpdateEvent values)
 {
     if (this.owner.GetActiveListener(this.currPhase) != null)
     {
         try
         {
             table.DoUpdate(values);
         }
         catch (PushServerException exception)
         {
             actionsLogger.Debug("Error in received values", exception);
             this.OnDataError(exception);
         }
         return true;
     }
     return false;
 }