当前位置: 首页>>代码示例>>C#>>正文


C# IPackage类代码示例

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


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

示例1: Validate

        public IEnumerable<PackageVerifierIssue> Validate(IPackageRepository packageRepo, IPackage package, IPackageVerifierLogger logger)
        {
            if (!package.IsSatellitePackage())
            {
                IEnumerable<string> allXmlFiles =
                    from file in package.GetLibFiles()
                    select file.Path into path
                    where path.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)
                    select path;

                foreach (IPackageFile current in package.GetLibFiles())
                {
                    string assemblyPath = current.Path;
                    // TODO: Does this need to check for just managed code?
                    if (assemblyPath.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
                    {
                        string docFilePath = Path.ChangeExtension(assemblyPath, ".xml");
                        if (!allXmlFiles.Contains(docFilePath, StringComparer.OrdinalIgnoreCase))
                        {
                            yield return PackageIssueFactory.AssemblyHasNoDocFile(assemblyPath);
                        }
                    }
                }
            }
            yield break;
        }
开发者ID:modulexcite,项目名称:DnxTools,代码行数:26,代码来源:AssemblyHasDocumentFileRule.cs

示例2: Package

 public Package(IPackage package, DerivedPackageData derivedData)
 {
     Id = package.Id;
     Version = package.Version.ToString();
     Title = package.Title;
     Authors = String.Join(",", package.Authors);
     if (package.IconUrl != null)
     {
         IconUrl = package.IconUrl.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped);
     }
     if (package.LicenseUrl != null)
     {
         LicenseUrl = package.LicenseUrl.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped);
     }
     if (package.ProjectUrl != null)
     {
         ProjectUrl = package.ProjectUrl.GetComponents(UriComponents.HttpRequestUrl, UriFormat.Unescaped);
     }
     RequireLicenseAcceptance = package.RequireLicenseAcceptance;
     Description = package.Description;
     Summary = package.Summary;
     ReleaseNotes = package.ReleaseNotes;
     Tags = package.Tags;
     Dependencies = String.Join("|", package.DependencySets.SelectMany(ConvertDependencySetToStrings));
     PackageHash = derivedData.PackageHash;
     PackageHashAlgorithm = "SHA512";
     PackageSize = derivedData.PackageSize;
     LastUpdated = derivedData.LastUpdated.UtcDateTime;
     Published = derivedData.Created.UtcDateTime;
     IsAbsoluteLatestVersion = package.IsAbsoluteLatestVersion;
     IsLatestVersion = package.IsLatestVersion;
     Path = derivedData.Path;
     FullPath = derivedData.FullPath;
 }
开发者ID:CloudMorph,项目名称:cloudmorph-fabric,代码行数:34,代码来源:Package.cs

示例3: Validate

        public IEnumerable<PackageIssue> Validate(IPackage package)
        {
            foreach (IPackageFile file in package.GetFiles())
            {
                string path = file.Path;
                string directory = Path.GetDirectoryName(path);

                // if under 'lib' directly
                if (directory.Equals(Constants.LibDirectory, StringComparison.OrdinalIgnoreCase))
                {
                    if (PackageHelper.IsAssembly(path))
                    {
                        yield return CreatePackageIssueForAssembliesUnderLib(path);
                    }
                }
                else if (!directory.StartsWith(Constants.LibDirectory + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase))
                {
                    // when checking for assemblies outside 'lib' folder, only check .dll files.
                    // .exe files are often legitimate outside 'lib'.
                    if (path.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) ||
                        path.EndsWith(".winmd", StringComparison.OrdinalIgnoreCase))
                    {
                        yield return CreatePackageIssueForAssembliesOutsideLib(path);
                    }
                }
            }
        }
开发者ID:aaasoft,项目名称:NuGet.Server,代码行数:27,代码来源:MisplacedAssemblyRule.cs

示例4: Execute

        public bool Execute(string installPath, string scriptFileName, IPackage package, Project project, FrameworkName targetFramework, ILogger logger)
        {
            string scriptPath, fullPath;
            if (package.FindCompatibleToolFiles(scriptFileName, targetFramework, out scriptPath))
            {
                fullPath = Path.Combine(installPath, scriptPath);
            }
            else
            {
                return false;
            }

            if (File.Exists(fullPath))
            {
                string toolsPath = Path.GetDirectoryName(fullPath);
                string logMessage = String.Format(CultureInfo.CurrentCulture, VsResources.ExecutingScript, fullPath);

                // logging to both the Output window and progress window.
                logger.Log(MessageLevel.Info, logMessage);

                IConsole console = OutputConsoleProvider.CreateOutputConsole(requirePowerShellHost: true);
                Host.Execute(console,
                    "[email protected](); $input|%{$__pc_args+=$_}; & " + PathHelper.EscapePSPath(fullPath) + " $__pc_args[0] $__pc_args[1] $__pc_args[2] $__pc_args[3]; Remove-Variable __pc_args -Scope 0",
                    new object[] { installPath, toolsPath, package, project });

                return true;
            }
            return false;
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:29,代码来源:PSScriptExecutor.cs

示例5: AddPackage

		public void AddPackage(IPackage package)
		{
			if (AddPackageCallback != null)
			{
				AddPackageCallback(package);
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:7,代码来源:FakeCorePackageRepository.cs

示例6: Validate

        public IEnumerable<PackageIssue> Validate(IPackage package)
        {
            if (package.ProjectUrl != null && package.ProjectUrl.OriginalString.Equals(SpecCommand.SampleProjectUrl, StringComparison.Ordinal))
            {
                yield return CreateIssueFor("ProjectUrl", package.ProjectUrl.OriginalString);
            }
            if (package.LicenseUrl != null && package.LicenseUrl.OriginalString.Equals(SpecCommand.SampleLicenseUrl, StringComparison.Ordinal))
            {
                yield return CreateIssueFor("LicenseUrl", package.LicenseUrl.OriginalString);
            }
            if (package.IconUrl != null && package.IconUrl.OriginalString.Equals(SpecCommand.SampleIconUrl, StringComparison.Ordinal))
            {
                yield return CreateIssueFor("IconUrl", package.IconUrl.OriginalString);
            }
            if (!String.IsNullOrEmpty(package.Tags) && package.Tags.Trim().Equals(SpecCommand.SampleTags, StringComparison.Ordinal))
            {
                yield return CreateIssueFor("Tags", SpecCommand.SampleTags);
            }
            if (SpecCommand.SampleReleaseNotes.Equals(package.ReleaseNotes, StringComparison.Ordinal))
            {
                yield return CreateIssueFor("ReleaseNotes", SpecCommand.SampleReleaseNotes);
            }
            if (SpecCommand.SampleDescription.Equals(package.Description, StringComparison.Ordinal))
            {
                yield return CreateIssueFor("Description", SpecCommand.SampleDescription);
            }

            var dependency = package.GetCompatiblePackageDependencies(targetFramework: null).FirstOrDefault();
            if (dependency != null && dependency.Id.Equals(SpecCommand.SampleManifestDependency.Id, StringComparison.Ordinal)
                                   && dependency.VersionSpec.ToString().Equals("[" + SpecCommand.SampleManifestDependency.Version + "]", StringComparison.Ordinal))
            {
                yield return CreateIssueFor("Dependency", dependency.ToString());
            }
        }
开发者ID:shrknt35,项目名称:sonarlint-vs,代码行数:34,代码来源:DefaultManifestValuesRule.cs

示例7: DetectUpgradeAction

        private static PackageUpgradeAction DetectUpgradeAction(PackageDependency dependency, IPackage recentPackage)
        {
            var upgradeType = PackageUpgradeAction.None;
            if (recentPackage == null)
            {
                upgradeType = PackageUpgradeAction.Unknown;
            }
            else if (dependency.VersionSpec.Satisfies(recentPackage.Version))
            {
                upgradeType = IsMinVersionUpgradeable(dependency, recentPackage)
                        ? PackageUpgradeAction.MinVersion
                        : PackageUpgradeAction.None;
            }
            else
            {
                var fromRelease = DependsOnReleaseVersion(dependency);

                if (recentPackage.IsReleaseVersion())
                {
                    upgradeType = fromRelease ? PackageUpgradeAction.ReleaseToRelease : PackageUpgradeAction.PrereleaseToRelease;
                }
                else
                {
                    upgradeType = fromRelease ? PackageUpgradeAction.ReleaseToPrerelease : PackageUpgradeAction.PrereleaseToPrerelease;
                }
            }

            return upgradeType;
        }
开发者ID:patricksadowski,项目名称:NuGet.Dgml,代码行数:29,代码来源:UpgradeWalker.cs

示例8: is_valid

        public override PackageValidationOutput is_valid(IPackage package)
        {
            var valid = true;

            var files = package.GetFiles().or_empty_list_if_null();

            foreach (var packageFile in files.or_empty_list_if_null())
            {
                string extension = Path.GetExtension(packageFile.Path).to_lower();
                if (extension != ".ps1" && extension != ".psm1") continue;

                var contents = packageFile.GetStream().ReadToEnd().to_lower();

                if (contents.Contains("install-chocolateypackage") ||
                    contents.Contains("start-chocolateyprocessasadmin") ||
                    contents.Contains("install-chocolateyinstallpackage") ||
                    contents.Contains("install-chocolateyenvironmentvariable") ||
                    contents.Contains("install-chocolateyexplorermenuitem") ||
                    contents.Contains("install-chocolateyfileassociation"))
                {
                    valid = package.Tags.to_string().Split(' ').Any(tag => tag.ToLower() == "admin");
                }
            }

            return valid;
        }
开发者ID:pkdevboxy,项目名称:package-validator,代码行数:26,代码来源:AdminTagShouldBeIncludedWhenUsingAdminHelpersGuideline.cs

示例9: AddPackage

        public void AddPackage(IPackage package)
        {
            // if the package is already present in the cache, no need to do anything
            if (FindPackage(package.Id, package.Version) != null)
            {
                return;
            }

            // create the cache directory if it doesn't exist
            var cacheDirectory = new DirectoryInfo(Source);
            if (!cacheDirectory.Exists)
            {
                cacheDirectory.Create();
            }

            // don't want to blow up user's hard drive with too many packages
            ClearCache(cacheDirectory, MaxNumberOfPackages);

            // now copy the package to the cache
            string filePath = GetPackageFilePath(package.Id, package.Version);
            using (Stream stream = package.GetStream(),
                          fileStream = File.Create(filePath))
            {
                if (stream != null)
                {
                    stream.CopyTo(fileStream);
                }
            }
        }
开发者ID:campersau,项目名称:NuGetPackageExplorer,代码行数:29,代码来源:MachineCache.cs

示例10: GetInstallPackageOperations

		public override IEnumerable<PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
		{
			if (ExceptionToThrowWhenGetInstallPackageOperationsCalled != null) {
				throw ExceptionToThrowWhenGetInstallPackageOperationsCalled;
			}
			return base.GetInstallPackageOperations(package, installAction);
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:7,代码来源:ExceptionThrowingPackageManagementProject.cs

示例11: LoadPackages

 public void LoadPackages(IPackage appPackage)
 {
     this._packageTable = new Hashtable();
     if (appPackage != null)
     {
         appPackage.Initialize(this._serviceProvider);
         this._packageTable.Add(typeof(IApplicationPackage), appPackage);
     }
     IPackage package = new CorePackage();
     package.Initialize(this._serviceProvider);
     this._packageTable.Add(typeof(CorePackage), package);
     IDictionary config = (IDictionary) ConfigurationSettings.GetConfig("microsoft.matrix/packages");
     if (config != null)
     {
         IDictionaryEnumerator enumerator = config.GetEnumerator();
         while (enumerator.MoveNext())
         {
             DictionaryEntry current = (DictionaryEntry) enumerator.Current;
             string packageTypeName = (string) current.Value;
             try
             {
                 this.LoadPackage(packageTypeName);
                 continue;
             }
             catch (Exception)
             {
                 continue;
             }
         }
     }
 }
开发者ID:ikvm,项目名称:webmatrix,代码行数:31,代码来源:PackageManager.cs

示例12: Parse

        public void Parse(byte[] packagebodybyte, IPackage package)
        {
            try
            {
                byte[] header = packagebodybyte.Take(min_body_header_length).ToArray();
                byte[] body = packagebodybyte.Skip(min_body_header_length).Take(packagebodybyte.Length - min_body_header_length).ToArray();

                ipp_Header ippheader = new ipp_Header(header);
                ipp_Body ippbody = new ipp_Body(body, _defEncoding);

                Indexes indexes = new Indexes(0, 6);

                package.PCC = ippbody.GetString(indexes);
                package.UID = ippbody.GetUid(indexes.Next(24));//ci + ippheader.PT + ippheader.PCT, ippheader.PCT);
                package.PD = ippbody.GetDatetime(indexes.Next(14));//ci + ippheader.PT + ippheader.PCT, ippheader.PCT);

                package.IPPV = ippbody.GetString(indexes.Next(ippheader.IPPV));//ci, ippheader.PT);
                package.PT = ippbody.GetInt(indexes.Next(ippheader.PT));//ci, ippheader.PT);
                package.PCT = ippbody.GetInt(indexes.Next(ippheader.PCT));//ci + ippheader.PT, ippheader.PCT);

                package.PCL = ippbody.GetInt(indexes.Next(ippheader.PCL));//ci + ippheader.PT + ippheader.PCT, ippheader.PCT);
                package.PS = ippbody.GetString(indexes.Next(ippheader.PS));//ci + ippheader.PT + ippheader.PCT + ippheader.PCL, ippheader.PS);
                package.PR = ippbody.GetString(indexes.Next(ippheader.PR));//ci + ippheader.PT + ippheader.PCT + ippheader.PCL + ippheader.PS, ippheader.PR);
                package.PCN = ippbody.GetString(indexes.Next(ippheader.PCN));//ci + ippheader.PT + ippheader.PCT + ippheader.PCL + ippheader.PS + ippheader.PR, ippheader.PS);
                package.PC = body.Skip(indexes.Index + indexes.Count).Take(body.Length - indexes.Index + indexes.Count).ToArray();//ci + ippheader.PT + ippheader.PCT + ippheader.PCL, ippheader.PCT);
            }
            catch (Exception e)
            {

            }
        }
开发者ID:WinHuStudio,项目名称:iTrip,代码行数:31,代码来源:ProxyPraser.cs

示例13: PutAsync

        public async Task<Hash> PutAsync(long id, SemanticVersion version, IPackage package)
        {
            #region Preconditions

            if (package == null) throw new ArgumentNullException(nameof(package));

            #endregion

            var key = id.ToString() + "/" + version.ToString();

            using (var ms = new MemoryStream())
            {
                await package.ZipToStreamAsync(ms).ConfigureAwait(false);

                var hash = Hash.ComputeSHA256(ms, leaveOpen: true);

                var blob = new Blob(ms) {
                    ContentType = "application/zip"
                };

                await bucket.PutAsync(key, blob).ConfigureAwait(false);

                return hash;
            }
        }
开发者ID:carbon,项目名称:Platform,代码行数:25,代码来源:PackageStore.cs

示例14: Parse

        public static ServerPackageMetadata Parse(IPackage package)
        {
            var Version = NuGetVersion.Parse(package.Version.ToString());
            var Published = package.Published;
            var title = String.IsNullOrEmpty(package.Title) ? package.Id : package.Title;
            var summary = package.Summary;
            var desc = package.Description;
            //*TODOs: Check if " " is the separator in the case of V3 jobjects ...
            var authors = package.Authors;
            var owners = package.Owners;
            var iconUrl = package.IconUrl;
            var licenseUrl = package.LicenseUrl;
            var projectUrl = package.ProjectUrl;
            IEnumerable<string> tags = package.Tags == null ? new string[0] : package.Tags.Split(' ');
            var dependencySets = package.DependencySets.Select(p => GetVisualStudioUIPackageDependencySet(p));
            var requiresLiceneseAcceptance = package.RequireLicenseAcceptance;

            var identity = new PackageIdentity(package.Id, Version);

            NuGetVersion minClientVersion = null;

            if (package.MinClientVersion != null)
            {
                NuGetVersion.TryParse(package.MinClientVersion.ToString(), out minClientVersion);
            }

            var downloadCount = package.DownloadCount;

            // This concept is not in v2 yet
            IEnumerable<string> types = new string[] { "Package" };

            return new ServerPackageMetadata(
                identity, title, summary, desc, authors, iconUrl, licenseUrl,
                projectUrl, tags, Published, dependencySets, requiresLiceneseAcceptance, minClientVersion, downloadCount, -1, owners, types);
        }
开发者ID:eerhardt,项目名称:NuGet3,代码行数:35,代码来源:ParsePackageMetadataV2.cs

示例15: WalkPackage

		void WalkPackage (IPackage package)
		{
			var localRepository = new FakePackageRepository ();
			var sourceRepository = new FakePackageRepository ();
			var walker = new InstallWalker (localRepository, sourceRepository, null, NullLogger.Instance, true, false, DependencyVersion.Lowest);
			walker.Walk (package);
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:MinClientVersionTests.cs


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