private void ProcessServiceMessage(ServiceMessage message) { switch (message.Name) { case ServiceMessageNames.SetVariable.Name: var variableName = message.GetValue(ServiceMessageNames.SetVariable.NameAttribute); var variableValue = message.GetValue(ServiceMessageNames.SetVariable.ValueAttribute); if (!string.IsNullOrWhiteSpace(variableName)) variables.SetOutputVariable(variableName, variableValue); break; } }
void ParseServiceMessage(ServiceMessage message) { switch (message.Name) { case ServiceMessageNames.SetVariable.Name: var variableName = message.GetValue(ServiceMessageNames.SetVariable.NameAttribute); var variableValue = message.GetValue(ServiceMessageNames.SetVariable.ValueAttribute); if (!string.IsNullOrWhiteSpace(variableName)) outputVariables.Set(variableName, variableValue); break; case ServiceMessageNames.CalamariFoundPackage.Name: CalamariFoundPackage = true; break; case ServiceMessageNames.FoundPackage.Name: var foundPackageId = message.GetValue(ServiceMessageNames.FoundPackage.IdAttribute); var foundPackageVersion = message.GetValue(ServiceMessageNames.FoundPackage.VersionAttribute); var foundPackageHash = message.GetValue(ServiceMessageNames.FoundPackage.HashAttribute); var foundPackageRemotePath = message.GetValue(ServiceMessageNames.FoundPackage.RemotePathAttribute); FoundPackage = new StoredPackage( new PackageMetadata { Id = foundPackageId, Version = foundPackageVersion, Hash = foundPackageHash }, foundPackageRemotePath); break; case ServiceMessageNames.PackageDeltaVerification.Name: var pdvHash = message.GetValue(ServiceMessageNames.PackageDeltaVerification.HashAttribute); var pdvSize = message.GetValue(ServiceMessageNames.PackageDeltaVerification.SizeAttribute); var pdvRemotePath = message.GetValue(ServiceMessageNames.PackageDeltaVerification.RemotePathAttribute); DeltaVerification = new StoredPackage(new PackageMetadata {Hash = pdvHash}, pdvRemotePath); break; } }