|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using GitCredentialManager.Interop.Windows; |
| 1 | +using System.Collections.Generic; |
4 | 2 |
|
5 | 3 | namespace GitCredentialManager; |
6 | 4 |
|
@@ -42,113 +40,4 @@ class CredentialManagerStore(ICredentialStore store, ICommandContext context) : |
42 | 40 | public IList<string> GetAccounts(string service) => store.GetAccounts(service); |
43 | 41 | public bool Remove(string service, string account) => store.Remove(service, account); |
44 | 42 | } |
45 | | - |
46 | | - class CommandContextWrapper(CommandContext context, string? @namespace) : ICommandContext |
47 | | - { |
48 | | - readonly ISettings settings = new SettingsWrapper( |
49 | | - context.Settings is WindowsSettings ? |
50 | | - new NoGitWindowsSettings(context.Environment, context.Git, context.Trace) : |
51 | | - new NoGitSettings(context.Environment, context.Git), @namespace); |
52 | | - |
53 | | - public ISettings Settings => settings; |
54 | | - |
55 | | - #region pass-through impl. |
56 | | - |
57 | | - public string ApplicationPath { get => ((ICommandContext)context).ApplicationPath; set => ((ICommandContext)context).ApplicationPath = value; } |
58 | | - |
59 | | - public string InstallationDirectory => ((ICommandContext)context).InstallationDirectory; |
60 | | - |
61 | | - public IStandardStreams Streams => ((ICommandContext)context).Streams; |
62 | | - |
63 | | - public ITerminal Terminal => ((ICommandContext)context).Terminal; |
64 | | - |
65 | | - public ISessionManager SessionManager => ((ICommandContext)context).SessionManager; |
66 | | - |
67 | | - public ITrace Trace => ((ICommandContext)context).Trace; |
68 | | - |
69 | | - public ITrace2 Trace2 => ((ICommandContext)context).Trace2; |
70 | | - |
71 | | - public IFileSystem FileSystem => ((ICommandContext)context).FileSystem; |
72 | | - |
73 | | - public ICredentialStore CredentialStore => ((ICommandContext)context).CredentialStore; |
74 | | - |
75 | | - public IHttpClientFactory HttpClientFactory => ((ICommandContext)context).HttpClientFactory; |
76 | | - |
77 | | - public IGit Git => new NoGit(context.Git); |
78 | | - |
79 | | - public IEnvironment Environment => ((ICommandContext)context).Environment; |
80 | | - |
81 | | - public IProcessManager ProcessManager => ((ICommandContext)context).ProcessManager; |
82 | | - |
83 | | - public void Dispose() => ((IDisposable)context).Dispose(); |
84 | | - |
85 | | - #endregion |
86 | | - } |
87 | | - |
88 | | - class NoGitSettings(IEnvironment environment, IGit git) : Settings(environment, new NoGit(git)) { } |
89 | | - |
90 | | - class NoGitWindowsSettings(IEnvironment environment, IGit git, ITrace trace) : WindowsSettings(environment, new NoGit(git), trace) { } |
91 | | - |
92 | | - class SettingsWrapper(ISettings settings, string? @namespace) : ISettings |
93 | | - { |
94 | | - public string CredentialNamespace => @namespace ?? settings.CredentialNamespace; |
95 | | - |
96 | | - #region pass-through impl. |
97 | | - |
98 | | - public string CredentialBackingStore => settings.CredentialBackingStore; |
99 | | - |
100 | | - public bool UseMsAuthDefaultAccount => settings.UseMsAuthDefaultAccount; |
101 | | - |
102 | | - public IEnumerable<string> GetSettingValues(string envarName, string section, string property, bool isPath) |
103 | | - => settings.GetSettingValues(envarName, section, property, isPath); |
104 | | - |
105 | | - public bool GetTracingEnabled(out string value) => settings.GetTracingEnabled(out value); |
106 | | - public bool TryGetPathSetting(string envarName, string section, string property, out string value) => settings.TryGetPathSetting(envarName, section, property, out value); |
107 | | - public bool TryGetSetting(string envarName, string section, string property, out string value) => settings.TryGetSetting(envarName, section, property, out value); |
108 | | - |
109 | | - public Uri RemoteUri { get => settings.RemoteUri; set => settings.RemoteUri = value; } |
110 | | - |
111 | | - public bool IsDebuggingEnabled => settings.IsDebuggingEnabled; |
112 | | - |
113 | | - public bool IsTerminalPromptsEnabled => settings.IsTerminalPromptsEnabled; |
114 | | - |
115 | | - public bool IsGuiPromptsEnabled { get => settings.IsGuiPromptsEnabled; set => settings.IsGuiPromptsEnabled = value; } |
116 | | - |
117 | | - public bool IsInteractionAllowed => settings.IsInteractionAllowed; |
118 | | - |
119 | | - public bool IsSecretTracingEnabled => settings.IsSecretTracingEnabled; |
120 | | - |
121 | | - public bool IsMsalTracingEnabled => settings.IsMsalTracingEnabled; |
122 | | - |
123 | | - public string ProviderOverride => settings.ProviderOverride; |
124 | | - |
125 | | - public string LegacyAuthorityOverride => settings.LegacyAuthorityOverride; |
126 | | - |
127 | | - public bool IsWindowsIntegratedAuthenticationEnabled => settings.IsWindowsIntegratedAuthenticationEnabled; |
128 | | - |
129 | | - public bool IsCertificateVerificationEnabled => settings.IsCertificateVerificationEnabled; |
130 | | - |
131 | | - public bool AutomaticallyUseClientCertificates => settings.AutomaticallyUseClientCertificates; |
132 | | - |
133 | | - public string ParentWindowId => settings.ParentWindowId; |
134 | | - |
135 | | - public string CustomCertificateBundlePath => settings.CustomCertificateBundlePath; |
136 | | - |
137 | | - public string CustomCookieFilePath => settings.CustomCookieFilePath; |
138 | | - |
139 | | - public TlsBackend TlsBackend => settings.TlsBackend; |
140 | | - |
141 | | - public bool UseCustomCertificateBundleWithSchannel => settings.UseCustomCertificateBundleWithSchannel; |
142 | | - |
143 | | - public int AutoDetectProviderTimeout => settings.AutoDetectProviderTimeout; |
144 | | - |
145 | | - public bool UseSoftwareRendering => settings.UseSoftwareRendering; |
146 | | - |
147 | | - public bool AllowUnsafeRemotes => settings.AllowUnsafeRemotes; |
148 | | - |
149 | | - public void Dispose() => settings.Dispose(); |
150 | | - public ProxyConfiguration GetProxyConfiguration() => settings.GetProxyConfiguration(); |
151 | | - public Trace2Settings GetTrace2Settings() => settings.GetTrace2Settings(); |
152 | | - #endregion |
153 | | - } |
154 | 43 | } |
0 commit comments