mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
WebServiceHandlerFactory that generates the documentation page. * WebServiceHandlerFactory.cs: Moved the code that generates the doc page to SoapDocumentationHandler.cs. * HttpGetClientProtocol.cs, HttpGetWebServiceHandler.cs, HttpPostClientProtocol.cs, HttpPostWebServiceHandler.cs, HttpSimpleWebServiceHandler.cs, HttpSoapWebServiceHandler.cs, SoapHttpClientProtocol.cs: Changed parameters of GetTypeStub call. * HttpGetTypeStubInfo.cs, HttpPostTypeStubInfo.cs: Added ProtocolName property. Added check for valid parameters. * HttpSimpleTypeStubInfo.cs: Define return MimeFormatter in constructor. * Methods.cs: BindingInfo and related properties moved to base TypeStubInfo. Added properties for XmlImporter and SoapImporter. * TypeStubManager.cs: Added BindingInfo and related properties. Changed GetTypeStub method. Now it takes the name of the protocol for which to get the type stub info. * ValueCollectionParameterReader.cs: IsSupported should only return true for input primitive parameters or array of primitives. svn path=/trunk/mcs/; revision=18575
93 lines
2.4 KiB
C#
93 lines
2.4 KiB
C#
//
|
|
// System.Web.Services.Protocols.ValueCollectionParameterReader.cs
|
|
//
|
|
// Author:
|
|
// Tim Coleman ([email protected])
|
|
// Lluis Sanchez Gual ([email protected])
|
|
//
|
|
// Copyright (C) Tim Coleman, 2002
|
|
//
|
|
|
|
using System.Collections.Specialized;
|
|
using System.Reflection;
|
|
using System.Web;
|
|
using System.Xml;
|
|
|
|
namespace System.Web.Services.Protocols {
|
|
public abstract class ValueCollectionParameterReader : MimeParameterReader {
|
|
|
|
ParameterInfo[] parameters;
|
|
|
|
#region Constructors
|
|
|
|
protected ValueCollectionParameterReader ()
|
|
{
|
|
}
|
|
|
|
#endregion // Constructors
|
|
|
|
#region Methods
|
|
|
|
public override object GetInitializer (LogicalMethodInfo methodInfo)
|
|
{
|
|
if (IsSupported (methodInfo)) return methodInfo.Parameters;
|
|
else return null;
|
|
}
|
|
|
|
public override void Initialize (object o)
|
|
{
|
|
parameters = (ParameterInfo[]) o;
|
|
}
|
|
|
|
public static bool IsSupported (LogicalMethodInfo methodInfo)
|
|
{
|
|
foreach (ParameterInfo param in methodInfo.Parameters)
|
|
if (!IsSupported (param)) return false;
|
|
return true;
|
|
}
|
|
|
|
public static bool IsSupported (ParameterInfo paramInfo)
|
|
{
|
|
Type type = paramInfo.ParameterType;
|
|
if (type.IsByRef || paramInfo.IsOut) return false;
|
|
if (type.IsArray) return IsSupportedPrimitive (type.GetElementType());
|
|
else return IsSupportedPrimitive (type);
|
|
}
|
|
|
|
public static bool IsSupportedPrimitive (Type type)
|
|
{
|
|
return ( type.IsPrimitive ||
|
|
type == typeof(string) ||
|
|
type == typeof(DateTime) ||
|
|
type == typeof(Guid) ||
|
|
type == typeof(XmlQualifiedName) ||
|
|
type == typeof(TimeSpan) ||
|
|
type == typeof(byte[])
|
|
);
|
|
}
|
|
|
|
protected object[] Read (NameValueCollection collection)
|
|
{
|
|
object[] res = new object [parameters.Length];
|
|
for (int n=0; n<res.Length; n++)
|
|
{
|
|
string val = collection [parameters[n].Name];
|
|
if (val == null) throw new InvalidOperationException ("Missing parameter: " + parameters[n].Name);
|
|
try
|
|
{
|
|
res [n] = Convert.ChangeType (val, parameters[n].ParameterType);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string error = "Cannot convert " + val + " to " + parameters[n].ParameterType.FullName + "\n";
|
|
error += "Parameter name: " + parameters[n].Name + " --> " + ex.Message;
|
|
throw new InvalidOperationException (error);
|
|
}
|
|
}
|
|
return res;
|
|
}
|
|
|
|
#endregion // Methods
|
|
}
|
|
}
|