示例#1
0
        public static void SetDefaultFilter(sc2dsstatsContext context)
        {
            var replays     = context.Dsreplays.OrderBy(o => o.Id);
            int step        = 1000;
            int i           = 0;
            var stepReplays = replays.Skip(i * step).Take(step).ToList();

            while (stepReplays.Any())
            {
                ReplayFilter.SetDefaultFilter(stepReplays);
                context.SaveChanges();
                i++;
                stepReplays = replays.Skip(i * step).Take(step).ToList();
                if (i % 100 == 0)
                {
                    Console.WriteLine(i);
                }
            }
        }
示例#2
0
        public async Task InsertReplays(List <Dsreplay> dsreplays, string id, EventWaitHandle ewh = null)
        {
            if (!String.IsNullOrEmpty(id))
            {
                dsreplays.ForEach(f => f.Id = 0);
                dsreplays.SelectMany(s => s.Middles).ToList().ForEach(f => f.Id   = 0);
                dsreplays.SelectMany(s => s.Dsplayers).ToList().ForEach(f => f.Id = 0);
                dsreplays.SelectMany(s => s.Dsplayers).SelectMany(s => s.Breakpoints).ToList().ForEach(f => f.Id = 0);
                dsreplays.SelectMany(s => s.Dsplayers).SelectMany(s => s.Breakpoints).SelectMany(s => s.Dsunits).ToList().ForEach(f => f.Id = 0);
                dsreplays.SelectMany(s => s.Dsplayers).Where(x => x.Name == "player").ToList().ForEach(f => { f.Name = id; f.isPlayer = true; });
            }
            ReplayFilter.SetDefaultFilter(dsreplays);

            foreach (var rep in dsreplays)
            {
                Replays.Add(rep);
            }

            await InsertJob(ewh);
        }