示例#1
0
 public RttiTreeNode(RttiObject rttiObject)
 {
     if (rttiObject.ObjectLocator != null)
     {
         Text = rttiObject.Offset != -1 ? $"{rttiObject.Offset:X4} {rttiObject.Name}" : rttiObject.Name;
     }
     else
     {
         Text = "Invalid";
     }
     RttiObject = rttiObject;
     Nodes.Add(new TreeNode(Text)
     {
         Name = "dummy"
     });
 }
 private void bWorkerMain_DoWork(object sender, DoWorkEventArgs e)
 {
     if (!Core.isLoaded)
     {
         return;
     }
     if (e.Argument is null)
     {
         e.Result = null;
         return;
     }
     if (e.Argument is RttiTreeNode node)
     {
         var nodeList = new List <RttiTreeNode>();
         Logging.Log($"Searching {MaxOffset / 4} addresses ...");
         var sw = Stopwatch.StartNew();
         for (var i = 0; i < MaxOffset; i += 4)
         {
             if (bWorkerMain.CancellationPending)
             {
                 break;
             }
             bWorkerMain.ReportProgress(i);
             var x = new RttiObject(node.RttiObject.BaseAddress + i, i);
             if (x.isValid())
             {
                 nodeList.Add(new RttiTreeNode(x));
             }
         }
         sw.Stop();
         Logging.Log($"Found {nodeList.Count} classes");
         Logging.Log($"Time: {sw.Elapsed.TotalMinutes:00}:{sw.Elapsed.Seconds:00}.{sw.Elapsed.Milliseconds:000}");
         Logging.Log($"{new string('-', 50)}");
         bWorkerMain.ReportProgress(MaxOffset);
         e.Result = new object[] { node, nodeList };
         return;
     }
     e.Result = null;
 }