Skip to content

Commit ef16484

Browse files
authored
Merge branch 'dev' into SelectBrowserCore
2 parents a6d3aaf + 70015e2 commit ef16484

File tree

46 files changed

+122
-131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+122
-131
lines changed

Flow.Launcher.Core/Flow.Launcher.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0-windows</TargetFramework>
4+
<TargetFramework>net7.0-windows</TargetFramework>
55
<UseWpf>true</UseWpf>
66
<UseWindowsForms>true</UseWindowsForms>
77
<OutputType>Library</OutputType>

Flow.Launcher.Infrastructure/Flow.Launcher.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0-windows</TargetFramework>
4+
<TargetFramework>net7.0-windows</TargetFramework>
55
<ProjectGuid>{4FD29318-A8AB-4D8F-AA47-60BC241B8DA3}</ProjectGuid>
66
<OutputType>Library</OutputType>
77
<UseWpf>true</UseWpf>

Flow.Launcher.Infrastructure/Storage/JsonStorage.cs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,17 @@ namespace Flow.Launcher.Infrastructure.Storage
1313
public class JsonStorage<T> where T : new()
1414
{
1515
protected T? Data;
16+
1617
// need a new directory name
1718
public const string DirectoryName = "Settings";
1819
public const string FileSuffix = ".json";
20+
1921
protected string FilePath { get; init; } = null!;
22+
2023
private string TempFilePath => $"{FilePath}.tmp";
24+
2125
private string BackupFilePath => $"{FilePath}.bak";
26+
2227
protected string DirectoryPath { get; init; } = null!;
2328

2429

@@ -35,7 +40,7 @@ public T Load()
3540
{
3641
try
3742
{
38-
Data = JsonSerializer.Deserialize<T>(serialized)?? TryLoadBackup() ?? LoadDefault();
43+
Data = JsonSerializer.Deserialize<T>(serialized) ?? TryLoadBackup() ?? LoadDefault();
3944
}
4045
catch (JsonException)
4146
{
@@ -46,6 +51,7 @@ public T Load()
4651
{
4752
Data = TryLoadBackup() ?? LoadDefault();
4853
}
54+
4955
return Data.NonNull();
5056
}
5157

@@ -67,12 +73,19 @@ private T LoadDefault()
6773
try
6874
{
6975
var data = JsonSerializer.Deserialize<T>(File.ReadAllText(BackupFilePath));
76+
7077
if (data != null)
7178
{
7279
Log.Info($"|JsonStorage.Load|Failed to load settings.json, {BackupFilePath} restored successfully");
73-
File.Replace(BackupFilePath, FilePath, null);
80+
81+
if(File.Exists(FilePath))
82+
File.Replace(BackupFilePath, FilePath, null);
83+
else
84+
File.Move(BackupFilePath, FilePath);
85+
7486
return data;
7587
}
88+
7689
return default;
7790
}
7891
catch (JsonException)
@@ -94,14 +107,22 @@ private void BackupOriginFile()
94107

95108
public void Save()
96109
{
97-
string serialized = JsonSerializer.Serialize(Data, new JsonSerializerOptions
98-
{
99-
WriteIndented = true
100-
});
110+
string serialized = JsonSerializer.Serialize(Data,
111+
new JsonSerializerOptions
112+
{
113+
WriteIndented = true
114+
});
101115

102116
File.WriteAllText(TempFilePath, serialized);
103-
File.Replace(TempFilePath, FilePath, BackupFilePath);
104-
File.Delete(TempFilePath);
117+
118+
if (!File.Exists(FilePath))
119+
{
120+
File.Move(TempFilePath, FilePath);
121+
}
122+
else
123+
{
124+
File.Replace(TempFilePath, FilePath, BackupFilePath);
125+
}
105126
}
106127
}
107128
}

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0-windows</TargetFramework>
4+
<TargetFramework>net7.0-windows</TargetFramework>
55
<ProjectGuid>{8451ECDD-2EA4-4966-BB0A-7BBC40138E80}</ProjectGuid>
66
<UseWPF>true</UseWPF>
77
<OutputType>Library</OutputType>
@@ -14,10 +14,10 @@
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
17-
<Version>3.1.0</Version>
18-
<PackageVersion>3.1.0</PackageVersion>
19-
<AssemblyVersion>3.1.0</AssemblyVersion>
20-
<FileVersion>3.1.0</FileVersion>
17+
<Version>4.0.0</Version>
18+
<PackageVersion>4.0.0</PackageVersion>
19+
<AssemblyVersion>4.0.0</AssemblyVersion>
20+
<FileVersion>4.0.0</FileVersion>
2121
<PackageId>Flow.Launcher.Plugin</PackageId>
2222
<Authors>Flow-Launcher</Authors>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -65,7 +65,7 @@
6565
<PrivateAssets>all</PrivateAssets>
6666
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
6767
</PackageReference>
68-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
68+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
6969
<PackageReference Include="JetBrains.Annotations" Version="2022.3.1" />
7070
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
7171
</ItemGroup>

Flow.Launcher.Test/Flow.Launcher.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
4+
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
55
<ProjectGuid>{FF742965-9A80-41A5-B042-D6C7D3A21708}</ProjectGuid>
66
<OutputType>Library</OutputType>
77
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -54,7 +54,7 @@
5454
<PrivateAssets>all</PrivateAssets>
5555
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
5656
</PackageReference>
57-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
57+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
5858
</ItemGroup>
5959

6060
</Project>

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
5+
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
66
<UseWPF>true</UseWPF>
77
<UseWindowsForms>true</UseWindowsForms>
88
<StartupObject>Flow.Launcher.App</StartupObject>

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true)
103103

104104
private void tbHotkey_LostFocus(object sender, RoutedEventArgs e)
105105
{
106-
tbHotkey.Text = CurrentHotkey.ToString();
106+
tbHotkey.Text = CurrentHotkey?.ToString() ?? "";
107107
tbHotkey.Select(tbHotkey.Text.Length, 0);
108108
}
109109

Flow.Launcher/Properties/PublishProfiles/Net6.0-SelfContained.pubxml renamed to Flow.Launcher/Properties/PublishProfiles/Net7.0-SelfContained.pubxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
77
<PublishProtocol>FileSystem</PublishProtocol>
88
<Configuration>Release</Configuration>
99
<Platform>Any CPU</Platform>
10-
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
10+
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
1111
<PublishDir>..\Output\Release\</PublishDir>
1212
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1313
<SelfContained>true</SelfContained>

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
 using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Net;

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Library</OutputType>
5-
<TargetFramework>net6.0-windows</TargetFramework>
5+
<TargetFramework>net7.0-windows</TargetFramework>
66
<UseWPF>true</UseWPF>
77
<ProjectGuid>{9B130CC5-14FB-41FF-B310-0A95B6894C37}</ProjectGuid>
88
<AppDesignerFolder>Properties</AppDesignerFolder>

0 commit comments

Comments
 (0)