• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IPackageMetadata类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPackageMetadata的典型用法代码示例。如果您正苦于以下问题:C# IPackageMetadata类的具体用法?C# IPackageMetadata怎么用?C# IPackageMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPackageMetadata类属于命名空间,在下文中一共展示了IPackageMetadata类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FromV2Package

 public static PackageLicenseModel FromV2Package(IPackageMetadata package)
 {
     return new PackageLicenseModel(
         package.Id,
         package.LicenseUrl,
         package.Authors);
 }
开发者ID:sistoimenov,项目名称:NuGet2,代码行数:7,代码来源:PackageLicenseModel.cs


示例2: Create

 public static Manifest Create(IPackageMetadata metadata)
 {
     return new Manifest
     {
         Metadata = new ManifestMetadata
         {
             Id = metadata.Id.SafeTrim(),
             Version = metadata.Version.ToStringSafe(),
             Title = metadata.Title.SafeTrim(),
             Authors = GetCommaSeparatedString(metadata.Authors),
             Owners = GetCommaSeparatedString(metadata.Owners) ?? GetCommaSeparatedString(metadata.Authors),
             Tags = String.IsNullOrEmpty(metadata.Tags) ? null : metadata.Tags.SafeTrim(),
             LicenseUrl = ConvertUrlToStringSafe(metadata.LicenseUrl),
             ProjectUrl = ConvertUrlToStringSafe(metadata.ProjectUrl),
             IconUrl = ConvertUrlToStringSafe(metadata.IconUrl),
             RequireLicenseAcceptance = metadata.RequireLicenseAcceptance,
             // DevelopmentDependency = metadata.DevelopmentDependency,
             Description = metadata.Description.SafeTrim(),
             Copyright = metadata.Copyright.SafeTrim(),
             Summary = metadata.Summary.SafeTrim(),
             ReleaseNotes = metadata.ReleaseNotes.SafeTrim(),
             Language = metadata.Language.SafeTrim(),
             DependencySets = CreateDependencySets(metadata),
             FrameworkAssemblies = CreateFrameworkAssemblies(metadata),
             ReferenceSets = CreateReferenceSets(metadata),
             MinClientVersionString = metadata.MinClientVersion.ToStringSafe()
         },
     };
 }
开发者ID:nagyistoce,项目名称:dnx,代码行数:29,代码来源:Manifest.cs


示例3: Resolve

        public void Resolve(IPackageMetadata metadata, string folder, string templateName, bool forceUpgrade)
        {
            var gitMetadata = metadata as GitPackageMetadata;
            var protobuildMetadata = metadata as ProtobuildPackageMetadata;
            var folderMetadata = metadata as FolderPackageMetadata;

            if (gitMetadata != null)
            {
                ResolveGit(gitMetadata, folder, templateName, forceUpgrade);
                return;
            }

            if (protobuildMetadata != null)
            {
                ResolveProtobuild(protobuildMetadata, folder, templateName, forceUpgrade);
                return;
            }

            if (folderMetadata != null)
            {
                ResolveFolder(folderMetadata, folder, templateName);
                return;
            }

            throw new InvalidOperationException("Unexpected metadata type " + metadata.GetType().Name + " for source resolve.");
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:26,代码来源:SourcePackageResolve.cs


示例4: SavePackage

        public static void SavePackage(IPackageMetadata packageMetadata, IEnumerable<IPackageFile> files, string targetFilePath, bool useTempFile)
        {
            var builder = new PackageBuilder();
            // set metadata
            CopyMetadata(packageMetadata, builder);
            // add files
            builder.Files.AddRange(files);

            // create package in the temprary file first in case the operation fails which would
            // override existing file with a 0-byte file.
            string fileNameToUse = useTempFile ? Path.GetTempFileName() : targetFilePath;
            try {
                using (Stream stream = File.Create(fileNameToUse)) {
                    builder.Save(stream);
                }

                if (useTempFile) {
                    File.Copy(fileNameToUse, targetFilePath, true);
                }
            }
            finally {
                try {
                    if (useTempFile && File.Exists(fileNameToUse)) {
                        File.Delete(fileNameToUse);
                    }
                }
                catch {
                    // don't care if this fails
                }
            }
        }
开发者ID:jacksonh,项目名称:nuget,代码行数:31,代码来源:PackageHelper.cs


示例5: PushPackage

        public async Task PushPackage(string apiKey, string filePath, IPackageMetadata package, bool pushAsUnlisted, bool appendV2ApiToUrl)
        {
            string requestUri = CreateRequestUri(appendV2ApiToUrl);

            HttpWebRequest httpRequest = WebRequest.CreateHttp(requestUri);

            httpRequest.Method = "PUT";
            httpRequest.AllowAutoRedirect = true;
            httpRequest.KeepAlive = false;
            httpRequest.Headers.Add(ApiKeyHeader, apiKey);
            httpRequest.UserAgent = _userAgent;
            httpRequest.UseDefaultCredentials = true;
            httpRequest.PreAuthenticate = true;

            var multipartRequest = new MultipartWebRequest();
            multipartRequest.AddFile(new FileInfo(filePath), package.ToString());

            // sending package data asynchronously
            await multipartRequest.CreateMultipartRequest(httpRequest);

            // waiting for response asynchronously
            await EnsureSuccessfulResponse(httpRequest, HttpStatusCode.Created);

            if (pushAsUnlisted)
            {
                await DeletePackageFromServer(apiKey, package.Id, package.Version.ToString(), appendV2ApiToUrl);
            }
        }
开发者ID:campersau,项目名称:NuGetPackageExplorer,代码行数:28,代码来源:GalleryServer.cs


示例6: PushPackage

        public async Task PushPackage(string apiKey, string filePath, IPackageMetadata package, bool pushAsUnlisted)
        {
            string requestUri = EnsureTrailingSlash(_source) + ServiceEndpoint;
            
            HttpWebRequest httpRequest = WebRequest.CreateHttp(requestUri);
            httpRequest.Method = "PUT";
            httpRequest.AllowAutoRedirect = true;
            httpRequest.AllowWriteStreamBuffering = false;
            httpRequest.KeepAlive = false;
            httpRequest.Headers.Add(ApiKeyHeader, apiKey);
            httpRequest.UserAgent = _userAgent;

            var multipartRequest = new MultipartWebRequest();
            multipartRequest.AddFile(new FileInfo(filePath), package.ToString());

            // sending package data asynchronously
            await multipartRequest.CreateMultipartRequest(httpRequest);
            
            // waiting for response asynchronously
            await EnsureSuccessfulResponse(httpRequest, HttpStatusCode.Created);

            if (pushAsUnlisted)
            {
                await DeletePackageFromServer(apiKey, package.Id, package.Version.ToString());
            }
        }
开发者ID:cinecove,项目名称:NuGetPackageExplorer,代码行数:26,代码来源:GalleryServer.cs


示例7: IsSatellitePackage

        public static bool IsSatellitePackage(
            IPackageMetadata package, 
            IPackageRepository repository,
            FrameworkName targetFramework,
            out IPackage runtimePackage)
        {
            // A satellite package has the following properties:
            //     1) A package suffix that matches the package's language, with a dot preceding it
            //     2) A dependency on the package with the same Id minus the language suffix
            //     3) The dependency can be found by Id in the repository (as its path is needed for installation)
            // Example: foo.ja-jp, with a dependency on foo

            runtimePackage = null;

            if (package.IsSatellitePackage())
            {
                string runtimePackageId = package.Id.Substring(0, package.Id.Length - (package.Language.Length + 1));
                PackageDependency dependency = package.FindDependency(runtimePackageId, targetFramework);

                if (dependency != null)
                {
                    runtimePackage = repository.FindPackage(runtimePackageId, versionSpec: dependency.VersionSpec, allowPrereleaseVersions: true, allowUnlisted: true);
                }
            }

            return runtimePackage != null;
        }
开发者ID:aaasoft,项目名称:NuGet.Server,代码行数:27,代码来源:PackageHelper.cs


示例8: RoslynReflector

 public RoslynReflector(IPackageMetadata package)
 {
     _types = new Dictionary<string, TypeModel>();
     _namespaces = new Dictionary<string, NamespaceModel>();
     _extensions = new Dictionary<string, ExtensionModel>();
     _package = package;
 }
开发者ID:digideskio,项目名称:NuGet.PackageIndex,代码行数:7,代码来源:RoslynReflector.cs


示例9: BuildPackage

 public static IPackage BuildPackage(IPackageMetadata metadata, IEnumerable<IPackageFile> files)
 {
     var builder = new PackageBuilder();
     CopyMetadata(metadata, builder);
     builder.Files.AddRange(files);
     return builder.Build();
 }
开发者ID:NuGetPackageExplorer,项目名称:NuGetPackageExplorer,代码行数:7,代码来源:PackageHelper.cs


示例10: Create

 public static Manifest Create(IPackageMetadata metadata)
 {
     return new Manifest {
         Metadata = new ManifestMetadata {
             Id = metadata.Id.SafeTrim(),
             Version = metadata.Version.ToStringSafe(),
             Title = metadata.Title.SafeTrim(),
             Authors = GetCommaSeparatedString(metadata.Authors),
             Owners = GetCommaSeparatedString(metadata.Owners) ?? GetCommaSeparatedString(metadata.Authors),
             Tags = String.IsNullOrEmpty(metadata.Tags) ? null : metadata.Tags.SafeTrim(),
             LicenseUrl = metadata.LicenseUrl != null ? metadata.LicenseUrl.OriginalString.SafeTrim() : null,
             ProjectUrl = metadata.ProjectUrl != null ? metadata.ProjectUrl.OriginalString.SafeTrim() : null,
             IconUrl = metadata.IconUrl != null ? metadata.IconUrl.OriginalString.SafeTrim() : null,
             RequireLicenseAcceptance = metadata.RequireLicenseAcceptance,
             Description = metadata.Description.SafeTrim(),
             Summary = metadata.Summary.SafeTrim(),
             Language = metadata.Language.SafeTrim(),
             Dependencies = metadata.Dependencies == null ||
                            !metadata.Dependencies.Any() ? null :
                            (from d in metadata.Dependencies
                             select new ManifestDependency {
                                 Id = d.Id.SafeTrim(),
                                 Version = d.VersionSpec.ToStringSafe()
                             }).ToList(),
             FrameworkAssemblies = metadata.FrameworkAssemblies == null ||
                                   !metadata.FrameworkAssemblies.Any() ? null :
                                   (from reference in metadata.FrameworkAssemblies
                                    select new ManifestFrameworkAssembly {
                                        AssemblyName = reference.AssemblyName,
                                        TargetFramework = String.Join(", ", reference.SupportedFrameworks.Select(VersionUtility.GetFrameworkString))
                                    }).ToList()
         }
     };
 }
开发者ID:grendello,项目名称:nuget,代码行数:34,代码来源:Manifest.cs


示例11: Equals

 public bool Equals(IPackageMetadata other)
 {
     return Id.Equals(other.Id)
            && Version.Equals(other.Version)
            && LocalPath.Equals(other.LocalPath)
            && AreTargetFrameworksEqual(TargetFrameworks, other.TargetFrameworks)
            && AreAssembliesEqual(Assemblies, other.Assemblies);
 }
开发者ID:digideskio,项目名称:NuGet.PackageIndex,代码行数:8,代码来源:PackageMetadata.cs


示例12: NotifyFileAdded

 public void NotifyFileAdded(IPackageMetadata package, string filepath, PackageType packageType)
 {
     var item = new MruItem {
         Path = filepath.ToLowerInvariant(),
         Id = package.Id,
         Version = package.Version,
         PackageType = packageType
     };
     AddFile(item);
 }
开发者ID:grendello,项目名称:nuget,代码行数:10,代码来源:MruManager.cs


示例13: GetProtobuildPackageBinary

        public void GetProtobuildPackageBinary(IPackageMetadata metadata, out string archiveType, out byte[] packageData)
        {
            var protobuildPackageMetadata = metadata as ProtobuildPackageMetadata;
            if (protobuildPackageMetadata == null)
            {
                throw new InvalidOperationException("Can't call GetProtobuildPackageBinary on non-Protobuild package metadata");
            }

            archiveType = protobuildPackageMetadata.BinaryFormat;
            packageData = GetProtobuildBinaryPackage(protobuildPackageMetadata);
        }
开发者ID:marler8997,项目名称:Protobuild,代码行数:11,代码来源:BinaryPackageResolve.cs


示例14: DownloadPackage

        public IPackage DownloadPackage(IHttpClient downloadClient, byte[] packageHash, IPackageMetadata package)
        {
            if (downloadClient == null)
            {
                throw new ArgumentNullException("downloadClient");
            }
            if (packageHash == null)
            {
                throw new ArgumentNullException("packageHash");
            }
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            // Get the operation display text
            string operation = String.Format(CultureInfo.CurrentCulture, NuGetResources.DownloadProgressStatus, package.Id, package.Version);

            EventHandler<ProgressEventArgs> progressAvailableHandler = (sender, e) =>
            {
                OnPackageDownloadProgress(new ProgressEventArgs(operation, e.PercentComplete));
            };

            EventHandler<WebRequestEventArgs> beforeSendingRequesthandler = (sender, e) =>
            {
                OnSendingRequest(e.Request);
            };

            try
            {
                downloadClient.ProgressAvailable += progressAvailableHandler;
                downloadClient.SendingRequest += beforeSendingRequesthandler;

                // TODO: This gets held onto in memory which we want to get rid of eventually
                byte[] buffer = downloadClient.DownloadData();

                if (!_hashProvider.VerifyHash(buffer, packageHash))
                {
                    throw new InvalidDataException(NuGetResources.PackageContentsVerifyError);
                }

                return _packageFactory.CreatePackage(() =>
                {
                    return new MemoryStream(buffer);
                });
            }
            finally
            {
                downloadClient.ProgressAvailable -= progressAvailableHandler;
                downloadClient.SendingRequest -= beforeSendingRequesthandler;
            }
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:52,代码来源:PackageDownloader.cs


示例15: DownloadPackage

        public virtual void DownloadPackage(Uri uri, IPackageMetadata package, Stream targetStream)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            var downloadClient = new HttpClient(uri)
                                 {
                                     UserAgent = HttpUtility.CreateUserAgentString(DefaultUserAgentClient)
                                 };
            DownloadPackage(downloadClient, package, targetStream);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:13,代码来源:PackageDownloader.cs


示例16: OutputDependencies

 private void OutputDependencies(IPackageMetadata package)
 {
     if (package.DependencySets.Any())
     {
         Console.WriteLine("Package Dependencies:");
         foreach (var dependencySet in package.DependencySets)
         {
             foreach (var dependency in dependencySet.Dependencies)
             {
                 Console.WriteLine("".PadLeft(_indent) + string.Format("{0} - {1} {2}",dependencySet.TargetFramework, dependency.Id, dependency.VersionSpec));
             }
         }
     }
 }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:14,代码来源:Details.cs


示例17: checkIfNuspecHasRequiredFields

        static void checkIfNuspecHasRequiredFields(IPackageMetadata zp, string packageFile)
        {
            if (String.IsNullOrWhiteSpace(zp.Id))
                throw new Exception(String.Format("Invalid 'id' value in nuspec file at '{0}'", packageFile));

            if (String.IsNullOrWhiteSpace(zp.Version.ToString()))
                throw new Exception(String.Format("Invalid 'version' value in nuspec file at '{0}'", packageFile));

            if (zp.Authors.All(String.IsNullOrWhiteSpace))
                throw new Exception(String.Format("Invalid 'authors' value in nuspec file at '{0}'", zp.Authors));

            if (String.IsNullOrWhiteSpace(zp.Description))
                throw new Exception(String.Format("Invalid 'description' value in nuspec file at '{0}'", zp.Description));
        }
开发者ID:ralberts,项目名称:Shimmer,代码行数:14,代码来源:ParseCommands.cs


示例18: DownloadPackage

        public virtual IPackage DownloadPackage(Uri uri, IPackageMetadata package)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            var downloadClient = new HttpClient(uri)
                                 {
                                     UserAgent = HttpUtility.CreateUserAgentString(DefaultUserAgentClient)
                                 };
            return DownloadPackage(downloadClient, package);
        }
开发者ID:atheken,项目名称:nuget,代码行数:17,代码来源:PackageDownloader.cs


示例19: CreatePackage

        public void CreatePackage(string apiKey, Stream packageStream, IObserver<int> progressObserver, IPackageMetadata metadata = null)
        {
            var state = new PublishState {
                PublishKey = apiKey,
                PackageMetadata = metadata,
                ProgressObserver = progressObserver
            };

            var url = new Uri(String.Format(CultureInfo.InvariantCulture, "{0}/{1}/{2}/nupkg", _baseGalleryServerUrl, CreatePackageService, apiKey));

            WebClient client = new WebClient();
            client.Proxy = _cachedProxy;
            client.Headers[HttpRequestHeader.ContentType] = "application/octet-stream";
            client.Headers[HttpRequestHeader.UserAgent] = _userAgent;
            client.UploadProgressChanged += OnUploadProgressChanged;
            client.UploadDataCompleted += OnCreatePackageCompleted;
            client.UploadDataAsync(url, "POST", packageStream.ReadAllBytes(), state);
        }
开发者ID:jacksonh,项目名称:nuget,代码行数:18,代码来源:GalleryServer.cs


示例20: CopyMetadata

 private static void CopyMetadata(IPackageMetadata source, PackageBuilder builder)
 {
     builder.Id = source.Id;
     builder.Version = source.Version;
     builder.Title = source.Title;
     builder.Authors.AddRange(source.Authors);
     builder.Owners.AddRange(source.Owners);
     builder.IconUrl = source.IconUrl;
     builder.LicenseUrl = source.LicenseUrl;
     builder.ProjectUrl = source.ProjectUrl;
     builder.RequireLicenseAcceptance = source.RequireLicenseAcceptance;
     builder.Description = source.Description;
     builder.Summary = source.Summary;
     builder.Language = source.Language;
     builder.Tags.AddRange(ParseTags(source.Tags));
     builder.Dependencies.AddRange(source.Dependencies);
     builder.FrameworkReferences.AddRange(source.FrameworkAssemblies);
 }
开发者ID:jacksonh,项目名称:nuget,代码行数:18,代码来源:PackageHelper.cs



注:本文中的IPackageMetadata类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPackagePathResolver类代码示例发布时间:2022-05-24
下一篇:
C# IPackageManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap