mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Reduce nesting
This commit is contained in:
parent
0c162b1cbe
commit
92ef2c76c7
2 changed files with 28 additions and 27 deletions
|
|
@ -171,21 +171,21 @@ public abstract class ChromiumBookmarkLoader : IBookmarkLoader
|
|||
cmd.Parameters.AddWithValue("@url", $"%{domain}%");
|
||||
|
||||
using var reader = cmd.ExecuteReader();
|
||||
if (reader.Read() && !reader.IsDBNull(1))
|
||||
{
|
||||
var iconId = reader.GetInt64(0).ToString();
|
||||
var imageData = (byte[])reader["image_data"];
|
||||
if (!reader.Read() || reader.IsDBNull(1))
|
||||
continue;
|
||||
|
||||
if (imageData != null && imageData.Length > 0)
|
||||
{
|
||||
var faviconPath = Path.Combine(_faviconCacheDir, $"{domain}_{iconId}.png");
|
||||
if (!File.Exists(faviconPath))
|
||||
{
|
||||
SaveBitmapData(imageData, faviconPath);
|
||||
}
|
||||
bookmark.FaviconPath = faviconPath;
|
||||
}
|
||||
var iconId = reader.GetInt64(0).ToString();
|
||||
var imageData = (byte[])reader["image_data"];
|
||||
|
||||
if (imageData is not { Length: > 0 })
|
||||
continue;
|
||||
|
||||
var faviconPath = Path.Combine(_faviconCacheDir, $"{domain}_{iconId}.png");
|
||||
if (!File.Exists(faviconPath))
|
||||
{
|
||||
SaveBitmapData(imageData, faviconPath);
|
||||
}
|
||||
bookmark.FaviconPath = faviconPath;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -145,22 +145,23 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
|||
cmd.Parameters.AddWithValue("@url", $"%{domain}%");
|
||||
|
||||
using var reader = cmd.ExecuteReader();
|
||||
if (reader.Read() && !reader.IsDBNull(0))
|
||||
if (!reader.Read() || reader.IsDBNull(0))
|
||||
continue;
|
||||
|
||||
var imageData = (byte[])reader["data"];
|
||||
|
||||
if (imageData is not { Length: > 0 })
|
||||
continue;
|
||||
|
||||
var ext = IsSvgData(imageData) ? "svg" : "png";
|
||||
var faviconPath = Path.Combine(_faviconCacheDir, $"firefox_{domain}.{ext}");
|
||||
|
||||
if (!File.Exists(faviconPath))
|
||||
{
|
||||
var imageData = (byte[])reader["data"];
|
||||
|
||||
if (imageData != null && imageData.Length > 0)
|
||||
{
|
||||
var ext = IsSvgData(imageData) ? "svg" : "png";
|
||||
var faviconPath = Path.Combine(_faviconCacheDir, $"firefox_{domain}.{ext}");
|
||||
|
||||
if (!File.Exists(faviconPath))
|
||||
{
|
||||
SaveBitmapData(imageData, faviconPath);
|
||||
}
|
||||
bookmark.FaviconPath = faviconPath;
|
||||
}
|
||||
SaveBitmapData(imageData, faviconPath);
|
||||
}
|
||||
|
||||
bookmark.FaviconPath = faviconPath;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue