| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.Description |
| | | 7 | | { |
| | | 8 | | internal static class ClientClassGenerator |
| | | 9 | | { |
| | | 10 | | internal static string GetClientClassName(string interfaceName) |
| | | 11 | | { |
| | 25 | 12 | | return GetClassName(interfaceName) + Strings.ClientTypeSuffix; |
| | | 13 | | } |
| | | 14 | | |
| | | 15 | | private static string GetClassName(string interfaceName) |
| | | 16 | | { |
| | | 17 | | // maybe strip a leading 'I' |
| | 25 | 18 | | if (interfaceName.Length >= 2 && |
| | 25 | 19 | | string.Compare(interfaceName, 0, Strings.InterfaceTypePrefix, 0, Strings.InterfaceTypePrefix.Length, Str |
| | 25 | 20 | | char.IsUpper(interfaceName, 1)) |
| | 18 | 21 | | return interfaceName.Substring(1); |
| | | 22 | | else |
| | 7 | 23 | | return interfaceName; |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | private static class Strings |
| | | 27 | | { |
| | | 28 | | public const string ClientBaseChannelProperty = "Channel"; |
| | | 29 | | public const string ClientTypeSuffix = "Client"; |
| | | 30 | | public const string InterfaceTypePrefix = "I"; |
| | | 31 | | } |
| | | 32 | | } |
| | | 33 | | } |