Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 77d9258

Browse files
committed
inconsistent naming fixes
1 parent 6996456 commit 77d9258

File tree

11 files changed

+79
-77
lines changed

11 files changed

+79
-77
lines changed

examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public ProxyTestController()
3232
{
3333
if (exception is ProxyHttpException phex)
3434
{
35-
await WriteToConsole(exception.Message + ": " + phex.InnerException?.Message, true);
35+
await writeToConsole(exception.Message + ": " + phex.InnerException?.Message, true);
3636
}
3737
else
3838
{
39-
await WriteToConsole(exception.Message, true);
39+
await writeToConsole(exception.Message, true);
4040
}
4141
};
4242
proxyServer.ForwardToUpstreamGateway = true;
@@ -52,8 +52,8 @@ public ProxyTestController()
5252

5353
public void StartProxy()
5454
{
55-
proxyServer.BeforeRequest += OnRequest;
56-
proxyServer.BeforeResponse += OnResponse;
55+
proxyServer.BeforeRequest += onRequest;
56+
proxyServer.BeforeResponse += onResponse;
5757

5858
proxyServer.ServerCertificateValidationCallback += OnCertificateValidation;
5959
proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
@@ -63,7 +63,7 @@ public void StartProxy()
6363
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000);
6464

6565
// Fired when a CONNECT request is received
66-
explicitEndPoint.BeforeTunnelConnectRequest += OnBeforeTunnelConnectRequest;
66+
explicitEndPoint.BeforeTunnelConnectRequest += onBeforeTunnelConnectRequest;
6767
explicitEndPoint.BeforeTunnelConnectResponse += OnBeforeTunnelConnectResponse;
6868

6969
// An explicit endpoint is where the client knows about the existence of a proxy
@@ -102,11 +102,11 @@ public void StartProxy()
102102

103103
public void Stop()
104104
{
105-
explicitEndPoint.BeforeTunnelConnectRequest -= OnBeforeTunnelConnectRequest;
105+
explicitEndPoint.BeforeTunnelConnectRequest -= onBeforeTunnelConnectRequest;
106106
explicitEndPoint.BeforeTunnelConnectResponse -= OnBeforeTunnelConnectResponse;
107107

108-
proxyServer.BeforeRequest -= OnRequest;
109-
proxyServer.BeforeResponse -= OnResponse;
108+
proxyServer.BeforeRequest -= onRequest;
109+
proxyServer.BeforeResponse -= onResponse;
110110
proxyServer.ServerCertificateValidationCallback -= OnCertificateValidation;
111111
proxyServer.ClientCertificateSelectionCallback -= OnCertificateSelection;
112112

@@ -116,10 +116,10 @@ public void Stop()
116116
//proxyServer.CertificateManager.RemoveTrustedRootCertificates();
117117
}
118118

119-
private async Task OnBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e)
119+
private async Task onBeforeTunnelConnectRequest(object sender, TunnelConnectSessionEventArgs e)
120120
{
121121
string hostname = e.HttpClient.Request.RequestUri.Host;
122-
await WriteToConsole("Tunnel to: " + hostname);
122+
await writeToConsole("Tunnel to: " + hostname);
123123

124124
if (hostname.Contains("dropbox.com"))
125125
{
@@ -136,10 +136,10 @@ private Task OnBeforeTunnelConnectResponse(object sender, TunnelConnectSessionEv
136136
}
137137

138138
// intecept & cancel redirect or update requests
139-
private async Task OnRequest(object sender, SessionEventArgs e)
139+
private async Task onRequest(object sender, SessionEventArgs e)
140140
{
141-
await WriteToConsole("Active Client Connections:" + ((ProxyServer)sender).ClientConnectionCount);
142-
await WriteToConsole(e.HttpClient.Request.Url);
141+
await writeToConsole("Active Client Connections:" + ((ProxyServer)sender).ClientConnectionCount);
142+
await writeToConsole(e.HttpClient.Request.Url);
143143

144144
// store it in the UserData property
145145
// It can be a simple integer, Guid, or any type
@@ -177,19 +177,19 @@ private async Task OnRequest(object sender, SessionEventArgs e)
177177
}
178178

179179
// Modify response
180-
private async Task MultipartRequestPartSent(object sender, MultipartRequestPartSentEventArgs e)
180+
private async Task multipartRequestPartSent(object sender, MultipartRequestPartSentEventArgs e)
181181
{
182182
var session = (SessionEventArgs)sender;
183-
await WriteToConsole("Multipart form data headers:");
183+
await writeToConsole("Multipart form data headers:");
184184
foreach (var header in e.Headers)
185185
{
186-
await WriteToConsole(header.ToString());
186+
await writeToConsole(header.ToString());
187187
}
188188
}
189189

190-
private async Task OnResponse(object sender, SessionEventArgs e)
190+
private async Task onResponse(object sender, SessionEventArgs e)
191191
{
192-
await WriteToConsole("Active Server Connections:" + ((ProxyServer)sender).ServerConnectionCount);
192+
await writeToConsole("Active Server Connections:" + ((ProxyServer)sender).ServerConnectionCount);
193193

194194
string ext = System.IO.Path.GetExtension(e.HttpClient.Request.RequestUri.AbsolutePath);
195195

@@ -261,7 +261,7 @@ public Task OnCertificateSelection(object sender, CertificateSelectionEventArgs
261261
return Task.FromResult(0);
262262
}
263263

264-
private async Task WriteToConsole(string message, bool useRedColor = false)
264+
private async Task writeToConsole(string message, bool useRedColor = false)
265265
{
266266
await @lock.WaitAsync();
267267

examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public SessionListItem SelectedSession
106106
if (value != selectedSession)
107107
{
108108
selectedSession = value;
109-
SelectedSessionChanged();
109+
selectedSessionChanged();
110110
}
111111
}
112112
}
@@ -131,7 +131,7 @@ private async Task ProxyServer_BeforeTunnelConnectRequest(object sender, TunnelC
131131
e.DecryptSsl = false;
132132
}
133133

134-
await Dispatcher.InvokeAsync(() => { AddSession(e); });
134+
await Dispatcher.InvokeAsync(() => { addSession(e); });
135135
}
136136

137137
private async Task ProxyServer_BeforeTunnelConnectResponse(object sender, TunnelConnectSessionEventArgs e)
@@ -148,7 +148,7 @@ await Dispatcher.InvokeAsync(() =>
148148
private async Task ProxyServer_BeforeRequest(object sender, SessionEventArgs e)
149149
{
150150
SessionListItem item = null;
151-
await Dispatcher.InvokeAsync(() => { item = AddSession(e); });
151+
await Dispatcher.InvokeAsync(() => { item = addSession(e); });
152152

153153
if (e.HttpClient.Request.HasBody)
154154
{
@@ -191,15 +191,15 @@ await Dispatcher.InvokeAsync(() =>
191191
});
192192
}
193193

194-
private SessionListItem AddSession(SessionEventArgsBase e)
194+
private SessionListItem addSession(SessionEventArgsBase e)
195195
{
196-
var item = CreateSessionListItem(e);
196+
var item = createSessionListItem(e);
197197
Sessions.Add(item);
198198
sessionDictionary.Add(e.HttpClient, item);
199199
return item;
200200
}
201201

202-
private SessionListItem CreateSessionListItem(SessionEventArgsBase e)
202+
private SessionListItem createSessionListItem(SessionEventArgsBase e)
203203
{
204204
lastSessionNumber++;
205205
bool isTunnelConnect = e is TunnelConnectSessionEventArgs;
@@ -248,7 +248,7 @@ private void ListViewSessions_OnKeyDown(object sender, KeyEventArgs e)
248248
}
249249
}
250250

251-
private void SelectedSessionChanged()
251+
private void selectedSessionChanged()
252252
{
253253
if (SelectedSession == null)
254254
{

src/Titanium.Web.Proxy.sln.DotSettings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MTA/@EntryIndexedValue">MTA</s:String>
2020
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OID/@EntryIndexedValue">OID</s:String>
2121
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OIDS/@EntryIndexedValue">OIDS</s:String>
22+
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
2223
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
2324
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
2425
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
2526
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
27+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
2628
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=a4ab2e69_002D4d9c_002D4345_002Dbcd1_002D5541dacf5d38/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private" Description="Method (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="METHOD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
2729
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=dda2ffa1_002D435c_002D4111_002D88eb_002D1a7c93c382f0/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static, Instance" AccessRightKinds="Private" Description="Property (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="PROPERTY" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
2830
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>

src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ internal void OnMultipartRequestPartSent(string boundary, HeaderCollection heade
117117
}
118118
catch (Exception ex)
119119
{
120-
exceptionFunc(new Exception("Exception thrown in user event", ex));
120+
ExceptionFunc(new Exception("Exception thrown in user event", ex));
121121
}
122122
}
123123

@@ -154,7 +154,7 @@ private async Task<byte[]> readBodyAsync(bool isRequest, CancellationToken cance
154154
{
155155
using (var bodyStream = new MemoryStream())
156156
{
157-
var writer = new HttpWriter(bodyStream, bufferPool, bufferSize);
157+
var writer = new HttpWriter(bodyStream, BufferPool, BufferSize);
158158

159159
if (isRequest)
160160
{
@@ -186,7 +186,7 @@ internal async Task SyphonOutBodyAsync(bool isRequest, CancellationToken cancell
186186

187187
using (var bodyStream = new MemoryStream())
188188
{
189-
var writer = new HttpWriter(bodyStream, bufferPool, bufferSize);
189+
var writer = new HttpWriter(bodyStream, BufferPool, BufferSize);
190190
await copyBodyAsync(isRequest, true, writer, TransformationMode.None, null, cancellationToken);
191191
}
192192
}
@@ -207,7 +207,7 @@ internal async Task CopyRequestBodyAsync(HttpWriter writer, TransformationMode t
207207
var reader = getStreamReader(true);
208208
string boundary = HttpHelper.GetBoundaryFromContentType(request.ContentType);
209209

210-
using (var copyStream = new CopyStream(reader, writer, bufferPool, bufferSize))
210+
using (var copyStream = new CopyStream(reader, writer, BufferPool, BufferSize))
211211
{
212212
while (contentLength > copyStream.ReadBytes)
213213
{
@@ -259,7 +259,7 @@ private async Task copyBodyAsync(bool isRequest, bool useOriginalHeaderValues, H
259259

260260
string contentEncoding = useOriginalHeaderValues ? requestResponse.OriginalContentEncoding : requestResponse.ContentEncoding;
261261

262-
Stream s = limitedStream = new LimitedStream(stream, bufferPool, isChunked, contentLength);
262+
Stream s = limitedStream = new LimitedStream(stream, BufferPool, isChunked, contentLength);
263263

264264
if (transformation == TransformationMode.Uncompress && contentEncoding != null)
265265
{
@@ -268,7 +268,7 @@ private async Task copyBodyAsync(bool isRequest, bool useOriginalHeaderValues, H
268268

269269
try
270270
{
271-
using (var bufStream = new CustomBufferedStream(s, bufferPool, bufferSize, true))
271+
using (var bufStream = new CustomBufferedStream(s, BufferPool, BufferSize, true))
272272
{
273273
await writer.CopyBodyAsync(bufStream, false, -1, onCopy, cancellationToken);
274274
}
@@ -290,7 +290,7 @@ private async Task<long> readUntilBoundaryAsync(ICustomStreamReader reader, long
290290
{
291291
int bufferDataLength = 0;
292292

293-
var buffer = bufferPool.GetBuffer(bufferSize);
293+
var buffer = BufferPool.GetBuffer(BufferSize);
294294
try
295295
{
296296
int boundaryLength = boundary.Length + 4;
@@ -340,7 +340,7 @@ private async Task<long> readUntilBoundaryAsync(ICustomStreamReader reader, long
340340
}
341341
finally
342342
{
343-
bufferPool.ReturnBuffer(buffer);
343+
BufferPool.ReturnBuffer(buffer);
344344
}
345345
}
346346

src/Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public abstract class SessionEventArgsBase : EventArgs, IDisposable
2424
internal TcpServerConnection ServerConnection => HttpClient.Connection;
2525
internal TcpClientConnection ClientConnection => ProxyClient.Connection;
2626

27-
protected readonly int bufferSize;
28-
protected readonly IBufferPool bufferPool;
29-
protected readonly ExceptionHandler exceptionFunc;
27+
protected readonly int BufferSize;
28+
protected readonly IBufferPool BufferPool;
29+
protected readonly ExceptionHandler ExceptionFunc;
3030

3131
/// <summary>
3232
/// Relative milliseconds for various events.
@@ -39,9 +39,9 @@ public abstract class SessionEventArgsBase : EventArgs, IDisposable
3939
private SessionEventArgsBase(ProxyServer server, ProxyEndPoint endPoint,
4040
CancellationTokenSource cancellationTokenSource)
4141
{
42-
bufferSize = server.BufferSize;
43-
bufferPool = server.BufferPool;
44-
exceptionFunc = server.ExceptionFunc;
42+
BufferSize = server.BufferSize;
43+
BufferPool = server.BufferPool;
44+
ExceptionFunc = server.ExceptionFunc;
4545
TimeLine["Session Created"] = DateTime.Now;
4646
}
4747

@@ -161,7 +161,7 @@ internal void OnDataSent(byte[] buffer, int offset, int count)
161161
}
162162
catch (Exception ex)
163163
{
164-
exceptionFunc(new Exception("Exception thrown in user event", ex));
164+
ExceptionFunc(new Exception("Exception thrown in user event", ex));
165165
}
166166
}
167167

@@ -173,7 +173,7 @@ internal void OnDataReceived(byte[] buffer, int offset, int count)
173173
}
174174
catch (Exception ex)
175175
{
176-
exceptionFunc(new Exception("Exception thrown in user event", ex));
176+
ExceptionFunc(new Exception("Exception thrown in user event", ex));
177177
}
178178
}
179179

src/Titanium.Web.Proxy/Helpers/RunTime.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private class UwpHelper
7070

7171
internal static bool IsRunningAsUwp()
7272
{
73-
if (IsWindows7OrLower)
73+
if (isWindows7OrLower)
7474
{
7575
return false;
7676
}
@@ -87,7 +87,7 @@ internal static bool IsRunningAsUwp()
8787
}
8888
}
8989

90-
private static bool IsWindows7OrLower
90+
private static bool isWindows7OrLower
9191
{
9292
get
9393
{

src/Titanium.Web.Proxy/Helpers/SystemProxy.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public SystemProxyManager()
8080
/// <param name="protocolType"></param>
8181
internal void SetProxy(string hostname, int port, ProxyProtocolType protocolType)
8282
{
83-
using (var reg = OpenInternetSettingsKey())
83+
using (var reg = openInternetSettingsKey())
8484
{
8585
if (reg == null)
8686
{
@@ -127,7 +127,7 @@ internal void SetProxy(string hostname, int port, ProxyProtocolType protocolType
127127
/// </summary>
128128
internal void RemoveProxy(ProxyProtocolType protocolType, bool saveOriginalConfig = true)
129129
{
130-
using (var reg = OpenInternetSettingsKey())
130+
using (var reg = openInternetSettingsKey())
131131
{
132132
if (reg == null)
133133
{
@@ -168,7 +168,7 @@ internal void RemoveProxy(ProxyProtocolType protocolType, bool saveOriginalConfi
168168
/// </summary>
169169
internal void DisableAllProxy()
170170
{
171-
using (var reg = OpenInternetSettingsKey())
171+
using (var reg = openInternetSettingsKey())
172172
{
173173
if (reg == null)
174174
{
@@ -186,7 +186,7 @@ internal void DisableAllProxy()
186186

187187
internal void SetAutoProxyUrl(string url)
188188
{
189-
using (var reg = OpenInternetSettingsKey())
189+
using (var reg = openInternetSettingsKey())
190190
{
191191
if (reg == null)
192192
{
@@ -201,7 +201,7 @@ internal void SetAutoProxyUrl(string url)
201201

202202
internal void SetProxyOverride(string proxyOverride)
203203
{
204-
using (var reg = OpenInternetSettingsKey())
204+
using (var reg = openInternetSettingsKey())
205205
{
206206
if (reg == null)
207207
{
@@ -286,7 +286,7 @@ internal void RestoreOriginalSettings()
286286

287287
internal ProxyInfo GetProxyInfoFromRegistry()
288288
{
289-
using (var reg = OpenInternetSettingsKey())
289+
using (var reg = openInternetSettingsKey())
290290
{
291291
if (reg == null)
292292
{
@@ -347,7 +347,7 @@ private static void refresh()
347347
/// <summary>
348348
/// Opens the registry key with the internet settings
349349
/// </summary>
350-
private static RegistryKey OpenInternetSettingsKey()
350+
private static RegistryKey openInternetSettingsKey()
351351
{
352352
return Registry.CurrentUser.OpenSubKey(regKeyInternetSettings, true);
353353
}

0 commit comments

Comments
 (0)