From 4a1919e0fb2689d790ec819e2a4336f08ed4a101 Mon Sep 17 00:00:00 2001 From: sta Date: Sat, 1 Mar 2014 15:00:51 +0900 Subject: [PATCH] Modified Fin enum values to PascalCase values --- websocket-sharp/Fin.cs | 14 +++++++------- websocket-sharp/WebSocket.cs | 12 ++++++------ websocket-sharp/WsFrame.cs | 12 ++++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/websocket-sharp/Fin.cs b/websocket-sharp/Fin.cs index 9698abad..12aa9faa 100644 --- a/websocket-sharp/Fin.cs +++ b/websocket-sharp/Fin.cs @@ -4,8 +4,8 @@ * * The MIT License * - * Copyright (c) 2012-2013 sta.blockhead - * + * Copyright (c) 2012-2014 sta.blockhead + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights @@ -15,7 +15,7 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -28,11 +28,11 @@ using System; -namespace WebSocketSharp { - +namespace WebSocketSharp +{ internal enum Fin : byte { - MORE = 0x0, - FINAL = 0x1 + More = 0x0, + Final = 0x1 } } diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index c8d724e3..f2997dec 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -1079,7 +1079,7 @@ namespace WebSocketSharp } var mask = _client ? Mask.MASK : Mask.UNMASK; - sent = send (WsFrame.CreateFrame (Fin.FINAL, opcode, mask, data, compressed)); + sent = send (WsFrame.CreateFrame (Fin.Final, opcode, mask, data, compressed)); } catch (Exception ex) { _logger.Fatal (ex.ToString ()); @@ -1173,20 +1173,20 @@ namespace WebSocketSharp if (quo == 0) { buffer = new byte [rem]; return stream.Read (buffer, 0, rem) == rem && - send (WsFrame.CreateFrame (Fin.FINAL, opcode, mask, buffer, compressed)); + send (WsFrame.CreateFrame (Fin.Final, opcode, mask, buffer, compressed)); } buffer = new byte [FragmentLength]; // First if (stream.Read (buffer, 0, FragmentLength) != FragmentLength || - !send (WsFrame.CreateFrame (Fin.MORE, opcode, mask, buffer, compressed))) + !send (WsFrame.CreateFrame (Fin.More, opcode, mask, buffer, compressed))) return false; // Mid for (long i = 0; i < times; i++) { if (stream.Read (buffer, 0, FragmentLength) != FragmentLength || - !send (WsFrame.CreateFrame (Fin.MORE, Opcode.CONT, mask, buffer, compressed))) + !send (WsFrame.CreateFrame (Fin.More, Opcode.CONT, mask, buffer, compressed))) return false; } @@ -1196,7 +1196,7 @@ namespace WebSocketSharp buffer = new byte [tmpLen = rem]; return stream.Read (buffer, 0, tmpLen) == tmpLen && - send (WsFrame.CreateFrame (Fin.FINAL, Opcode.CONT, mask, buffer, compressed)); + send (WsFrame.CreateFrame (Fin.Final, Opcode.CONT, mask, buffer, compressed)); } // As client @@ -1443,7 +1443,7 @@ namespace WebSocketSharp byte [] cached; if (!cache.TryGetValue (_compression, out cached)) { cached = WsFrame.CreateFrame ( - Fin.FINAL, + Fin.Final, opcode, Mask.UNMASK, data.Compress (_compression), diff --git a/websocket-sharp/WsFrame.cs b/websocket-sharp/WsFrame.cs index c10b7510..2433290f 100644 --- a/websocket-sharp/WsFrame.cs +++ b/websocket-sharp/WsFrame.cs @@ -67,7 +67,7 @@ namespace WebSocketSharp } public WsFrame (Opcode opcode, Mask mask, PayloadData payload) - : this (Fin.FINAL, opcode, mask, payload) + : this (Fin.Final, opcode, mask, payload) { } @@ -166,13 +166,13 @@ namespace WebSocketSharp internal bool IsFinal { get { - return Fin == Fin.FINAL; + return Fin == Fin.Final; } } internal bool IsFragmented { get { - return Fin == Fin.MORE || Opcode == Opcode.CONT; + return Fin == Fin.More || Opcode == Opcode.CONT; } } @@ -347,7 +347,7 @@ namespace WebSocketSharp private static bool isFinal (Fin fin) { - return fin == Fin.FINAL; + return fin == Fin.Final; } private static bool isMasked (Mask mask) @@ -375,7 +375,7 @@ namespace WebSocketSharp /* Header */ // FIN - var fin = (header [0] & 0x80) == 0x80 ? Fin.FINAL : Fin.MORE; + var fin = (header [0] & 0x80) == 0x80 ? Fin.Final : Fin.More; // RSV1 var rsv1 = (header [0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF; // RSV2 @@ -390,7 +390,7 @@ namespace WebSocketSharp var payloadLen = (byte) (header [1] & 0x7f); // Check if correct frame. - var incorrect = isControl (opcode) && fin == Fin.MORE + var incorrect = isControl (opcode) && fin == Fin.More ? "A control frame is fragmented." : !isData (opcode) && rsv1 == Rsv.ON ? "A non data frame is compressed."