Пример #1
0
        public static XS__metadata[] Load_fromURI(
            XS__RootMetadata root_ref_in,
            params Uri[] filePath_in
            )
        {
            XS__metadata[] _output
                = new XS__metadata[filePath_in.Length];

            for (int i = 0; i < filePath_in.Length; i++)
            {
                if (filePath_in[i].IsFile)
                {
                    _output[i] = XS__metadata.Load_fromFile(
                        filePath_in[i].LocalPath
                        )[0];
                    // no need! everything's been taken care at: XS__metadata.Load_fromFile(...)
                    //_output[i].root_metadata_ = ROOT + "." + METADATA + "[" + 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__metadata) new XmlSerializer(typeof(XS__metadata)).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__metadata).Namespace,
                                                typeof(XS__metadata).Name,
                                                //(filePath_in[i].IsFile)
                                                //	? filePath_in[i].LocalPath
                                                //	:
                                                filePath_in[i].ToString(),
                                                _ex.Message
                                                ));
                    }
                    _output[i].root_metadata_ = ROOT + "." + METADATA + "[" + 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__metadata[] Load_fromFile(
            XS__RootMetadata root_ref_in,
            params string[] filePath_in
            )
        {
            FileStream _stream;

            XS__metadata[] _output
                = new XS__metadata[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__metadata) new XmlSerializer(typeof(XS__metadata)).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__metadata).Namespace,
                                            typeof(XS__metadata).Name,
                                            filePath_in[i],
                                            _ex.Message,
                                            _ex.InnerException
                                            ));
                }
                _output[i].root_metadata_ = ROOT + "." + METADATA + "[" + 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__metadata[] Load_fromFile(
			XS__RootMetadata root_ref_in, 
			params string[] filePath_in
		) {
			FileStream _stream;
			XS__metadata[] _output 
				= new XS__metadata[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__metadata)new XmlSerializer(typeof(XS__metadata)).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__metadata).Namespace, 
						typeof(XS__metadata).Name, 
						filePath_in[i],
						_ex.Message,
						_ex.InnerException
					));
				}
				_output[i].root_metadata_ = ROOT + "." + METADATA + "[" + 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 XS__RootMetadata(
                #endif
            string metadataFilePath_in
            )
        {
            string _metadataPath = System.IO.Path.GetDirectoryName(metadataFilePath_in);

            this.metadatafiles_ = Metadatas.Load_fromFile(metadataFilePath_in);

            #region int _total_xxx = ...;
            int _total_metadata = 0;
            int _total_schema   = 0;
            for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (this.metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__metadata.METADATA:
                    _total_metadata++;
                    break;

                case XS__schema.SCHEMA:
                    _total_schema++;
                    break;
                }
            }
            #endregion
            #region string[] _xxxFilePath = new string[_total_xxx];
            string[] _metadataFilePath = new string[
                _total_metadata
                                         ];
            string[] _schemaFilePath = new string[
                _total_schema
                                       ];
            #endregion

            _total_metadata = 0;
            _total_schema   = 0;
            for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (this.metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__metadata.METADATA:
                    _metadataFilePath[_total_metadata] = System.IO.Path.Combine(
                        _metadataPath,
                        this.metadatafiles_.MetadataFiles[f].XMLFileName
                        );
                    _total_metadata++;
                    break;

                case XS__schema.SCHEMA:
                    _schemaFilePath[_total_schema] = System.IO.Path.Combine(
                        _metadataPath,
                        this.metadatafiles_.MetadataFiles[f].XMLFileName
                        );
                    _total_schema++;
                    break;
                }
            }

            this.metadatacollection_ = new XS__metadataCollection(
                XS__metadata.Load_fromFile(
                    (XS__RootMetadata)this,
                    _metadataFilePath
                    )
                );
            this.schemacollection_ = new XS__schemaCollection(
                XS__schema.Load_fromFile(
                    (XS__RootMetadata)this,
                    _schemaFilePath
                    )
                );
        }
Пример #5
0
		public static XS__metadata[] Load_fromURI(
			XS__RootMetadata root_ref_in, 
			params Uri[] filePath_in
		) {
			XS__metadata[] _output 
				= new XS__metadata[filePath_in.Length];

			for (int i = 0; i < filePath_in.Length; i++) {
				if (filePath_in[i].IsFile) {
					_output[i] = XS__metadata.Load_fromFile(
						filePath_in[i].LocalPath
					)[0];
					// no need! everything's been taken care at: XS__metadata.Load_fromFile(...)
					//_output[i].root_metadata_ = ROOT + "." + METADATA + "[" + 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__metadata)new XmlSerializer(typeof(XS__metadata)).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__metadata).Namespace, 
							typeof(XS__metadata).Name, 
							//(filePath_in[i].IsFile)
							//	? filePath_in[i].LocalPath
							//	: 
							filePath_in[i].ToString(),
							_ex.Message
						));
					}
					_output[i].root_metadata_ = ROOT + "." + METADATA + "[" + i + "]";
					_output[i].parent_ref = root_ref_in; // ToDos: now!
					if (root_ref_in != null) _output[i].root_ref = root_ref_in;
				}
			}

			return _output;
		}
Пример #6
0
		public XS__metadataCollection(
			XS__metadata[] metadatacollection_in
		) : base (
			metadatacollection_in
		) {
		}
Пример #7
0
		public XS__metadataCollection(
		#endif
			XS__metadata[] metadataCollection_in
		) {
			this.metadatacollection_ = metadataCollection_in;
		}