public static LeagueInfo GetInstance(CancellationToken ct) { if (_instance == null) { _instance = new LeagueInfo(ct); } return(_instance); }
public BuyItemPlugin(SDConnection connection, InitialPayload payload) : base(connection, payload) { Logger.Instance.LogMessage(TracingLevel.DEBUG, $"Constructor called"); LeagueInfo.OnUpdateStarted += LeagueInfo_OnUpdateStarted; LeagueInfo.OnUpdateProgress += LeagueInfo_OnUpdateProgress; LeagueInfo.OnUpdateCompleted += LeagueInfo_OnUpdateCompleted; _info = LeagueInfo.GetInstance(_cts.Token); Connection.OnApplicationDidLaunch += Connection_OnApplicationDidLaunch; Connection.OnApplicationDidTerminate += Connection_OnApplicationDidTerminate; if (payload.Settings == null || payload.Settings.Count == 0) { this._settings = BuyItemSettings.CreateDefaultSettings(); } else { this._settings = payload.Settings.ToObject <BuyItemSettings>(); } if (_info.UpdateTask != null) { Task.Run(async() => { var image = Utilities.GetUpdateImage(); await Connection.SetImageAsync(image); await _info.UpdateTask; await Connection.SetDefaultImageAsync(); await Connection.SetTitleAsync(string.Empty); }); } Task.Run(async() => { await _info.UpdateTask; _settings.Items = _info.GetItems(); await SaveSettings(); UpdateItemImage(_settings.ItemId); if (_settings.DisplayFormat == EBuyItemDisplayFormat.TotalCost) { var item = _info.GetItem(_settings.ItemId); await Connection.SetTitleAsync($"{item.TotalCost:F0}"); } }); }
public SpellTimerPlugin(SDConnection connection, InitialPayload payload) : base(connection, payload) { Logger.Instance.LogMessage(TracingLevel.DEBUG, $"Constructor called"); LeagueInfo.OnUpdateStarted += LeagueInfo_OnUpdateStarted; LeagueInfo.OnUpdateProgress += LeagueInfo_OnUpdateProgress; LeagueInfo.OnUpdateCompleted += LeagueInfo_OnUpdateCompleted; _info = LeagueInfo.GetInstance(_cts.Token); Connection.OnApplicationDidLaunch += Connection_OnApplicationDidLaunch; Connection.OnApplicationDidTerminate += Connection_OnApplicationDidTerminate; if (payload.Settings == null || payload.Settings.Count == 0) { this._settings = SpellTimerSettings.CreateDefaultSettings(); } else { this._settings = payload.Settings.ToObject <SpellTimerSettings>(); } if (_info.UpdateTask != null) { Task.Run(async() => { var image = Utilities.GetUpdateImage(); await Connection.SetImageAsync(image); await _info.UpdateTask; await Connection.SetDefaultImageAsync(); await Connection.SetTitleAsync(string.Empty); }); } }