public void DefaultFilter(string Winrate = "") { DSoptions defoptions = new DSoptions(); this.Build = String.Empty; this.Duration = defoptions.Duration; this.Leaver = defoptions.Leaver; this.Army = defoptions.Army; this.Kills = defoptions.Kills; this.Income = defoptions.Income; this.Startdate = defoptions.Startdate; this.Enddate = defoptions.Enddate; this.Time = defoptions.Time; this.Interest = defoptions.Interest; this.Vs = defoptions.Vs; this.Player = defoptions.Player; this.Dataset = defoptions.Dataset; this.Gamemodes = new Dictionary <string, bool>(defoptions.Gamemodes); this.Players = new Dictionary <string, bool>(); foreach (var ent in DSdata.Config.Players) { this.Players[ent] = true; } this.CmdrsChecked = new Dictionary <string, bool>(defoptions.CmdrsChecked); this.Cmdrinfo = new CmdrInfo(); this.Breakpoint = defoptions.Breakpoint; this.GameBreakpoint = defoptions.GameBreakpoint; this.PlayerCount = defoptions.PlayerCount; this.Mode = Winrate; this.MengskPreviewFilter = defoptions.MengskPreviewFilter; }
public RadioCheckBool(DSoptions _options) { options = _options; }
async Task GetDatasetInfo() { DateTime t = DateTime.UtcNow; using (var scope = scopeFactory.CreateScope()) { var context = scope.ServiceProvider.GetRequiredService <DSReplayContext>(); DSdata.Datasets = new List <DatasetInfo>(); var names = context.DSPlayers.Select(s => s.NAME).Distinct().ToArray(); DSoptions _options = new DSoptions(); _options.Startdate = new DateTime(2018, 1, 1); var replays = DBReplayFilter.Filter(_options, context, false); var ireps = from r in replays from p in r.DSPlayer where p.NAME.Length == 64 from p2 in r.DSPlayer where p2 != p && p2.TEAM == p.TEAM select new { r.ID, r.GAMETIME, p.WIN, p.NAME, p.RACE, TEAM = p2.NAME.Length == 64, MVP = r.MAXKILLSUM == p.KILLSUM }; var lireps = ireps.ToList(); foreach (var hash in names.Where(x => x.Length == 64)) { /* * var qreps = from r in replays * from p in r.DSPlayer * where p.NAME == hash * from p2 in r.DSPlayer * where p2 != p && p2.TEAM == p.TEAM * select new * { * r.ID, * p.WIN, * TEAM = p2.NAME.Length == 64, * MVP = r.MAXKILLSUM == p.KILLSUM * }; */ // var reps = qreps.ToList(); var reps = lireps.Where(x => x.NAME == hash); if (reps.Count() < 20) { continue; } if (reps.OrderByDescending(o => o.GAMETIME).First().GAMETIME.AddMonths(3) < DateTime.UtcNow) { continue; } DatasetInfo setinfo = new DatasetInfo(); setinfo.Dataset = hash; setinfo.Count = reps.Count(); //var teams = reps.Where(x => x.DSPlayer.Where(y => y.NAME.Length == 64 && y.TEAM == x.TEAM).Count() > 1); //int teamgames = teams.Count(); setinfo.Teamgames = MathF.Round((float)reps.Where(x => x.TEAM == true).Count() * 100 / (float)setinfo.Count, 2); int wins = reps.Where(x => x.WIN == true).Count(); setinfo.Winrate = MathF.Round((float)wins * 100 / (float)setinfo.Count, 2); setinfo.MVP = MathF.Round((float)reps.Where(x => x.MVP == true).Count() * 100 / (float)setinfo.Count, 2); int maincount = 0; string maincmdr = ""; foreach (string cmdr in DSdata.s_races_cmdr) { int c = reps.Where(x => x.RACE == cmdr).Count(); if (c > maincount) { maincount = c; maincmdr = cmdr; } } float mainper = MathF.Round((float)maincount * 100 / (float)setinfo.Count, 2); //if (mainper < 100 / DSdata.s_races_cmdr.Count() + 5) // maincmdr = "Random"; setinfo.Main = new KeyValuePair <string, float>(maincmdr, mainper); setinfo.Count = reps.Select(s => s.ID).Distinct().Count(); DSdata.Datasets.Add(setinfo); } } Console.WriteLine($"Dataset info created in {(DateTime.UtcNow - t).TotalSeconds}"); }