Exemplo n.º 1
0
        private void ProcessRenamingFile(string filePath)
        {
            using (var fileReader = new StreamReader(filePath))
            {
                try
                {
                    using (var reader = XmlReader.Create(fileReader))
                    {
                        // let the manifest factory do all the heavy lifting of parsing the XML
                        // into config objects
                        var config = ManifestFactory.Create(reader);
                        if (config != null)
                        {
                            // add any rename pairs
                            foreach (var pair in config.RenameIdentifiers)
                            {
                                m_switchParser.JSSettings.AddRenamePair(pair.Key, pair.Value);
                            }

                            // add any no-rename identifiers
                            m_switchParser.JSSettings.SetNoAutoRenames(config.NoRenameIdentifiers);
                        }
                    }
                }
                catch (XmlException e)
                {
                    // throw an error indicating the XML error
                    System.Diagnostics.Debug.WriteLine(e.ToString());
                    throw new NotSupportedException(AjaxMin.InputXmlError.FormatInvariant(e.Message));
                }
            }
        }
Exemplo n.º 2
0
        private string PersistManifestFileAndReturnLocation(Package package)
        {
            var manifestFilePath = Path.Combine(package.ClonedPath, "manifest.xml");

            ManifestFactory.Save(manifestFilePath, package.Manifest);

            return(manifestFilePath);
        }
Exemplo n.º 3
0
        public static Manifest ReadManifestFile(string xmlPath)
        {
            Manifest manifest = null;

            // create the file reader
            using (var fileReader = new StreamReader(xmlPath))
            {
                // create the xml reader from the file string using these settings
                var settings = new XmlReaderSettings()
                {
                    IgnoreComments = true,
                    IgnoreProcessingInstructions = true,
                    IgnoreWhitespace             = true,
                };

                using (var reader = XmlReader.Create(fileReader, settings))
                {
                    manifest = ManifestFactory.Create(reader);
                }
            }

            return(manifest);
        }