Remove CLSCompliant attribute

This commit is contained in:
Sardelka
2022-06-20 10:55:12 +08:00
parent 212c004d31
commit 33244b930f
12 changed files with 61 additions and 61 deletions

View File

@ -187,7 +187,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads an unsigned 16 bit integer
/// </summary>
[CLSCompliant(false)]
#if UNSAFE
public static unsafe ushort ReadUInt16(byte[] fromBuffer, int numberOfBits, int readBitOffset)
{
@ -233,7 +233,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads the specified number of bits into an UInt32
/// </summary>
[CLSCompliant(false)]
#if UNSAFE
public static unsafe uint ReadUInt32(byte[] fromBuffer, int numberOfBits, int readBitOffset)
{
@ -296,13 +296,13 @@ namespace Lidgren.Network
#endif
}
//[CLSCompliant(false)]
//
//public static ulong ReadUInt64(byte[] fromBuffer, int numberOfBits, int readBitOffset)
/// <summary>
/// Writes an unsigned 16 bit integer
/// </summary>
[CLSCompliant(false)]
public static void WriteUInt16(ushort source, int numberOfBits, byte[] destination, int destinationBitOffset)
{
if (numberOfBits == 0)
@ -331,7 +331,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes the specified number of bits into a byte array
/// </summary>
[CLSCompliant(false)]
public static int WriteUInt32(uint source, int numberOfBits, byte[] destination, int destinationBitOffset)
{
#if BIGENDIAN
@ -377,7 +377,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes the specified number of bits into a byte array
/// </summary>
[CLSCompliant(false)]
public static int WriteUInt64(ulong source, int numberOfBits, byte[] destination, int destinationBitOffset)
{
#if BIGENDIAN
@ -475,7 +475,7 @@ namespace Lidgren.Network
/// Write Base128 encoded variable sized unsigned integer
/// </summary>
/// <returns>number of bytes written</returns>
[CLSCompliant(false)]
public static int WriteVariableUInt32(byte[] intoBuffer, int offset, uint value)
{
int retval = 0;
@ -493,7 +493,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a UInt32 written using WriteUnsignedVarInt(); will increment offset!
/// </summary>
[CLSCompliant(false)]
public static uint ReadVariableUInt32(byte[] buffer, ref int offset)
{
int num1 = 0;

View File

@ -59,7 +59,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads an SByte without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public sbyte PeekSByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
@ -116,7 +116,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a UInt16 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt16 PeekUInt16()
{
NetException.Assert(m_bitLength - m_readPosition >= 16, c_readOverflowError);
@ -166,7 +166,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a UInt32 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt32 PeekUInt32()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
@ -177,7 +177,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads the specified number of bits into a UInt32 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt32 PeekUInt32(int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "ReadUInt() can only read between 1 and 32 bits");
@ -193,7 +193,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a UInt64 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt64 PeekUInt64()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
@ -223,7 +223,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads the specified number of bits into an UInt64 without advancing the read pointer
/// </summary>
[CLSCompliant(false)]
public UInt64 PeekUInt64(int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 64), "ReadUInt() can only read between 1 and 64 bits");

View File

@ -60,7 +60,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a signed byte
/// </summary>
[CLSCompliant(false)]
public sbyte ReadSByte()
{
NetException.Assert(m_bitLength - m_readPosition >= 8, c_readOverflowError);
@ -163,7 +163,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a 16 bit unsigned integer written using Write(UInt16)
/// </summary>
[CLSCompliant(false)]
public UInt16 ReadUInt16()
{
NetException.Assert(m_bitLength - m_readPosition >= 16, c_readOverflowError);
@ -186,7 +186,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a 32 bit signed integer written using Write(Int32)
/// </summary>
[CLSCompliant(false)]
public bool ReadInt32(out Int32 result)
{
if (m_bitLength - m_readPosition < 32)
@ -230,7 +230,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads an 32 bit unsigned integer written using Write(UInt32)
/// </summary>
[CLSCompliant(false)]
public UInt32 ReadUInt32()
{
NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);
@ -242,7 +242,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads an 32 bit unsigned integer written using Write(UInt32) and returns true for success
/// </summary>
[CLSCompliant(false)]
public bool ReadUInt32(out UInt32 result)
{
if (m_bitLength - m_readPosition < 32)
@ -258,7 +258,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads an unsigned integer stored in 1 to 32 bits, written using Write(UInt32, Int32)
/// </summary>
[CLSCompliant(false)]
public UInt32 ReadUInt32(int numberOfBits)
{
NetException.Assert(numberOfBits > 0 && numberOfBits <= 32, "ReadUInt32(bits) can only read between 1 and 32 bits");
@ -272,7 +272,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a 64 bit unsigned integer written using Write(UInt64)
/// </summary>
[CLSCompliant(false)]
public UInt64 ReadUInt64()
{
NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);
@ -304,7 +304,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads an unsigned integer stored in 1 to 64 bits, written using Write(UInt64, Int32)
/// </summary>
[CLSCompliant(false)]
public UInt64 ReadUInt64(int numberOfBits)
{
NetException.Assert(numberOfBits > 0 && numberOfBits <= 64, "ReadUInt64(bits) can only read between 1 and 64 bits");
@ -416,7 +416,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a variable sized UInt32 written using WriteVariableUInt32()
/// </summary>
[CLSCompliant(false)]
public uint ReadVariableUInt32()
{
int num1 = 0;
@ -437,7 +437,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a variable sized UInt32 written using WriteVariableUInt32() and returns true for success
/// </summary>
[CLSCompliant(false)]
public bool ReadVariableUInt32(out uint result)
{
int num1 = 0;
@ -483,7 +483,7 @@ namespace Lidgren.Network
/// <summary>
/// Reads a variable sized UInt32 written using WriteVariableInt64()
/// </summary>
[CLSCompliant(false)]
public UInt64 ReadVariableUInt64()
{
UInt64 num1 = 0;

View File

@ -43,7 +43,7 @@ namespace Lidgren.Network
/// Value as an unsigned 32 bit integer
/// </summary>
[FieldOffset(0)]
[CLSCompliant(false)]
public uint UIntValue;
}
@ -114,7 +114,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a signed byte
/// </summary>
[CLSCompliant(false)]
public void Write(sbyte source)
{
EnsureBufferSize(m_bitLength + 8);
@ -163,7 +163,7 @@ namespace Lidgren.Network
/// Writes an unsigned 16 bit integer
/// </summary>
/// <param name="source"></param>
[CLSCompliant(false)]
public void Write(UInt16 source)
{
EnsureBufferSize(m_bitLength + 16);
@ -174,7 +174,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a 16 bit unsigned integer at a given offset in the buffer
/// </summary>
[CLSCompliant(false)]
public void WriteAt(Int32 offset, UInt16 source)
{
int newBitLength = Math.Max(m_bitLength, offset + 16);
@ -186,7 +186,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes an unsigned integer using 1 to 16 bits
/// </summary>
[CLSCompliant(false)]
public void Write(UInt16 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 16), "Write(ushort, numberOfBits) can only write between 1 and 16 bits");
@ -288,7 +288,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a 32 bit unsigned integer
/// </summary>
[CLSCompliant(false)]
public void Write(UInt32 source)
{
EnsureBufferSize(m_bitLength + 32);
@ -300,7 +300,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a 32 bit unsigned integer at a given offset in the buffer
/// </summary>
[CLSCompliant(false)]
public void WriteAt(Int32 offset, UInt32 source)
{
int newBitLength = Math.Max(m_bitLength, offset + 32);
@ -312,7 +312,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a 32 bit signed integer
/// </summary>
[CLSCompliant(false)]
public void Write(UInt32 source, int numberOfBits)
{
NetException.Assert((numberOfBits > 0 && numberOfBits <= 32), "Write(uint, numberOfBits) can only write between 1 and 32 bits");
@ -347,7 +347,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a 64 bit unsigned integer
/// </summary>
[CLSCompliant(false)]
public void Write(UInt64 source)
{
EnsureBufferSize(m_bitLength + 64);
@ -358,7 +358,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes a 64 bit unsigned integer at a given offset in the buffer
/// </summary>
[CLSCompliant(false)]
public void WriteAt(Int32 offset, UInt64 source)
{
int newBitLength = Math.Max(m_bitLength, offset + 64);
@ -370,7 +370,7 @@ namespace Lidgren.Network
/// <summary>
/// Writes an unsigned integer using 1 to 64 bits
/// </summary>
[CLSCompliant(false)]
public void Write(UInt64 source, int numberOfBits)
{
EnsureBufferSize(m_bitLength + numberOfBits);
@ -485,7 +485,7 @@ namespace Lidgren.Network
/// Write Base128 encoded variable sized unsigned integer of up to 32 bits
/// </summary>
/// <returns>number of bytes written</returns>
[CLSCompliant(false)]
public int WriteVariableUInt32(uint value)
{
int retval = 1;
@ -524,7 +524,7 @@ namespace Lidgren.Network
/// Write Base128 encoded variable sized unsigned integer of up to 64 bits
/// </summary>
/// <returns>number of bytes written</returns>
[CLSCompliant(false)]
public int WriteVariableUInt64(UInt64 value)
{
int retval = 1;

View File

@ -26,7 +26,7 @@ namespace Lidgren.Network
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
m_w = seed;
@ -36,7 +36,7 @@ namespace Lidgren.Network
/// <summary>
/// (Re)initialize this instance with provided 64 bit seed
/// </summary>
[CLSCompliant(false)]
public void Initialize(ulong seed)
{
m_w = (uint)seed;
@ -46,7 +46,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
m_z = 36969 * (m_z & 65535) + (m_z >> 16);
@ -83,7 +83,7 @@ namespace Lidgren.Network
/// <summary>
/// Constructor with provided 64 bit seed
/// </summary>
[CLSCompliant(false)]
public XorShiftRandom(ulong seed)
{
Initialize(seed);
@ -92,7 +92,7 @@ namespace Lidgren.Network
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
m_x = (uint)seed;
@ -104,7 +104,7 @@ namespace Lidgren.Network
/// <summary>
/// (Re)initialize this instance with provided 64 bit seed
/// </summary>
[CLSCompliant(false)]
public void Initialize(ulong seed)
{
m_x = (uint)seed;
@ -116,7 +116,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
uint t = (m_x ^ (m_x << 11));
@ -164,7 +164,7 @@ namespace Lidgren.Network
/// <summary>
/// Constructor with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public MersenneTwisterRandom(uint seed)
{
Initialize(seed);
@ -173,7 +173,7 @@ namespace Lidgren.Network
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
mt = new UInt32[N];
@ -187,7 +187,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
UInt32 y;
@ -242,7 +242,7 @@ namespace Lidgren.Network
/// <summary>
/// Seed in CryptoRandom does not create deterministic sequences
/// </summary>
[CLSCompliant(false)]
public override void Initialize(uint seed)
{
byte[] tmp = new byte[seed % 16];
@ -252,7 +252,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public override uint NextUInt32()
{
var bytes = new byte[4];

View File

@ -35,7 +35,7 @@ namespace Lidgren.Network
/// <summary>
/// (Re)initialize this instance with provided 32 bit seed
/// </summary>
[CLSCompliant(false)]
public virtual void Initialize(uint seed)
{
// should be abstract, but non-CLS compliant methods can't be abstract!
@ -45,7 +45,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a random value from UInt32.MinValue to UInt32.MaxValue, inclusively
/// </summary>
[CLSCompliant(false)]
public virtual uint NextUInt32()
{
// should be abstract, but non-CLS compliant methods can't be abstract!
@ -117,7 +117,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a random value between UInt64.MinValue to UInt64.MaxValue
/// </summary>
[CLSCompliant(false)]
public ulong NextUInt64()
{
ulong retval = NextUInt32();

View File

@ -13,7 +13,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a 32 bit random seed
/// </summary>
[CLSCompliant(false)]
public static uint GetUInt32()
{
ulong seed = GetUInt64();
@ -25,7 +25,7 @@ namespace Lidgren.Network
/// <summary>
/// Generates a 64 bit random seed
/// </summary>
[CLSCompliant(false)]
public static ulong GetUInt64()
{
var guidBytes = Guid.NewGuid().ToByteArray();

View File

@ -273,7 +273,7 @@ namespace Lidgren.Network
/// <summary>
/// Returns how many bits are necessary to hold a certain number
/// </summary>
[CLSCompliant(false)]
public static int BitsToHoldUInt(uint value)
{
int bits = 1;
@ -285,7 +285,7 @@ namespace Lidgren.Network
/// <summary>
/// Returns how many bits are necessary to hold a certain number
/// </summary>
[CLSCompliant(false)]
public static int BitsToHoldUInt64(ulong value)
{
int bits = 1;

View File

@ -14,7 +14,7 @@ namespace Lidgren.Network
{
}
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;

View File

@ -14,7 +14,7 @@ namespace Lidgren.Network
{
}
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;

View File

@ -14,7 +14,7 @@ namespace Lidgren.Network
private static readonly long s_timeInitialized = Stopwatch.GetTimestamp();
private static readonly double s_dInvFreq = 1.0 / (double)Stopwatch.Frequency;
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)System.Diagnostics.Stopwatch.GetTimestamp();

View File

@ -44,7 +44,7 @@ namespace Lidgren.Network
public static partial class NetUtility
{
[CLSCompliant(false)]
public static ulong GetPlatformSeed(int seedInc)
{
ulong seed = (ulong)Environment.TickCount + (ulong)seedInc;