Beispiel #1
0
        public static DDFBase Create(DDFType type)
        {
            switch (type)
            {
            case DDFType.Bool:
                return(new DDFBool());

            case DDFType.Byte:
                return(new DDFByte());

            case DDFType.ByteArray:
                return(new DDFByteArray());

            case DDFType.Char:
                return(new DDFChar());

            case DDFType.Double:
                return(new DDFDouble());

            case DDFType.Float:
                return(new DDFFloat());

            case DDFType.Int:
                return(new DDFInt());

            case DDFType.List:
                return(new DDFList());

            case DDFType.Long:
                return(new DDFLong());

            case DDFType.Map:
                return(new DDFMap());

            case DDFType.SByte:
                return(new DDFSByte());

            case DDFType.Short:
                return(new DDFShort());

            case DDFType.String:
                return(new DDFString());

            case DDFType.UInt:
                return(new DDFUInt());

            case DDFType.ULong:
                return(new DDFULong());

            case DDFType.UShort:
                return(new DDFUShort());

            default:
                return(null);
            }
        }
Beispiel #2
0
        public override void Deserialize(DataStream dataStream)
        {
            entries.Clear();

            this.listType = (DDFType)dataStream.ReadByte();

            ushort count = dataStream.ReadUShort();

            for (int i = 0; i < count; i++)
            {
                DDFBase entry = DDFFactory.Create(listType);

                entry.Deserialize(dataStream);

                entries.Add(entry);
            }
        }
Beispiel #3
0
        public override void Deserialize(DataStream dataStream)
        {
            entries.Clear();

            ushort count = dataStream.ReadUShort();

            for (int i = 0; i < count; i++)
            {
                DDFString entryName = new DDFString();

                entryName.Deserialize(dataStream);
                DDFType entryType = (DDFType)dataStream.ReadByte();
                DDFBase entry     = DDFFactory.Create(entryType);

                entry.Deserialize(dataStream);

                entries.Add(entryName.Value, entry);
            }
        }
Beispiel #4
0
 public DDFValueBase(DDFType type)
     : base(type)
 {
     this.Value = default(T);
 }
Beispiel #5
0
 public DDFPrimitiveBase(DDFType type)
     : base(type)
 {
 }
Beispiel #6
0
 public DDFList(DDFType listType) : base(DDFType.List)
 {
     this.entries  = new ArrayList <DDFBase>();
     this.listType = listType;
 }
Beispiel #7
0
 public DDFBase(DDFType type)
 {
     this.type = type;
 }