Ejemplo n.º 1
0
        public static string PropertyToText(Property p, IPCCObject pcc)
        {
            string s = "";

            s  = "Name: " + pcc.Names[p.Name];
            s += " Type: " + TypeToString((int)p.TypeVal);
            s += " Size: " + p.Value.len.ToString();
            int MEtype = Methods.GetMEType();

            switch (p.TypeVal)
            {
            case Type.StructProperty:
                s += " \"" + pcc.GetName(p.Value.IntValue) + "\" with " + p.Value.Array.Count.ToString() + " bytes";
                break;

            case Type.IntProperty:
            case Type.BoolProperty:
            case Type.StringRefProperty:
                s += " Value: " + p.Value.IntValue.ToString();
                break;

            case Type.ObjectProperty:
                if (MEtype == 2)
                {
                    s += " Value: " + p.Value.IntValue.ToString();
                }
                else
                {
                    s += " Value: " + p.Value.IntValue.ToString() + " ";
                    int v = p.Value.IntValue;
                    if (v == 0)
                    {
                        s += "None";
                    }
                    else
                    {
                        s += pcc.GetClass(v);
                    }
                }

                break;

            case Type.FloatProperty:
                byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                float  f    = BitConverter.ToSingle(buff, 0);
                s += " Value: " + f.ToString();
                break;

            case Type.NameProperty:
                s += " " + pcc.Names[p.Value.IntValue];
                break;

            case Type.ByteProperty:
                s += " Value: \"" + p.Value.StringValue + "\" with \"" + pcc.GetName(p.Value.IntValue) + "\"";
                break;

            case Type.ArrayProperty:
                s += " bytes";     //Value: " + p.Value.Array.Count.ToString() + " Elements";
                break;

            case Type.StrProperty:
                if (p.Value.StringValue.Length == 0)
                {
                    break;
                }
                s += " Value: " + p.Value.StringValue.Substring(0, p.Value.StringValue.Length - 1);
                break;
            }
            return(s);
        }
Ejemplo n.º 2
0
        public static string PropertyToText(Property p, IPCCObject pcc)
        {
            string s = "";
            s = "Name: " + pcc.Names[p.Name];
            s += " Type: " + TypeToString((int)p.TypeVal);
            s += " Size: " + p.Value.len.ToString();
            int MEtype = Methods.GetMEType();
            switch (p.TypeVal)
            {
                case Type.StructProperty:
                    s += " \"" + pcc.GetName(p.Value.IntValue) + "\" with " + p.Value.Array.Count.ToString() + " bytes";
                    break;
                case Type.IntProperty:
                case Type.BoolProperty:
                case Type.StringRefProperty:
                    s += " Value: " + p.Value.IntValue.ToString();
                    break;
                case Type.ObjectProperty:
                    if (MEtype == 2)
                        s += " Value: " + p.Value.IntValue.ToString();
                    else
                    {
                        s += " Value: " + p.Value.IntValue.ToString() + " ";
                        int v = p.Value.IntValue;
                        if (v == 0)
                            s += "None";
                        else
                            s += pcc.GetClass(v);
                    }

                    break;
                case Type.FloatProperty:
                    byte[] buff = BitConverter.GetBytes(p.Value.IntValue);
                    float f = BitConverter.ToSingle(buff, 0);
                    s += " Value: " + f.ToString();
                    break;
                case Type.NameProperty:
                    s += " " + pcc.Names[p.Value.IntValue];
                    break;
                case Type.ByteProperty:
                    s += " Value: \"" + p.Value.StringValue + "\" with \"" + pcc.GetName(p.Value.IntValue) + "\"";
                    break;
                case Type.ArrayProperty:
                    s += " bytes"; //Value: " + p.Value.Array.Count.ToString() + " Elements";
                    break;
                case Type.StrProperty:
                    if (p.Value.StringValue.Length == 0)
                        break;
                    s += " Value: " + p.Value.StringValue.Substring(0, p.Value.StringValue.Length - 1);
                    break;
            }
            return s;
        }
Ejemplo n.º 3
0
        public TreeNode GenerateNode(PropHeader p)
        {
            string s = p.offset.ToString("X4") + " : ";

            s += "Name: \"" + pcc.getNameEntry(p.name) + "\" ";
            s += "Type: \"" + pcc.getNameEntry(p.type) + "\" ";
            s += "Size: " + p.size.ToString() + " Value: ";
            int idx = -1;

            switch (isType(pcc.getNameEntry(p.type)))
            {
            case 3:
                idx = BitConverter.ToInt32(memory, p.offset + 24);
                s  += idx.ToString() + " ";
                if (idx == 0)
                {
                    s += "None";
                }
                else
                {
                    s += pcc.GetClass(idx);
                }
                break;

            case 1:
                idx = BitConverter.ToInt32(memory, p.offset + 24);
                s  += idx.ToString();
                break;

            case 8:
                int count = BitConverter.ToInt32(memory, p.offset + 24);
                s += "\"";

                if (GameVersion == 1)
                {
                    for (int i = 0; i < count - 1; i++)
                    {
                        s += (char)memory[p.offset + 28 + i];
                    }
                }
                else
                {
                    for (int i = 0; i < count * -1 - 1; i++)
                    {
                        s += (char)memory[p.offset + 28 + i * 2];
                    }
                }
                s += "\"";
                break;

            case 5:
                byte val = memory[p.offset + 24];
                s += (val == 1).ToString();
                break;

            case 2:
                float f = BitConverter.ToSingle(memory, p.offset + 24);
                s += f.ToString() + "f";
                break;

            case 0:
            case 4:
                idx = BitConverter.ToInt32(memory, p.offset + 24);
                s  += "\"" + pcc.getNameEntry(idx) + "\"";
                break;

            case 6:
                idx = BitConverter.ToInt32(memory, p.offset + 24);
                if (GameVersion == 3)
                {
                    int idx2 = BitConverter.ToInt32(memory, p.offset + 32);
                    s += "\"" + pcc.getNameEntry(idx) + "\",\"" + pcc.getNameEntry(idx2) + "\"";
                }
                else if (GameVersion == 2)
                {
                    s += "\"" + pcc.GetName(idx) + "\"";
                }
                break;

            case 7:
                idx = BitConverter.ToInt32(memory, p.offset + 24);
                s  += idx.ToString() + "(count)";
                break;

            case 9:
                idx = BitConverter.ToInt32(memory, p.offset + 24);

                if (GameVersion == 3)
                {
                    s += "#" + idx.ToString() + ": ";
                    s += talkFile.findDataById(idx);
                }
                else if (GameVersion == 2)
                {
                    s += "#" + idx.ToString();
                }
                break;
            }
            TreeNode ret = new TreeNode(s);

            ret.Name = p.offset.ToString();
            return(ret);
        }