GetSchemaNamespace() 공개 정적인 메소드

public static GetSchemaNamespace ( int version ) : string
version int
리턴 string
예제 #1
0
        public void Save(Stream stream, bool validate, int minimumManifestVersion)
        {
            if (validate)
            {
                // Validate before saving
                Validate(this);
            }

            int    version         = Math.Max(minimumManifestVersion, ManifestVersionUtility.GetManifestVersion(Metadata));
            string schemaNamespace = ManifestSchemaUtility.GetSchemaNamespace(version);

            // Define the namespaces to use when serializing
            var ns = new XmlSerializerNamespaces();

            ns.Add("", schemaNamespace);

            // Need to force the namespace here again as the default in order to get the XML output clean
            var serializer = new XmlSerializer(typeof(Manifest), schemaNamespace);

            using (var xmlWriter = new XmlTextWriter(stream, Encoding.UTF8))
            {
                xmlWriter.Indentation = 4;
                xmlWriter.Formatting  = Formatting.Indented;
                serializer.Serialize(xmlWriter, this, ns);
            }
        }
예제 #2
0
        public void Save(Stream stream, bool validate, int minimumManifestVersion)
        {
            int version         = Math.Max(minimumManifestVersion, ManifestVersionUtility.GetManifestVersion(Metadata));
            var schemaNamespace = (XNamespace)ManifestSchemaUtility.GetSchemaNamespace(version);

            new XDocument(
                new XElement(schemaNamespace + "package",
                             Metadata.ToXElement(schemaNamespace))).Save(stream);
        }
예제 #3
0
        public void Save(Stream stream, bool validate, int minimumManifestVersion)
        {
            if (validate)
            {
                Validate(this);
            }
            string schemaNamespace             = ManifestSchemaUtility.GetSchemaNamespace(Math.Max(minimumManifestVersion, ManifestVersionUtility.GetManifestVersion(this.Metadata)));
            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();

            namespaces.Add("", schemaNamespace);
            new XmlSerializer(typeof(Manifest), schemaNamespace).Serialize(stream, this, namespaces);
        }
예제 #4
0
        public void Save(Stream stream, bool validate, int minimumManifestVersion)
        {
            int    version         = Math.Max(minimumManifestVersion, ManifestVersionUtility.GetManifestVersion(Metadata));
            string schemaNamespace = ManifestSchemaUtility.GetSchemaNamespace(version);

            // Define the namespaces to use when serializing
            var ns = new XmlSerializerNamespaces();

            ns.Add("", schemaNamespace);

            // Need to force the namespace here again as the default in order to get the XML output clean
            var serializer = new XmlSerializer(typeof(Manifest), schemaNamespace);

            serializer.Serialize(stream, this, ns);
        }
예제 #5
0
파일: Manifest.cs 프로젝트: pgrudzien12/dnx
        public void Save(Stream stream, bool validate, int minimumManifestVersion)
        {
            int version         = Math.Max(minimumManifestVersion, ManifestVersionUtility.GetManifestVersion(Metadata));
            var schemaNamespace = (XNamespace)ManifestSchemaUtility.GetSchemaNamespace(version);

            new XDocument(
                new XElement(schemaNamespace + "package",
                             Metadata.ToXElement(schemaNamespace),
                             Files.Any() ?
                             new XElement(schemaNamespace + "files",
                                          Files.Select(file => new XElement(schemaNamespace + "file",
                                                                            new XAttribute("src", file.Source),
                                                                            new XAttribute("target", file.Target),
                                                                            new XAttribute("exclude", file.Exclude)))) : null)).Save(stream);
        }
예제 #6
0
        public void Save(Stream stream, bool validate, int minimumManifestVersion)
        {
            int version         = Math.Max(minimumManifestVersion, ManifestVersionUtility.GetManifestVersion(Metadata));
            var schemaNamespace = (XNamespace)ManifestSchemaUtility.GetSchemaNamespace(version);

            var document = new XDocument(
                new XElement(schemaNamespace + "package",
                             Metadata.ToXElement(schemaNamespace)));

            var fileElement = Files.ToXElement(schemaNamespace);

            if (fileElement != null)
            {
                document.Root.Add(fileElement);
            }

            document.Save(stream);
        }