123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System.Text;
- using SharpCompress.Converters;
- namespace SharpCompress.Compressors.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)
- {
- _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();
- }
- }
- }
|