//------------------------------------------------------------------------------ // // 此代码由工具生成。 // // 对此文件的更改可能导致不正确的行为,并在以下条件下丢失: // 代码重新生成。 // //------------------------------------------------------------------------------ namespace ServiceReferenceSound { [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3")] [System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReferenceSound.WebServiceSoundSoap")] public interface WebServiceSoundSoap { [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/PlaySoundBySwapStep", ReplyAction="*")] System.Threading.Tasks.Task PlaySoundBySwapStepAsync(ushort step); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/PlayOneSoundFile", ReplyAction="*")] System.Threading.Tasks.Task PlayOneSoundFileAsync(int soundcode); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/PlayLoopSoundFile", ReplyAction="*")] System.Threading.Tasks.Task PlayLoopSoundFileAsync(int soundcode, int interval); } [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3")] public interface WebServiceSoundSoapChannel : ServiceReferenceSound.WebServiceSoundSoap, System.ServiceModel.IClientChannel { } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3")] public partial class WebServiceSoundSoapClient : System.ServiceModel.ClientBase, ServiceReferenceSound.WebServiceSoundSoap { /// /// 实现此分部方法,配置服务终结点。 /// /// 要配置的终结点 /// 客户端凭据 static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials); public WebServiceSoundSoapClient(EndpointConfiguration endpointConfiguration) : base(WebServiceSoundSoapClient.GetBindingForEndpoint(endpointConfiguration), WebServiceSoundSoapClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); } public WebServiceSoundSoapClient(EndpointConfiguration endpointConfiguration, string remoteAddress) : base(WebServiceSoundSoapClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); } public WebServiceSoundSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(WebServiceSoundSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); } public WebServiceSoundSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : base(binding, remoteAddress) { } public System.Threading.Tasks.Task PlaySoundBySwapStepAsync(ushort step) { return base.Channel.PlaySoundBySwapStepAsync(step); } public System.Threading.Tasks.Task PlayOneSoundFileAsync(int soundcode) { return base.Channel.PlayOneSoundFileAsync(soundcode); } public System.Threading.Tasks.Task PlayLoopSoundFileAsync(int soundcode, int interval) { return base.Channel.PlayLoopSoundFileAsync(soundcode, interval); } public virtual System.Threading.Tasks.Task OpenAsync() { return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen)); } public virtual System.Threading.Tasks.Task CloseAsync() { return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndClose)); } private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration) { if ((endpointConfiguration == EndpointConfiguration.WebServiceSoundSoap)) { System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(); result.MaxBufferSize = int.MaxValue; result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max; result.MaxReceivedMessageSize = int.MaxValue; result.AllowCookies = true; return result; } if ((endpointConfiguration == EndpointConfiguration.WebServiceSoundSoap12)) { System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding(); System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement(); textBindingElement.MessageVersion = System.ServiceModel.Channels.MessageVersion.CreateVersion(System.ServiceModel.EnvelopeVersion.Soap12, System.ServiceModel.Channels.AddressingVersion.None); result.Elements.Add(textBindingElement); System.ServiceModel.Channels.HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement(); httpBindingElement.AllowCookies = true; httpBindingElement.MaxBufferSize = int.MaxValue; httpBindingElement.MaxReceivedMessageSize = int.MaxValue; result.Elements.Add(httpBindingElement); return result; } throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration)); } private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration) { if ((endpointConfiguration == EndpointConfiguration.WebServiceSoundSoap)) { return new System.ServiceModel.EndpointAddress("http://127.0.0.1:8080/WebServiceSound.asmx"); } if ((endpointConfiguration == EndpointConfiguration.WebServiceSoundSoap12)) { return new System.ServiceModel.EndpointAddress("http://127.0.0.1:8080/WebServiceSound.asmx"); } throw new System.InvalidOperationException(string.Format("找不到名称为“{0}”的终结点。", endpointConfiguration)); } public enum EndpointConfiguration { WebServiceSoundSoap, WebServiceSoundSoap12, } } }