mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Remove vars (#819)
This commit is contained in:
parent
6eaea267d5
commit
2327498b31
@ -97,7 +97,7 @@ public static ReaderParameters ReaderParameters(string assemblyPath, IEnumerable
|
||||
helper.AddSearchDirectory(Path.GetDirectoryName(mirrorNetDLLPath));
|
||||
if (extraPaths != null)
|
||||
{
|
||||
foreach (var path in extraPaths)
|
||||
foreach (string path in extraPaths)
|
||||
helper.AddSearchDirectory(path);
|
||||
}
|
||||
parameters.AssemblyResolver = assemblyResolver;
|
||||
|
@ -58,7 +58,7 @@ public static MethodReference ResolveMethodInParents(TypeReference tr, AssemblyD
|
||||
// System.Byte[] arguments need a version with a string
|
||||
public static MethodReference ResolveMethodWithArg(TypeReference tr, AssemblyDefinition scriptDef, string name, string argTypeFullName)
|
||||
{
|
||||
foreach (var methodRef in tr.Resolve().Methods)
|
||||
foreach (MethodDefinition methodRef in tr.Resolve().Methods)
|
||||
{
|
||||
if (methodRef.Name == name)
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ public async void Connect(Uri uri)
|
||||
|
||||
cancellation = new CancellationTokenSource();
|
||||
|
||||
var clientFactory = new WebSocketClientFactory();
|
||||
WebSocketClientFactory clientFactory = new WebSocketClientFactory();
|
||||
|
||||
try
|
||||
{
|
||||
@ -84,7 +84,7 @@ public async void Connect(Uri uri)
|
||||
|
||||
async Task ReceiveLoop(WebSocket webSocket, CancellationToken token)
|
||||
{
|
||||
var buffer = new byte[MaxMessageSize];
|
||||
byte[] buffer = new byte[MaxMessageSize];
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ void EnlargeBufferIfRequired(int count)
|
||||
newSize = (int)Math.Pow(2, Math.Ceiling(Math.Log(requiredSize) / Math.Log(2))); ;
|
||||
}
|
||||
|
||||
var newBuffer = new byte[newSize];
|
||||
byte[] newBuffer = new byte[newSize];
|
||||
Buffer.BlockCopy(_buffer, 0, newBuffer, 0, position);
|
||||
_ms = new MemoryStream(newBuffer, 0, newBuffer.Length, true, true)
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ internal static class WebSocketFrameReader
|
||||
public static async Task<WebSocketFrame> ReadAsync(Stream fromStream, ArraySegment<byte> intoBuffer, CancellationToken cancellationToken)
|
||||
{
|
||||
// allocate a small buffer to read small chunks of data from the stream
|
||||
var smallBuffer = new ArraySegment<byte>(new byte[8]);
|
||||
ArraySegment<byte> smallBuffer = new ArraySegment<byte>(new byte[8]);
|
||||
|
||||
await BinaryReaderWriter.ReadExactly(2, fromStream, smallBuffer, cancellationToken);
|
||||
byte byte1 = smallBuffer.Array[0];
|
||||
|
@ -96,7 +96,7 @@ internal WebSocketImplementation(Guid guid, Func<MemoryStream> recycledStreamFac
|
||||
// the ping pong manager starts a task
|
||||
// but we don't have to keep a reference to it
|
||||
#pragma warning disable 0219
|
||||
var pingPongManager = new PingPongManager(guid, this, keepAliveInterval, _internalReadCts.Token);
|
||||
PingPongManager pingPongManager = new PingPongManager(guid, this, keepAliveInterval, _internalReadCts.Token);
|
||||
#pragma warning restore 0219
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ public override async Task SendAsync(ArraySegment<byte> buffer, WebSocketMessage
|
||||
DeflateStream deflateStream = new DeflateStream(temp, CompressionMode.Compress);
|
||||
deflateStream.Write(buffer.Array, buffer.Offset, buffer.Count);
|
||||
deflateStream.Flush();
|
||||
var compressedBuffer = new ArraySegment<byte>(temp.ToArray());
|
||||
ArraySegment<byte> compressedBuffer = new ArraySegment<byte>(temp.ToArray());
|
||||
WebSocketFrameWriter.Write(opCode, compressedBuffer, stream, endOfMessage, _isClient);
|
||||
Events.Log.SendingFrame(_guid, opCode, endOfMessage, compressedBuffer.Count, true);
|
||||
}
|
||||
@ -566,7 +566,7 @@ async Task CloseOutputAutoTimeoutAsync(WebSocketCloseStatus closeStatus, string
|
||||
statusDescription = statusDescription + "\r\n\r\n" + ex.ToString();
|
||||
}
|
||||
|
||||
var autoCancel = new CancellationTokenSource(timeSpan);
|
||||
CancellationTokenSource autoCancel = new CancellationTokenSource(timeSpan);
|
||||
await CloseOutputAsync(closeStatus, statusDescription, autoCancel.Token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
@ -61,7 +61,7 @@ public class PingPongManager : IPingPongManager
|
||||
/// if keepAliveInterval is positive</param>
|
||||
public PingPongManager(Guid guid, WebSocket webSocket, TimeSpan keepAliveInterval, CancellationToken cancellationToken)
|
||||
{
|
||||
var webSocketImpl = webSocket as WebSocketImplementation;
|
||||
WebSocketImplementation webSocketImpl = webSocket as WebSocketImplementation;
|
||||
_webSocket = webSocketImpl;
|
||||
if (_webSocket == null)
|
||||
throw new InvalidCastException("Cannot cast WebSocket to an instance of WebSocketImplementation. Please use the web socket factories to create a web socket");
|
||||
|
@ -86,7 +86,7 @@ public WebSocketClientFactory(Func<MemoryStream> bufferFactory)
|
||||
Guid guid = Guid.NewGuid();
|
||||
string host = uri.Host;
|
||||
int port = uri.Port;
|
||||
var tcpClient = new TcpClient(AddressFamily.InterNetworkV6);
|
||||
TcpClient tcpClient = new TcpClient(AddressFamily.InterNetworkV6);
|
||||
tcpClient.NoDelay = options.NoDelay;
|
||||
tcpClient.Client.DualMode = true;
|
||||
string uriScheme = uri.Scheme.ToLower();
|
||||
|
@ -124,14 +124,14 @@ async void ProcessTcpClient(TcpClient tcpClient, CancellationToken token)
|
||||
Stream stream = tcpClient.GetStream();
|
||||
if (_secure)
|
||||
{
|
||||
var sslStream = new SslStream(stream, false, CertVerificationCallback);
|
||||
SslStream sslStream = new SslStream(stream, false, CertVerificationCallback);
|
||||
sslStream.AuthenticateAsServer(_sslConfig.Certificate, _sslConfig.ClientCertificateRequired, _sslConfig.EnabledSslProtocols, _sslConfig.CheckCertificateRevocation);
|
||||
stream = sslStream;
|
||||
}
|
||||
WebSocketHttpContext context = await webSocketServerFactory.ReadHttpHeaderFromStreamAsync(stream, token);
|
||||
if (context.IsWebSocketRequest)
|
||||
{
|
||||
var options = new WebSocketServerOptions() { KeepAliveInterval = TimeSpan.FromSeconds(30), SubProtocol = "binary" };
|
||||
WebSocketServerOptions options = new WebSocketServerOptions() { KeepAliveInterval = TimeSpan.FromSeconds(30), SubProtocol = "binary" };
|
||||
|
||||
WebSocket webSocket = await webSocketServerFactory.AcceptWebSocketAsync(context, options);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user