55using System . Diagnostics ;
66using System . IO ;
77using System . Linq ;
8- using System . Threading . Tasks ;
8+ using System . Text ;
99using SimpleCore . Utilities ;
1010using SmartImage . Engines ;
1111using SmartImage . Engines . Imgur ;
@@ -54,7 +54,7 @@ private static ISearchEngine[] GetAvailableEngines()
5454
5555
5656 new KarmaDecay ( ) ,
57- new TraceMoe ( ) ,
57+ new TraceMoe ( )
5858 } ;
5959
6060 engines . AddRange ( others ) ;
@@ -68,7 +68,7 @@ public static bool RunSearch(string img, ref SearchResult[] res)
6868 * Run
6969 */
7070
71- var auth = SearchConfig . Config . ImgurAuth ;
71+ string auth = SearchConfig . Config . ImgurAuth ;
7272 bool useImgur = ! String . IsNullOrWhiteSpace ( auth ) ;
7373
7474 var engines = SearchConfig . Config . Engines ;
@@ -137,23 +137,38 @@ private static bool StartSearches(string imgUrl, SearchEngines engines, ref Sear
137137 Console . Write ( wait ) ;
138138 } ) ;
139139
140+ var sw = Stopwatch . StartNew ( ) ;
140141
141142 // Run search
142143 var result = currentEngine . GetResult ( imgUrl ) ;
143144
145+ sw . Stop ( ) ;
146+
144147 if ( result != null ) {
145148 string url = result . Url ;
146149
150+ var sb = new StringBuilder ( ) ;
151+ double t = sw . Elapsed . TotalSeconds ;
152+ double t2 = Math . Round ( t , 3 ) ;
153+ sb . AppendFormat ( "{0}: Done ({1:F3} sec)\n " , result . Name , t2 ) ;
154+
155+
156+ //todo
157+
158+ bool ok = url != null ;
159+
160+ string sz = sb . ToString ( ) ;
161+
147162
148- if ( url != null ) {
149- CliOutput . OnCurrentLine ( ConsoleColor . Green , "{0}: Done \n " , result . Name ) ;
163+ if ( ok ) {
164+ CliOutput . OnCurrentLine ( ConsoleColor . Green , sz ) ;
150165
151166 if ( SearchConfig . Config . PriorityEngines . HasFlag ( currentEngine . Engine ) ) {
152167 WebAgent . OpenUrl ( result . Url ) ;
153168 }
154169 }
155170 else {
156- CliOutput . OnCurrentLine ( ConsoleColor . Yellow , "{0}: Done (url is null!) \n " , result . Name ) ;
171+ CliOutput . OnCurrentLine ( ConsoleColor . Yellow , sz ) ;
157172 }
158173
159174 res [ i ] = result ;
0 commit comments