Skip to content

Commit 5fb6b29

Browse files
committed
Revert some changes; fix a few bugs
1 parent 3b4cacf commit 5fb6b29

File tree

9 files changed

+78
-92
lines changed

9 files changed

+78
-92
lines changed

SmartImage.Lib/SmartImage.Lib.csproj

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

33
<PropertyGroup>
44
<TargetFramework>net5.0</TargetFramework>
55
<PublishSingleFile>true</PublishSingleFile>
66
<PublishTrimmed>true</PublishTrimmed>
7-
<Configurations>Debug;Release;TestDebug</Configurations>
7+
<Configurations>Debug;Release</Configurations>
88
</PropertyGroup>
99

1010
<ItemGroup>

SmartImage.sln

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ Global
1919
Release|Any CPU = Release|Any CPU
2020
Release|x64 = Release|x64
2121
Release|x86 = Release|x86
22-
TestDebug|Any CPU = TestDebug|Any CPU
23-
TestDebug|x64 = TestDebug|x64
24-
TestDebug|x86 = TestDebug|x86
2522
EndGlobalSection
2623
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2724
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -36,12 +33,6 @@ Global
3633
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.Release|x64.Build.0 = Release|Any CPU
3734
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.Release|x86.ActiveCfg = Release|Any CPU
3835
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.Release|x86.Build.0 = Release|Any CPU
39-
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.TestDebug|Any CPU.ActiveCfg = TestDebug|Any CPU
40-
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.TestDebug|Any CPU.Build.0 = TestDebug|Any CPU
41-
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.TestDebug|x64.ActiveCfg = TestDebug|Any CPU
42-
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.TestDebug|x64.Build.0 = TestDebug|Any CPU
43-
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.TestDebug|x86.ActiveCfg = TestDebug|Any CPU
44-
{51B1D8B9-E79F-416E-9FD6-55DFB8A5CAF0}.TestDebug|x86.Build.0 = TestDebug|Any CPU
4536
{AD7595AB-6759-4688-96D1-667D26114CAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4637
{AD7595AB-6759-4688-96D1-667D26114CAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
4738
{AD7595AB-6759-4688-96D1-667D26114CAB}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -54,12 +45,6 @@ Global
5445
{AD7595AB-6759-4688-96D1-667D26114CAB}.Release|x64.Build.0 = Release|Any CPU
5546
{AD7595AB-6759-4688-96D1-667D26114CAB}.Release|x86.ActiveCfg = Release|Any CPU
5647
{AD7595AB-6759-4688-96D1-667D26114CAB}.Release|x86.Build.0 = Release|Any CPU
57-
{AD7595AB-6759-4688-96D1-667D26114CAB}.TestDebug|Any CPU.ActiveCfg = TestDebug|Any CPU
58-
{AD7595AB-6759-4688-96D1-667D26114CAB}.TestDebug|Any CPU.Build.0 = TestDebug|Any CPU
59-
{AD7595AB-6759-4688-96D1-667D26114CAB}.TestDebug|x64.ActiveCfg = TestDebug|Any CPU
60-
{AD7595AB-6759-4688-96D1-667D26114CAB}.TestDebug|x64.Build.0 = TestDebug|Any CPU
61-
{AD7595AB-6759-4688-96D1-667D26114CAB}.TestDebug|x86.ActiveCfg = TestDebug|Any CPU
62-
{AD7595AB-6759-4688-96D1-667D26114CAB}.TestDebug|x86.Build.0 = TestDebug|Any CPU
6348
{244F57D9-F021-4F47-9844-45F26CA9378D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
6449
{244F57D9-F021-4F47-9844-45F26CA9378D}.Debug|Any CPU.Build.0 = Debug|Any CPU
6550
{244F57D9-F021-4F47-9844-45F26CA9378D}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -72,12 +57,6 @@ Global
7257
{244F57D9-F021-4F47-9844-45F26CA9378D}.Release|x64.Build.0 = Release|Any CPU
7358
{244F57D9-F021-4F47-9844-45F26CA9378D}.Release|x86.ActiveCfg = Release|Any CPU
7459
{244F57D9-F021-4F47-9844-45F26CA9378D}.Release|x86.Build.0 = Release|Any CPU
75-
{244F57D9-F021-4F47-9844-45F26CA9378D}.TestDebug|Any CPU.ActiveCfg = TestDebug|Any CPU
76-
{244F57D9-F021-4F47-9844-45F26CA9378D}.TestDebug|Any CPU.Build.0 = TestDebug|Any CPU
77-
{244F57D9-F021-4F47-9844-45F26CA9378D}.TestDebug|x64.ActiveCfg = TestDebug|Any CPU
78-
{244F57D9-F021-4F47-9844-45F26CA9378D}.TestDebug|x64.Build.0 = TestDebug|Any CPU
79-
{244F57D9-F021-4F47-9844-45F26CA9378D}.TestDebug|x86.ActiveCfg = TestDebug|Any CPU
80-
{244F57D9-F021-4F47-9844-45F26CA9378D}.TestDebug|x86.Build.0 = TestDebug|Any CPU
8160
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8261
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
8362
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -90,12 +69,6 @@ Global
9069
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.Release|x64.Build.0 = Release|Any CPU
9170
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.Release|x86.ActiveCfg = Release|Any CPU
9271
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.Release|x86.Build.0 = Release|Any CPU
93-
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.TestDebug|Any CPU.ActiveCfg = TestDebug|Any CPU
94-
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.TestDebug|Any CPU.Build.0 = TestDebug|Any CPU
95-
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.TestDebug|x64.ActiveCfg = TestDebug|Any CPU
96-
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.TestDebug|x64.Build.0 = TestDebug|Any CPU
97-
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.TestDebug|x86.ActiveCfg = TestDebug|Any CPU
98-
{0318489D-8B5C-4B0E-90F8-AB6CDEC16AD7}.TestDebug|x86.Build.0 = TestDebug|Any CPU
9972
EndGlobalSection
10073
GlobalSection(SolutionProperties) = preSolution
10174
HideSolutionNode = FALSE

SmartImage/Core/AppInfo.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Kantan.Diagnostics;
1919
using Kantan.Text;
2020
using Kantan.Utilities;
21+
using Novus;
2122
using SmartImage.Lib.Utilities;
2223
using static Kantan.Diagnostics.LogCategories;
2324

@@ -43,11 +44,11 @@ public static class AppInfo
4344
/// Name in ASCII art
4445
/// </summary>
4546
public const string NAME_BANNER =
46-
" ____ _ ___\n" +
47-
" / ___| _ __ ___ __ _ _ __| |_|_ _|_ __ ___ __ _ __ _ ___\n" +
48-
@" \___ \| '_ ` _ \ / _` | '__| __|| || '_ ` _ \ / _` |/ _` |/ _ \" + "\n" +
47+
" ____ _ ___\n" +
48+
" / ___| _ __ ___ __ _ _ __| |_|_ _|_ __ ___ __ _ __ _ ___\n" +
49+
@" \___ \| '_ ` _ \ / _` | '__| __|| || '_ ` _ \ / _` |/ _` |/ _ \" + "\n" +
4950
" ___) | | | | | | (_| | | | |_ | || | | | | | (_| | (_| | __/\n" +
50-
@" |____/|_| |_| |_|\__,_|_| \__|___|_| |_| |_|\__,_|\__, |\___|" + "\n" +
51+
@" |____/|_| |_| |_|\__,_|_| \__|___|_| |_| |_|\__,_|\__, |\___|" + "\n" +
5152
" |___/\n";
5253

5354

@@ -97,7 +98,18 @@ public static string ExeLocation
9798
}
9899

99100

100-
public static bool IsAppFolderInPath => FileSystem.IsFolderInPath(AppFolder);
101+
public static bool IsAppFolderInPath
102+
{
103+
get
104+
{
105+
if (OperatingSystem.IsLinux()) {
106+
var p = Environment.GetEnvironmentVariable("PATH");
107+
return p.Contains(AppFolder);
108+
}
109+
110+
return FileSystem.IsFolderInPath(AppFolder);
111+
}
112+
}
101113

102114
/// <summary>
103115
/// Setup

SmartImage/Program.cs

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
using System.Text.Unicode;
3131
using System.Threading;
3232
using System.Threading.Tasks;
33-
// using Windows.ApplicationModel.Background;
34-
// using Windows.Networking.Connectivity;
35-
// using Windows.UI.Notifications;
33+
using Windows.ApplicationModel.Background;
34+
using Windows.Networking.Connectivity;
35+
using Windows.UI.Notifications;
3636
using Kantan.Cli;
3737
using Kantan.Cli.Controls;
3838
using Kantan.Diagnostics;
@@ -87,12 +87,14 @@ public static class Program
8787
/// <summary>
8888
/// Console UI for search results
8989
/// </summary>
90-
private static readonly ConsoleDialog ResultDialog = new() {
90+
private static readonly ConsoleDialog ResultDialog = new()
91+
{
9192
Options = new List<ConsoleOption>(),
9293
Description = "Press the result number to open in browser\n" +
9394
"Ctrl: Load direct | Alt: Show other | Shift: Open raw | Alt+Ctrl: Download\n" +
9495
"F1: Show filtered results | F2: Refine | F5: Refresh",
95-
Functions = new() {
96+
Functions = new()
97+
{
9698
[ConsoleKey.F1] = () =>
9799
{
98100
// F1 : Show filtered
@@ -150,7 +152,7 @@ private static async Task Main(string[] args)
150152
* Register events
151153
*/
152154

153-
//ToastNotificationManagerCompat.OnActivated += AppInterface.OnToastActivated;
155+
ToastNotificationManagerCompat.OnActivated += AppInterface.OnToastActivated;
154156

155157
Console.OutputEncoding = Encoding.Unicode;
156158

@@ -164,8 +166,11 @@ private static async Task Main(string[] args)
164166

165167
Console.CancelKeyPress += (sender, eventArgs) => { };
166168

167-
var process = Process.GetCurrentProcess();
168-
process.PriorityClass = ProcessPriorityClass.AboveNormal;
169+
if (OperatingSystem.IsWindows()) {
170+
var process = Process.GetCurrentProcess();
171+
process.PriorityClass = ProcessPriorityClass.AboveNormal;
172+
173+
}
169174

170175
/*
171176
* Start
@@ -200,13 +205,15 @@ private static async Task Main(string[] args)
200205
OnSearchCompleted(obj, eventArgs, _cancellationToken);
201206

202207
if (Config.Notification) {
203-
// AppInterface.ShowToast(obj, eventArgs);
208+
AppInterface.ShowToast(obj, eventArgs);
204209
}
205210
};
211+
206212
if (OperatingSystem.IsWindows()) {
207213
ConsoleProgressIndicator.Start(_cancellationToken);
208214

209215
}
216+
210217
// Show results
211218
var searchTask = Client.RunSearchAsync();
212219

@@ -280,7 +287,7 @@ private static async Task<bool> HandleArguments()
280287

281288

282289
#region Event handlers
283-
290+
284291
private static void OnSearchCompleted(object sender, SearchCompletedEventArgs eventArgs,
285292
CancellationTokenSource cts)
286293
{
@@ -337,9 +344,12 @@ private static void OnResultCompleted(object sender, ResultCompletedEventArgs ev
337344
/// <summary>
338345
/// Command line argument handler
339346
/// </summary>
340-
private static readonly CliHandler CliHandler = new() {
341-
Parameters = {
342-
new() {
347+
private static readonly CliHandler CliHandler = new()
348+
{
349+
Parameters =
350+
{
351+
new()
352+
{
343353
ArgumentCount = 1,
344354
ParameterId = "-se",
345355
Function = strings =>
@@ -348,7 +358,8 @@ private static void OnResultCompleted(object sender, ResultCompletedEventArgs ev
348358
return null;
349359
}
350360
},
351-
new() {
361+
new()
362+
{
352363
ArgumentCount = 1,
353364
ParameterId = "-pe",
354365
Function = strings =>
@@ -357,7 +368,8 @@ private static void OnResultCompleted(object sender, ResultCompletedEventArgs ev
357368
return null;
358369
}
359370
},
360-
new() {
371+
new()
372+
{
361373
ArgumentCount = 0,
362374
ParameterId = "-f",
363375
Function = delegate
@@ -366,7 +378,8 @@ private static void OnResultCompleted(object sender, ResultCompletedEventArgs ev
366378
return null;
367379
}
368380
},
369-
new() {
381+
new()
382+
{
370383
ArgumentCount = 0,
371384
ParameterId = "-output_only",
372385
Function = delegate
@@ -376,7 +389,8 @@ private static void OnResultCompleted(object sender, ResultCompletedEventArgs ev
376389
}
377390
}
378391
},
379-
Default = new CliParameter {
392+
Default = new CliParameter
393+
{
380394
ArgumentCount = 1,
381395
ParameterId = null,
382396
Function = strings =>

SmartImage/Publish.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
@echo off
22

3+
4+
dotnet build -c Release
5+
36
dotnet publish -c Release -r win10-x64 --self-contained true
47

58
CHOICE /N /C:YN /M "Copy to Desktop (Y/N)"%1

SmartImage/SmartImage.csproj

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,28 @@
33
<OutputType>Exe</OutputType>
44

55
<LangVersion>latest</LangVersion>
6-
<TargetFramework>net5.0</TargetFramework>
7-
<!-- <TargetFramework>net5.0-windows10.0.17763.0</TargetFramework> -->
8-
<!-- <RuntimeIdentifier>win10-x64</RuntimeIdentifier> -->
9-
<!-- <PublishSingleFile>true</PublishSingleFile> -->
10-
<!-- <PublishTrimmed>true</PublishTrimmed> -->
6+
<!-- <TargetFramework>net5.0</TargetFramework> -->
7+
<!-- <TargetFramework>net5.0-windows</TargetFramework> -->
8+
9+
<TargetFramework>net5.0-windows10.0.17763.0</TargetFramework>
10+
11+
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
12+
<PublishSingleFile>true</PublishSingleFile>
13+
<PublishTrimmed>true</PublishTrimmed>
14+
<!-- <RuntimeIdentifiers>win10-x64;ubuntu.16.04-x64</RuntimeIdentifiers> -->
1115

1216
<!--<PublishReadyToRun>true</PublishReadyToRun>-->
1317
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
1418
<ApplicationIcon>..\Assets\Icon.ico</ApplicationIcon>
1519
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1620
<!--<Nullable>enable</Nullable>-->
1721
<DefineConstants>JETBRAINS_ANNOTATIONS;TRACE</DefineConstants>
18-
<Configurations>Debug;Release;TestDebug</Configurations>
19-
<AnalysisLevel>latest</AnalysisLevel>
20-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
21-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
22-
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
23-
<NoWarn>
24-
HAA0601
25-
HAA0601,
26-
HAA0602,
27-
HAA0603,
28-
HAA0604,
29-
HAA0501,
30-
HAA0502,
31-
HAA0503,
32-
HAA0504,
33-
HAA0505,
34-
HAA0506,
35-
HAA0301,
36-
HAA0302,
37-
HAA0303,
38-
HAA0101,
39-
CS1591,
40-
CA1069,
41-
</NoWarn>
22+
<Configurations>Debug;Release</Configurations>
23+
<!-- <AnalysisLevel>latest</AnalysisLevel> -->
24+
<!-- <EnableNETAnalyzers>true</EnableNETAnalyzers> -->
25+
<!-- <GenerateDocumentationFile>true</GenerateDocumentationFile> -->
26+
<!-- <RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild> -->
27+
4228

4329
</PropertyGroup>
4430
<ItemGroup>
@@ -49,15 +35,13 @@
4935
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
5036
<DefineConstants>DEBUG;TRACE;JETBRAINS_ANNOTATIONS</DefineConstants>
5137
<!-- <NoWarn>CA1416</NoWarn> -->
52-
</PropertyGroup>
5338

54-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='TestDebug|AnyCPU'">
55-
<DefineConstants>DEBUG;TRACE;JETBRAINS_ANNOTATIONS;TEST_DEBUG</DefineConstants>
56-
<!-- <NoWarn>CA1416</NoWarn> -->
5739
</PropertyGroup>
5840

41+
5942
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
6043
<DefineConstants>TRACE;JETBRAINS_ANNOTATIONS</DefineConstants>
44+
6145
<!-- <NoWarn>CA1416</NoWarn> -->
6246
</PropertyGroup>
6347

@@ -81,7 +65,7 @@
8165

8266
<PropertyGroup>
8367
<PackageId>SmartImage</PackageId>
84-
<Version>2.1.8</Version>
68+
<Version>2.1.9</Version>
8569
<Authors>Read Stanton (Decimation)</Authors>
8670
<PackageTags>Image reverse search identification source sauce</PackageTags>
8771
<RepositoryUrl>https://github.com/Decimation/SmartImage</RepositoryUrl>

SmartImage/UI/AppInterface.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static AppInterface()
190190

191191
#region Toast
192192

193-
/*public static void ShowToast(object sender, SearchCompletedEventArgs args)
193+
public static void ShowToast(object sender, SearchCompletedEventArgs args)
194194
{
195195
var bestResult = args.Detailed;
196196

@@ -253,10 +253,10 @@ static AppInterface()
253253

254254
builder.Show();
255255

256-
//ToastNotificationManager.CreateToastNotifier();
257-
}*/
256+
// ToastNotificationManager.CreateToastNotifier();
257+
}
258258

259-
/*public static void OnToastActivated(ToastNotificationActivatedEventArgsCompat compat)
259+
public static void OnToastActivated(ToastNotificationActivatedEventArgsCompat compat)
260260
{
261261
// NOTE: Does not return if invoked from background
262262

@@ -281,7 +281,7 @@ static AppInterface()
281281
//
282282
Environment.Exit(0);
283283
}
284-
}*/
284+
}
285285

286286
#endregion
287287
}

Test/Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net5.0</TargetFramework>
6-
<Configurations>Debug;Release;TestDebug</Configurations>
6+
<Configurations>Debug;Release</Configurations>
77
</PropertyGroup>
88
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='TestDebug|AnyCPU'">
99
<DefineConstants>DEBUG;TRACE;JETBRAINS_ANNOTATIONS;TEST_DEBUG</DefineConstants>

UnitTest/UnitTest.csproj

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

66
<IsPackable>false</IsPackable>
77

8-
<Configurations>Debug;Release;TestDebug</Configurations>
8+
<Configurations>Debug;Release</Configurations>
99
</PropertyGroup>
1010
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='TestDebug|AnyCPU'">
1111
<DefineConstants>DEBUG;TRACE;JETBRAINS_ANNOTATIONS;TEST_DEBUG</DefineConstants>

0 commit comments

Comments
 (0)