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}%");
|
cmd.Parameters.AddWithValue("@url", $"%{domain}%");
|
||||||
|
|
||||||
using var reader = cmd.ExecuteReader();
|
using var reader = cmd.ExecuteReader();
|
||||||
if (reader.Read() && !reader.IsDBNull(1))
|
if (!reader.Read() || reader.IsDBNull(1))
|
||||||
{
|
continue;
|
||||||
var iconId = reader.GetInt64(0).ToString();
|
|
||||||
var imageData = (byte[])reader["image_data"];
|
|
||||||
|
|
||||||
if (imageData != null && imageData.Length > 0)
|
var iconId = reader.GetInt64(0).ToString();
|
||||||
{
|
var imageData = (byte[])reader["image_data"];
|
||||||
var faviconPath = Path.Combine(_faviconCacheDir, $"{domain}_{iconId}.png");
|
|
||||||
if (!File.Exists(faviconPath))
|
if (imageData is not { Length: > 0 })
|
||||||
{
|
continue;
|
||||||
SaveBitmapData(imageData, faviconPath);
|
|
||||||
}
|
var faviconPath = Path.Combine(_faviconCacheDir, $"{domain}_{iconId}.png");
|
||||||
bookmark.FaviconPath = faviconPath;
|
if (!File.Exists(faviconPath))
|
||||||
}
|
{
|
||||||
|
SaveBitmapData(imageData, faviconPath);
|
||||||
}
|
}
|
||||||
|
bookmark.FaviconPath = faviconPath;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -145,22 +145,23 @@ public abstract class FirefoxBookmarkLoaderBase : IBookmarkLoader
|
||||||
cmd.Parameters.AddWithValue("@url", $"%{domain}%");
|
cmd.Parameters.AddWithValue("@url", $"%{domain}%");
|
||||||
|
|
||||||
using var reader = cmd.ExecuteReader();
|
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"];
|
SaveBitmapData(imageData, faviconPath);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bookmark.FaviconPath = faviconPath;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue