Пример #1
0
 private void ProcessClientType(Type t, bool force, bool isWCF)
 {
     if (force || !this._processedTypes.Contains(t))
     {
         this._processedTypes[t] = null;
         if (t.IsEnum)
         {
             WebServiceEnumData webServiceTypeData = null;
             if (isWCF)
             {
                 webServiceTypeData = (WebServiceEnumData)WebServiceTypeData.GetWebServiceTypeData(t);
             }
             else
             {
                 webServiceTypeData = new WebServiceEnumData(t.Name, t.Namespace, t, Enum.GetNames(t), Enum.GetValues(t), Enum.GetUnderlyingType(t) == typeof(ulong));
             }
             this._enumTypesDictionary[this.GetTypeStringRepresentation(webServiceTypeData.TypeName, false)] = webServiceTypeData;
         }
         else if (t.IsGenericType)
         {
             if (isWCF)
             {
                 this.ProcessKnownTypes(t);
             }
             else
             {
                 Type[] genericArguments = t.GetGenericArguments();
                 if (genericArguments.Length <= 1)
                 {
                     this.ProcessClientType(genericArguments[0], false, isWCF);
                 }
             }
         }
         else if (t.IsArray)
         {
             this.ProcessClientType(t.GetElementType(), false, isWCF);
         }
         else if (((!t.IsPrimitive && (t != typeof(object))) && ((t != typeof(string)) && (t != typeof(DateTime)))) && ((((t != typeof(void)) && (t != typeof(decimal))) && ((t != typeof(Guid)) && !typeof(IEnumerable).IsAssignableFrom(t))) && (!typeof(IDictionary).IsAssignableFrom(t) && (isWCF || ObjectConverter.IsClientInstantiatableType(t, this._serializer)))))
         {
             if (isWCF)
             {
                 this.ProcessKnownTypes(t);
             }
             else
             {
                 string typeStringRepresentation = this.GetTypeStringRepresentation(t.FullName, false);
                 this._clientTypesDictionary[typeStringRepresentation] = new WebServiceTypeData(t.Name, t.Namespace, t);
                 this._clientTypeNameDictionary[t] = typeStringRepresentation;
             }
         }
     }
 }
Пример #2
0
        private void ProcessKnownTypes(Type t)
        {
            WebServiceTypeData webServiceTypeData = WebServiceTypeData.GetWebServiceTypeData(t);
            bool flag = false;

            if (webServiceTypeData != null)
            {
                if (!typeof(IEnumerable).IsAssignableFrom(t) && !typeof(IDictionary).IsAssignableFrom(t))
                {
                    this._clientTypeNameDictionary[t] = this.GetTypeStringRepresentation(webServiceTypeData.TypeName);
                    flag = this.ProcessTypeData(webServiceTypeData);
                }
                if (!flag)
                {
                    foreach (WebServiceTypeData data2 in WebServiceTypeData.GetKnownTypes(t, webServiceTypeData))
                    {
                        this.ProcessTypeData(data2);
                    }
                }
            }
        }