コード例 #1
0
        public static XS__documentation[] Load_fromURI(
            XS__RootMetadata root_ref_in,
            params Uri[] filePath_in
            )
        {
            XS__documentation[] _output
                = new XS__documentation[filePath_in.Length];

            for (int i = 0; i < filePath_in.Length; i++)
            {
                if (filePath_in[i].IsFile)
                {
                    _output[i] = XS__documentation.Load_fromFile(
                        filePath_in[i].LocalPath
                        )[0];
                    // no need! everything's been taken care at: XS__documentation.Load_fromFile(...)
                    //_output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + 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__documentation) new XmlSerializer(typeof(XS__documentation)).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__documentation).Namespace,
                                                typeof(XS__documentation).Name,
                                                //(filePath_in[i].IsFile)
                                                //	? filePath_in[i].LocalPath
                                                //	:
                                                filePath_in[i].ToString(),
                                                _ex.Message
                                                ));
                    }
                    _output[i].root_documentation_ = ROOT + "." + DOCUMENTATION + "[" + 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 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_documentation = 0;
            for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (this.metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__documentation.DOCUMENTATION:
                    _total_documentation++;
                    break;
                }
            }
            #endregion
            #region string[] _xxxFilePath = new string[_total_xxx];
            string[] _documentationFilePath = new string[
                _total_documentation
                                              ];
            #endregion

            _total_documentation = 0;
            for (int f = 0; f < this.metadatafiles_.MetadataFiles.Count; f++)
            {
                switch (this.metadatafiles_.MetadataFiles[f].XMLFileType)
                {
                case XS__documentation.DOCUMENTATION:
                    _documentationFilePath[_total_documentation] = System.IO.Path.Combine(
                        _metadataPath,
                        this.metadatafiles_.MetadataFiles[f].XMLFileName
                        );
                    _total_documentation++;
                    break;
                }
            }

            this.documentationcollection_ = new XS__documentationCollection(
                XS__documentation.Load_fromFile(
                    (XS__RootMetadata)this,
                    _documentationFilePath
                    )
                );
        }