public override async Task FixAsync(DataCenter dataCenter) { switch (this.Type) { case ErrorType.FlagCount: var flag = await dataCenter.FlagManager.FindAsync(JryFlag.BuildFlagId(this.type, this.value)); if (flag != null) { flag.Count = this.count; await dataCenter.FlagManager.UpdateAsync(flag); } else { Debug.Assert(false); } break; default: throw new ArgumentOutOfRangeException(); } }
private async Task BuildFlagAsync() { await this.dataCenter.FlagManager.Source.CursorAsync(z => { var type = (int)z.Type; var dest = this.flagRefs.GetOrCreateValue(type); if (string.IsNullOrEmpty(z.Value) || z.Id != JryFlag.BuildFlagId(z.Type, z.Value)) { if (Debugger.IsAttached) { Debugger.Break(); } Debug.Assert(false); } dest.Add(z.Value, z.Count); }); foreach (var dictPair in this.flagRefs) { var d = new Dictionary <string, int>(dictPair.Value.Count); d.AddRange(dictPair.Value.ToList()); this.originFlagRefs[dictPair.Key] = d; } }