Exemple #1
0
        private PsoType6 ReadType6(XmlNode node)
        {
            PsoType6 v = new Types.PsoType6();

            v.Value = long.Parse(node.Attributes["value"].Value);
            return(v);
        }
Exemple #2
0
        public void Read(DataReader reader)
        {
            long position = reader.Position;

            this.Values = new Dictionary <int, IPsoValue>();
            for (int i = 0; i < psoSection.Entries.Count; i++)
            {
                var x1 = psoSection.Entries[i];
                if (x1.EntryNameHash == 0x100)
                {
                    continue;
                }

                reader.Position = position + x1.DataOffset;
                switch (x1.Type)
                {
                case DataType.Array:
                {
                    var entryValue = new PsoArray();
                    entryValue.psoSection = psoSection.Entries[x1.ReferenceKey & 0x0000FFFF];
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.INT_0Bh:
                {
                    if (psoSection.Entries[i].ReferenceKey == 0)
                    {
                        var entryValue = new PsoType11(0);
                        entryValue.Read(reader);
                        this.Values.Add(x1.EntryNameHash, entryValue);
                    }
                    else
                    {
                        var entryValue = new PsoType11(64);
                        entryValue.Read(reader);
                        this.Values.Add(x1.EntryNameHash, entryValue);
                    }

                    break;
                }

                case DataType.BYTE_ENUM_VALUE:
                {
                    var entryValue = new PsoType14();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.SHORT_0Fh:
                {
                    var entryValue = new PsoType15();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.INT_06h:
                {
                    var entryValue = new PsoType6();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.Structure:
                {
                    var entryValue = new PsoStructure();
                    entryValue.pso          = pso;
                    entryValue.psoSection   = GetStructureInfo(pso, x1.ReferenceKey);
                    entryValue.psoEntryInfo = GetStructureIndexInfo(pso, x1.ReferenceKey);
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }


                case DataType.TYPE_10h:
                {
                    var entryValue = new PsoType16();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.INT_05h:
                {
                    var entryValue = new PsoType5();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.BYTE_02h:
                {
                    var entryValue = new PsoType2();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.Float:
                {
                    var entryValue = new PsoFloat();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.BYTE_00h:
                {
                    var entryValue = new PsoType0();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                case DataType.TYPE_15h:
                {
                    var entryValue = new PsoType21();
                    entryValue.Read(reader);
                    this.Values.Add(x1.EntryNameHash, entryValue);
                    break;
                }

                default:
                    throw new Exception("Unknown Type");
                }
            }

            reader.Position = position + psoSection.StructureLength;
        }