Ejemplo n.º 1
0
        static string DumpField(string szName, string sPrefix, uint dwPointer, uint lastIndex, out uint outLastIndex, string prefixEnum, bool multiply, bool upper, bool remLocal)
        {
            string valueReturn = "";

            valueReturn = valueReturn + "public enum " + prefixEnum + szName + Environment.NewLine + "{" + Environment.NewLine;
            string lastPszName = "";

            while (true)
            {
                DescriptorStruct descriptorStruct = (DescriptorStruct)_memory.ReadObject((uint)_memory.MainModule.BaseAddress + dwPointer, typeof(DescriptorStruct));
                // Get name:
                string pszName     = _memory.ReadASCIIString(descriptorStruct.pName, 100);
                uint   multiplyNum = 1;
                if (multiply)
                {
                    multiplyNum = 4;
                }

                if (string.IsNullOrEmpty(pszName))
                {
                    break;
                }

                if (pszName.Contains(sPrefix) && !pszName.Contains("["))
                {
                    pszName = pszName.Replace(sPrefix, "").Replace(".", "_");

                    if (remLocal)
                    {
                        pszName = pszName.Replace("local_", "");
                    }
                    if (upper)
                    {
                        var t = pszName.ToCharArray();
                        if (t.Length > 0)
                        {
                            t[0]    = pszName[0].ToString(CultureInfo.InvariantCulture).ToUpper().ToCharArray()[0];
                            pszName = new string(t);
                        }
                    }

                    if (string.IsNullOrEmpty(lastPszName) || lastPszName != pszName)
                    {
                        lastPszName = pszName;

                        valueReturn = valueReturn + "   " + pszName + " = 0x" + ((lastIndex) * multiplyNum).ToString("X") +
                                      "," + Environment.NewLine;
                        lastIndex = lastIndex + descriptorStruct.size;
                    }
                }

                dwPointer = dwPointer + 0xC;
            }

            valueReturn = valueReturn + "};" + Environment.NewLine + Environment.NewLine;

            outLastIndex = lastIndex;

            return(valueReturn);
        }
Ejemplo n.º 2
0
 public static string StuctFileName(DescriptorStruct jStruct)
 {
     return(CppStyleName(jStruct.Name));
 }