Beispiel #1
0
        public static YCSLib.YMSGPacket.Payload Slice(this YCSLib.YMSGPacket.Payload payload, string key, int index)
        {
            YCSLib.YMSGPacket.Payload retVal = null;
            int x = 0;

            for (int i = 0; i < payload.Count; i++)
            {
                if (payload[index].Key == key)
                {
                    if (x == index)
                    {
                        retVal = new YCSLib.YMSGPacket.Payload(payload.GetRange(x, payload.FindIndex(x, p =>
                                                                                                     { if (p.Key == key)
                                                                                                       {
                                                                                                           return(true);
                                                                                                       }
                                                                                                       return(false); }
                                                                                                     )));
                    }
                    else
                    {
                        x++;
                    }
                }
            }
            return(retVal);
        }
Beispiel #2
0
 public static YCSLib.YMSGPacket.Payload Slice(this YCSLib.YMSGPacket.Payload payload, string key, int index)
 {
     YCSLib.YMSGPacket.Payload retVal = null;
     int x = 0;
     for (int i = 0; i < payload.Count; i++)
         if (payload[index].Key == key)
             if (x == index)
                 retVal = new YCSLib.YMSGPacket.Payload(payload.GetRange(x, payload.FindIndex(x, p =>
                 { if (p.Key == key) return true; return false; }
                 )));
             else
                 x++;
     return retVal;
 }