-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create & Implement INetStreamReader & INetStreamWriter * Add simple stream necessities * Oops * Not for steam 😅
- Loading branch information
Showing
5 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Obsidian.API; | ||
public interface INetStream : IDisposable, IAsyncDisposable | ||
{ | ||
public long Length { get; } | ||
|
||
public long Position { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace Obsidian.API; | ||
public interface INetStreamReader : INetStream | ||
{ | ||
public bool CanRead { get; } | ||
|
||
public sbyte ReadSignedByte(); | ||
public byte ReadUnsignedByte(); | ||
public bool ReadBoolean(); | ||
public ushort ReadUnsignedShort(); | ||
public short ReadShort(); | ||
public int ReadInt(); | ||
public long ReadLong(); | ||
public ulong ReadUnsignedLong(); | ||
public float ReadFloat(); | ||
public double ReadDouble(); | ||
public string ReadString(int maxLength = short.MaxValue); | ||
public int ReadVarInt(); | ||
public byte[] ReadUInt8Array(int length = 0); | ||
public long ReadVarLong(); | ||
|
||
public DateTimeOffset ReadDateTimeOffset(); | ||
|
||
public Vector ReadPosition(); | ||
public Vector ReadAbsolutePosition(); | ||
public VectorF ReadPositionF(); | ||
public VectorF ReadAbsolutePositionF(); | ||
public VectorF ReadAbsoluteFloatPositionF(); | ||
|
||
public SoundPosition ReadSoundPosition(); | ||
|
||
public Angle ReadAngle(); | ||
public Angle ReadFloatAngle(); | ||
public ChatMessage ReadChat(); | ||
public byte[] ReadByteArray(); | ||
public Guid ReadGuid(); | ||
public Guid? ReadOptionalGuid(); | ||
public ItemStack ReadItemStack(); | ||
public Velocity ReadVelocity(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace Obsidian.API; | ||
public interface INetStreamWriter : INetStream | ||
{ | ||
public bool CanWrite { get; } | ||
public void WriteByte(sbyte value); | ||
public void WriteUnsignedByte(byte value); | ||
public void WriteBoolean(bool value); | ||
|
||
public void WriteUnsignedShort(ushort value); | ||
public void WriteShort(short value); | ||
|
||
public void WriteInt(int value); | ||
|
||
public void WriteLong(long value); | ||
|
||
public void WriteFloat(float value); | ||
public void WriteDouble(double value); | ||
|
||
public void WriteString(string value, int maxLength = short.MaxValue); | ||
public void WriteVarInt(int value); | ||
public void WriteVarInt(Enum value); | ||
|
||
public void WriteLongArray(long[] values); | ||
public void WriteVarLong(long value); | ||
|
||
public void WriteBitSet(BitSet bitset, bool isFixed = false); | ||
public void WriteChat(ChatMessage chatMessage); | ||
public void WriteItemStack(ItemStack itemStack); | ||
public void WriteDateTimeOffset(DateTimeOffset date); | ||
public void WriteSoundEffect(SoundEffect sound); | ||
public void WriteByteArray(byte[] values); | ||
public void WriteUuid(Guid value); | ||
|
||
public byte[] ToArray(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters