public static GenerateHash ( byte input ) : string | ||
input | byte | |
Результат | string |
public override void ExecuteCommand() { using (var sqlConnection = new SqlConnection(ConnectionString.ConnectionString)) using (var dbExecutor = new SqlExecutor(sqlConnection)) { sqlConnection.Open(); var package = Util.GetPackage( dbExecutor, PackageId, PackageVersion); if (package == null) { Log.Info("Package '{0}.{1}' does not exist; exiting."); return; } new BackupPackageFileTask { StorageAccount = StorageAccount, PackageId = package.Id, PackageVersion = package.Version, PackageHash = package.Hash }.ExecuteCommand(); var hash = Util.GenerateHash(ReplacementFile.AsSeekableStream()); Log.Info("Updating hash for package '{0}.{1}' to '{2}'", package.Id, package.Version, hash); dbExecutor.Execute( "UPDATE Packages SET Hash = @hash WHERE [Key] = @key", new { @key = package.Key, hash }); Log.Info("Uploading replacement file for package '{0}.{1}'", package.Id, package.Version); ReplacementFile.Position = 0; new UploadPackageTask { StorageAccount = StorageAccount, PackageId = package.Id, PackageVersion = package.Version, PackageFile = ReplacementFile }.ExecuteCommand(); } }