Ejemplo n.º 1
0
        public static void SaveAll()
        {
            try
            {
                Console.WriteLine("Player Size: " + Server.playerHandler.add.Count);
                var Playss = Server.playerHandler.add.Where(xe => xe.Key != null && xe.Value != null).Select(xe => xe.Value).ToList();

                var Itemss = NewItems.Values.Where(xe => xe.InvSlot >= 0).Select(xe => xe).ToList();
                Console.WriteLine("Item Size: " + Itemss.Count());

                var AuctionItemss = NewAuctions.Values.Where(xe => xe != null).Select(xe => xe).ToList();
                Console.WriteLine("Auction Size: " + AuctionItemss.Count());

                Console.WriteLine("World Save Complete");
                BinaryIO.SavePlayers(Playss);
                BinaryIO.SaveItems(Itemss);
                BinaryIO.SaveAuctionItems(AuctionItemss);
                BinaryIO.BackUpData();
                Console.WriteLine("World Save IO Complete");

                /*foreach (var item in Itemss)
                 * {
                 *  World.DBConnect.WriteQue.Enqueue(() => World.DBConnect.InsertItem(item));
                 * }*/
            }
            catch
            {
                Console.WriteLine("failed to save all");
            }

            /*       foreach (var mobiles in LKCamelot.model.World.m_MObjects)
             *         LKCamelot.model.World.DBConnect.InsertObject(mobiles.Value);*/
        }