protected override void ProcessRecord() { switch (this.ParameterSetName) { case "Search": WriteVerbose(String.Format(@"Searching for ""{0}""", this.Query)); s_results = new List <GoogleResult>(); IList <IWebResult> results = GwebSearcher.Search(this.Query, this.MaxResults); if (results.Count == 0) { WriteWarning("No results found."); } else { foreach (IWebResult result in results) { GoogleResult googleResult = new GoogleResult(s_resultIndex++, result); WriteObject(googleResult); s_results.Add(googleResult); } } break; case "GotoResult": foreach (GoogleResult googleResult in s_results) { if (googleResult.Index == this.GotoResult) { Help.ShowHelp(null, googleResult.Url); return; } } throw new Exception(String.Format("Result index {0} not available", this.GotoResult)); } }
protected override void ProcessRecord() { switch ( this.ParameterSetName ) { case "Search": WriteVerbose( String.Format( @"Searching for ""{0}""", this.Query ) ); s_results = new List<GoogleResult>(); IList<IWebResult> results = GwebSearcher.Search( this.Query, this.MaxResults ); if ( results.Count == 0 ) { WriteWarning( "No results found." ); } else { foreach ( IWebResult result in results ) { GoogleResult googleResult = new GoogleResult( s_resultIndex++, result ); WriteObject( googleResult ); s_results.Add( googleResult ); } } break; case "GotoResult": foreach ( GoogleResult googleResult in s_results ) { if ( googleResult.Index == this.GotoResult ) { Help.ShowHelp( null, googleResult.Url ); return; } } throw new Exception( String.Format( "Result index {0} not available", this.GotoResult ) ); } }