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


C# SemanticVersion.ToString方法代码示例

本文整理汇总了C#中SemanticVersion.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SemanticVersion.ToString方法的具体用法?C# SemanticVersion.ToString怎么用?C# SemanticVersion.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SemanticVersion的用法示例。


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

示例1: 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

示例2: GeneralCtorTest

 public void GeneralCtorTest()
 {
     SemanticVersion v = new SemanticVersion(0, 2, 1);
     Assert.Equal("0.2.1", v.ToString());
     Assert.Equal("0.2.1", v.ToString("C"));
     Assert.Equal("0.2.1", v.ToString("G"));
 }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:7,代码来源:CompareTest.cs

示例3: AttemptToGetPackageFromCache

        private void AttemptToGetPackageFromCache(string packageId, SemanticVersion version, string feedId, string cacheDirectory, out IPackage downloaded, out string downloadedTo)
        {
            downloaded = null;
            downloadedTo = null;

            Log.VerboseFormat("Checking package cache for package {0} {1}", packageId, version.ToString());

            var name = GetNameOfPackage(packageId, version.ToString());
            fileSystem.EnsureDirectoryExists(cacheDirectory);

            var files = fileSystem.EnumerateFilesRecursively(cacheDirectory, name + "*.nupkg");

            foreach (var file in files)
            {
                var package = ReadPackageFile(file);
                if (package == null)
                    continue;

                if (!string.Equals(package.Id, packageId, StringComparison.OrdinalIgnoreCase) || !string.Equals(package.Version.ToString(), version.ToString(), StringComparison.OrdinalIgnoreCase))
                    continue;

                downloaded = package;
                downloadedTo = file;
            }
        }
开发者ID:bjewell52,项目名称:Calamari,代码行数:25,代码来源:PackageDownloader.cs

示例4: FullCtorTest

 public void FullCtorTest()
 {
     PreRelease pre = new PreRelease(PreReleaseStage.BETA, 5);
     SemanticVersion v = new SemanticVersion(0, 2, 1, pre, 1000);
     Assert.Equal("0.2.1-BETA.5+1000", v.ToString());
     Assert.Equal("0.2.1-BETA.5", v.ToString("C"));
     Assert.Equal("0.2.1", v.ToString("G"));
 }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:8,代码来源:CompareTest.cs

示例5: ComparableCtorTest

 public void ComparableCtorTest()
 {
     PreRelease pre = new PreRelease(PreReleaseStage.ALPHA);
     SemanticVersion v = new SemanticVersion(0, 2, 1, pre);
     Assert.Equal("0.2.1-ALPHA", v.ToString(""));
     Assert.Equal("0.2.1-ALPHA", v.ToString("C"));
     Assert.Equal("0.2.1", v.ToString("G"));
 }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:8,代码来源:CompareTest.cs

示例6: GetAllPackages

        private IEnumerable<NuDeployPackageInfo> GetAllPackages()
        {
            IEnumerable<PackageInfo> installedPackages = this.packageConfigurationAccessor.GetInstalledPackages();

            foreach (PackageInfo package in installedPackages)
            {
                string packagePrefix = string.Format("{0}.", package.Id);

                var packageDirectories =
                    this.filesystemAccessor.GetSubDirectories(this.applicationInformation.StartupFolder).Where(
                        dir => dir.Name.StartsWith(packagePrefix, StringComparison.OrdinalIgnoreCase));

                foreach (DirectoryInfo packageDirectory in packageDirectories)
                {
                    string packageVersionString = packageDirectory.Name.Replace(string.Format("{0}.", package.Id), string.Empty);
                    var packageVersion = new SemanticVersion(packageVersionString);
                    var isInstalled = packageVersion.ToString().Equals(package.Version);

                    yield return new NuDeployPackageInfo
                        {
                            Id = package.Id,
                            Version = packageVersion,
                            Folder = packageDirectory.FullName,
                            IsInstalled = isInstalled
                        };
                }
            }
        }
开发者ID:andreaskoch,项目名称:NuDeploy,代码行数:28,代码来源:InstallationStatusProvider.cs

示例7: DownloadPackage

        public void DownloadPackage(HttpContextBase context)
        {
            RouteData routeData = GetRouteData(context);
            // Get the package file name from the route
            string packageId = routeData.GetRequiredString("packageId");
            var version = new SemanticVersion(routeData.GetRequiredString("version"));

            string filename = packageId + "." + version.ToString() + ".nupkg";

            IPackage requestedPackage = _azureRepository.FindPackage(packageId, version);

            if (requestedPackage != null)
            {
                CloudBlockBlob blob = _azureRepository.GetBlob(requestedPackage);

                MemoryStream ms = new MemoryStream();
                blob.DownloadToStream(ms);

                context.Response.Clear();
                context.Response.AddHeader("content-disposition", String.Format("attachment; filename={0}", filename));
                context.Response.ContentType = "application/octet-stream";
                context.Response.BinaryWrite(ms.ToArray());
                context.Response.End();
                
            }
            else
            {
                // Package not found
                WritePackageNotFound(context, packageId, version);
            }
        }
开发者ID:purplepiranha,项目名称:Nuget.Server.AzureStorage,代码行数:31,代码来源:AzurePackageService.cs

示例8: GetVersion

		static string GetVersion(SemanticVersion version)
		{
			if (version != null) {
				return version.ToString();
			}
			return null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:IPackageFromRepositoryExtensions.cs

示例9: BumpPatchVersion

 public void BumpPatchVersion()
 {
    
     var semver = new SemanticVersion(Version);
     var newVer = new SemanticVersion(semver.Major, semver.Minor, semver.Patch+1,build:null, preRelease: null);
     Version = FileVersion = newVer.ToString();
 }
开发者ID:RejectKid,项目名称:MakeSharp,代码行数:7,代码来源:AssemblyInfo.cs

示例10: GetAsync

        public async Task<Package> GetAsync(long id, SemanticVersion version, Hash hash)
        {
            var key = prefix + id.ToString() + "/" + version.ToString();

            var ms = new MemoryStream();

            using (var blob = await bucket.GetAsync(key))
            {
                using (var data = blob.Open())
                {
                    await data.CopyToAsync(ms).ConfigureAwait(false);
                }
            }

            ms.Position = 0;
            
            var secret = SecretKey.Derive(password, hash.Data);

            var protector = new AesProtector(secret); // dispose?

            var stream = protector.DecryptStream(ms);

            #region Verify the hash

            var computedHash = Hash.ComputeSHA256(stream, true);

            if (computedHash != hash)
            {
                throw new IntegrityException(hash.Data, computedHash.Data);
            }

            #endregion

            return ZipPackage.FromStream(stream, false);
        }
开发者ID:carbon,项目名称:Platform,代码行数:35,代码来源:ProtectedPackageStore.cs

示例11: PutAsync

        public async Task<Hash> PutAsync(long id, SemanticVersion version, IPackage package)
        {
            var key = prefix + id.ToString() + "/" + version.ToString();

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

                ms.Position = 0;

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

                var secret = SecretKey.Derive(password, hash.Data);

                using (var protector = new AesProtector(secret))
                {
                    using (var packageStream = protector.EncryptStream(ms))
                    {
                        var blob = new Blob(packageStream) {
                            ContentType = "application/zip"
                        };

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

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

示例12: WillReturnConflictIfAPackageWithTheIdAndSemanticVersionAlreadyExists

            public void WillReturnConflictIfAPackageWithTheIdAndSemanticVersionAlreadyExists()
            {
                var version = new SemanticVersion("1.0.42");
                var nuGetPackage = new Mock<IPackage>();
                nuGetPackage.Setup(x => x.Id).Returns("theId");
                nuGetPackage.Setup(x => x.Version).Returns(version);

                var user = new User();

                var packageRegistration = new PackageRegistration
                {
                    Packages = new List<Package> { new Package { Version = version.ToString() } },
                    Owners = new List<User> { user }
                };

                var packageSvc = new Mock<IPackageService>();
                packageSvc.Setup(x => x.FindPackageRegistrationById(It.IsAny<string>())).Returns(packageRegistration);
                var userSvc = new Mock<IUserService>();
                userSvc.Setup(x => x.FindByApiKey(It.IsAny<Guid>())).Returns(user);
                var controller = CreateController(userSvc: userSvc, packageSvc: packageSvc, packageFromInputStream: nuGetPackage.Object);

                // Act
                var result = controller.CreatePackagePut(Guid.NewGuid().ToString());

                // Assert
                Assert.IsType<HttpStatusCodeWithBodyResult>(result);
                var statusCodeResult = (HttpStatusCodeWithBodyResult)result;
                Assert.Equal(409, statusCodeResult.StatusCode);
                Assert.Equal(String.Format(Strings.PackageExistsAndCannotBeModified, "theId", "1.0.42"), statusCodeResult.StatusDescription);
            }
开发者ID:Redsandro,项目名称:chocolatey.org,代码行数:30,代码来源:ApiControllerFacts.cs

示例13: GetPackageDirectory

 public virtual string GetPackageDirectory(string packageId, SemanticVersion version)
 {
     string directory = packageId;
     if (_useSideBySidePaths)
     {
         directory = Path.Combine(directory, version.ToString());
     }
     return directory;
 }
开发者ID:AlanFrey,项目名称:dnx,代码行数:9,代码来源:DefaultPackagePathResolver.cs

示例14: SemanticVersion

        void INuGet.SavePackageVersion(string path, Version version)
        {
            var manifest = Manifest.ReadFrom(null, false);

            var semanticVersion = new SemanticVersion(version);
            manifest.Metadata.Version = semanticVersion.ToString();

            manifest.Save(null);
        }
开发者ID:run00,项目名称:SemVer,代码行数:9,代码来源:NuGet.cs

示例15: StringConstructorParsesValuesCorrectly

        public void StringConstructorParsesValuesCorrectly(string version, Version versionValue, string specialValue)
        {
            // Act
            SemanticVersion semanticVersion = new SemanticVersion(version);

            // Assert
            Assert.Equal(versionValue, semanticVersion.Version);
            Assert.Equal(specialValue, semanticVersion.SpecialVersion);
            Assert.Equal(version, semanticVersion.ToString());
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:10,代码来源:SemanticVersionTest.cs


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