예제 #1
0
        public static XS__metadataBusiness[] Load_fromURI(
            XS__RootMetadata root_ref_in,
            params Uri[] filePath_in
            )
        {
            XS__metadataBusiness[] _output
                = new XS__metadataBusiness[filePath_in.Length];

            for (int i = 0; i < filePath_in.Length; i++)
            {
                if (filePath_in[i].IsFile)
                {
                    _output[i] = XS__metadataBusiness.Load_fromFile(
                        filePath_in[i].LocalPath
                        )[0];
                    // no need! everything's been taken care at: XS__metadataBusiness.Load_fromFile(...)
                    //_output[i].root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + i + "]";
                    //_output[i].parent_ref = root_ref_in; // ToDos: now!
                    //if (root_ref_in != null) _output[i].root_ref = root_ref_in;
                }
                else
                {
                    try {
                        _output[i] = (XS__metadataBusiness) new XmlSerializer(typeof(XS__metadataBusiness)).Deserialize(
                            OGen.Libraries.PresentationLayer.WebForms.Utilities.ReadURL(
                                filePath_in[i].ToString()
                                )
                            );
                    } catch (Exception _ex) {
                        throw new Exception(string.Format(
                                                System.Globalization.CultureInfo.CurrentCulture,
                                                "\n---\n{0}.{1}.Load_fromURI():\nERROR READING XML:\n{2}\n---\n{3}",
                                                typeof(XS__metadataBusiness).Namespace,
                                                typeof(XS__metadataBusiness).Name,
                                                //(filePath_in[i].IsFile)
                                                //	? filePath_in[i].LocalPath
                                                //	:
                                                filePath_in[i].ToString(),
                                                _ex.Message
                                                ));
                    }
                    _output[i].root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + i + "]";
                    _output[i].parent_ref             = root_ref_in;         // ToDos: now!
                    if (root_ref_in != null)
                    {
                        _output[i].root_ref = root_ref_in;
                    }
                }
            }

            return(_output);
        }
예제 #2
0
        public static XS__metadataBusiness[] Load_fromFile(
            XS__RootMetadata root_ref_in,
            params string[] filePath_in
            )
        {
            FileStream _stream;

            XS__metadataBusiness[] _output
                = new XS__metadataBusiness[filePath_in.Length];

            for (int i = 0; i < filePath_in.Length; i++)
            {
                _stream = new FileStream(
                    filePath_in[i],
                    FileMode.Open,
                    FileAccess.Read,
                    FileShare.Read
                    );

                try {
                    _output[i] = (XS__metadataBusiness) new XmlSerializer(typeof(XS__metadataBusiness)).Deserialize(
                        _stream
                        );
                    _stream.Close();
#if !NET_1_1
                    _stream.Dispose();
#endif
                } catch (Exception _ex) {
                    throw new Exception(string.Format(
                                            System.Globalization.CultureInfo.CurrentCulture,
                                            "\n---\n{0}.{1}.Load_fromFile():\nERROR READING XML:\n{2}\n---\n{3}\n---\n{4}\n---\n",
                                            typeof(XS__metadataBusiness).Namespace,
                                            typeof(XS__metadataBusiness).Name,
                                            filePath_in[i],
                                            _ex.Message,
                                            _ex.InnerException
                                            ));
                }
                _output[i].root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + i + "]";

                _output[i].parent_ref = root_ref_in;                 // ToDos: now!
                if (root_ref_in != null)
                {
                    _output[i].root_ref = root_ref_in;
                }
            }
            return(_output);
        }
예제 #3
0
		public static XS__metadataBusiness[] Load_fromFile(
			XS__RootMetadata root_ref_in, 
			params string[] filePath_in
		) {
			FileStream _stream;
			XS__metadataBusiness[] _output 
				= new XS__metadataBusiness[filePath_in.Length];

			for (int i = 0; i < filePath_in.Length; i++) {
				_stream = new FileStream(
					filePath_in[i],
					FileMode.Open,
					FileAccess.Read,
					FileShare.Read
				);

				try {
					_output[i] = (XS__metadataBusiness)new XmlSerializer(typeof(XS__metadataBusiness)).Deserialize(
						_stream
					);
					_stream.Close();
#if !NET_1_1
					_stream.Dispose();
#endif
				} catch (Exception _ex) {
					throw new Exception(string.Format(
						System.Globalization.CultureInfo.CurrentCulture,
						"\n---\n{0}.{1}.Load_fromFile():\nERROR READING XML:\n{2}\n---\n{3}\n---\n{4}\n---\n",
						typeof(XS__metadataBusiness).Namespace, 
						typeof(XS__metadataBusiness).Name, 
						filePath_in[i],
						_ex.Message,
						_ex.InnerException
					));
				}
				_output[i].root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + i + "]";

				_output[i].parent_ref = root_ref_in; // ToDos: now!
				if (root_ref_in != null) _output[i].root_ref = root_ref_in;
			}
			return _output;
		}
예제 #4
0
		public static XS__metadataBusiness[] Load_fromURI(
			XS__RootMetadata root_ref_in, 
			params Uri[] filePath_in
		) {
			XS__metadataBusiness[] _output 
				= new XS__metadataBusiness[filePath_in.Length];

			for (int i = 0; i < filePath_in.Length; i++) {
				if (filePath_in[i].IsFile) {
					_output[i] = XS__metadataBusiness.Load_fromFile(
						filePath_in[i].LocalPath
					)[0];
					// no need! everything's been taken care at: XS__metadataBusiness.Load_fromFile(...)
					//_output[i].root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + i + "]";
					//_output[i].parent_ref = root_ref_in; // ToDos: now!
					//if (root_ref_in != null) _output[i].root_ref = root_ref_in;
				} else {
					try {
						_output[i] = (XS__metadataBusiness)new XmlSerializer(typeof(XS__metadataBusiness)).Deserialize(
							OGen.Libraries.PresentationLayer.WebForms.Utilities.ReadURL(
								filePath_in[i].ToString()
							)
						);
					} catch (Exception _ex) {
						throw new Exception(string.Format(
							System.Globalization.CultureInfo.CurrentCulture,
							"\n---\n{0}.{1}.Load_fromURI():\nERROR READING XML:\n{2}\n---\n{3}",
							typeof(XS__metadataBusiness).Namespace, 
							typeof(XS__metadataBusiness).Name, 
							//(filePath_in[i].IsFile)
							//	? filePath_in[i].LocalPath
							//	: 
							filePath_in[i].ToString(),
							_ex.Message
						));
					}
					_output[i].root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + i + "]";
					_output[i].parent_ref = root_ref_in; // ToDos: now!
					if (root_ref_in != null) _output[i].root_ref = root_ref_in;
				}
			}

			return _output;
		}
예제 #5
0
		public static XS__metadataBusiness Load_fromAssembly(
			string assemblyFilePath_in, 

			XS__RootMetadata root_ref_in, 
			int index_in
		) {
			#region XS__metadataBusiness _output = ...;
			XS__metadataBusiness _output = new XS__metadataBusiness();

			_output.root_metadatabusiness_ = string.Concat(ROOT, ".", METADATABUSINESS, "[", index_in.ToString(System.Globalization.CultureInfo.CurrentCulture), "]");
			_output.parent_ref = root_ref_in; // ToDos: now!
			if (root_ref_in != null) _output.root_ref = root_ref_in;
			#endregion

			#region Assembly _assembly = Assembly.LoadFrom(assemblyFilePath_in);
			Assembly _assembly
				//= Assembly.LoadFile(assemblyFilePath_in);
				= Assembly.LoadFrom(assemblyFilePath_in);
			//_assembly.GetFiles(true);
			//_assembly.GetReferencedAssemblies();

			if (_assembly == null) {
				throw new Exception(string.Format(
					System.Globalization.CultureInfo.CurrentCulture,
					"can't load assembly 'assemblyName_in'\n at: {0}.{1}.Load_fromAssembly();",
					typeof(XS__metadataBusiness).Namespace,
					typeof(XS__metadataBusiness).Name,
					assemblyFilePath_in
				));
			}
			#endregion

			//bool _isBO = false;
			//bool _isBDO = false;
			int _class_index;
			int _method_index;
			int _property_index;
			Type[] _types = _assembly.GetTypes();

#if NET_2_0
			Array.Sort(
				_types,
				delegate(
					Type arg1,
					Type arg2
				) {
					return string.Compare(
						arg1.Name, 
						arg2.Name,
						false,
						System.Globalization.CultureInfo.CurrentCulture
					);
				}
			);
#endif

			for (int t = 0; t < _types.Length; t++) {
				Type _type = (Type)_types[t];

				object[] _classattributes = _type.GetCustomAttributes(
					typeof(BOClassAttribute),
					true//false
				);
				if (
					(_classattributes.Length > 0)
					&&
					(_type.Name.IndexOf("SBO_", StringComparison.CurrentCulture) == 0)
				) {
					for (int ca = 0; ca < _classattributes.Length; ca++) {
//						BOClassAttribute _attribute 
//							= (BOClassAttribute)_classattributes[ca];

_output.Classes.ClassCollection.Add(
	out _class_index, 
	//_attribute.Name
	(_type.Name.IndexOf("SBO_", StringComparison.CurrentCulture) == 0)
		? _type.Name.Substring(4)
		: _type.Name
);
_output.Classes.ClassCollection[_class_index].Namespace
	= _type.Namespace;
_output.Classes.ClassCollection[_class_index].Type
	= XS_BoEnumeration.invalid;

						MethodInfo[] _methods = _type.GetMethods(
							BindingFlags.Public |
							//BindingFlags.Instance 
							BindingFlags.Static
						);

#if NET_2_0
						Array.Sort(
							_methods,
							delegate(
								MethodInfo arg1,
								MethodInfo arg2
							) {
								return string.Compare(
									arg1.Name,
									arg2.Name,
									false,
									System.Globalization.CultureInfo.CurrentCulture
								);
							}
						);
#endif

						for (int m = 0; m < _methods.Length; m++) {
							if (Attribute.IsDefined(
								_methods[m],
								typeof(BOMethodAttribute)
							)) {
								Attribute[] _methodattributes = Attribute.GetCustomAttributes(
									_methods[m],
									typeof(BOMethodAttribute),
									true
								);

								_method_index = -1;
								for (int ma = 0; ma < _methodattributes.Length; ma++) {
									if (_methodattributes[ma].GetType() == typeof(BOMethodAttribute)) {
										BOMethodAttribute _methodattribute
											= (BOMethodAttribute)_methodattributes[ma];

_output.Classes.ClassCollection[_class_index].Methods.MethodCollection.Add(
	out _method_index, 
	_methods[m].Name
);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
	_method_index
].Distribute = _methodattribute.Distribute;
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
	_method_index
].IsSearch = _methodattribute.IsSearch;
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
	_method_index
].IPParamNum = _methodattribute.IPParamNum;
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
	_method_index
].OutputType
	= OGen.Libraries.Utilities.Type_ToString(_methods[m].ReturnType);

									}
								}

								ParameterInfo[] _parameterinfo = _methods[m].GetParameters();
								for (int p = 0; p < _parameterinfo.Length; p++) {

_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection.Add(
	out _property_index, 
	_parameterinfo[p].Name
);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].IsOut = _parameterinfo[p].IsOut;
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].Type = OGen.Libraries.Utilities.Type_ToString(_parameterinfo[p].ParameterType);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].IsRef = (_parameterinfo[p].ParameterType.IsByRef && !_parameterinfo[p].IsOut);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].IsParams = false;

								}
							}
						}
					}
				}
			}

			return _output;
		}
예제 #6
0
		public static XS__metadataBusiness Load_fromAssembly(
			string assemblyFilePath_in, 

			XS__RootMetadata root_ref_in, 
			int index_in
		) {
			#region XS__metadataBusiness _output = ...;
			XS__metadataBusiness _output = new XS__metadataBusiness();

			_output.root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + index_in.ToString() + "]";
			_output.parent_ref = root_ref_in; // ToDos: now!
			if (root_ref_in != null) _output.root_ref = root_ref_in;
			#endregion

			#region Assembly _assembly = Assembly.LoadFrom(assemblyFilePath_in);
			Assembly _assembly
				//= Assembly.LoadFile(assemblyFilePath_in);
				= Assembly.LoadFrom(assemblyFilePath_in);
			//_assembly.GetFiles(true);
			//_assembly.GetReferencedAssemblies();

			if (_assembly == null) {
				throw new Exception(String.Format(
					"can't load assembly 'assemblyName_in'\n at: {0}.{1}.Load_fromAssembly();",
					typeof(XS__metadataBusiness).Namespace,
					typeof(XS__metadataBusiness).Name,
					assemblyFilePath_in
				));
			}
			#endregion

			bool _isBO = false;
			bool _isBDO = false;
			int _class_index;
			int _method_index;
			int _property_index;
			Type[] _types = _assembly.GetTypes();
			for (int t = 0; t < _types.Length; t++) {
				Type _type = (Type)_types[t];

				object[] _classattributes = _type.GetCustomAttributes(
					typeof(BOClassAttribute),
					true//false
				);
				if (
					(_classattributes.Length > 0)
					//&&
					//(_type.Name.IndexOf("BO0_") != 0)
					//&&
					//(_type.Name.IndexOf("BDO0_") != 0)
					&&
					(
						(_type.Name.IndexOf("BO_") == 0)
						||
						(_type.Name.IndexOf("BDO_") == 0)
					)
				) {
					for (int ca = 0; ca < _classattributes.Length; ca++) {
						BOClassAttribute _attribute 
							= (BOClassAttribute)_classattributes[ca];

_isBO = false;
_isBDO = false;
_output.Classes.ClassCollection.Add(
	out _class_index, 
	//_attribute.Name
	(_isBO = (_type.Name.IndexOf("BO_") == 0))
		? _type.Name.Substring(3)
		: (
			(_isBDO = (_type.Name.IndexOf("BDO_") == 0))
				? _type.Name.Substring(4)
				: _type.Name
		)
);
_output.Classes.ClassCollection[_class_index].Type
	= ((_isBO)
		? XS_BoEnumeration.BO
		: ((_isBDO)
			? XS_BoEnumeration.BDO
			: XS_BoEnumeration.invalid
		)
	);

						MethodInfo[] _methods = _type.GetMethods(
							BindingFlags.Public |
							BindingFlags.Instance
						);
						for (int m = 0; m < _methods.Length; m++) {
							if (Attribute.IsDefined(
								_methods[m],
								typeof(BOMethodAttribute)
							)) {
								Attribute[] _methodattributes = Attribute.GetCustomAttributes(
									_methods[m],
									typeof(BOMethodAttribute),
									true
								);

								_method_index = -1;
								for (int ma = 0; ma < _methodattributes.Length; ma++) {
									if (_methodattributes[ma].GetType() == typeof(BOMethodAttribute)) {
										BOMethodAttribute _methodattribute
											= (BOMethodAttribute)_methodattributes[ma];

_output.Classes.ClassCollection[_class_index].Methods.MethodCollection.Add(
	out _method_index, 
	_methods[m].Name
);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
	_method_index
].Distribute = _methodattribute.Distribute;
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
	_method_index
].OutputType
	= translate(string.Format(
		"{0}.{1}", 
		_methods[m].ReturnType.Namespace, 
		_methods[m].ReturnType.Name
	));

									}
								}

								ParameterInfo[] _parameterinfo = _methods[m].GetParameters();
								for (int p = 0; p < _parameterinfo.Length; p++) {

_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection.Add(
	out _property_index, 
	_parameterinfo[p].Name
);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].isOut = _parameterinfo[p].IsOut;
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].Type = translate(string.Format(
	"{0}.{1}",
	_parameterinfo[p].ParameterType.Namespace,
	(_parameterinfo[p].ParameterType.Name.IndexOf('&') >= 0)
		? _parameterinfo[p].ParameterType.Name.Substring(0, _parameterinfo[p].ParameterType.Name.Length - 1)
		: _parameterinfo[p].ParameterType.Name

));
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].isRef = (_parameterinfo[p].ParameterType.IsByRef && !_parameterinfo[p].IsOut);
_output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
	_property_index
].isParams = false;

								}
							}
						}
					}
				}
			}

			return _output;
		}
예제 #7
0
        public XS__RootMetadata(
                #endif
            string metadataFilepath_in
            )
        {
            string _metadataPath = System.IO.Path.GetDirectoryName(metadataFilepath_in);

            metadatafiles_ = Metadatas.Load_fromFile(metadataFilepath_in);

            #region int _total_xxx = ...;
            int _total_metadataextended = 0;
            int _total_metadatadb       = 0;
            int _total_metadatabusiness = 0;
            for (int f = 0; f < metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__metadataExtended.METADATAEXTENDED:
                    _total_metadataextended++;
                    break;

                case XS__metadataDB.METADATADB:
                    _total_metadatadb++;
                    break;

                case XS__metadataBusiness.METADATABUSINESS:
                    _total_metadatabusiness++;
                    break;
                }
            }
            #endregion
            #region string[] _xxxFilepath = new string[_total_xxx];
            string[] _metadataextendedFilepath = new string[
                _total_metadataextended
                                                 ];
            string[] _metadatadbFilepath = new string[
                _total_metadatadb
                                           ];
            string[] _metadatabusinessFilepath = new string[
                _total_metadatabusiness
                                                 ];
            #endregion

            _total_metadataextended = 0;
            _total_metadatadb       = 0;
            _total_metadatabusiness = 0;
            for (int f = 0; f < metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__metadataExtended.METADATAEXTENDED:
                    _metadataextendedFilepath[_total_metadataextended] = System.IO.Path.Combine(
                        _metadataPath,
                        metadatafiles_.MetadataFiles[f].XMLFilename
                        );
                    _total_metadataextended++;
                    break;

                case XS__metadataDB.METADATADB:
                    _metadatadbFilepath[_total_metadatadb] = System.IO.Path.Combine(
                        _metadataPath,
                        metadatafiles_.MetadataFiles[f].XMLFilename
                        );
                    _total_metadatadb++;
                    break;

                case XS__metadataBusiness.METADATABUSINESS:
                    _metadatabusinessFilepath[_total_metadatabusiness] = System.IO.Path.Combine(
                        _metadataPath,
                        metadatafiles_.MetadataFiles[f].XMLFilename
                        );
                    _total_metadatabusiness++;
                    break;
                }
            }

            metadataextendedcollection_ = new XS__metadataExtendedCollection(
                XS__metadataExtended.Load_fromFile(
                    (XS__RootMetadata)this,
                    _metadataextendedFilepath
                    )
                );
            metadatadbcollection_ = new XS__metadataDBCollection(
                XS__metadataDB.Load_fromFile(
                    (XS__RootMetadata)this,
                    _metadatadbFilepath
                    )
                );
            metadatabusinesscollection_ = new XS__metadataBusinessCollection(
                XS__metadataBusiness.Load_fromFile(
                    (XS__RootMetadata)this,
                    _metadatabusinessFilepath
                    )
                );
        }
		public XS__metadataBusinessCollection(
			XS__metadataBusiness[] metadatabusinesscollection_in
		) : base (
			metadatabusinesscollection_in
		) {
		}
예제 #9
0
        public static XS__metadataBusiness Load_fromAssembly(
            string assemblyFilePath_in,

            XS__RootMetadata root_ref_in,
            int index_in
            )
        {
            #region XS__metadataBusiness _output = ...;
            XS__metadataBusiness _output = new XS__metadataBusiness();

            _output.root_metadatabusiness_ = ROOT + "." + METADATABUSINESS + "[" + index_in.ToString() + "]";
            _output.parent_ref             = root_ref_in; // ToDos: now!
            if (root_ref_in != null)
            {
                _output.root_ref = root_ref_in;
            }
            #endregion

            #region Assembly _assembly = Assembly.LoadFrom(assemblyFilePath_in);
            Assembly _assembly
            //= Assembly.LoadFile(assemblyFilePath_in);
                = Assembly.LoadFrom(assemblyFilePath_in);
            //_assembly.GetFiles(true);
            //_assembly.GetReferencedAssemblies();

            if (_assembly == null)
            {
                throw new Exception(String.Format(
                                        "can't load assembly 'assemblyName_in'\n at: {0}.{1}.Load_fromAssembly();",
                                        typeof(XS__metadataBusiness).Namespace,
                                        typeof(XS__metadataBusiness).Name,
                                        assemblyFilePath_in
                                        ));
            }
            #endregion

            bool   _isBO  = false;
            bool   _isBDO = false;
            int    _class_index;
            int    _method_index;
            int    _property_index;
            Type[] _types = _assembly.GetTypes();
            for (int t = 0; t < _types.Length; t++)
            {
                Type _type = (Type)_types[t];

                object[] _classattributes = _type.GetCustomAttributes(
                    typeof(BOClassAttribute),
                    true                    //false
                    );
                if (
                    (_classattributes.Length > 0)
                    //&&
                    //(_type.Name.IndexOf("BO0_") != 0)
                    //&&
                    //(_type.Name.IndexOf("BDO0_") != 0)
                    &&
                    (
                        (_type.Name.IndexOf("BO_") == 0)
                        ||
                        (_type.Name.IndexOf("BDO_") == 0)
                    )
                    )
                {
                    for (int ca = 0; ca < _classattributes.Length; ca++)
                    {
                        BOClassAttribute _attribute
                            = (BOClassAttribute)_classattributes[ca];

                        _isBO  = false;
                        _isBDO = false;
                        _output.Classes.ClassCollection.Add(
                            out _class_index,
                            //_attribute.Name
                            (_isBO = (_type.Name.IndexOf("BO_") == 0))
                ? _type.Name.Substring(3)
                : (
                                (_isBDO = (_type.Name.IndexOf("BDO_") == 0))
                                ? _type.Name.Substring(4)
                                : _type.Name
                                )
                            );
                        _output.Classes.ClassCollection[_class_index].Type
                            = ((_isBO)
                ? XS_BoEnumeration.BO
                : ((_isBDO)
                        ? XS_BoEnumeration.BDO
                        : XS_BoEnumeration.invalid
                   )
                               );

                        MethodInfo[] _methods = _type.GetMethods(
                            BindingFlags.Public |
                            BindingFlags.Instance
                            );
                        for (int m = 0; m < _methods.Length; m++)
                        {
                            if (Attribute.IsDefined(
                                    _methods[m],
                                    typeof(BOMethodAttribute)
                                    ))
                            {
                                Attribute[] _methodattributes = Attribute.GetCustomAttributes(
                                    _methods[m],
                                    typeof(BOMethodAttribute),
                                    true
                                    );

                                _method_index = -1;
                                for (int ma = 0; ma < _methodattributes.Length; ma++)
                                {
                                    if (_methodattributes[ma].GetType() == typeof(BOMethodAttribute))
                                    {
                                        BOMethodAttribute _methodattribute
                                            = (BOMethodAttribute)_methodattributes[ma];

                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection.Add(
                                            out _method_index,
                                            _methods[m].Name
                                            );
                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
                                            _method_index
                                        ].Distribute = _methodattribute.Distribute;
                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
                                            _method_index
                                        ].OutputType
                                            = translate(string.Format(
                                                            "{0}.{1}",
                                                            _methods[m].ReturnType.Namespace,
                                                            _methods[m].ReturnType.Name
                                                            ));
                                    }
                                }

                                ParameterInfo[] _parameterinfo = _methods[m].GetParameters();
                                for (int p = 0; p < _parameterinfo.Length; p++)
                                {
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection.Add(
                                        out _property_index,
                                        _parameterinfo[p].Name
                                        );
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].isOut = _parameterinfo[p].IsOut;
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].Type = translate(string.Format(
                                                           "{0}.{1}",
                                                           _parameterinfo[p].ParameterType.Namespace,
                                                           (_parameterinfo[p].ParameterType.Name.IndexOf('&') >= 0)
                ? _parameterinfo[p].ParameterType.Name.Substring(0, _parameterinfo[p].ParameterType.Name.Length - 1)
                : _parameterinfo[p].ParameterType.Name

                                                           ));
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].isRef = (_parameterinfo[p].ParameterType.IsByRef && !_parameterinfo[p].IsOut);
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].isParams = false;
                                }
                            }
                        }
                    }
                }
            }

            return(_output);
        }
		public XS__metadataBusinessCollection(
		#endif
			XS__metadataBusiness[] metadatabusinesscollection_in
		) {
			metadatabusinesscollection_ = metadatabusinesscollection_in;
		}
예제 #11
0
        public static XS__metadataBusiness Load_fromAssembly(
            string assemblyFilePath_in,

            XS__RootMetadata root_ref_in,
            int index_in
            )
        {
            #region XS__metadataBusiness _output = ...;
            XS__metadataBusiness _output = new XS__metadataBusiness();

            _output.root_metadatabusiness_ = string.Concat(ROOT, ".", METADATABUSINESS, "[", index_in.ToString(System.Globalization.CultureInfo.CurrentCulture), "]");
            _output.parent_ref             = root_ref_in; // ToDos: now!
            if (root_ref_in != null)
            {
                _output.root_ref = root_ref_in;
            }
            #endregion

            #region Assembly _assembly = Assembly.LoadFrom(assemblyFilePath_in);
            Assembly _assembly
            //= Assembly.LoadFile(assemblyFilePath_in);
                = Assembly.LoadFrom(assemblyFilePath_in);
            //_assembly.GetFiles(true);
            //_assembly.GetReferencedAssemblies();

            if (_assembly == null)
            {
                throw new Exception(string.Format(
                                        System.Globalization.CultureInfo.CurrentCulture,
                                        "can't load assembly 'assemblyName_in'\n at: {0}.{1}.Load_fromAssembly();",
                                        typeof(XS__metadataBusiness).Namespace,
                                        typeof(XS__metadataBusiness).Name,
                                        assemblyFilePath_in
                                        ));
            }
            #endregion

            //bool _isBO = false;
            //bool _isBDO = false;
            int    _class_index;
            int    _method_index;
            int    _property_index;
            Type[] _types = _assembly.GetTypes();

#if NET_2_0
            Array.Sort(
                _types,
                delegate(
                    Type arg1,
                    Type arg2
                    ) {
                return(string.Compare(
                           arg1.Name,
                           arg2.Name,
                           false,
                           System.Globalization.CultureInfo.CurrentCulture
                           ));
            }
                );
#endif

            for (int t = 0; t < _types.Length; t++)
            {
                Type _type = (Type)_types[t];

                object[] _classattributes = _type.GetCustomAttributes(
                    typeof(BOClassAttribute),
                    true                    //false
                    );
                if (
                    (_classattributes.Length > 0)
                    &&
                    (_type.Name.IndexOf("SBO_", StringComparison.CurrentCulture) == 0)
                    )
                {
                    for (int ca = 0; ca < _classattributes.Length; ca++)
                    {
//						BOClassAttribute _attribute
//							= (BOClassAttribute)_classattributes[ca];

                        _output.Classes.ClassCollection.Add(
                            out _class_index,
                            //_attribute.Name
                            (_type.Name.IndexOf("SBO_", StringComparison.CurrentCulture) == 0)
                ? _type.Name.Substring(4)
                : _type.Name
                            );
                        _output.Classes.ClassCollection[_class_index].Namespace
                            = _type.Namespace;
                        _output.Classes.ClassCollection[_class_index].Type
                            = XS_BoEnumeration.invalid;

                        MethodInfo[] _methods = _type.GetMethods(
                            BindingFlags.Public |
                            //BindingFlags.Instance
                            BindingFlags.Static
                            );

#if NET_2_0
                        Array.Sort(
                            _methods,
                            delegate(
                                MethodInfo arg1,
                                MethodInfo arg2
                                ) {
                            return(string.Compare(
                                       arg1.Name,
                                       arg2.Name,
                                       false,
                                       System.Globalization.CultureInfo.CurrentCulture
                                       ));
                        }
                            );
#endif

                        for (int m = 0; m < _methods.Length; m++)
                        {
                            if (Attribute.IsDefined(
                                    _methods[m],
                                    typeof(BOMethodAttribute)
                                    ))
                            {
                                Attribute[] _methodattributes = Attribute.GetCustomAttributes(
                                    _methods[m],
                                    typeof(BOMethodAttribute),
                                    true
                                    );

                                _method_index = -1;
                                for (int ma = 0; ma < _methodattributes.Length; ma++)
                                {
                                    if (_methodattributes[ma].GetType() == typeof(BOMethodAttribute))
                                    {
                                        BOMethodAttribute _methodattribute
                                            = (BOMethodAttribute)_methodattributes[ma];

                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection.Add(
                                            out _method_index,
                                            _methods[m].Name
                                            );
                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
                                            _method_index
                                        ].Distribute = _methodattribute.Distribute;
                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
                                            _method_index
                                        ].IsSearch = _methodattribute.IsSearch;
                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
                                            _method_index
                                        ].IPParamNum = _methodattribute.IPParamNum;
                                        _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[
                                            _method_index
                                        ].OutputType
                                            = OGen.Libraries.Utilities.Type_ToString(_methods[m].ReturnType);
                                    }
                                }

                                ParameterInfo[] _parameterinfo = _methods[m].GetParameters();
                                for (int p = 0; p < _parameterinfo.Length; p++)
                                {
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection.Add(
                                        out _property_index,
                                        _parameterinfo[p].Name
                                        );
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].IsOut = _parameterinfo[p].IsOut;
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].Type = OGen.Libraries.Utilities.Type_ToString(_parameterinfo[p].ParameterType);
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].IsRef = (_parameterinfo[p].ParameterType.IsByRef && !_parameterinfo[p].IsOut);
                                    _output.Classes.ClassCollection[_class_index].Methods.MethodCollection[_method_index].Parameters.ParameterCollection[
                                        _property_index
                                    ].IsParams = false;
                                }
                            }
                        }
                    }
                }
            }

            return(_output);
        }