コード例 #1
0
        internal async Task <Modifier> Modifier(ModifierCategory modCategory, ModifierKey modKey)
        {
            if
            (
                !modCategory.Name().Equals(ModifierCategoryName.Default) &&
                modKey.Equals(ModifierKey.Default)
            )
            {
                var app = await modCategory.App();

                modCategory = await app.ModCategory(ModifierCategoryName.Default);
            }
            var record = await factory.DB
                         .Modifiers
                         .Retrieve()
                         .Where(m => m.CategoryID == modCategory.ID.Value && m.ModKey == modKey.Value)
                         .FirstOrDefaultAsync();

            if (record == null)
            {
                record = await factory.DB
                         .Modifiers
                         .Retrieve()
                         .Where(m => m.ModKey == ModifierKey.Default.Value)
                         .FirstOrDefaultAsync();
            }
            return(factory.Modifier(record));
        }
コード例 #2
0
 private IQueryable <ModifierRecord> modifiersForCategory(ModifierCategory modCategory)
 {
     return(factory.DB
            .Modifiers
            .Retrieve()
            .Where(m => m.CategoryID == modCategory.ID.Value));
 }
コード例 #3
0
        internal async Task <Modifier> Modifier(ModifierCategory category, string targetKey)
        {
            var record = await modifiersForCategory(category)
                         .Where(m => m.TargetKey == targetKey)
                         .FirstOrDefaultAsync();

            return(factory.Modifier(record));
        }
コード例 #4
0
 internal Task <ResourceGroup[]> Groups(ModifierCategory modCategory)
 => factory.DB
 .ResourceGroups
 .Retrieve()
 .Where(g => g.ModCategoryID == modCategory.ID.Value)
 .OrderBy(g => g.Name)
 .Select(g => factory.Group(g))
 .ToArrayAsync();
コード例 #5
0
 public Task SetModCategory(ModifierCategory category)
 => factory.DB
 .ResourceGroups
 .Update
 (
     record, r =>
 {
     r.ModCategoryID = category.ID.Value;
 }
 );
コード例 #6
0
        internal async Task <Modifier> Add(ModifierCategory category, ModifierKey modKey, string targetID, string displayText)
        {
            var record = new ModifierRecord
            {
                CategoryID  = category.ID.Value,
                ModKey      = modKey.Value,
                TargetKey   = targetID,
                DisplayText = displayText
            };
            await factory.DB.Modifiers.Create(record);

            return(factory.Modifier(record));
        }
コード例 #7
0
 internal Task <Modifier[]> Modifiers(ModifierCategory category)
 {
     return(modifiersForCategory(category)
            .Select(m => factory.Modifier(m))
            .ToArrayAsync());
 }
コード例 #8
0
        internal async Task <ResourceGroup> Add(AppVersion version, ResourceGroupName name, ModifierCategory modCategory)
        {
            var record = new ResourceGroupRecord
            {
                VersionID     = version.ID.Value,
                Name          = name.Value,
                ModCategoryID = modCategory.ID.Value
            };
            await factory.DB.ResourceGroups.Create(record);

            return(factory.Group(record));
        }