/// <summary> /// Load the complete history of the Lutim uploads, with the corresponding information /// </summary> private async Task LoadHistory(CancellationToken cancellationToken = default) { bool saveNeeded = false; // Load the ImUr history foreach (string hash in LutimConfiguration.LutimUploadHistory.Keys) { if (LutimConfiguration.RuntimeLutimHistory.ContainsKey(hash)) { // Already loaded, only add it to the view LutimHistory.Add(LutimConfiguration.RuntimeLutimHistory[hash]); continue; } try { var lutimInfo = await LutimUtils.RetrieveLutimInfoAsync(hash, LutimConfiguration.LutimUploadHistory[hash], cancellationToken); if (lutimInfo != null) { await LutimUtils.RetrieveLutimThumbnailAsync(lutimInfo, cancellationToken); LutimConfiguration.RuntimeLutimHistory.Add(hash, lutimInfo); // Already loaded, only add it to the view LutimHistory.Add(lutimInfo); } else { Log.Debug().WriteLine("Deleting not found Lutim {0} from config.", hash); LutimConfiguration.LutimUploadHistory.Remove(hash); saveNeeded = true; } } catch (Exception e) { Log.Error().WriteLine(e, "Problem loading Lutim history for hash {0}", hash); } } if (saveNeeded) { // Save needed changes // IniConfig.Save(); } }
public async Task Delete() { await LutimUtils.DeleteLutimImage(SelectedLutim); }