public void DebugDump(TextWriter writer, Story story) { if (OwnerNode != null && OwnerNode.Name.Length > 0) { writer.Write("{0}/{1}", OwnerNode.Name, OwnerNode.NameIndex); } else if (OwnerNode != null) { writer.Write("<{0}>", OwnerNode.TypeName()); } else { writer.Write("(Not owned)"); } writer.Write(" @ {0:X}: ", FactsPosition); Parameters.DebugDump(writer, story); writer.WriteLine(""); writer.WriteLine(" Facts: "); foreach (var fact in Facts) { writer.Write(" "); fact.DebugDump(writer, story); writer.WriteLine(); } }
public void Visit(Node node) { writer.WritePropertyName("type"); writer.WriteValue(node.TypeName()); writer.WritePropertyName("name"); writer.WriteValue(node.Name); writer.WritePropertyName("numParams"); writer.WriteValue(node.NumParams); writer.WritePropertyName("nodeDb"); Visit(node.DatabaseRef); }
public void DebugDump(TextWriter writer, Story story) { writer.Write("Adapter - "); if (OwnerNode != null && OwnerNode.Name.Length > 0) { writer.WriteLine("Node {0}({1})", OwnerNode.Name, OwnerNode.NumParams); } else if (OwnerNode != null) { writer.WriteLine("Node <{0}>", OwnerNode.TypeName()); } else { writer.WriteLine("(Not owned)"); } if (Constants.Logical.Count > 0) { writer.Write(" Constants: "); Constants.DebugDump(writer, story); writer.WriteLine(""); } if (LogicalIndices.Count > 0) { writer.Write(" Logical indices: "); foreach (var index in LogicalIndices) { writer.Write("{0}, ", index); } writer.WriteLine(""); } if (LogicalToPhysicalMap.Count > 0) { writer.Write(" Logical to physical mappings: "); foreach (var pair in LogicalToPhysicalMap) { writer.Write("{0} -> {1}, ", pair.Key, pair.Value); } writer.WriteLine(""); } }
private void LoadStory(Stream s) { var reader = new StoryReader(); _story = reader.Read(s); databaseSelectorCb.Items.Clear(); foreach (KeyValuePair <uint, Database> database in _story.Databases) { var name = "(Unnamed)"; Node owner = database.Value.OwnerNode; if (owner != null) { name = owner.Name.Length > 0 ? $"{owner.Name}({owner.NumParams})" : $"<{owner.TypeName()}>"; } name += $" #{database.Key} ({database.Value.Facts.Count} rows)"; databaseSelectorCb.Items.Add(name); if (databaseSelectorCb.Items.Count > 0) { databaseSelectorCb.SelectedIndex = 0; } } }