예제 #1
0
        private void SearchFinished()
        {
            timeoutTimer.Stop();
            IsSearchOpen = false;
            List <ShopSearchTuple> tuples = new List <ShopSearchTuple>(this.Results.Count);

            lock (Results)
            {
                foreach (SShopResultPacket resultPacket in Results)
                {
                    ShopSearchTuple tuple = new ShopSearchTuple()
                    {
                        Count        = resultPacket.ItemCount,
                        ItemId       = resultPacket.ItemId,
                        Price        = resultPacket.Price,
                        ShopId       = resultPacket.ShopId,
                        Seller       = resultPacket.SellerName,
                        ShopPosition = resultPacket.ShopPosition
                    };
                    //using (MemoryStream ms = new MemoryStream())
                    //{
                    //    ms.Write(BitConverter.GetBytes(resultPacket.ItemCount), 0, sizeof(UInt32));
                    //    ms.Write(BitConverter.GetBytes(resultPacket.ItemId), 0, sizeof(UInt32));
                    //    ms.Write(BitConverter.GetBytes(resultPacket.ShopId), 0, sizeof(UInt32));
                    //    ms.Write(BitConverter.GetBytes(resultPacket.Price), 0, sizeof(UInt64));
                    //    ms.Write(BitConverter.GetBytes(resultPacket.ShopPosition), 0, sizeof(UInt16));
                    //    tuple.Hash = Convert.ToBase64String(ms.ToArray());
                    //}
                    tuples.Add(tuple);
                }
            }

            virtualClient.OnShopSearchFinished(tuples);
            virtualClient.Logger.LogInfo("Fetched " + Results.Count + " results");
        }