/// <summary> Creates the reader/writer object, from the provided code assembly, namespace, and class </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public iMetadata_Module Get_Module() { try { // Using reflection, create an object from the class namespace/name Assembly dllAssembly = Assembly.GetExecutingAssembly(); if (Code_Assembly.Length > 0) { // Try to find the file/path for this assembly then string assemblyFilePath = ResourceObjectSettings.Get_Assembly(Code_Assembly); if (assemblyFilePath != null) { dllAssembly = Assembly.LoadFrom(assemblyFilePath); } } // Assembly dllAssembly = Assembly..LoadFrom( Code_Assembly ); Type readerWriterType = dllAssembly.GetType(Code_Namespace + "." + Code_Class); object possibleModule = Activator.CreateInstance(readerWriterType); iMetadata_Module module = possibleModule as iMetadata_Module; return(module); } catch { return(null); } }
/// <summary> Creates the reader/writer object, from the provided code assembly, namespace, and class </summary> /// <returns> TRUE if successful, otherwise FALSE </returns> public bool Create_ReaderWriterObject() { try { // Using reflection, create an object from the class namespace/name // Assembly dllAssembly = Assembly.GetExecutingAssembly(); if (Code_Assembly.Length > 0) { // Try to find the file/path for this assembly then string assemblyFilePath = ResourceObjectSettings.Get_Assembly(Code_Assembly); if (assemblyFilePath != null) { dllAssembly = Assembly.LoadFrom(assemblyFilePath); } } // Assembly dllAssembly = Assembly..LoadFrom( Code_Assembly ); Type readerWriterType = dllAssembly.GetType(Code_Namespace + "." + Code_Class); ReaderWriterObject = Activator.CreateInstance(readerWriterType); return(true); } catch (Exception ee) { ReaderWriterObject_Creation_Error = "Unable to load class from assembly. ( " + Code_Namespace + "." + Code_Class + " ) : " + ee.Message; return(false); } }