public override bool Execute(PipelinePackage package, PackagePipelineContext context)
        {
            DateTime?commitTimeStamp = PackagePipelineHelpers.GetCommitTimeStamp(context);
            Guid?    commitId        = PackagePipelineHelpers.GetCommitId(context);

            IGraph graph = new Graph();

            INode resource = graph.CreateUriNode(context.Uri);

            if (commitTimeStamp != null)
            {
                graph.Assert(
                    resource,
                    graph.CreateUriNode(Schema.Predicates.CatalogTimeStamp),
                    graph.CreateLiteralNode(commitTimeStamp.Value.ToString("O"), Schema.DataTypes.DateTime));
            }

            if (commitId != null)
            {
                graph.Assert(
                    resource,
                    graph.CreateUriNode(Schema.Predicates.CatalogCommitId),
                    graph.CreateLiteralNode(commitId.Value.ToString()));
            }

            context.StageResults.Add(new GraphPackageMetadata(graph));

            return(true);
        }
        public override bool Execute(PipelinePackage package, PackagePipelineContext context)
        {
            XDocument document = PackagePipelineHelpers.GetXmlZipArchiveEntry(package, context, _entryName);



            return(true);
        }
예제 #3
0
        public override bool Execute(PipelinePackage package, PackagePipelineContext context)
        {
            JToken packageSpec = PackagePipelineHelpers.GetPackageSpec(package, context);

            JToken token = PackagePipelineHelpers.GetContext("");

            Console.WriteLine(token);

            return(true);
        }
예제 #4
0
        public override bool Execute(PipelinePackage package, PackagePipelineContext context)
        {
            JToken packageSpec     = PackagePipelineHelpers.GetPackageSpec(package, context);
            string id              = packageSpec["id"].ToString();
            string version         = packageSpec["version"].ToString();
            string relativeAddress = string.Format("{0}/{1}", id, version);

            context.Uri        = new Uri(context.BaseAddress, relativeAddress.ToLowerInvariant());
            packageSpec["@id"] = context.Uri.AbsoluteUri;
            return(true);
        }
예제 #5
0
        public override bool Execute(PipelinePackage package, PackagePipelineContext context)
        {
            XDocument nuspec = PackagePipelineHelpers.GetNuspec(package, context);

            IGraph graph = Utils.CreateNuspecGraph(nuspec, context.BaseAddress.AbsoluteUri);

            INode rdfTypePredicate = graph.CreateUriNode(Schema.Predicates.Type);

            Triple resource = graph.GetTriplesWithPredicateObject(rdfTypePredicate, graph.CreateUriNode(Schema.DataTypes.PackageDetails)).First();

            graph.Assert(resource.Subject, rdfTypePredicate, graph.CreateUriNode(Schema.DataTypes.Permalink));

            IGraph pageGraph = CreatePageGraph(resource.Subject, graph);

            context.Uri = ((UriNode)resource.Subject).Uri;

            context.StageResults.Add(new GraphPackageMetadata(graph));

            context.StagePageResults.Add(new GraphPackageMetadata(pageGraph));

            return(true);
        }
        public override bool Execute(PipelinePackage package, PackagePipelineContext context)
        {
            ZipArchive zipArchive = PackagePipelineHelpers.GetZipArchive(package, context);

            IEnumerable <PackageEntry> entries = GetEntries(zipArchive);

            IGraph graph = new Graph();

            if (entries != null)
            {
                INode packageEntryPredicate     = graph.CreateUriNode(Schema.Predicates.PackageEntry);
                INode packageEntryType          = graph.CreateUriNode(Schema.DataTypes.PackageEntry);
                INode fullNamePredicate         = graph.CreateUriNode(Schema.Predicates.FullName);
                INode namePredicate             = graph.CreateUriNode(Schema.Predicates.Name);
                INode lengthPredicate           = graph.CreateUriNode(Schema.Predicates.Length);
                INode compressedLengthPredicate = graph.CreateUriNode(Schema.Predicates.CompressedLength);
                INode rdfTypePredicate          = graph.CreateUriNode(Schema.Predicates.Type);

                INode resource = graph.CreateUriNode(context.Uri);

                foreach (PackageEntry entry in entries)
                {
                    Uri entryUri = new Uri(context.Uri.AbsoluteUri + "#" + entry.FullName);

                    INode entryNode = graph.CreateUriNode(entryUri);

                    graph.Assert(resource, packageEntryPredicate, entryNode);
                    graph.Assert(entryNode, rdfTypePredicate, packageEntryType);
                    graph.Assert(entryNode, fullNamePredicate, graph.CreateLiteralNode(entry.FullName));
                    graph.Assert(entryNode, namePredicate, graph.CreateLiteralNode(entry.Name));
                    graph.Assert(entryNode, lengthPredicate, graph.CreateLiteralNode(entry.Length.ToString(), Schema.DataTypes.Integer));
                    graph.Assert(entryNode, compressedLengthPredicate, graph.CreateLiteralNode(entry.CompressedLength.ToString(), Schema.DataTypes.Integer));
                }
            }

            context.StageResults.Add(new GraphPackageMetadata(graph));

            return(true);
        }