3131using Windows . Networking . Connectivity ;
3232using Windows . UI . Notifications ;
3333using Kantan . Cli ;
34+ using Kantan . Cli . Controls ;
3435using Kantan . Diagnostics ;
3536using Kantan . Net ;
37+ using Kantan . Text ;
3638using Kantan . Utilities ;
3739using Microsoft . Toolkit . Uwp . Notifications ;
3840using Novus . Win32 ;
@@ -78,9 +80,9 @@ public static class Program
7880 /// <summary>
7981 /// Console UI for search results
8082 /// </summary>
81- private static readonly NConsoleDialog ResultDialog = new ( )
83+ private static readonly ConsoleDialog ResultDialog = new ( )
8284 {
83- Options = new List < NConsoleOption > ( ) ,
85+ Options = new List < ConsoleOption > ( ) ,
8486
8587 Description = "Press the result number to open in browser\n " +
8688 "Ctrl: Load direct | Alt: Show other | Shift: Open raw | Alt+Ctrl: Download\n " +
@@ -103,13 +105,13 @@ public static class Program
103105
104106 ResultDialog . Options . Add ( _orig ) ;
105107
106- foreach ( NConsoleOption option in buffer . Select ( NConsoleFactory . CreateResultOption ) ) {
108+ foreach ( ConsoleOption option in buffer . Select ( NConsoleFactory . CreateResultOption ) ) {
107109 ResultDialog . Options . Add ( option ) ;
108110 }
109111
110112 _isFilteredShown = ! _isFilteredShown ;
111113
112- NConsole . Refresh ( ) ;
114+ ConsoleManager . Refresh ( ) ;
113115 } ,
114116 [ ConsoleKey . F2 ] = async ( ) =>
115117 {
@@ -123,11 +125,11 @@ public static class Program
123125 await Client . RefineSearchAsync ( ) ;
124126 }
125127 catch ( Exception e ) {
126- Console . WriteLine ( "Error: {0}" , e . Message ) ;
127- NConsole . WaitForSecond ( ) ;
128+ Console . WriteLine ( "Error: {0}" , e . Message ) ;
129+ ConsoleManager . WaitForSecond ( ) ;
128130 }
129131
130- NConsole . Refresh ( ) ;
132+ ConsoleManager . Refresh ( ) ;
131133 } ,
132134 }
133135 } ;
@@ -147,15 +149,14 @@ private static async Task Main(string[] args)
147149
148150 ToastNotificationManagerCompat . OnActivated += AppInterface . OnToastActivated ;
149151
150- //...
151- Native . SetConsoleOutputCP ( Native . CP_IBM437 ) ;
152-
152+ Console . OutputEncoding = Encoding . Unicode ;
153+
153154 Console . Title = $ "{ AppInfo . NAME } ";
154155
155156 //120,30
156157 //Console.WindowHeight = 60;
157158
158- NConsole . Init ( ) ;
159+ ConsoleManager . Init ( ) ;
159160 Console . Clear ( ) ;
160161
161162 Console . CancelKeyPress += ( sender , eventArgs ) => { } ;
@@ -200,7 +201,7 @@ private static async Task Main(string[] args)
200201 }
201202 } ;
202203
203- NConsoleProgress . Queue ( _cancellationToken ) ;
204+ ConsoleProgressIndicator . Queue ( _cancellationToken ) ;
204205
205206 // Show results
206207 var searchTask = Client . RunSearchAsync ( ) ;
@@ -211,7 +212,6 @@ private static async Task Main(string[] args)
211212 // Add original image
212213 ResultDialog . Options . Add ( _orig ) ;
213214
214-
215215 await ResultDialog . ReadAsync ( ) ;
216216
217217 await searchTask ;
@@ -227,14 +227,17 @@ private static async Task<bool> HandleArguments()
227227 if ( ! args . Any ( ) ) {
228228 var options = await AppInterface . MainMenuDialog . ReadAsync ( ) ;
229229
230- if ( ! options . Any ( ) ) {
231- return false ;
232- }
230+ var file = options . DragAndDrop ;
233231
234- if ( options . First ( ) is string file ) {
232+ if ( file != null ) {
235233 Debug . WriteLine ( $ "Drag and drop: { file } ") ;
236234 Console . WriteLine ( $ ">> { file } ". AddColor ( AppInterface . Elements . ColorMain ) ) ;
237235 Config . Query = file ;
236+ return true ;
237+ }
238+
239+ if ( ! options . Output . Any ( ) ) {
240+ return false ;
238241 }
239242 }
240243 else {
@@ -264,7 +267,7 @@ private static async Task<bool> HandleArguments()
264267
265268 private static bool _isFilteredShown ;
266269
267- private static NConsoleOption _orig ;
270+ private static ConsoleOption _orig ;
268271
269272 #region Event handlers
270273
@@ -278,7 +281,7 @@ private static void OnSearchCompleted(object sender, SearchCompletedEventArgs ev
278281 cts . Dispose ( ) ;
279282
280283 SystemSounds . Exclamation . Play ( ) ;
281- NConsole . Refresh ( ) ;
284+ ConsoleManager . Refresh ( ) ;
282285
283286 if ( Config . PriorityEngines == SearchEngineOptions . Auto ) {
284287 var m = Client . Results . OrderByDescending ( x => x . PrimaryResult . Similarity ) ;
0 commit comments