static Instances() { Instances.Client = new LittleClient(); Instances.AccountBag = new RiotAccountBag(); Instances.WintermintUpdater = new WintermintUpdateDaemon(); Instances.RiotUpdater = new RiotUpdateDaemon(); }
private static object GetJsonDto(SupportedRealm[] realms, RiotUpdateDaemon.UpdaterState update) { return (object) new { realm = ((Func<string, object>) (realmId => (object) Enumerable.FirstOrDefault<SupportedRealm>((IEnumerable<SupportedRealm>) realms, (Func<SupportedRealm, bool>) (x => realmId.Equals(x.Id, StringComparison.OrdinalIgnoreCase)))))(update.RealmId), status = update.Status, position = update.Position, length = update.Length }; }
private async Task OnUpdateProgressAsync(RiotUpdateDaemon.UpdaterState[] updates) { SupportedRealm[] realms = await RealmService.GetRealms(); RiotUpdateDaemon.UpdaterState[] updaterStateArray = updates; IEnumerable<object> completed = from update in (IEnumerable<RiotUpdateDaemon.UpdaterState>)updaterStateArray where !update.Completed select RiotUpdateNotificationService.GetJsonDto(realms, update); JsApiService.Push("update:riot:progress", completed); }
private async Task OnUpdateProgressAsync(RiotUpdateDaemon.UpdaterState[] updates) { SupportedRealm[] realms = await RealmService.GetRealms(); IEnumerable<object> transformed = Enumerable.Select<RiotUpdateDaemon.UpdaterState, object>(Enumerable.Where<RiotUpdateDaemon.UpdaterState>((IEnumerable<RiotUpdateDaemon.UpdaterState>) updates, (Func<RiotUpdateDaemon.UpdaterState, bool>) (update => !update.Completed)), (Func<RiotUpdateDaemon.UpdaterState, object>) (update => RiotUpdateNotificationService.GetJsonDto(realms, update))); JsApiService.Push("update:riot:progress", (object) transformed); }
private async Task UpdaterOnCompletedAsync(RiotUpdateDaemon.UpdaterState update) { SupportedRealm[] realms = await RealmService.GetRealms(); JsApiService.Push("update:riot:completed", RiotUpdateNotificationService.GetJsonDto(realms, update)); }
internal static bool TryCreate(string realmId, string[] arguments, Action notifyChange, Action<RiotUpdateDaemon.UpdaterState> notifyCompleted, out RiotUpdateDaemon.UpdaterState updaterState) { bool flag; try { updaterState = RiotUpdateDaemon.UpdaterState.Create(realmId, arguments, notifyChange, notifyCompleted); flag = true; } catch { updaterState = null; flag = false; } return flag; }
private void OnCompleted(RiotUpdateDaemon.UpdaterState completedState) { if (this.Completed != null) { this.Completed(this, completedState); } }
private void OnCompleted(RiotUpdateDaemon.UpdaterState completedState) { if (this.Completed == null) return; this.Completed((object) this, completedState); }
private static object GetJsonDto(SupportedRealm[] realms, RiotUpdateDaemon.UpdaterState update) { Func<string, object> func = (string realmId) => realms.FirstOrDefault<SupportedRealm>((SupportedRealm x) => realmId.Equals(x.Id, StringComparison.OrdinalIgnoreCase)); return new { realm = func(update.RealmId), status = update.Status, position = update.Position, length = update.Length }; }