mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
894 B
39 lines
894 B
// Copyright (c) Six Labors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
namespace SixLabors.ImageSharp.Tests
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public class ByteBuffer
|
|
{
|
|
List<byte> bytes = new List<byte>();
|
|
bool isLittleEndian;
|
|
|
|
public ByteBuffer(bool isLittleEndian)
|
|
{
|
|
this.isLittleEndian = isLittleEndian;
|
|
}
|
|
|
|
public void AddByte(byte value)
|
|
{
|
|
bytes.Add(value);
|
|
}
|
|
|
|
public void AddUInt16(ushort value)
|
|
{
|
|
bytes.AddRange(BitConverter.GetBytes(value).WithByteOrder(isLittleEndian));
|
|
}
|
|
|
|
public void AddUInt32(uint value)
|
|
{
|
|
bytes.AddRange(BitConverter.GetBytes(value).WithByteOrder(isLittleEndian));
|
|
}
|
|
|
|
public byte[] ToArray()
|
|
{
|
|
return bytes.ToArray();
|
|
}
|
|
}
|
|
}
|