Esempio n. 1
0
 private static XElement GetProperties(ODataPackage package)
 {
     return(new XElement(
                XmlElements.m_properties,
                new XElement(XmlElements.d_Id, package.Id),
                new XElement(XmlElements.d_Title, package.Title),
                new XElement(XmlElements.d_Version, package.Version),
                new XElement(XmlElements.d_NormalizedVersion, package.NormalizedVersion),
                new XElement(XmlElements.d_Authors, package.Authors),
                new XElement(XmlElements.d_Copyright, package.Copyright),
                new XElement(XmlElements.d_Dependencies, package.Dependencies),
                new XElement(XmlElements.d_Description, package.Description),
                new XElement(XmlElements.d_DownloadCount, package.DownloadCount),          //TODO m:type="Edm.Int32"
                new XElement(XmlElements.d_LastEdited, package.LastUpdated),
                new XElement(XmlElements.d_Published, package.Published),
                new XElement(XmlElements.d_PackageHash, package.PackageHash),
                new XElement(XmlElements.d_PackageHashAlgorithm, package.PackageHashAlgorithm),
                new XElement(XmlElements.d_PackageSize, package.PackageSize),
                new XElement(XmlElements.d_ProjectUrl, package.ProjectUrl),
                new XElement(XmlElements.d_IconUrl, package.IconUrl),
                new XElement(XmlElements.d_LicenseUrl, package.LicenseUrl),
                //new XElement(XmlElements.d_ReportAbuseUrl, package.ReportAbuseUrl),
                new XElement(XmlElements.d_Tags, package.Tags),
                new XElement(XmlElements.d_RequireLicenseAcceptance, package.RequireLicenseAcceptance)
                ));
 }
Esempio n. 2
0
        public void Serialize(Stream outputStream, ODataPackage package, string serviceBaseUrl, string resourceIdUrl, string packageContentUrl)
        {
            var doc = new XElement(XmlElements.entry,
                                   new XAttribute(XmlElements.baze, XNamespace.Get(serviceBaseUrl)),
                                   new XAttribute(XmlElements.m, XmlNamespaces.m),
                                   new XAttribute(XmlElements.d, XmlNamespaces.d),
                                   new XAttribute(XmlElements.georss, XmlNamespaces.georss),
                                   new XAttribute(XmlElements.gml, XmlNamespaces.gml),
                                   new XElement(XmlElements.id, resourceIdUrl),
                                   new XElement(XmlElements.title, package.Title),
                                   new XElement(XmlElements.author, new XElement(XmlElements.name, package.Authors)),
                                   new XElement(
                                       XmlElements.content,
                                       new XAttribute("type", "application/zip"),
                                       new XAttribute("src", packageContentUrl)
                                       ),
                                   GetProperties(package)
                                   );
            var writer = XmlWriter.Create(outputStream);

            doc.WriteTo(writer);
            writer.Flush();
        }
Esempio n. 3
0
 public PackageWithUrls(Package pkg, string resourceIdUrl, string packageContentUrl)
 {
     this.pkg               = new ODataPackage(pkg);
     this.resourceIdUrl     = resourceIdUrl;
     this.packageContentUrl = packageContentUrl;
 }