public async static Task <string> SaveStwStoreToLocalAsync(this IEpicApi ieapi, bool forceDownload = true) { var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "savedStwStore.png"); FileInfo fif = new FileInfo(filePath); if (!forceDownload) { var elapsedHours = (DateTime.UtcNow - fif.LastWriteTime.ToUniversalTime()).TotalHours; if (fif.Exists && elapsedHours <= 23) { return(filePath); } } if (fif.Exists) { fif.Delete(); } using (HttpClient client = new HttpClient()) { var queueApi = DIManager.Services.GetRequiredService <IFortniteQueueApi>(); var stwStore = queueApi.STWStoreSimplified(); var strjson = JsonConvert.SerializeObject(stwStore); var response = await client.PostAsync($"https://cdn.ftnpower.com/api/StwStore?aKey={DIManager.Services.ImageServiceConfigs().AKey}", new StringContent(strjson, Encoding.UTF8, "application/json")); using (var b = Image.FromStream(await response.Content.ReadAsStreamAsync())) { ImageCodecInfo codec = ImageCodecInfo.GetImageEncoders().First(f => f.MimeType == "image/png"); EncoderParameters eParams = new EncoderParameters(1); eParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L); b.Save(filePath, codec, eParams); } } return(filePath); }
public MissionService(IEpicApi epicApi, Func <IMissionServiceEventArgs, Task> missionCallback) { this.EpicApi = epicApi; this.WebhookCallback = missionCallback; }
public CatalogService(IEpicApi epicApi, Func <ICatalogServiceEventArgs, Task> catalogWebhook = null) { this.EpicApi = epicApi; this.CatalogCallback = catalogWebhook; }
public StwStoreService(IEpicApi epicApi) : base() { Api = epicApi; }