using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HaloObjects
{
    public class String256 : MetaNode
    {
        string Value = "", Name = "String256";

        public String256(string Name)
        {
            this.Name = Name;
        }

        #region MetaNode Members

        public void Read(System.IO.BinaryReader br)
        {
            Value = new string(br.ReadChars(256));
        }

        public void Read(System.IO.BinaryReader br, int Magic)
        {
            Value = new string(br.ReadChars(256));
        }

        public void Write(System.IO.BinaryWriter bw)
        {
            bw.Write(Value.ToCharArray());
            bw.Write(new byte[256 - Value.Length]);
        }

        public object GetValue()
        {
            return Value;
        }

        public void SetValue(object Value)
        {
            this.Value = (string)Value;
        }

        public int GetSize()
        {
            return 256;
        }

        public void Compile(System.IO.BinaryWriter bw, int Magic)
        {
            bw.Write(Value.ToCharArray());
            bw.Write(new byte[256 - Value.Length]);
        }

        public void Decompile(System.IO.BinaryWriter bw, int Magic)
        {
            bw.Write(Value.ToCharArray());
            bw.Write(new byte[256 - Value.Length]);
        }

        public string GetName()
        {
            return Name;
        }

        #endregion

        #region ICloneable Members

        public object Clone()
        {
            String256 s = new String256(this.Name);
            s.Value = Value;
            return s;
        }

        #endregion
    }
}
