Files
sharpcompress/SharpCompress/Compressor/PPMd/H/RarNode.cs
benshoof 8ceac9000c SharpCompress now endian neutral
SharpCompress can now be used on machines with big endian architecture
such as powerpc. All byte conversions now run through Mono's
DataConverter (or a portable version for builds that don't allow unsafe
code) instead of BitConverter, as BitConverter's behavior depends on the
host cpu.
2016-01-22 14:32:35 -09:00

54 lines
1.3 KiB
C#

using System.Text;
using SharpCompress.Converter;
namespace SharpCompress.Compressor.PPMd.H
{
internal class RarNode : Pointer
{
private int next; //rarnode pointer
public const int size = 4;
public RarNode(byte[] Memory)
: base(Memory)
{
}
internal int GetNext()
{
if (Memory != null)
{
next = DataConverter.LittleEndian.GetInt32(Memory, Address);
}
return next;
}
internal void SetNext(RarNode next)
{
SetNext(next.Address);
}
internal void SetNext(int next)
{
this.next = next;
if (Memory != null)
{
DataConverter.LittleEndian.PutBytes(Memory, Address, next);
}
}
public override string ToString()
{
StringBuilder buffer = new StringBuilder();
buffer.Append("State[");
buffer.Append("\n Address=");
buffer.Append(Address);
buffer.Append("\n size=");
buffer.Append(size);
buffer.Append("\n next=");
buffer.Append(GetNext());
buffer.Append("\n]");
return buffer.ToString();
}
}
}