private static Dictionary <string, FirmwareEntry> RefreshCache(Dictionary <string, FirmwareEntry> old) { var data = new Dictionary <string, FirmwareEntry>(old?.Count ?? 128, StringComparer.OrdinalIgnoreCase); using (var links = Client.GetAsync(ConfigHelper.GetString("FirmwareUrl")).GetAwaiter().GetResult().Content.ReadAsStreamAsync().GetAwaiter().GetResult()) using (var reader = new StreamReader(links)) { while (reader.ReadLine() is string line) { var splits = line.Split('\t'); if (splits.Length != 6) { Log.Warning("Zeile {Row} in Datensatz enthält {Length} anstatt 6 Elemente", line, splits.Length); continue; } var entry = new FirmwareEntry { Nick = splits[0], Model = splits[1], Firmware = splits[2], Recovery = splits[3], Downgrade = splits[4], Source = splits[5] }; data.Add(entry.Nick, entry); } } return(data); }
private static string FormatResult(FirmwareEntry entry, bool firmware, bool recovery, bool downgrades, bool source) { string output = entry.Model; if (firmware && !String.IsNullOrWhiteSpace(entry.Firmware)) { output += " - Firmwares: " + entry.Firmware; } if (recovery && !String.IsNullOrWhiteSpace(entry.Recovery)) { output += " - Recoveries: " + entry.Recovery; } if (downgrades && !String.IsNullOrWhiteSpace(entry.Downgrade)) { output += " - Downgrades: " + entry.Downgrade; } if (source && !String.IsNullOrWhiteSpace(entry.Source)) { output += " - Sources: " + entry.Source; } return(output); }