Skip to content

Commit de35af0

Browse files
Merge branch 'master' of https://github.com/TwoTenPvP/MLAPI
2 parents f511913 + be0c4a2 commit de35af0

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

MLAPI.Tests/NetworkingManagerComponents/Binary/BitStreamTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void TestGrow()
3535
BitStream bitStream = new BitStream(new byte[0]);
3636
Assert.That(
3737
() => { bitStream.WriteInt64(long.MaxValue); },
38-
Throws.TypeOf<CapacityException>());
38+
Throws.TypeOf<NotSupportedException>());
3939
}
4040

4141
[Test]

MLAPI/NetworkingManagerComponents/Binary/BitStream.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public override long Seek(long offset, SeekOrigin origin)
205205
/// <param name="value">New capacity of the buffer</param>
206206
private void SetCapacity(long value)
207207
{
208-
if (!Resizable) throw new CapacityException("Can't resize fixed-capacity buffer! Capacity (bytes): "+target.Length); // Don't do shit because fuck you
208+
if (!Resizable) throw new NotSupportedException("Can't resize non resizable buffer"); // Don't do shit because fuck you (comment by @GabrielTofvesson -TwoTen)
209209
byte[] newTarg = new byte[value];
210210
long len = Math.Min(value, target.LongLength);
211211
Buffer.BlockCopy(target, 0, newTarg, 0, (int)len);
@@ -685,15 +685,5 @@ public byte[] ToArray()
685685
/// </summary>
686686
/// <returns>Hex encoded version of the buffer</returns>
687687
public override string ToString() => BitConverter.ToString(target, 0, (int)Length);
688-
689-
/// <summary>
690-
/// An exception representing cases when buffer-capacity related errors occur.
691-
/// </summary>
692-
public sealed class CapacityException : Exception
693-
{
694-
public CapacityException() { }
695-
public CapacityException(string message) : base(message) { }
696-
public CapacityException(string message, Exception innerException) : base(message, innerException) { }
697-
}
698688
}
699689
}

0 commit comments

Comments
 (0)