Exemplo n.º 1
0
        public ExtractHeroAssetsScript(FehContextFactory dbContextFactory, string sourceDirectory, string targetDirectory, bool overwrite = false)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceDirectory = sourceDirectory;
            this._targetDirectory = targetDirectory;

            this._overwrite = overwrite;
        }
Exemplo n.º 2
0
        public WeaponService(FehContext context, IMapper mapper)
        {
            _mapper = mapper;

            _weaponRepository        = new WeaponRepository(context);
            _weaponUpgradeRepository = new WeaponUpgradeRepository(context);
            _weaponTypeRepository    = new WeaponTypeRepository(context);
            _weaponCostRepository    = new BaseRepository <WeaponCost>(context);

            _WeaponEffectiveAgainstRepository = new BaseRepository <WeaponEffectiveAgainst>(context);
            _weaponStatChangeRepository       = new BaseRepository <WeaponStatChange>(context);
        }
Exemplo n.º 3
0
        public ImportHeroesScript(FehContextFactory dbContextFactory, string sourceFile)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceFiile = sourceFile;

            this._artistMap = this._dbContext
                              .Artists
                              .ToDictionaryAsync(
                x => x.Name.ToLower(),
                y => y
                )
                              .Result;
        }
Exemplo n.º 4
0
        public ImportHeroSkillsScript(FehContextFactory dbContextFactory, string sourceFile)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceFiile = sourceFile;

            this._heroMap = this._dbContext
                            .Heroes
                            .ToDictionaryAsync(
                x => x.Tag,
                y => y
                )
                            .Result;

            this._skillMap = this._dbContext
                             .Skills
                             .ToDictionaryAsync(
                x => x.Tag,
                y => y
                )
                             .Result;
        }
 public SkillWeaponEffectivenessService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 6
0
 public HeroVoiceActorService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 7
0
 public WeaponUpgradeRepository(FehContext context) : base(context)
 {
 }
Exemplo n.º 8
0
 public ItemService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 9
0
 public HeroSkillService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 10
0
        public ImportVoiceActorsScript(FehContextFactory dbContextFactory, string sourceFile)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceFiile = sourceFile;
        }
Exemplo n.º 11
0
        public static async Task Initialize(FehContext context, IWeaponService weaponService, IAuthService authService, IConfiguration configuration)
        {
            context.Database.EnsureCreated();

            if (!context.WeaponTypes.Any())
            {
                try
                {
                    var weaponTypes = JsonConvert.DeserializeObject <List <WeaponType> >(File.ReadAllText("Seed" + Path.DirectorySeparatorChar + GetFileName("WeaponType")));

                    foreach (var wt in weaponTypes)
                    {
                        context.WeaponTypes.Add(wt);
                    }

                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            if (!context.MovementTypes.Any())
            {
                try
                {
                    var movementTypes = JsonConvert.DeserializeObject <List <MovementType> >(File.ReadAllText("Seed" + Path.DirectorySeparatorChar + GetFileName("MovementType")));

                    foreach (var mt in movementTypes)
                    {
                        context.MovementTypes.Add(mt);
                    }

                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            if (!context.Weapons.Any())
            {
                try
                {
                    var weapons        = JsonConvert.DeserializeObject <List <WeaponResource> >(File.ReadAllText("Seed" + Path.DirectorySeparatorChar + GetFileName("Weapons")));
                    var refinedWeapons = JsonConvert.DeserializeObject <List <WeaponResource> >(File.ReadAllText("Seed" + Path.DirectorySeparatorChar + GetFileName("WeaponsRefined")));

                    // gets images for refined weapons (since they have the same image as the unrefined versions)
                    for (int i = 0; i < refinedWeapons.Count(); i++)
                    {
                        if (string.IsNullOrEmpty(refinedWeapons[i].ImageUri))
                        {
                            var split       = refinedWeapons[i].Name.Split('(')[0];
                            var fixedLength = split.Substring(0, split.Length - 1);
                            var weaponWhere = weapons.Where(w => w.Name.Contains(fixedLength));

                            refinedWeapons[i].ImageUri = weaponWhere.First().ImageUri;
                        }
                    }

                    await weaponService.CreateFromList(weapons);

                    await weaponService.CreateFromList(refinedWeapons);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            if (!context.Users.Any())
            {
                try
                {
                    UserResource userEntry = new UserResource()
                    {
                        Username = "******",
                        Password = "******"
                    };

                    await authService.CreateAccount(userEntry);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }
Exemplo n.º 12
0
 public BaseRepository(FehContext context)
 {
     _context  = context;
     _entities = context.Set <T>();
 }
Exemplo n.º 13
0
 public UserRepository(FehContext context) : base(context)
 {
 }
Exemplo n.º 14
0
 public AuthService(FehContext context, IConfiguration Configuration)
 {
     _userRepository = new UserRepository(context);
     _configuration  = Configuration;
 }
Exemplo n.º 15
0
 public SkillWeaponTypeService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 16
0
 public ArtistService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 17
0
 public MovementTypeRepository(FehContext context) : base(context)
 {
 }
Exemplo n.º 18
0
 public SkillMovementTypeService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }
Exemplo n.º 19
0
 public WeaponTypeRepository(FehContext context) : base(context)
 {
 }
Exemplo n.º 20
0
 public AccessoryService(FehContext dbContext)
 {
     this._dbContext = dbContext;
 }