public void String() { var f = new Fingerprint(ValueKind.Null, 1); Assert.Equal("Null [1 B]", f.ToString()); f = new Fingerprint(ValueKind.Boolean, 1, new byte[] { 1 }); Assert.Equal("Boolean 01 [1 B]", f.ToString()); f = new Fingerprint(ValueKind.Binary, 7, new byte[] { 0x12, 0xff, 0xab, 0x67, 0x99 }); Assert.Equal("Binary 12ffab6799 [7 B]", f.ToString()); f = new Fingerprint(ValueKind.List, 100, new byte[20]); Assert.Equal("List 0000000000000000000000000000000000000000 [100 B]", f.ToString()); }
/// <summary> /// Returns a string representation of the packet. This is /// a human readable formated representation that has nothing /// to do with OpenPGP or RFC2440 /// </summary> /// <returns>String representation of the packet.</returns> /// <remarks>No remarks</remarks> public override string ToString() { string strReturn = ""; strReturn += "PublicKeyPacket:\r\n"; strReturn += "Version: " + Version.ToString() + "\r\n"; strReturn += "Algorithm: " + Algorithm.ToString() + "\r\n"; strReturn += "Time Created: " + TimeCreated.ToLocalTime() + "\r\n"; strReturn += "Fingerprint: 0x" + Fingerprint.ToString(16) + "\r\n"; strReturn += "KeyID: " + KeyID.ToString() + "\r\n"; strReturn += "Key Material:\r\n"; for (int i = 0; i < KeyMaterial.Length; i++) { strReturn += KeyMaterial[i].ToString(16) + "\r\n\r\n"; } return(strReturn + "----\r\n\r\n"); }
protected override async Task ProcessCommandInternalAsync( AgentTaskPluginExecutionContext context, Fingerprint fingerprint, Func <Fingerprint[]> restoreKeysGenerator, string path, CancellationToken token) { context.SetTaskVariable(RestoreStepRanVariableName, RestoreStepRanVariableValue); context.SetTaskVariable(ResolvedFingerPrintVariableName, fingerprint.ToString()); var server = new PipelineCacheServer(context); Fingerprint[] restoreFingerprints = restoreKeysGenerator(); await server.DownloadAsync( context, (new [] { fingerprint }).Concat(restoreFingerprints).ToArray(), path, context.GetInput(PipelineCacheTaskPluginConstants.CacheHitVariable, required: false), token); }
protected override async Task ProcessCommandInternalAsync( AgentTaskPluginExecutionContext context, Fingerprint keyFingerprint, Func <Fingerprint[]> restoreKeysGenerator, string[] pathSegments, string workspaceRoot, CancellationToken token) { string contentFormatValue = context.Variables.GetValueOrDefault(ContentFormatVariableName)?.Value ?? string.Empty; string calculatedFingerPrint = context.TaskVariables.GetValueOrDefault(ResolvedFingerPrintVariableName)?.Value ?? string.Empty; if (!string.IsNullOrWhiteSpace(calculatedFingerPrint) && !keyFingerprint.ToString().Equals(calculatedFingerPrint, StringComparison.Ordinal)) { context.Warning($"The given cache key has changed in it's resolved value between restore and save steps;\n" + $"original key: {calculatedFingerPrint}\n" + $"modified key: {keyFingerprint}\n"); } ContentFormat contentFormat; if (string.IsNullOrWhiteSpace(contentFormatValue)) { contentFormat = ContentFormat.SingleTar; } else { contentFormat = Enum.Parse <ContentFormat>(contentFormatValue, ignoreCase: true); } PipelineCacheServer server = new PipelineCacheServer(context); await server.UploadAsync( context, keyFingerprint, pathSegments, workspaceRoot, token, contentFormat); }
/// <inheritdoc /> public void Add(Fingerprint fingerprint) { WriteJson(fingerprint.ToString()); }
/// <inheritdoc /> public void Add(AbsolutePath path, Fingerprint fingerprint) { WriteJson(PathToString(path), fingerprint.ToString()); }
/// <inheritdoc /> public void Add(string name, Fingerprint fingerprint) { WriteJson(name, fingerprint.ToString()); }
public void ToStringIsToHex() { var v = new Fingerprint("ABCD"); Assert.Equal(v.ToHex(), v.ToString()); }
public override string ToString() { StringBuilder __sb = new StringBuilder("THProcessAppOpenRequest("); bool __first = true; if (Fingerprint != null && __isset.fingerprint) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Fingerprint: "); __sb.Append(Fingerprint == null ? "<null>" : Fingerprint.ToString()); } if (Referrer != null && __isset.referrer) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Referrer: "); __sb.Append(Referrer); } if (DeepLinkUrl != null && __isset.deepLinkUrl) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DeepLinkUrl: "); __sb.Append(DeepLinkUrl); } if (__isset.isNewInstall) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("IsNewInstall: "); __sb.Append(IsNewInstall); } if (Referrers != null && __isset.referrers) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Referrers: "); __sb.Append(Referrers); } if (ReferrerData != null && __isset.referrerData) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("ReferrerData: "); __sb.Append(ReferrerData); } if (DeviceInfo != null && __isset.deviceInfo) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DeviceInfo: "); __sb.Append(DeviceInfo); } __sb.Append(")"); return(__sb.ToString()); }