Modified Fin enum values to PascalCase values

This commit is contained in:
sta 2014-03-01 15:00:51 +09:00
parent 46fc6f927f
commit 4a1919e0fb
3 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,7 @@
* *
* The MIT License * 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 * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -28,11 +28,11 @@
using System; using System;
namespace WebSocketSharp { namespace WebSocketSharp
{
internal enum Fin : byte internal enum Fin : byte
{ {
MORE = 0x0, More = 0x0,
FINAL = 0x1 Final = 0x1
} }
} }

View File

@ -1079,7 +1079,7 @@ namespace WebSocketSharp
} }
var mask = _client ? Mask.MASK : Mask.UNMASK; 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) { catch (Exception ex) {
_logger.Fatal (ex.ToString ()); _logger.Fatal (ex.ToString ());
@ -1173,20 +1173,20 @@ namespace WebSocketSharp
if (quo == 0) { if (quo == 0) {
buffer = new byte [rem]; buffer = new byte [rem];
return stream.Read (buffer, 0, rem) == 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]; buffer = new byte [FragmentLength];
// First // First
if (stream.Read (buffer, 0, FragmentLength) != FragmentLength || 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; return false;
// Mid // Mid
for (long i = 0; i < times; i++) { for (long i = 0; i < times; i++) {
if (stream.Read (buffer, 0, FragmentLength) != FragmentLength || 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; return false;
} }
@ -1196,7 +1196,7 @@ namespace WebSocketSharp
buffer = new byte [tmpLen = rem]; buffer = new byte [tmpLen = rem];
return stream.Read (buffer, 0, tmpLen) == tmpLen && 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 // As client
@ -1443,7 +1443,7 @@ namespace WebSocketSharp
byte [] cached; byte [] cached;
if (!cache.TryGetValue (_compression, out cached)) { if (!cache.TryGetValue (_compression, out cached)) {
cached = WsFrame.CreateFrame ( cached = WsFrame.CreateFrame (
Fin.FINAL, Fin.Final,
opcode, opcode,
Mask.UNMASK, Mask.UNMASK,
data.Compress (_compression), data.Compress (_compression),

View File

@ -67,7 +67,7 @@ namespace WebSocketSharp
} }
public WsFrame (Opcode opcode, Mask mask, PayloadData payload) 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 { internal bool IsFinal {
get { get {
return Fin == Fin.FINAL; return Fin == Fin.Final;
} }
} }
internal bool IsFragmented { internal bool IsFragmented {
get { 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) private static bool isFinal (Fin fin)
{ {
return fin == Fin.FINAL; return fin == Fin.Final;
} }
private static bool isMasked (Mask mask) private static bool isMasked (Mask mask)
@ -375,7 +375,7 @@ namespace WebSocketSharp
/* Header */ /* Header */
// FIN // FIN
var fin = (header [0] & 0x80) == 0x80 ? Fin.FINAL : Fin.MORE; var fin = (header [0] & 0x80) == 0x80 ? Fin.Final : Fin.More;
// RSV1 // RSV1
var rsv1 = (header [0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF; var rsv1 = (header [0] & 0x40) == 0x40 ? Rsv.ON : Rsv.OFF;
// RSV2 // RSV2
@ -390,7 +390,7 @@ namespace WebSocketSharp
var payloadLen = (byte) (header [1] & 0x7f); var payloadLen = (byte) (header [1] & 0x7f);
// Check if correct frame. // Check if correct frame.
var incorrect = isControl (opcode) && fin == Fin.MORE var incorrect = isControl (opcode) && fin == Fin.More
? "A control frame is fragmented." ? "A control frame is fragmented."
: !isData (opcode) && rsv1 == Rsv.ON : !isData (opcode) && rsv1 == Rsv.ON
? "A non data frame is compressed." ? "A non data frame is compressed."