Пример #1
0
        public static string PropertyToText(Property p, PCCObject pcc)
        {
            string s = "";

            s  = "Name: " + pcc.Names[p.Name];
            s += " Type: " + TypeToString((int)p.TypeVal);
            s += " Size: " + p.Value.len.ToString();
            switch (p.TypeVal)
            {
            case Type.StructProperty:
                s += " \"" + pcc.getNameEntry(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:
                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 + "\"";
                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);
        }
Пример #2
0
 public static string PropertyToText(Property p,PCCObject pcc)
 {
     string s = "";
     s = "Name: " + pcc.Names[p.Name];
     s += " Type: " + TypeToString((int)p.TypeVal);
     s += " Size: " + p.Value.len.ToString();
     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:
             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;
 }
Пример #3
0
        public TreeNode GenerateNode(PropHeader p)
        {
            string s = p.offset.ToString("X4") + " : ";

            s += "Name: \"" + pcc.GetName(p.name) + "\" ";
            s += "Type: \"" + pcc.GetName(p.type) + "\" ";
            s += "Size: " + p.size.ToString() + " Value: ";
            switch (isType(pcc.GetName(p.type)))
            {
            case 1:
                int idx = BitConverter.ToInt32(memory, p.offset + 24);
                s += idx.ToString();
                break;

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

            case 8:
                int count = BitConverter.ToInt32(memory, p.offset + 24);
                s += "\"";
                for (int i = 0; i < count - 1; i++)
                {
                    s += (char)memory[p.offset + 28 + i];
                }
                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.GetName(idx) + "\"";
                break;

            case 6:
                idx = BitConverter.ToInt32(memory, p.offset + 24);
                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);
                s  += "#" + idx.ToString();
                break;
            }
            TreeNode ret = new TreeNode(s);

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