Example #1
0
        public void InsertHerd(string herdName)
        {
            HerdEntity newHerd = new HerdEntity {
                HerdId = herdName
            };

            if (grangerSimpleDb.Herds.ContainsKey(herdName))
            {
                throw new ApplicationException("There already exists a herd with id " + herdName);
            }
            grangerSimpleDb.Herds[herdName] = newHerd;
            grangerSimpleDb.Save();
            OnHerdsModified?.Invoke(this, new EventArgs());
        }
Example #2
0
        public void Run()
        {
            foreach (var creatureEntity in grangerSimpleDb.Creatures.Values)
            {
                switch (creatureEntity.CreatureColorId)
                {
                case "0":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Unknown;
                    break;

                case "1":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Black;
                    break;

                case "2":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.White;
                    break;

                case "3":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Grey;
                    break;

                case "4":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Brown;
                    break;

                case "5":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Gold;
                    break;

                case "6":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.BloodBay;
                    break;

                case "7":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.EbonyBlack;
                    break;

                case "8":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.PiebaldPinto;
                    break;

                case null:
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Unknown;
                    break;

                default:
                    break;
                }
            }
            grangerSimpleDb.Save();
        }
Example #3
0
        public void Run()
        {
            foreach (var creatureEntity in grangerSimpleDb.Creatures.Values)
            {
                switch (creatureEntity.CreatureColorId)
                {
                case "Unknown":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Unknown;
                    break;

                case "Black":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Black;
                    break;

                case "White":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.White;
                    break;

                case "Grey":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Grey;
                    break;

                case "Brown":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Brown;
                    break;

                case "Gold":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Gold;
                    break;

                case "BloodBay":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.BloodBay;
                    break;

                case "EbonyBlack":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.EbonyBlack;
                    break;

                case "PiebaldPinto":
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.PiebaldPinto;
                    break;

                case null:
                    creatureEntity.CreatureColorId = DefaultCreatureColorIds.Unknown;
                    break;

                default:
                    break;
                }
            }

            foreach (var creatureColorEntity in grangerSimpleDb.CreatureColors.Values.ToArray())
            {
                switch (creatureColorEntity.Id)
                {
                case "Unknown":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "Unknown",
                                              DefaultCreatureColorIds.Unknown,
                                              "Unknown",
                                              string.Empty);
                    break;

                case "Black":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "Black",
                                              DefaultCreatureColorIds.Black,
                                              "Black",
                                              "black");
                    break;

                case "White":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "White",
                                              DefaultCreatureColorIds.White,
                                              "White",
                                              "white");
                    break;

                case "Grey":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "Grey",
                                              DefaultCreatureColorIds.Grey,
                                              "Grey",
                                              "grey");
                    break;

                case "Brown":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "Brown",
                                              DefaultCreatureColorIds.Brown,
                                              "Brown",
                                              "brown");
                    break;

                case "Gold":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "Gold",
                                              DefaultCreatureColorIds.Gold,
                                              "Gold",
                                              "gold");
                    break;

                case "BloodBay":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "BloodBay",
                                              DefaultCreatureColorIds.BloodBay,
                                              "Blood Bay",
                                              "blood bay");
                    break;

                case "EbonyBlack":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "EbonyBlack",
                                              DefaultCreatureColorIds.EbonyBlack,
                                              "Ebony Black",
                                              "ebony black");
                    break;

                case "PiebaldPinto":
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              "PiebaldPinto",
                                              DefaultCreatureColorIds.PiebaldPinto,
                                              "Piebald Pinto",
                                              "piebald pinto");
                    break;

                default:
                    UpdateCreatureColorEntity(creatureColorEntity,
                                              creatureColorEntity.Id,
                                              creatureColorEntity.Id,
                                              creatureColorEntity.Id,
                                              string.Empty);
                    break;
                }
            }

            grangerSimpleDb.Save();
        }