//private string path; public TypeDefinitionViewModel( //[NotNull] CommandCollection commands, [NotNull] ITypeDefinition definition) { //this.commands = commands ?? throw new ArgumentNullException(nameof(commands)); this.definition = definition ?? throw new ArgumentNullException(nameof(definition)); //this.typeDefinitionContentFactory = typeDefinitionContentFactory // ?? throw new ArgumentNullException(nameof(typeDefinitionContentFactory)); //this.managedObjectContentFactory = managedObjectContentFactory // ?? throw new ArgumentNullException(nameof(managedObjectContentFactory)); //this.listContentFactory = listContentFactory ?? throw new ArgumentNullException(nameof(listContentFactory)); var model = new TypeDefinitionContentViewModel(this.definition); //model.AppendToTrail += this.ModelOnAppendToTrail; this.content = model; }
public static void DumpMemory(object value, string currentNode, List <string> dump, List <uint> addresses) { //if (Regex.Matches(currentNode, Crawler.SEPARATOR).Count > 4) //{ // dump.Add("Too deep, returning " + currentNode); // return; //} //dump.Add("is value? " + (value is IManagedObjectInstance)); //Console.WriteLine("Dumping memory value for " + value + " in " + currentNode); if (value is ITypeDefinition type) { var model = new TypeDefinitionContentViewModel(type); model.DumpMemory(currentNode, dump, addresses, value as dynamic); //this.Content = model; } else if (value is TypeDefinitionContentViewModel contentModel) { contentModel.DumpMemory(currentNode, dump, addresses, value as dynamic); } else if (value is IManagedObjectInstance instance) { //if (addresses.Contains(instance.GetAddress())) //{ // return; //} //addresses.Add(instance.GetAddress()); //dump.Add("Ready to handle managed object " + currentNode); var model = new ManagedObjectInstanceContentViewModel(instance); model.DumpMemory(currentNode, dump, addresses); //this.Content = model; } else if (value is IList list) { var model = new ListContentViewModel(list); model.DumpMemory(currentNode, dump, addresses); //model.AppendToTrail += this.ModelOnAppendToTrail; //this.Content = model; } else { try { var model = new TypeDefinitionContentViewModel((value as dynamic).TypeDefinition); model.DumpMemory(currentNode, dump, addresses, value as dynamic); } catch (Exception e) { } } //else if (value != null) //{ // Console.WriteLine("Unknown content type " + value.GetType()); //} //else if (value == null) //{ // Console.WriteLine("Null value for " + currentNode); //} //else //{ // Console.WriteLine("Wtf value for " + currentNode); //} }