public void Write(NodeWriter writer, NodeEntry node) { var data = (ItemData)node.Value; writer.Write(data.ItemTdbId); WriteHeaderThing(writer, data.Header); writer.Write(data.Flags.Raw); writer.Write(data.CreationTime); switch (data.Header.Kind) { case 0: WriteModableItemWithQuantityData(writer, data.Data as ItemData.ModableItemWithQuantityData); break; case 1: WriteSimpleItemData(writer, data.Data as ItemData.SimpleItemData); break; case 2: WriteModableItemData(writer, data.Data as ItemData.ModableItemData); break; } }
private static void Write( ExpressionSyntax expression, ExpressionSyntax nextExpression, SyntaxToken token, string newText, NodeWriter writer) { if (IsFixable(expression, token)) { if (expression.GetTrailingTrivia().Any(f => !f.IsWhitespaceOrEndOfLineTrivia()) || token.LeadingTrivia.Any(f => !f.IsWhitespaceOrEndOfLineTrivia())) { writer.WriteTrailingTrivia(expression); writer.WriteLeadingTrivia(token); } writer.WriteTrailingTrivia(token); writer.WriteLeadingTrivia(nextExpression); writer.Write(newText); writer.WriteSpan(nextExpression); } else { writer.WriteTrailingTrivia(expression); writer.WriteFullSpan(token); writer.WriteLeadingTriviaAndSpan(nextExpression); } }
public static Task <Document> RefactorAsync( Document document, ConditionalExpressionSyntax conditionalExpression, CancellationToken cancellationToken) { ExpressionSyntax condition = conditionalExpression.Condition; ExpressionSyntax whenTrue = conditionalExpression.WhenTrue; ExpressionSyntax whenFalse = conditionalExpression.WhenFalse; SyntaxToken questionToken = conditionalExpression.QuestionToken; SyntaxToken colonToken = conditionalExpression.ColonToken; var writer = new NodeWriter(conditionalExpression); writer.WriteLeadingTrivia(); writer.WriteSpan(condition); Write(condition, whenTrue, questionToken, "? ", writer); Write(whenTrue, whenFalse, colonToken, ": ", writer); writer.WriteTrailingTrivia(); ExpressionSyntax newNode = SyntaxFactory.ParseExpression(writer.ToString()); return(document.ReplaceNodeAsync(conditionalExpression, newNode, cancellationToken)); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (DSDynamicConnections)node.Value; writer.WritePackedInt(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.Unknown1); } foreach (var entry in data.Entries) { writer.WritePackedString(entry.Unknown2); writer.WritePackedInt(entry.Unknown3.Count); foreach (var val in entry.Unknown3) { writer.Write(val); } writer.WritePackedInt(entry.Unknown4.Count); foreach (var val in entry.Unknown4) { writer.Write(val); } writer.Write(entry.Unknown5); writer.WritePackedString(entry.Unknown6); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (PlayerSystem)node.Value; writer.Write(data.Unk_Hash); writer.Write(data.Unk_Id); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (CharacterCustomizationAppearances)node.Value; writer.Write(data.DataExists); writer.Write(data.Unknown1); if (data.DataExists) { writer.Write(data.UnknownFirstBytes); WriteSection(writer, data.FirstSection); WriteSection(writer, data.SecondSection); WriteSection(writer, data.ThirdSection); writer.Write(data.StringTriples.Count); foreach (var st in data.StringTriples) { WriteStringTriple(writer, st); } // Only when SaveVersion > 171 writer.WritePackedInt(data.Strings.Count); foreach (var s in data.Strings) { writer.WritePackedString(s); } } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (JournalManager)node.Value; writer.Write(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.Unk1_PathHash); writer.Write(entry.Unk2_State); writer.Write(entry.Unknown3); writer.Write(entry.Unknown4); } writer.Write(data.Unk1_TrackedQuestPath); writer.Write(data.Unknown2.Count); foreach (var entry in data.Unknown2) { writer.Write(entry); } writer.Write(data.Unknown3.Count); foreach (var entry in data.Unknown3) { writer.Write(entry.Unknown1); writer.Write(entry.Unknown2); writer.Write(entry.Unknown3); writer.Write(entry.Unknown4); } writer.Write(data.TrailingBytes); }
private async void NodeWriterTestInternal() { // One node description to file File.Delete(filePath); INodeWriter implementation = new NodeWriter(new NodeDescriber(new NodesHelper())); await implementation.WriteToFileAsync(new NoChildrenNode("root"), filePath); var result = File.ReadAllText(filePath, Encoding.Unicode); Assert.AreEqual("new NoChildrenNode(\"root\");", result); // Multiple nodes description to file File.Delete(filePath); implementation = new NodeWriter(new NodeDescriber(new NodesHelper())); await implementation.WriteToFileAsync(new SingleChildNode("root", new TwoChildrenNode("child1", new NoChildrenNode("leaf1"), new SingleChildNode("child2", new NoChildrenNode("leaf2")))), filePath); result = File.ReadAllText(filePath, Encoding.Unicode); StringBuilder sb = new StringBuilder(); sb.Append("new SingleChildNode(\"root\","); sb.Append(Environment.NewLine); sb.Append(tab); sb.Append("new TwoChildrenNode(\"child1\","); sb.Append(Environment.NewLine); sb.Append(tab); sb.Append(tab); sb.Append("new NoChildrenNode(\"leaf1\"),"); sb.Append(Environment.NewLine); sb.Append(tab); sb.Append(tab); sb.Append("new SingleChildNode(\"child2\","); sb.Append(Environment.NewLine); sb.Append(tab); sb.Append(tab); sb.Append(tab); sb.Append("new NoChildrenNode(\"leaf2\"))));"); string expectedResult = sb.ToString(); Assert.AreEqual(sb.ToString(), result); }
public void Write(NodeWriter writer, NodeEntry node) { foreach (var child in node.Children) { writer.Write(child); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (ItemDropStorage)node.Value; writer.WritePackedString(data.UnknownString); writer.Write(data.HeaderBytes); InventoryParser.WriteSubInventory(writer, data.Inventory); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (QuestDebugLogManager)node.Value; var text = string.Join("\n", data.Lines); writer.WritePackedString(text); }
public sealed override void ToString(NodeWriter writer) { writer.EnsureNewLine(); writer.OpenNode(NodeName); writer.EnsureSpace(); Expression.ToString(writer); writer.CloseNode(); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (TimeSystemCore)node.Value; writer.Write(data.Unknown1); writer.Write(data.CurrentGameTime); writer.Write(data.Unknown2); }
public override void ToString(NodeWriter writer) { writer.EnsureNewLine(); writer.OpenNode("import"); writer.Write($" \"{Module}\" \"{Field}\" "); Node?.ToString(writer); writer.CloseNode(); writer.EnsureNewLine(); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (Inventory)node.Value; writer.Write(data.NumberOfInventories); for (var i = 0; i < data.NumberOfInventories; ++i) { WriteSubInventory(writer, data.SubInventories[i]); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (DirectorSystem)node.Value; writer.Write(data.Unknown1); writer.WritePackedString(data.Unknown2); writer.Write(data.Unknown3); writer.WritePackedString(data.Unknown4); writer.Write(data.Unknown5); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (ContainerManagerNPCLootBagsVer3LootedIDs)node.Value; writer.WritePackedInt(data.EntityIds.Count); foreach (var entityId in data.EntityIds) { writer.Write(entityId); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (GameSessionConfig)node.Value; writer.Write(data.Hash1); writer.Write(data.Hash2); writer.WritePackedString(data.TextValue); writer.Write(data.Hash3); writer.Write(data.TrailingBytes); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (CustomArray)node.Value; writer.Write(data.Unknown.Count); foreach (var entry in data.Unknown) { writer.Write(entry); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (ContainerManager)node.Value; writer.Write(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.CNameHash); writer.Write(entry.Unknown1); } }
public async Task WriteEmpty() { var filePath = "test-tree-empty.txt"; INodeWriter implementation = new NodeWriter(); await implementation.WriteToFileAsync(null, filePath); var result = File.ReadAllText(filePath); Assert.AreEqual("", result); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (CommunitySystem)node.Value; writer.Write(data.Unk_HashList.Count); foreach (var entry in data.Unk_HashList) { writer.Write(entry); } writer.Write(data.TrailingBytes); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (CAttitudeManager)node.Value; writer.Write(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.Unk_Hash1); writer.Write(entry.Unknown2); } writer.Write(data.Unknown2); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (CCoverManager)node.Value; writer.Write(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.Unk_Hash1); writer.Write(entry.Unk_EntityHash); writer.Write(entry.Unknown3); } }
public static void WriteSubInventory(NodeWriter writer, Inventory.SubInventory subInventory) { writer.Write(subInventory.InventoryId); writer.Write(subInventory.NumberOfItems); for (var i = 0; i < subInventory.NumberOfItems; ++i) { var nextItem = subInventory.Items[i]; ItemDataParser.WriteNextItemEntryFromItem(writer, nextItem); writer.Write(nextItem.Node); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (WorkspotInstancesSavedata)node.Value; writer.Write(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.Unk_Hash1); writer.Write(entry.Unk_EntityHash); writer.Write(entry.Unknown3); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (ItemDropStorageManager)node.Value; writer.Write(data.NumberOfItemDropStorages); for (var i = 0; i < data.NumberOfItemDropStorages; ++i) { writer.Write(node.Children[i]); } writer.Write(data.TrailingBytes); }
public void Write(NodeWriter writer, NodeEntry node) { var data = (EventManager)node.Value; writer.Write(data.Unknown.Count); foreach (var entry in data.Unknown) { writer.Write(entry.Unknown1); writer.Write(entry.Unknown2); writer.Write(entry.Unknown3); writer.Write(entry.Unknown4); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (QuestMusicHistory)node.Value; writer.Write(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.Unknown1); writer.Write(entry.Unknown2); writer.Write(entry.Unknown3); writer.Write(entry.Unknown4); writer.Write(entry.Unknown5); writer.Write(entry.Unknown6); } }
public void Write(NodeWriter writer, NodeEntry node) { var data = (ContainerManagerLootSlotAvailability)node.Value; writer.WritePackedInt(data.Entries.Count); foreach (var entry in data.Entries) { writer.Write(entry.CNameHash); } foreach (var entry in data.Entries) { writer.Write(entry.Unknown1); } }