コード例 #1
0
ファイル: Consignments.cs プロジェクト: yakoder/NRaas
        public static void ValidateObjectForSale(Dictionary <object, IList> objectsForSale)
        {
            foreach (KeyValuePair <object, IList> pair in objectsForSale)
            {
                if (!pair.Value.Contains(pair.Key))
                {
                    if (pair.Key is ConsignmentRegister.ConsignmentRegisterObjectData)
                    {
                        ConsignmentRegister.ConsignmentRegisterObjectData castObj = pair.Key as ConsignmentRegister.ConsignmentRegisterObjectData;

                        castObj.Destroy();
                    }
                    else if (pair.Key is PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData)
                    {
                        PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData castObj = pair.Key as PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData;

                        castObj.Destroy();
                    }
                    else if (pair.Key is BotShopRegister.BotShopConsignmentRegisterObjectData)
                    {
                        BotShopRegister.BotShopConsignmentRegisterObjectData castObj = pair.Key as BotShopRegister.BotShopConsignmentRegisterObjectData;

                        castObj.Destroy();
                    }
                    else if (pair.Key is FruitVeggieStand.FruitVeggieStandObjectData)
                    {
                        FruitVeggieStand.FruitVeggieStandObjectData castObj = pair.Key as FruitVeggieStand.FruitVeggieStandObjectData;

                        castObj.Destroy();
                    }
                }
            }
        }
コード例 #2
0
ファイル: Consignments.cs プロジェクト: yakoder/NRaas
        protected static void Cleanup3 <TConsigned>(Logger log, string prefix, ref List <TConsigned> list, ref Dictionary <object, IList> validObjects)
        {
            if (list == null)
            {
                return;
            }

            for (int i = list.Count - 1; i >= 0; i--)
            {
                TConsigned data = list[i];

                try
                {
                    if (data is ConsignmentRegister.ConsignmentRegisterObjectData)
                    {
                        ConsignmentRegister.ConsignmentRegisterObjectData castObj = data as ConsignmentRegister.ConsignmentRegisterObjectData;

                        castObj.GetThumbnailKey();
                    }
                    else if (data is PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData)
                    {
                        PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData castObj = data as PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData;

                        castObj.GetThumbnailKey();
                    }
                    else if (data is BotShopRegister.BotShopConsignmentRegisterObjectData)
                    {
                        BotShopRegister.BotShopConsignmentRegisterObjectData castObj = data as BotShopRegister.BotShopConsignmentRegisterObjectData;

                        castObj.GetThumbnailKey();
                    }
                    else if (data is FruitVeggieStand.FruitVeggieStandObjectData)
                    {
                        FruitVeggieStand.FruitVeggieStandObjectData castObj = data as FruitVeggieStand.FruitVeggieStandObjectData;

                        castObj.GetThumbnailKey();
                    }
                    validObjects.Add(data, list);
                }
                catch
                {
                    if (log != null)
                    {
                        log(" Bad Consignment choice removed (2)");
                    }

                    try
                    {
                        if (data is ConsignmentRegister.ConsignmentRegisterObjectData)
                        {
                            ConsignmentRegister.ConsignmentRegisterObjectData castObj = data as ConsignmentRegister.ConsignmentRegisterObjectData;

                            castObj.Destroy();
                        }
                        else if (data is PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData)
                        {
                            PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData castObj = data as PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData;

                            castObj.Destroy();
                        }
                        else if (data is BotShopRegister.BotShopConsignmentRegisterObjectData)
                        {
                            BotShopRegister.BotShopConsignmentRegisterObjectData castObj = data as BotShopRegister.BotShopConsignmentRegisterObjectData;

                            castObj.Destroy();
                        }
                        else if (data is FruitVeggieStand.FruitVeggieStandObjectData)
                        {
                            FruitVeggieStand.FruitVeggieStandObjectData castObj = data as FruitVeggieStand.FruitVeggieStandObjectData;

                            castObj.Destroy();
                        }
                    }
                    catch
                    { }

                    list.RemoveAt(i);
                }
            }
        }