//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

// 
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
// 


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="GoogleSearchBinding", Namespace="urn:GoogleSearch")]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(ResultElement))]
public partial class GoogleSearchService : System.Web.Services.Protocols.SoapHttpClientProtocol {
    
    private System.Threading.SendOrPostCallback doGetCachedPageOperationCompleted;
    
    private System.Threading.SendOrPostCallback doSpellingSuggestionOperationCompleted;
    
    private System.Threading.SendOrPostCallback doGoogleSearchOperationCompleted;
    
    /// <remarks/>
    public GoogleSearchService() {
        this.Url = "http://api.google.com/search/beta2";
    }
    
    /// <remarks/>
    public event doGetCachedPageCompletedEventHandler doGetCachedPageCompleted;
    
    /// <remarks/>
    public event doSpellingSuggestionCompletedEventHandler doSpellingSuggestionCompleted;
    
    /// <remarks/>
    public event doGoogleSearchCompletedEventHandler doGoogleSearchCompleted;
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:GoogleSearchAction", RequestNamespace="urn:GoogleSearch", ResponseNamespace="urn:GoogleSearch")]
    [return: System.Xml.Serialization.SoapElementAttribute("return", DataType="base64Binary")]
    public byte[] doGetCachedPage(string key, string url) {
        object[] results = this.Invoke("doGetCachedPage", new object[] {
                    key,
                    url});
        return ((byte[])(results[0]));
    }
    
    /// <remarks/>
    public System.IAsyncResult BegindoGetCachedPage(string key, string url, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("doGetCachedPage", new object[] {
                    key,
                    url}, callback, asyncState);
    }
    
    /// <remarks/>
    public byte[] EnddoGetCachedPage(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((byte[])(results[0]));
    }
    
    /// <remarks/>
    public void doGetCachedPageAsync(string key, string url) {
        this.doGetCachedPageAsync(key, url, null);
    }
    
    /// <remarks/>
    public void doGetCachedPageAsync(string key, string url, object userState) {
        if ((this.doGetCachedPageOperationCompleted == null)) {
            this.doGetCachedPageOperationCompleted = new System.Threading.SendOrPostCallback(this.OndoGetCachedPageOperationCompleted);
        }
        this.InvokeAsync("doGetCachedPage", new object[] {
                    key,
                    url}, this.doGetCachedPageOperationCompleted, userState);
    }
    
    private void OndoGetCachedPageOperationCompleted(object arg) {
        if ((this.doGetCachedPageCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.doGetCachedPageCompleted(this, new doGetCachedPageCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:GoogleSearchAction", RequestNamespace="urn:GoogleSearch", ResponseNamespace="urn:GoogleSearch")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public string doSpellingSuggestion(string key, string phrase) {
        object[] results = this.Invoke("doSpellingSuggestion", new object[] {
                    key,
                    phrase});
        return ((string)(results[0]));
    }
    
    /// <remarks/>
    public System.IAsyncResult BegindoSpellingSuggestion(string key, string phrase, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("doSpellingSuggestion", new object[] {
                    key,
                    phrase}, callback, asyncState);
    }
    
    /// <remarks/>
    public string EnddoSpellingSuggestion(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((string)(results[0]));
    }
    
    /// <remarks/>
    public void doSpellingSuggestionAsync(string key, string phrase) {
        this.doSpellingSuggestionAsync(key, phrase, null);
    }
    
    /// <remarks/>
    public void doSpellingSuggestionAsync(string key, string phrase, object userState) {
        if ((this.doSpellingSuggestionOperationCompleted == null)) {
            this.doSpellingSuggestionOperationCompleted = new System.Threading.SendOrPostCallback(this.OndoSpellingSuggestionOperationCompleted);
        }
        this.InvokeAsync("doSpellingSuggestion", new object[] {
                    key,
                    phrase}, this.doSpellingSuggestionOperationCompleted, userState);
    }
    
    private void OndoSpellingSuggestionOperationCompleted(object arg) {
        if ((this.doSpellingSuggestionCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.doSpellingSuggestionCompleted(this, new doSpellingSuggestionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:GoogleSearchAction", RequestNamespace="urn:GoogleSearch", ResponseNamespace="urn:GoogleSearch")]
    [return: System.Xml.Serialization.SoapElementAttribute("return")]
    public GoogleSearchResult doGoogleSearch(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe) {
        object[] results = this.Invoke("doGoogleSearch", new object[] {
                    key,
                    q,
                    start,
                    maxResults,
                    filter,
                    restrict,
                    safeSearch,
                    lr,
                    ie,
                    oe});
        return ((GoogleSearchResult)(results[0]));
    }

    public GoogleSearchResult DoGoogleSearch(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe) {
    	return doGoogleSearch(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe);
    }
    
    /// <remarks/>
    public System.IAsyncResult BegindoGoogleSearch(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("doGoogleSearch", new object[] {
                    key,
                    q,
                    start,
                    maxResults,
                    filter,
                    restrict,
                    safeSearch,
                    lr,
                    ie,
                    oe}, callback, asyncState);
    }
    
    /// <remarks/>
    public GoogleSearchResult EnddoGoogleSearch(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((GoogleSearchResult)(results[0]));
    }
    
    /// <remarks/>
    public void doGoogleSearchAsync(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe) {
        this.doGoogleSearchAsync(key, q, start, maxResults, filter, restrict, safeSearch, lr, ie, oe, null);
    }
    
    /// <remarks/>
    public void doGoogleSearchAsync(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe, object userState) {
        if ((this.doGoogleSearchOperationCompleted == null)) {
            this.doGoogleSearchOperationCompleted = new System.Threading.SendOrPostCallback(this.OndoGoogleSearchOperationCompleted);
        }
        this.InvokeAsync("doGoogleSearch", new object[] {
                    key,
                    q,
                    start,
                    maxResults,
                    filter,
                    restrict,
                    safeSearch,
                    lr,
                    ie,
                    oe}, this.doGoogleSearchOperationCompleted, userState);
    }
    
    private void OndoGoogleSearchOperationCompleted(object arg) {
        if ((this.doGoogleSearchCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.doGoogleSearchCompleted(this, new doGoogleSearchCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    public new void CancelAsync(object userState) {
        base.CancelAsync(userState);
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="urn:GoogleSearch")]
public partial class GoogleSearchResult {
    
    private bool documentFilteringField;
    
    private string searchCommentsField;
    
    private int estimatedTotalResultsCountField;
    
    private bool estimateIsExactField;
    
    private ResultElement[] resultElementsField;
    
    private string searchQueryField;
    
    private int startIndexField;
    
    private int endIndexField;
    
    private string searchTipsField;
    
    private DirectoryCategory[] directoryCategoriesField;
    
    private double searchTimeField;
    
    /// <remarks/>
    public bool DocumentFiltering {
        get {
            return this.documentFilteringField;
        }
        set {
            this.documentFilteringField = value;
        }
    }
    
    /// <remarks/>
    public string SearchComments {
        get {
            return this.searchCommentsField;
        }
        set {
            this.searchCommentsField = value;
        }
    }
    
    /// <remarks/>
    public int EstimatedTotalResultsCount {
        get {
            return this.estimatedTotalResultsCountField;
        }
        set {
            this.estimatedTotalResultsCountField = value;
        }
    }
    
    /// <remarks/>
    public bool EstimateIsExact {
        get {
            return this.estimateIsExactField;
        }
        set {
            this.estimateIsExactField = value;
        }
    }
    
    /// <remarks/>
    public ResultElement[] ResultElements {
        get {
            return this.resultElementsField;
        }
        set {
            this.resultElementsField = value;
        }
    }
    
    /// <remarks/>
    public string SearchQuery {
        get {
            return this.searchQueryField;
        }
        set {
            this.searchQueryField = value;
        }
    }
    
    /// <remarks/>
    public int StartIndex {
        get {
            return this.startIndexField;
        }
        set {
            this.startIndexField = value;
        }
    }
    
    /// <remarks/>
    public int EndIndex {
        get {
            return this.endIndexField;
        }
        set {
            this.endIndexField = value;
        }
    }
    
    /// <remarks/>
    public string SearchTips {
        get {
            return this.searchTipsField;
        }
        set {
            this.searchTipsField = value;
        }
    }
    
    /// <remarks/>
    public DirectoryCategory[] DirectoryCategories {
        get {
            return this.directoryCategoriesField;
        }
        set {
            this.directoryCategoriesField = value;
        }
    }
    
    /// <remarks/>
    public double SearchTime {
        get {
            return this.searchTimeField;
        }
        set {
            this.searchTimeField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="urn:GoogleSearch")]
public partial class ResultElement {
    
    private string summaryField;
    
    private string uRLField;
    
    private string snippetField;
    
    private string titleField;
    
    private string cachedSizeField;
    
    private bool relatedInformationPresentField;
    
    private string hostNameField;
    
    private DirectoryCategory directoryCategoryField;
    
    private string directoryTitleField;
    
    /// <remarks/>
    public string Summary {
        get {
            return this.summaryField;
        }
        set {
            this.summaryField = value;
        }
    }
    
    /// <remarks/>
    public string Url {
        get {
            return this.uRLField;
        }
        set {
            this.uRLField = value;
        }
    }
    
    /// <remarks/>
    public string Snippet {
        get {
            return this.snippetField;
        }
        set {
            this.snippetField = value;
        }
    }
    
    /// <remarks/>
    public string Title {
        get {
            return this.titleField;
        }
        set {
            this.titleField = value;
        }
    }
    
    /// <remarks/>
    public string CachedSize {
        get {
            return this.cachedSizeField;
        }
        set {
            this.cachedSizeField = value;
        }
    }
    
    /// <remarks/>
    public bool RelatedInformationPresent {
        get {
            return this.relatedInformationPresentField;
        }
        set {
            this.relatedInformationPresentField = value;
        }
    }
    
    /// <remarks/>
    public string HostName {
        get {
            return this.hostNameField;
        }
        set {
            this.hostNameField = value;
        }
    }
    
    /// <remarks/>
    public DirectoryCategory DirectoryCategory {
        get {
            return this.directoryCategoryField;
        }
        set {
            this.directoryCategoryField = value;
        }
    }
    
    /// <remarks/>
    public string DirectoryTitle {
        get {
            return this.directoryTitleField;
        }
        set {
            this.directoryTitleField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="urn:GoogleSearch")]
public partial class DirectoryCategory {
    
    private string fullViewableNameField;
    
    private string specialEncodingField;
    
    /// <remarks/>
    public string fullViewableName {
        get {
            return this.fullViewableNameField;
        }
        set {
            this.fullViewableNameField = value;
        }
    }
    
    /// <remarks/>
    public string specialEncoding {
        get {
            return this.specialEncodingField;
        }
        set {
            this.specialEncodingField = value;
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void doGetCachedPageCompletedEventHandler(object sender, doGetCachedPageCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class doGetCachedPageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    
    private object[] results;
    
    internal doGetCachedPageCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
            base(exception, cancelled, userState) {
        this.results = results;
    }
    
    /// <remarks/>
    public byte[] Result {
        get {
            this.RaiseExceptionIfNecessary();
            return ((byte[])(this.results[0]));
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void doSpellingSuggestionCompletedEventHandler(object sender, doSpellingSuggestionCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class doSpellingSuggestionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    
    private object[] results;
    
    internal doSpellingSuggestionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
            base(exception, cancelled, userState) {
        this.results = results;
    }
    
    /// <remarks/>
    public string Result {
        get {
            this.RaiseExceptionIfNecessary();
            return ((string)(this.results[0]));
        }
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void doGoogleSearchCompletedEventHandler(object sender, doGoogleSearchCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class doGoogleSearchCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    
    private object[] results;
    
    internal doGoogleSearchCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
            base(exception, cancelled, userState) {
        this.results = results;
    }
    
    /// <remarks/>
    public GoogleSearchResult Result {
        get {
            this.RaiseExceptionIfNecessary();
            return ((GoogleSearchResult)(this.results[0]));
        }
    }
}
