/// <summary>
        /// Adds the specified culture.
        /// </summary>
        /// <param name="cultureEntity">Culture.</param>
        public void Add(CultureEntity cultureEntity)
        {
            List <CultureEntity> cultureEntities = xmlDatabase.LoadEntities().ToList();

            cultureEntities.Add(cultureEntity);

            try
            {
                xmlDatabase.SaveEntities(cultureEntities);
            }
            catch
            {
                throw new DuplicateEntityException(cultureEntity.Id, nameof(CultureEntity).Replace("Entity", ""));
            }
        }
        public void Add(ProfileEventEntity profileEventEntity)
        {
            List <ProfileEventEntity> profileEventEntities = xmlDatabase.LoadEntities().ToList();

            profileEventEntities.Add(profileEventEntity);

            try
            {
                xmlDatabase.SaveEntities(profileEventEntities);
            }
            catch
            {
                throw new DuplicateEntityException(profileEventEntity.Id, nameof(ProfileEventEntity).Replace("Entity", ""));
            }
        }
Exemple #3
0
        /// <summary>
        /// Adds the specified flag.
        /// </summary>
        /// <param name="flagEntity">Flag.</param>
        public void Add(FlagEntity flagEntity)
        {
            List <FlagEntity> flagEntities = xmlDatabase.LoadEntities().ToList();

            flagEntities.Add(flagEntity);

            try
            {
                xmlDatabase.SaveEntities(flagEntities);
            }
            catch
            {
                throw new DuplicateEntityException(flagEntity.Id, nameof(FlagEntity).Replace("Entity", ""));
            }
        }
        /// <summary>
        /// Adds the specified resource.
        /// </summary>
        /// <param name="resourceEntity">Resource.</param>
        public void Add(ResourceEntity resourceEntity)
        {
            List <ResourceEntity> resourceEntities = xmlDatabase.LoadEntities().ToList();

            resourceEntities.Add(resourceEntity);

            try
            {
                xmlDatabase.SaveEntities(resourceEntities);
            }
            catch
            {
                throw new DuplicateEntityException(resourceEntity.Id, nameof(ResourceEntity).Replace("Entity", ""));
            }
        }
        /// <summary>
        /// Adds the specified holding.
        /// </summary>
        /// <param name="holdingEntity">Holding.</param>
        public void Add(HoldingEntity holdingEntity)
        {
            List <HoldingEntity> holdingEntities = xmlDatabase.LoadEntities().ToList();

            holdingEntities.Add(holdingEntity);

            try
            {
                xmlDatabase.SaveEntities(holdingEntities);
            }
            catch
            {
                throw new DuplicateEntityException(holdingEntity.Id, nameof(HoldingEntity).Replace("Entity", ""));
            }
        }
Exemple #6
0
        /// <summary>
        /// Adds the specified border.
        /// </summary>
        /// <param name="borderEntity">Border.</param>
        public void Add(BorderEntity borderEntity)
        {
            List <BorderEntity> borderEntities = xmlDatabase.LoadEntities().ToList();

            borderEntities.Add(borderEntity);

            try
            {
                xmlDatabase.SaveEntities(borderEntities);
            }
            catch
            {
                throw new DuplicateEntityException($"{borderEntity.Province1Id}-{borderEntity.Province2Id}", nameof(BorderEntity).Replace("Entity", ""));
            }
        }
Exemple #7
0
        /// <summary>
        /// Adds the specified unit.
        /// </summary>
        /// <param name="unitEntity">Unit.</param>
        public void Add(UnitEntity unitEntity)
        {
            List <UnitEntity> unitEntities = xmlDatabase.LoadEntities().ToList();

            unitEntities.Add(unitEntity);

            try
            {
                xmlDatabase.SaveEntities(unitEntities);
            }
            catch
            {
                throw new DuplicateEntityException(unitEntity.Id, nameof(UnitEntity).Replace("Entity", ""));
            }
        }
Exemple #8
0
        /// <summary>
        /// Adds the specified biome.
        /// </summary>
        /// <param name="biomeEntity">Biome.</param>
        public void Add(BiomeEntity biomeEntity)
        {
            List <BiomeEntity> biomeEntities = xmlDatabase.LoadEntities().ToList();

            biomeEntities.Add(biomeEntity);

            try
            {
                xmlDatabase.SaveEntities(biomeEntities);
            }
            catch
            {
                throw new DuplicateEntityException(biomeEntity.Id, nameof(BiomeEntity).Replace("Entity", ""));
            }
        }