diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-05-17 08:27:23 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-17 08:27:23 -0500 |
| commit | 7b3bfb3ab5ee3f075fa63cef81e38c117f7f8ac8 (patch) | |
| tree | d4d6dd89af90d005c4c9db4ee1232c2e5a969733 /src/slskd/Common | |
| parent | e22472791be56eb3b44d7af7064400aa5e6ef9fc (diff) | |
| parent | 2ebcc6f312d337d1bb4412b41781a973fb253aed (diff) | |
| download | slskd-7b3bfb3ab5ee3f075fa63cef81e38c117f7f8ac8.tar.gz | |
Merge pull request #72 from slskd/proxy
Add SOCKS5 proxy support
Diffstat (limited to 'src/slskd/Common')
| -rw-r--r-- | src/slskd/Common/Extensions.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/slskd/Common/Extensions.cs b/src/slskd/Common/Extensions.cs index 4e08ed02..4bf9f919 100644 --- a/src/slskd/Common/Extensions.cs +++ b/src/slskd/Common/Extensions.cs @@ -44,6 +44,17 @@ namespace slskd } /// <summary> + /// Returns a "pretty" string representation of the provided Type; specifically, corrects the naming of generic Types + /// and appends the type parameters for the type to the name as it appears in the code editor. + /// </summary> + /// <param name="type">The type for which the colloquial name should be created.</param> + /// <returns>A "pretty" string representation of the provided Type.</returns> + public static string ToColloquialString(this Type type) + { + return !type.IsGenericType ? type.Name : type.Name.Split('`')[0] + "<" + string.Join(", ", type.GetGenericArguments().Select(a => a.ToColloquialString())) + ">"; + } + + /// <summary> /// Returns the SHA1 hash of the given string. /// </summary> /// <param name="str">The string to hash.</param> |
