33using System ;
44using System . Collections . Generic ;
55using System . ComponentModel ;
6+ using System . Diagnostics ;
67using System . Drawing ;
78using System . IO ;
89using System . Linq ;
@@ -22,8 +23,6 @@ namespace SmartImage.Searching
2223 /// </summary>
2324 public sealed class FullSearchResult : NConsoleOption , ISearchResult
2425 {
25-
26-
2726 public const char ATTR_SUCCESS = Formatting . CHECK_MARK ;
2827
2928 public FullSearchResult ( ISearchEngine engine , string url , float ? similarity = null )
@@ -67,6 +66,8 @@ public override NConsoleFunction? CtrlFunction
6766 // }
6867 // }
6968
69+ Debug . WriteLine ( "Downloading" ) ;
70+
7071 string ? path = Network . DownloadUrl ( Url ) ;
7172
7273 NConsole . WriteSuccess ( "Downloaded to {0}" , path ) ;
@@ -81,16 +82,8 @@ public override NConsoleFunction? CtrlFunction
8182 } ;
8283 }
8384 }
84-
85- // public bool? IsImage
86- // {
87- // get;
88- // internal set;
89- // }
90-
9185
9286
93-
9487 public override string Data => ToString ( ) ;
9588
9689 /// <summary>
@@ -125,9 +118,13 @@ public override NConsoleFunction ComboFunction
125118 {
126119 return ( ) =>
127120 {
128- var u = RawUrl ?? Url ;
129-
130- Network . OpenUrl ( u ) ;
121+ if ( RawUrl != null ) {
122+ Network . OpenUrl ( RawUrl ) ;
123+ return null ;
124+ }
125+
126+ NConsole . WriteError ( "Raw result unavailable" ) ;
127+ NConsoleIO . WaitForSecond ( ) ;
131128 return null ;
132129 } ;
133130 }
@@ -177,17 +174,18 @@ public override string ToString()
177174
178175 string attrSuccess = ATTR_SUCCESS . ToString ( ) ;
179176
180-
177+
181178 var ex = ExtendedResults . Count > 0
182- ? string . Format ( $ "({ ExtendedResults . Count } )") : string . Empty ;
183-
179+ ? String . Format ( $ "({ ExtendedResults . Count } )")
180+ : String . Empty ;
181+
184182 sb . Append ( $ "{ attrSuccess } { ex } \n ") ;
185183
186184
187185 if ( RawUrl != Url ) {
188186 sb . Append ( $ "\t Result: { Url } \n ") ;
189187 }
190- else if ( RawUrl != null ) {
188+ if ( RawUrl != null ) {
191189 sb . Append ( $ "\t Raw: { RawUrl } \n ") ;
192190 }
193191
@@ -235,7 +233,5 @@ private IList<FullSearchResult> FromExtendedResult(IReadOnlyList<ISearchResult>
235233
236234 return rg ;
237235 }
238-
239-
240236 }
241237}
0 commit comments