Skip to content

Commit

Permalink
Merge pull request #301 from atc-net/feature/miscellaneous-extensions
Browse files Browse the repository at this point in the history
Feature/miscellaneous extensions
  • Loading branch information
davidkallesen authored Jan 18, 2024
2 parents 33727ce + 2f64a87 commit 0960172
Show file tree
Hide file tree
Showing 21 changed files with 1,094 additions and 15 deletions.
71 changes: 71 additions & 0 deletions docs/CodeDoc/Atc/Atc.Helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,28 @@ PrimitiveTypeHelper.
<br />
## StackTraceHelper
Provides utility methods for working with stack traces.
>```csharp
>public static class StackTraceHelper
>```
### Static Methods
#### ContainsConstructorWithinFrameCount
>```csharp
>bool ContainsConstructorWithinFrameCount(int drillDownFrameMax)
>```
><b>Summary:</b> Determines whether any of the stack frames within the specified frame count contains a constructor.
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`drillDownFrameMax`&nbsp;&nbsp;-&nbsp;&nbsp;The maximum number of frames to inspect in the stack trace.<br />
>
><b>Returns:</b> `true` if a constructor is found within the specified number of frames; otherwise, `false`.
<br />
## TaskHelper
TaskHelper.
Expand Down Expand Up @@ -2101,4 +2123,53 @@ ThreadHelper.
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`exemptProcessorCount`&nbsp;&nbsp;-&nbsp;&nbsp;The exempt processor count.<br />
<br />
## VersionHelper
Provides utility methods for comparing and handling version strings and Version objects.
>```csharp
>public static class VersionHelper
>```
### Static Methods
#### IsDefault
>```csharp
>bool IsDefault(Version sourceVersion, Version destinationVersion)
>```
><b>Summary:</b> Determines whether both source and destination versions are the default version ("1.0.0.0").
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`sourceVersion`&nbsp;&nbsp;-&nbsp;&nbsp;The source version as a Version object.<br />
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`destinationVersion`&nbsp;&nbsp;-&nbsp;&nbsp;The destination version as a Version object.<br />
>
><b>Returns:</b> True if both versions are "1.0.0.0"; otherwise, false.
#### IsSourceNewerThanDestination
>```csharp
>bool IsSourceNewerThanDestination(string sourceVersion, string destinationVersion)
>```
><b>Summary:</b> Compares two version strings to determine if the source version is newer than the destination version.
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`sourceVersion`&nbsp;&nbsp;-&nbsp;&nbsp;The source version as a string.<br />
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`destinationVersion`&nbsp;&nbsp;-&nbsp;&nbsp;The destination version as a string.<br />
>
><b>Returns:</b> True if the source version is newer than the destination version; otherwise, false.
>
><b>Remarks:</b> If either version string is null, or if they are equal, the method returns false. If the version strings cannot be parsed into System.Version, a lexical comparison is performed.
#### IsSourceNewerThanDestination
>```csharp
>bool IsSourceNewerThanDestination(Version sourceVersion, Version destinationVersion)
>```
><b>Summary:</b> Compares two version strings to determine if the source version is newer than the destination version.
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`sourceVersion`&nbsp;&nbsp;-&nbsp;&nbsp;The source version as a string.<br />
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`destinationVersion`&nbsp;&nbsp;-&nbsp;&nbsp;The destination version as a string.<br />
>
><b>Returns:</b> True if the source version is newer than the destination version; otherwise, false.
>
><b>Remarks:</b> If either version string is null, or if they are equal, the method returns false. If the version strings cannot be parsed into System.Version, a lexical comparison is performed.
<hr /><div style='text-align: right'><i>Generated by MarkdownCodeDoc version 1.2</i></div>
19 changes: 19 additions & 0 deletions docs/CodeDoc/Atc/Atc.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ Flag-Enumeration: AddressType.
<br />
## ArrowDirectionType
>```csharp
>public enum ArrowDirectionType
>```
| Value | Name | Description | Summary |
| --- | --- | --- | --- |
| 0 | None | None | Default None. |
| 1 | Left | Left | Left. |
| 2 | Up | Up | Up. |
| 4 | Right | Right | Right. |
| 8 | Down | Down | Down. |
<br />
## ArticleNumberType
Expand Down
8 changes: 8 additions & 0 deletions docs/CodeDoc/Atc/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## [Atc](Atc.md)

- [AddressType](Atc.md#addresstype)
- [ArrowDirectionType](Atc.md#arrowdirectiontype)
- [ArticleNumberType](Atc.md#articlenumbertype)
- [AtcAssemblyTypeInitializer](Atc.md#atcassemblytypeinitializer)
- [BooleanOperatorType](Atc.md#booleanoperatortype)
Expand Down Expand Up @@ -99,8 +100,10 @@
- [ReflectionHelper](Atc.Helpers.md#reflectionhelper)
- [RegionInfoHelper](Atc.Helpers.md#regioninfohelper)
- [SimpleTypeHelper](Atc.Helpers.md#simpletypehelper)
- [StackTraceHelper](Atc.Helpers.md#stacktracehelper)
- [TaskHelper](Atc.Helpers.md#taskhelper)
- [ThreadHelper](Atc.Helpers.md#threadhelper)
- [VersionHelper](Atc.Helpers.md#versionhelper)

## [Atc.Math](Atc.Math.md)

Expand Down Expand Up @@ -191,6 +194,7 @@
- [DesignTimeUseOnlyException](System.md#designtimeuseonlyexception)
- [DoubleExtensions](System.md#doubleextensions)
- [EntityStoreException](System.md#entitystoreexception)
- [EnumAtcExtensions](System.md#enumatcextensions)
- [EnumExtensions](System.md#enumextensions)
- [ExceptionExtensions](System.md#exceptionextensions)
- [IntegerExtensions](System.md#integerextensions)
Expand Down Expand Up @@ -255,6 +259,10 @@

- [ClaimsPrincipalExtensions](System.Security.Claims.md#claimsprincipalextensions)

## [System.Security.Cryptography.X509Certificates](System.Security.Cryptography.X509Certificates.md)

- [X509Certificate2Extensions](System.Security.Cryptography.X509Certificates.md#x509certificate2extensions)

## [System.Text](System.Text.md)

- [StringBuilderExtensions](System.Text.md#stringbuilderextensions)
Expand Down
30 changes: 30 additions & 0 deletions docs/CodeDoc/Atc/IndexExtended.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## [Atc](Atc.md)

- [AddressType](Atc.md#addresstype)
- [ArrowDirectionType](Atc.md#arrowdirectiontype)
- [ArticleNumberType](Atc.md#articlenumbertype)
- [AtcAssemblyTypeInitializer](Atc.md#atcassemblytypeinitializer)
- [BooleanOperatorType](Atc.md#booleanoperatortype)
Expand Down Expand Up @@ -4665,6 +4666,9 @@
- GetBeautifyTypeName(Type type)
- GetBeautifyTypeNameByRef(Type type)
- IsSimpleType(string value, StringComparison comparison = Ordinal)
- [StackTraceHelper](Atc.Helpers.md#stacktracehelper)
- Static Methods
- ContainsConstructorWithinFrameCount(int drillDownFrameMax)
- [TaskHelper](Atc.Helpers.md#taskhelper)
- Static Methods
- Execute(Func&lt;CancellationToken, Task&lt;TResult&gt;&gt; taskToRun, TimeSpan timeout, CancellationToken cancellationToken = null)
Expand All @@ -4680,6 +4684,11 @@
- ProcessorCount
- Static Methods
- GetParallelOptions(int exemptProcessorCount = 2)
- [VersionHelper](Atc.Helpers.md#versionhelper)
- Static Methods
- IsDefault(Version sourceVersion, Version destinationVersion)
- IsSourceNewerThanDestination(Version sourceVersion, Version destinationVersion)
- IsSourceNewerThanDestination(string sourceVersion, string destinationVersion)

## [Atc.Math](Atc.Math.md)

Expand Down Expand Up @@ -5027,6 +5036,17 @@
- RoundOff2(this double value)
- RoundOffPercent(this double percent)
- [EntityStoreException](System.md#entitystoreexception)
- [EnumAtcExtensions](System.md#enumatcextensions)
- Static Methods
- Opposite(this ArrowDirectionType arrowDirectionType)
- Opposite(this CardinalDirectionType cardinalDirectionType)
- Opposite(this ForwardReverseType forwardReverseType)
- Opposite(this InsertRemoveType insertRemoveType)
- Opposite(this LeftRightType leftRightType)
- Opposite(this OnOffType onOffType)
- Opposite(this SortDirectionType sortDirectionType)
- Opposite(this UpDownType yesNoType)
- Opposite(this YesNoType yesNoType)
- [EnumExtensions](System.md#enumextensions)
- Static Methods
- GetDescription(this Enum enumeration, bool useLocalizedIfPossible = True)
Expand Down Expand Up @@ -5089,6 +5109,7 @@
- GetStringFormatParameterNumericCount(this string value)
- GetStringFormatParameterTemplatePlaceholders(this string value)
- GetTemplateKeys(this string value, TemplatePatternType templatePatternType = HardBrackets, bool includeTemplatePattern = False)
- GetUniqueTemplateKeysWithOccurrence(this string value, TemplatePatternType templatePatternType = HardBrackets, bool includeTemplatePattern = False)
- GetValueBetweenLessAndGreaterThanCharsIfExist(this string value)
- Humanize(this string value)
- IndexersOf(this string value, string pattern, bool ignoreCaseSensitive = True, bool useEndOfPatternToMatch = False)
Expand All @@ -5110,6 +5131,8 @@
- ReplaceMany(this string value, IDictionary&lt;string, string&gt; replacements)
- ReplaceMany(this string value, char[] chars, char replacement)
- ReplaceNewLines(this string value, string newValue)
- ReplaceTemplateKeyWithValue(this string value, string templateKey, string templateValue, TemplatePatternType templatePatternType = HardBrackets)
- ReplaceTemplateKeysWithValues(this string value, IDictionary&lt;string, string&gt; templateKeyValues, TemplatePatternType templatePatternType = HardBrackets)
- SetStringFormatParameterTemplatePlaceholders(this string value, Dictionary&lt;string, string&gt; replacements)
- ToLines(this string value)
- ToStream(this string value)
Expand Down Expand Up @@ -5356,6 +5379,13 @@
- Static Methods
- GetIdentity(this ClaimsPrincipal principal)

## [System.Security.Cryptography.X509Certificates](System.Security.Cryptography.X509Certificates.md)

- [X509Certificate2Extensions](System.Security.Cryptography.X509Certificates.md#x509certificate2extensions)
- Static Methods
- GetNameIdentifier(this X509Certificate2 certificate)
- IsValid(this X509Certificate2 certificate)

## [System.Text](System.Text.md)

- [StringBuilderExtensions](System.Text.md#stringbuilderextensions)
Expand Down
39 changes: 39 additions & 0 deletions docs/CodeDoc/Atc/System.Security.Cryptography.X509Certificates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<div style='text-align: right'>

[References](Index.md)&nbsp;&nbsp;-&nbsp;&nbsp;[References extended](IndexExtended.md)
</div>

# System.Security.Cryptography.X509Certificates

<br />

## X509Certificate2Extensions
Provides extension methods for the X509Certificate2 class.

>```csharp
>public static class X509Certificate2Extensions
>```
### Static Methods
#### GetNameIdentifier
>```csharp
>string GetNameIdentifier(this X509Certificate2 certificate)
>```
><b>Summary:</b> Gets the name identifier of the certificate. This can be the FriendlyName, or a substring of the SubjectName.
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`certificate`&nbsp;&nbsp;-&nbsp;&nbsp;The X509Certificate2 object.<br />
>
><b>Returns:</b> The FriendlyName of the certificate if not null or empty; otherwise, a substring of the SubjectName starting from "CN=" if it exists, or the full SubjectName if "CN=" is not found.
#### IsValid
>```csharp
>bool IsValid(this X509Certificate2 certificate)
>```
><b>Summary:</b> Checks if the certificate is valid. A certificate is considered valid if it is not archived, the current date is within the certificate's validity period, and it has a non-empty name identifier.
>
><b>Parameters:</b><br>
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`certificate`&nbsp;&nbsp;-&nbsp;&nbsp;The X509Certificate2 object.<br />
>
><b>Returns:</b> True if the certificate is valid; otherwise, false.
<hr /><div style='text-align: right'><i>Generated by MarkdownCodeDoc version 1.2</i></div>
Loading

0 comments on commit 0960172

Please sign in to comment.