/[dgee]/dgee/cslib/DotGNU/DGEE/Protocols/AssemblyContainer.cs
ViewVC logotype

Diff of /dgee/cslib/DotGNU/DGEE/Protocols/AssemblyContainer.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1 by csmith, Mon Aug 18 18:35:40 2003 UTC revision 1.1.2.2 by csmith, Sat Aug 30 17:51:54 2003 UTC
# Line 39  namespace DotGNU.DGEE.Protocols Line 39  namespace DotGNU.DGEE.Protocols
39      {      {
40            int error;            int error;
41            
42        try        // Load in requested dll
         {  
           // Load in requested dll  
           //  
           assembly = LoadFromMemory( assemblyName, out error );  
         }  
       catch( Exception xcpt )  
         {  
           throw new Exception("Could not load dll " + assemblyName, xcpt );  
         }  
     }  
       
       
     internal WebMethodAttribute GetAttribute(MethodInfo method)  
     {  
       Attribute[] attrs = Attribute.GetCustomAttributes(method,  
                                                         typeof(WebMethodAttribute), false);  
   
       if( attrs == null || attrs.Length != 1 ) return null;  
   
       return (WebMethodAttribute)attrs[0];  
     }  
   
   
     internal MethodInfo FindMethod( Type type, String methodname )  
     {  
       MethodInfo []methods = type.GetMethods();  
       //type.GetMethods(BindingFlags.Public | BindingFlags.Static);  
       
       // Scan methods in class, looking for the requested  
43        //        //
44        foreach(MethodInfo method in methods) {        assembly = LoadFromMemory( assemblyName, out error );
         //Console.WriteLine( "Method: {0}", method.Name );  
45    
46          if( method.Name != methodname ) continue;            if( assembly == null || error > 0 )
47          // See if method is a Webservice (indicated by attribute)                  throw new Exception("Could not load dll " + assemblyName + " - Error: " + error.ToString() );
         //  
         Attribute attr = GetAttribute(method);  
         if(attr != null) {  
           // Found required MethodInfo  
           //  
           return method;  
         }  
       }  
       
       return null;  
48      }      }
   
     internal MethodInfo ResolveMethod( String typeName, String methodName )  
     {  
       MethodInfo minfo = null;  
   
       // Get array of classes  
       //  
       Type[] types=assembly.GetTypes();  
   
       foreach(Type type in types) {  
         Console.WriteLine( "Type: {0}", type.ToString() );  
         
         if( type.ToString() == typeName ) minfo = FindMethod(type,methodName);  
         if( minfo != null ) break;  
       }  
49            
       return minfo;  
     }  
     
50      public Assembly assembly = null;      public Assembly assembly = null;
51    }    }
52  }  }

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26