Skip to content

Commit b475396

Browse files
committed
Code cleanup
1 parent 7fce1f2 commit b475396

14 files changed

+51
-52
lines changed

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#nullable enable
2-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1+
#nullable enable
32
using System;
43
using System.Collections.Generic;
5-
using System.Windows.Controls;
4+
using System.Collections.Specialized;
5+
using System.ComponentModel;
6+
using System.IO;
7+
using System.Linq;
68
using System.Threading;
79
using System.Threading.Tasks;
10+
using System.Windows.Controls;
11+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
812
using Flow.Launcher.Plugin.BrowserBookmark.Services;
9-
using System.ComponentModel;
10-
using System.Linq;
11-
using System.Collections.Specialized;
12-
using System.IO;
1313

1414
namespace Flow.Launcher.Plugin.BrowserBookmark;
1515

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public bool LoadChromeBookmark
2323
}
2424
}
2525
}
26-
26+
2727
public bool LoadFirefoxBookmark
2828
{
2929
get => _loadFirefoxBookmark;
@@ -36,7 +36,7 @@ public bool LoadFirefoxBookmark
3636
}
3737
}
3838
}
39-
39+
4040
public bool LoadEdgeBookmark
4141
{
4242
get => _loadEdgeBookmark;
@@ -75,7 +75,7 @@ public bool EnableFavicons
7575
}
7676
}
7777
}
78-
78+
7979
public bool FetchMissingFavicons
8080
{
8181
get => _fetchMissingFavicons;
@@ -88,7 +88,7 @@ public bool FetchMissingFavicons
8888
}
8989
}
9090
}
91-
91+
9292
private ObservableCollection<CustomBrowser> _customBrowsers = new();
9393

9494
public ObservableCollection<CustomBrowser> CustomBrowsers

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/BookmarkLoaderService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#nullable enable
2-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1+
#nullable enable
32
using System;
43
using System.Collections.Concurrent;
54
using System.Collections.Generic;
65
using System.IO;
76
using System.Linq;
87
using System.Threading;
98
using System.Threading.Tasks;
9+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1010

1111
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
1212

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/BrowserDetector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#nullable enable
2-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1+
#nullable enable
32
using System.Collections.Generic;
43
using System.IO;
54
using System.Linq;
5+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
66

77
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
88

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/ChromiumBookmarkLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#nullable enable
2-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1+
#nullable enable
32
using System;
43
using System.Collections.Concurrent;
54
using System.Collections.Generic;
65
using System.IO;
76
using System.Runtime.CompilerServices;
87
using System.Text.Json;
98
using System.Threading;
9+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1010

1111
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
1212

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/FaviconService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#nullable enable
1+
#nullable enable
22

3-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
43
using System;
54
using System.Collections.Concurrent;
65
using System.Collections.Generic;
@@ -11,6 +10,7 @@
1110
using System.Text.Json;
1211
using System.Threading;
1312
using System.Threading.Tasks;
13+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
1414

1515
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
1616

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/FirefoxBookmarkLoader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#nullable enable
2-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
3-
using Microsoft.Data.Sqlite;
1+
#nullable enable
42
using System;
53
using System.Collections.Generic;
64
using System.IO;
75
using System.Runtime.CompilerServices;
86
using System.Threading;
97
using System.Threading.Tasks;
8+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
9+
using Microsoft.Data.Sqlite;
1010

1111
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
1212

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/FirefoxProfileFinder.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#nullable enable
1+
#nullable enable
22
using System;
33
using System.IO;
44
using System.Linq;
@@ -13,20 +13,20 @@ public static class FirefoxProfileFinder
1313
// Standard MSI installer path
1414
var standardPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Mozilla\Firefox");
1515
var placesPath = GetPlacesPathFromProfileDir(standardPath);
16-
16+
1717
return !string.IsNullOrEmpty(placesPath) ? placesPath : null;
1818
}
1919

2020
public static string? GetFirefoxMsixPlacesPath()
2121
{
2222
var packagesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Packages");
23-
if (!Directory.Exists(packagesPath))
23+
if (!Directory.Exists(packagesPath))
2424
return null;
2525

2626
try
2727
{
2828
var firefoxPackageFolder = Directory.EnumerateDirectories(packagesPath, "Mozilla.Firefox*", SearchOption.TopDirectoryOnly).FirstOrDefault();
29-
if (firefoxPackageFolder == null)
29+
if (firefoxPackageFolder == null)
3030
return null;
3131

3232
var profileFolderPath = Path.Combine(firefoxPackageFolder, @"LocalCache\Roaming\Mozilla\Firefox");
@@ -75,7 +75,7 @@ public static class FirefoxProfileFinder
7575
targetSection = profileSections.FirstOrDefault(s =>
7676
Regex.IsMatch(s, @"^Name\s*=\s*default-release", RegexOptions.Multiline | RegexOptions.IgnoreCase) &&
7777
Regex.IsMatch(s, @"^Default\s*=\s*1", RegexOptions.Multiline | RegexOptions.IgnoreCase));
78-
78+
7979
// Find any profile marked as default.
8080
if (targetSection == null)
8181
{
@@ -87,19 +87,19 @@ public static class FirefoxProfileFinder
8787
{
8888
targetSection = profileSections.FirstOrDefault();
8989
}
90-
91-
if (targetSection == null)
90+
91+
if (targetSection == null)
9292
return null;
93-
93+
9494
var pathMatch = Regex.Match(targetSection, @"^Path\s*=\s*(.+)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
95-
if (!pathMatch.Success)
95+
if (!pathMatch.Success)
9696
return null;
9797

9898
var pathValue = pathMatch.Groups[1].Value.Trim();
99-
99+
100100
// IsRelative=0 means it's an absolute path. The default is relative (IsRelative=1).
101101
var isRelative = !Regex.IsMatch(targetSection, @"^IsRelative\s*=\s*0", RegexOptions.Multiline | RegexOptions.IgnoreCase);
102-
102+
103103
var finalProfilePath = isRelative ? Path.Combine(profileFolderPath, pathValue.Replace('/', Path.DirectorySeparatorChar)) : pathValue;
104104
var finalPlacesDb = Path.Combine(finalProfilePath, "places.sqlite");
105105

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/HtmlFaviconParser.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#nullable enable
1+
#nullable enable
22
using System;
33
using System.Collections.Generic;
44
using System.IO;
55
using System.Text.RegularExpressions;
6-
using static Flow.Launcher.Plugin.BrowserBookmark.Services.FaviconService;
76

87
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
98

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Services/IBookmarkLoader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using Flow.Launcher.Plugin.BrowserBookmark.Models;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Threading;
3+
using Flow.Launcher.Plugin.BrowserBookmark.Models;
44

55
namespace Flow.Launcher.Plugin.BrowserBookmark.Services;
66

0 commit comments

Comments
 (0)