예제 #1
0
        public string GetStringValueFromMemoryDictEntry(MemoryDictEntry entry)
        {
            switch (entry.Type)
            {
            case "str":
                return(((PyStr)entry.Value).String);

            case "unicode":
                return(((PyUnicode)entry.Value).String);

            case "float":
                return(((PyFloat)entry.Value).Float.ToString());

            case "int":
                return(((PyInt)entry.Value).Int.ToString());

            case "bool":
                return(((PyBool)entry.Value).Bool.ToString());

            case "list":
                return(entry.BaseAddress.ToString("x"));

            default:
                return(entry.BaseAddress.ToString("x"));
            }
        }
예제 #2
0
        public MemoryManager()
        {
            try
            {
                // Prep:
                RootNode = null;
                Nodes    = new Dictionary <long, MemoryNode>();

                ReadRootNode();
                if (RootNode == null)
                {
                    return;
                }

                var AllNodes =
                    new UITreeNode[] { RootNode }
                .Concat(RootNode.EnumerateChildrenTransitive(PyMemoryReader)).ToArray();

                //	show off the spoils....
                foreach (var Node in AllNodes)
                {
                    MemoryNode memNode = new MemoryNode();
                    memNode.BaseAddress = Node.BaseAddress;

                    var Dict = Node.Dict;

                    if (null == Dict)
                    {
                        continue;
                    }

                    var DictSlots = Dict.Slots;

                    if (null == DictSlots)
                    {
                        continue;
                    }

                    //	show info for each entry in dict that has a String as Key.
                    foreach (var Entry in DictSlots)
                    {
                        var EntryKeyStr = Entry.KeyStr;

                        if (null == EntryKeyStr)
                        {
                            continue;
                        }

                        var          me_value   = Entry.me_value;
                        PyTypeObject typeObject = new PyObject(me_value.Value, MemoryReader).LoadType(PyMemoryReader);

                        MemoryDictEntry memEntry = new MemoryDictEntry(Entry.BaseAddress, EntryKeyStr, GetTypeName(me_value), ReadValue(me_value));
                        memNode.AddMemoryDictEntry(memEntry);
                    }

                    Nodes.Add(memNode.BaseAddress, memNode);
                }
            }
            finally
            {
            }
        }
예제 #3
0
 public void AddMemoryDictEntry(MemoryDictEntry entry)
 {
     Dict.Add(entry.Key, entry);
 }