/// <summary> /// Creates a new <see cref="GeneralKeyHeader"/> with the /// <paramref name="reader"/> from which to read information from. /// </summary> /// <param name="reader">The <see cref="BinaryReader"/> /// from which to source the information from.</param> public GeneralKeyHeader(BinaryReader reader) { this.keyType = (KeyTypes)reader.ReadByte(); this.version = reader.ReadByte(); this.reserved = reader.ReadUInt16(); this.algorithmId = reader.ReadUInt32(); this.keyTypeId = (KeyIdentifiers)reader.ReadUInt32(); this.bitLength = reader.ReadUInt32(); this.exponent = reader.ReadUInt32(); }
public bool IsValid() { return(!string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Title) && !string.IsNullOrEmpty(Description) && Uri.IsWellFormedUriString(Url.ToString(), UriKind.RelativeOrAbsolute) && Uri.IsWellFormedUriString(ParentStoryUrl.ToString(), UriKind.RelativeOrAbsolute) && KeyIdentifiers != null && KeyIdentifiers.Any() ? KeyIdentifiers.All(s => s.IsValid()) : true && TestCases != null && TestCases.Any() ? TestCases.All(s => s.IsValid()) : true && Checkups != null && Checkups.Any() ? Checkups.All(s => s.IsValid()) : true && Attachments != null && Attachments.Any() ? Attachments.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && Queries != null && Queries.Any() ? Queries.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && Scripts != null && Scripts.Any() ? Scripts.All(s => Uri.IsWellFormedUriString(s.Value, UriKind.RelativeOrAbsolute)) : true && SubTasks.Any() ? SubTasks.All(s => s.IsValid()) : true); }
/// <summary> /// Creates a new <see cref="GeneralKeyHeader"/> with the /// <paramref name="keyType"/>, <paramref name="bitLength"/> /// and <paramref name="exponent"/> provided. /// </summary> /// <param name="keyType">The <see cref="KeyTypes"/> value which determines /// whether the <see cref="GeneralKeyHeader"/> is for a public or a private /// key.</param> /// <param name="bitLength">The <see cref="UInt32"/> which determines the number of bits /// used to construct the cryptographic key used by the algorithm.</param> /// <param name="exponent">The <see cref="UInt32"/> value denoting the public exponent of the /// current key pair.</param> public GeneralKeyHeader(KeyTypes keyType, uint bitLength, uint exponent) { switch (keyType) { case KeyTypes.PublicKey: this.keyTypeId = KeyIdentifiers.PublicKey; break; case KeyTypes.PrivateKey: this.keyTypeId = KeyIdentifiers.PrivateKey; break; default: this.keyTypeId = KeyIdentifiers.None; break; } this.keyType = keyType; this.bitLength = bitLength; this.version = StrongNameVersion; this.reserved = 0; this.algorithmId = RSASigningAlgorithmId; this.exponent = exponent; }
private FlowDocument BuildDocument() { var doc = new FlowDocument(); doc.LineStackingStrategy = System.Windows.LineStackingStrategy.BlockLineHeight; doc.LineHeight = 12; doc.Blocks.Add(new Paragraph(new Bold(new Run("Summary")))); doc.Blocks.Add(new Paragraph(new Run(" " + Title))); doc.Blocks.Add(new Paragraph(new Bold(new Run("Description")))); doc.Blocks.Add(new Paragraph(new Run(" " + Description))); doc.Blocks.Add(new Paragraph(new Bold(new Run("Url")))); var url = new Hyperlink(new Run(Url.ToString())); doc.Blocks.Add(new Paragraph(url)); doc.Blocks.Add(new Paragraph(new Bold(new Run("Parent Story")))); var parentUrl = new Hyperlink(new Run(ParentStoryUrl.ToString())); parentUrl.NavigateUri = ParentStoryUrl; doc.Blocks.Add(new Paragraph(parentUrl)); doc.Blocks.Add(new Paragraph(new Italic(new Run("Status: " + Status.ToString())))); doc.Blocks.Add(new Paragraph(new Italic(new Run("Date Started: " + DateStarted.Value.ToString("yyyy-MM-dd hh:mm:ss"))))); if (DateEnded.HasValue && DateEnded.Value != DateTime.MinValue) { doc.Blocks.Add(new Paragraph(new Italic(new Run("Date Ended: " + DateEnded.Value.ToString("yyyy-MM-dd hh:mm:ss"))))); } if (Attachments.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Attachments")))); foreach (var item in Attachments) { var itemUri = new Uri(item.Value); var itemUrl = new Hyperlink(new Run(item.Value)); doc.Blocks.Add(new Paragraph(itemUrl)); } } if (AcceptanceCriteria.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Acceptance Criteria")))); foreach (var item in AcceptanceCriteria) { doc.Blocks.Add(new Paragraph(new Run(" + " + item.Value))); } } if (DeveloperCriteria.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Development Criteria")))); foreach (var item in DeveloperCriteria) { doc.Blocks.Add(new Paragraph(new Run(" + " + item.Value))); } } var i = 0; var j = 0; if (KeyIdentifiers.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Key Identifiers")))); foreach (var item in KeyIdentifiers) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); if (item.Questions.Any()) { j = 0; doc.Blocks.Add(new Paragraph(new Italic(new Run(" Questions")))); foreach (var q in item.Questions) { doc.Blocks.Add(new Paragraph(new Run(" " + (++j).ToString() + ".Q. " + q.Ask))); doc.Blocks.Add(new Paragraph(new Run(" A. " + q.Answer))); } } } } if (Issues.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("Issues")))); foreach (var item in Issues) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Is Open: " + item.IsOpen.ToString())))); } } if (Queries.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Queries")))); foreach (var item in Queries) { var itemUri = new Uri(item.Value); var itemUrl = new Hyperlink(new Run(item.Value)); doc.Blocks.Add(new Paragraph(itemUrl)); } } if (Scripts.Any()) { doc.Blocks.Add(new Paragraph(new Bold(new Run("Scripts")))); foreach (var item in Scripts) { var itemUri = new Uri(item.Value); var itemUrl = new Hyperlink(new Run(item.Value)); doc.Blocks.Add(new Paragraph(itemUrl)); } } if (TestCases.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("Test Cases")))); foreach (var item in TestCases) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Status: " + item.Status.ToString())))); if (item.Steps.Any()) { j = 0; doc.Blocks.Add(new Paragraph(new Italic(new Run(" Steps")))); foreach (var q in item.Steps) { doc.Blocks.Add(new Paragraph(new Run(" " + (++j).ToString() + ". " + q.Value))); } } } } if (Checkups.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("Checkups")))); foreach (var item in Checkups) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Description))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Applied: " + item.Applied.ToString())))); } } if (SubTasks.Any()) { i = 0; doc.Blocks.Add(new Paragraph(new Bold(new Run("SubTasks")))); foreach (var item in SubTasks) { doc.Blocks.Add(new Paragraph(new Run(" " + (++i).ToString() + ". " + item.Title))); doc.Blocks.Add(new Paragraph(new Italic(new Run(" Status: " + item.Status)))); } } return(doc); }