Beispiel #1
0
        /// <summary>
        /// Imports xml metadata document
        /// </summary>
        /// <remarks>
        /// used to import xml metadata document.
        /// </remarks>
        /// <param name="sourceXml">Metadata to be converted</param>
        /// <param name="mdFileID">Unique file identifier</param>
        /// <returns>Returns true if execution was successful.</returns>
        private bool ImportMetadata(string sourceXml, ref String xmlFileName)
        {
            ImportMetadata gpTool = GpHelper.xmlImporter(sourceXml, xmlFileName);

            // Request that the GpHelper execute the instantiated tool. A wrapper is
            // used to abstract error handling and allow a simple integer success code
            // equivalency check to determine success/failure.
            string[] xmlFilePaths;
            return(GpHelper.Execute(gpTool, out xmlFilePaths) == 0);
        }
Beispiel #2
0
        /// <summary>
        /// Publishes metadata document
        /// </summary>
        /// <remarks>
        /// used to publish metadata document.
        /// </remarks>
        /// <param name="xmlMetadata">Metadata to be converted</param>
        /// <param name="mdFileID">Unique file identifier</param>
        /// <param name="publicationResults">string[] output publication results.</param>
        /// <returns>Returns true if execution was successful.</returns>
        private bool PublishMetadata(string xmlMetadata, string mdFileID, out string[] publicationResults)
        {
            // Request that the GpHelper instantiate an MDPublisher geoprocessing
            // tool and set tool's parameters.
            MDPublisher gpTool = GpHelper.xmlPublisher(xmlMetadata, mdFileID, parameters);

            // Request that the GpHelper execute the instantiated tool. A wrapper is
            // used to abstract error handling and allow a simple integer success code
            // equivalency check to determine success/failure.
            return(GpHelper.Execute(gpTool, out publicationResults) == 0);
        }
Beispiel #3
0
        /// <summary>
        /// Translates metadata document
        /// </summary>
        /// <remarks>
        /// used to translate source metadata to another format using xslt.
        /// </remarks>
        /// <param name="propertySet">IXmlPropertySet2 metadata to be converted</param>
        /// <param name="xmlFilePaths">string[] output string array of file paths.</param>
        /// <returns>Returns true if execution was successful.</returns>
        private bool TranslateMetadata(IXmlPropertySet2 propertySet, out string[] xmlFilePaths)
        {
            const string noHeader     = "";
            const bool   ansiRestrict = false;
            string       sourceXml    = Path.GetTempFileName();

            propertySet.SaveAsFile(null, noHeader, ansiRestrict, ref sourceXml);
            ESRITranslator gpTool = GpHelper.xmlTranslator(sourceXml);

            // Request that the GpHelper execute the instantiated tool. A wrapper is
            // used to abstract error handling and allow a simple integer success code
            // equivalency check to determine success/failure.
            return(GpHelper.Execute(gpTool, out xmlFilePaths) == 0);
        }
        /// <summary>
        /// Translates metadata document
        /// </summary>
        /// <remarks>
        /// used to translate source metadata to another format using xslt.
        /// </remarks>
        /// <param name="propertySet">IXmlPropertySet2 metadata to be converted</param>
        /// <param name="xmlFilePaths">string[] output string array of file paths.</param>
        /// <returns>Returns true if execution was successful.</returns>
        private bool TranslateMetadata(IXmlPropertySet2 propertySet, out string[] xmlFilePaths)
        {
            const string noHeader     = "";
            const bool   ansiRestrict = false;
            string       sourceXml    = Path.GetTempFileName();

            propertySet.SaveAsFile(null, noHeader, ansiRestrict, ref sourceXml);

            String selectedStyleCfg = Globals.ArcGISInstallationFolderFromCommandLine + "\\Metadata\\Config\\" + Globals.ArcGISDesktopMetadataConfig + ".cfg";

            translatorPath = readTranslatorFromConfig(selectedStyleCfg);
            ESRITranslator gpTool = GpHelper.xmlTranslator(sourceXml, translatorPath);

            // Request that the GpHelper execute the instantiated tool. A wrapper is
            // used to abstract error handling and allow a simple integer success code
            // equivalency check to determine success/failure.
            return(GpHelper.Execute(gpTool, out xmlFilePaths) == 0);
        }