diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:47:32 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:47:32 +0700 |
commit | a395a34a769d3c7e6616129f4832b7014dbbfe98 (patch) | |
tree | 76a4749c2f548afff826c6758de3c8ce0b6fd646 /crypto/src/asn1 | |
parent | Generics migration complete (diff) | |
download | BouncyCastle.NET-ed25519-a395a34a769d3c7e6616129f4832b7014dbbfe98.tar.xz |
Cleanup NewLine handling
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/util/Asn1Dump.cs | 3 | ||||
-rw-r--r-- | crypto/src/asn1/x509/AuthorityInformationAccess.cs | 13 | ||||
-rw-r--r-- | crypto/src/asn1/x509/CRLDistPoint.cs | 14 | ||||
-rw-r--r-- | crypto/src/asn1/x509/DistributionPoint.cs | 25 | ||||
-rw-r--r-- | crypto/src/asn1/x509/DistributionPointName.cs | 27 | ||||
-rw-r--r-- | crypto/src/asn1/x509/GeneralNames.cs | 13 | ||||
-rw-r--r-- | crypto/src/asn1/x509/IssuingDistributionPoint.cs | 32 |
7 files changed, 43 insertions, 84 deletions
diff --git a/crypto/src/asn1/util/Asn1Dump.cs b/crypto/src/asn1/util/Asn1Dump.cs index faf9294df..7bae766c3 100644 --- a/crypto/src/asn1/util/Asn1Dump.cs +++ b/crypto/src/asn1/util/Asn1Dump.cs @@ -248,7 +248,8 @@ namespace Org.BouncyCastle.Asn1.Utilities else { buf.Append(indent); - buf.AppendLine(obj.ToString()); + buf.Append(obj); + buf.AppendLine(); } } diff --git a/crypto/src/asn1/x509/AuthorityInformationAccess.cs b/crypto/src/asn1/x509/AuthorityInformationAccess.cs index 57868baea..382513674 100644 --- a/crypto/src/asn1/x509/AuthorityInformationAccess.cs +++ b/crypto/src/asn1/x509/AuthorityInformationAccess.cs @@ -94,18 +94,13 @@ namespace Org.BouncyCastle.Asn1.X509 //return "AuthorityInformationAccess: Oid(" + this.descriptions[0].AccessMethod.Id + ")"; StringBuilder buf = new StringBuilder(); - string sep = Platform.NewLine; - - buf.Append("AuthorityInformationAccess:"); - buf.Append(sep); - + buf.AppendLine("AuthorityInformationAccess:"); foreach (AccessDescription description in descriptions) { - buf.Append(" "); - buf.Append(description); - buf.Append(sep); + buf.Append(" ") + .Append(description) + .AppendLine(); } - return buf.ToString(); } } diff --git a/crypto/src/asn1/x509/CRLDistPoint.cs b/crypto/src/asn1/x509/CRLDistPoint.cs index 446bb19db..518bf3f00 100644 --- a/crypto/src/asn1/x509/CRLDistPoint.cs +++ b/crypto/src/asn1/x509/CRLDistPoint.cs @@ -72,16 +72,12 @@ namespace Org.BouncyCastle.Asn1.X509 public override string ToString() { StringBuilder buf = new StringBuilder(); - string sep = Platform.NewLine; - - buf.Append("CRLDistPoint:"); - buf.Append(sep); - DistributionPoint[] dp = GetDistributionPoints(); - for (int i = 0; i != dp.Length; i++) + buf.AppendLine("CRLDistPoint:"); + foreach (DistributionPoint dp in GetDistributionPoints()) { - buf.Append(" "); - buf.Append(dp[i]); - buf.Append(sep); + buf.Append(" ") + .Append(dp) + .AppendLine(); } return buf.ToString(); } diff --git a/crypto/src/asn1/x509/DistributionPoint.cs b/crypto/src/asn1/x509/DistributionPoint.cs index 54ab930a5..f35586016 100644 --- a/crypto/src/asn1/x509/DistributionPoint.cs +++ b/crypto/src/asn1/x509/DistributionPoint.cs @@ -106,43 +106,34 @@ namespace Org.BouncyCastle.Asn1.X509 public override string ToString() { - string sep = Platform.NewLine; StringBuilder buf = new StringBuilder(); - buf.Append("DistributionPoint: ["); - buf.Append(sep); + buf.AppendLine("DistributionPoint: ["); if (distributionPoint != null) { - appendObject(buf, sep, "distributionPoint", distributionPoint.ToString()); + AppendObject(buf, "distributionPoint", distributionPoint.ToString()); } if (reasons != null) { - appendObject(buf, sep, "reasons", reasons.ToString()); + AppendObject(buf, "reasons", reasons.ToString()); } if (cRLIssuer != null) { - appendObject(buf, sep, "cRLIssuer", cRLIssuer.ToString()); + AppendObject(buf, "cRLIssuer", cRLIssuer.ToString()); } - buf.Append("]"); - buf.Append(sep); + buf.AppendLine("]"); return buf.ToString(); } - private void appendObject( - StringBuilder buf, - string sep, - string name, - string val) + private void AppendObject(StringBuilder buf, string name, string val) { string indent = " "; - buf.Append(indent); buf.Append(name); - buf.Append(":"); - buf.Append(sep); + buf.AppendLine(":"); buf.Append(indent); buf.Append(indent); buf.Append(val); - buf.Append(sep); + buf.AppendLine(); } } } diff --git a/crypto/src/asn1/x509/DistributionPointName.cs b/crypto/src/asn1/x509/DistributionPointName.cs index 43fdaf533..bca54fa06 100644 --- a/crypto/src/asn1/x509/DistributionPointName.cs +++ b/crypto/src/asn1/x509/DistributionPointName.cs @@ -92,39 +92,30 @@ namespace Org.BouncyCastle.Asn1.X509 public override string ToString() { - string sep = Platform.NewLine; StringBuilder buf = new StringBuilder(); - buf.Append("DistributionPointName: ["); - buf.Append(sep); + buf.AppendLine("DistributionPointName: ["); if (type == FullName) { - appendObject(buf, sep, "fullName", name.ToString()); + AppendObject(buf, "fullName", name.ToString()); } else { - appendObject(buf, sep, "nameRelativeToCRLIssuer", name.ToString()); + AppendObject(buf, "nameRelativeToCRLIssuer", name.ToString()); } - buf.Append("]"); - buf.Append(sep); + buf.AppendLine("]"); return buf.ToString(); } - private void appendObject( - StringBuilder buf, - string sep, - string name, - string val) + private void AppendObject(StringBuilder buf, string name, string val) { string indent = " "; - buf.Append(indent); buf.Append(name); - buf.Append(":"); - buf.Append(sep); + buf.AppendLine(":"); buf.Append(indent); buf.Append(indent); buf.Append(val); - buf.Append(sep); - } - } + buf.AppendLine(); + } + } } diff --git a/crypto/src/asn1/x509/GeneralNames.cs b/crypto/src/asn1/x509/GeneralNames.cs index c105f3b6e..acf263f84 100644 --- a/crypto/src/asn1/x509/GeneralNames.cs +++ b/crypto/src/asn1/x509/GeneralNames.cs @@ -78,18 +78,13 @@ namespace Org.BouncyCastle.Asn1.X509 public override string ToString() { StringBuilder buf = new StringBuilder(); - string sep = Platform.NewLine; - - buf.Append("GeneralNames:"); - buf.Append(sep); - + buf.AppendLine("GeneralNames:"); foreach (GeneralName name in names) { - buf.Append(" "); - buf.Append(name); - buf.Append(sep); + buf.Append(" ") + .Append(name) + .AppendLine(); } - return buf.ToString(); } } diff --git a/crypto/src/asn1/x509/IssuingDistributionPoint.cs b/crypto/src/asn1/x509/IssuingDistributionPoint.cs index 8e9362b90..a05efffa4 100644 --- a/crypto/src/asn1/x509/IssuingDistributionPoint.cs +++ b/crypto/src/asn1/x509/IssuingDistributionPoint.cs @@ -192,56 +192,46 @@ namespace Org.BouncyCastle.Asn1.X509 public override string ToString() { - string sep = Platform.NewLine; StringBuilder buf = new StringBuilder(); - - buf.Append("IssuingDistributionPoint: ["); - buf.Append(sep); + buf.AppendLine("IssuingDistributionPoint: ["); if (_distributionPoint != null) { - appendObject(buf, sep, "distributionPoint", _distributionPoint.ToString()); + AppendObject(buf, "distributionPoint", _distributionPoint.ToString()); } if (_onlyContainsUserCerts) { - appendObject(buf, sep, "onlyContainsUserCerts", _onlyContainsUserCerts.ToString()); + AppendObject(buf, "onlyContainsUserCerts", _onlyContainsUserCerts.ToString()); } if (_onlyContainsCACerts) { - appendObject(buf, sep, "onlyContainsCACerts", _onlyContainsCACerts.ToString()); + AppendObject(buf, "onlyContainsCACerts", _onlyContainsCACerts.ToString()); } if (_onlySomeReasons != null) { - appendObject(buf, sep, "onlySomeReasons", _onlySomeReasons.ToString()); + AppendObject(buf, "onlySomeReasons", _onlySomeReasons.ToString()); } if (_onlyContainsAttributeCerts) { - appendObject(buf, sep, "onlyContainsAttributeCerts", _onlyContainsAttributeCerts.ToString()); + AppendObject(buf, "onlyContainsAttributeCerts", _onlyContainsAttributeCerts.ToString()); } if (_indirectCRL) { - appendObject(buf, sep, "indirectCRL", _indirectCRL.ToString()); + AppendObject(buf, "indirectCRL", _indirectCRL.ToString()); } - buf.Append("]"); - buf.Append(sep); + buf.AppendLine("]"); return buf.ToString(); } - private void appendObject( - StringBuilder buf, - string sep, - string name, - string val) + private void AppendObject(StringBuilder buf, string name, string val) { string indent = " "; - buf.Append(indent); buf.Append(name); - buf.Append(":"); - buf.Append(sep); + buf.AppendLine(":"); buf.Append(indent); buf.Append(indent); buf.Append(val); - buf.Append(sep); + buf.AppendLine(); } } } |