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 = (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);
                }
            }
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (PlayerSystem)node.Value;

            writer.Write(data.Unk_Hash);
            writer.Write(data.Unk_Id);
        }
Esempio n. 5
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (TimeSystemCore)node.Value;

            writer.Write(data.Unknown1);
            writer.Write(data.CurrentGameTime);
            writer.Write(data.Unknown2);
        }
Esempio n. 6
0
        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);
            }
        }
Esempio n. 7
0
        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 = (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 = (ContainerManager)node.Value;

            writer.Write(data.Entries.Count);
            foreach (var entry in data.Entries)
            {
                writer.Write(entry.CNameHash);
                writer.Write(entry.Unknown1);
            }
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
        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);
            }
        }
Esempio n. 12
0
        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);
            }
        }
Esempio n. 13
0
        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);
            }
        }
Esempio n. 14
0
        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 = (ItemDropStorageManager)node.Value;

            writer.Write(data.NumberOfItemDropStorages);

            for (var i = 0; i < data.NumberOfItemDropStorages; ++i)
            {
                writer.Write(node.Children[i]);
            }

            writer.Write(data.TrailingBytes);
        }
Esempio n. 16
0
        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 = (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);
            }
        }
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (PersistencySystem)node.Value;

            writer.Write(data.Unk_HashList.Count);
            foreach (var id in data.Unk_HashList)
            {
                writer.Write(id);
            }

            foreach (var child in node.Children)
            {
                writer.Write(child);
            }
        }
Esempio n. 19
0
 public void Write(NodeWriter writer, NodeEntry node)
 {
     foreach (var child in node.Children)
     {
         writer.Write(child);
     }
 }
Esempio n. 20
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (DefaultRepresentation)node.Value;

            writer.Write(data.HeaderBlob);

            if (node.Children.Count > 0)
            {
                foreach (var child in node.Children)
                {
                    writer.Write(child);
                }
            }

            writer.Write(data.TrailingBlob);
        }
Esempio n. 21
0
        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);
            }
        }
Esempio n. 22
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (MusicSystem)node.Value;

            writer.WritePackedString(data.Unknown1);
            if (data.Unknown1 != "None")
            {
                writer.WritePackedString(data.Unknown2);
                writer.Write(data.Unknown3);
                writer.WritePackedString(data.Unknown4);
                writer.WritePackedString(data.Unknown5);
                writer.Write(data.Unknown6);
                writer.WritePackedString(data.Unknown7);
                writer.Write(data.Unknown8);
            }
        }
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (DynamicEntityIDSystem)node.Value;

            writer.Write(data.Unknown1);
            writer.Write(data.Unk_NextEntityHash);

            writer.Write(data.Unknown4.Count);
            foreach (var pair in data.Unknown4)
            {
                writer.WritePackedString(pair.Key);
                writer.Write(pair.Value);
            }

            writer.Write(data.Unk_NextListId);
        }
Esempio n. 24
0
        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);
        }
Esempio n. 25
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (FactsDB)node.Value;

            if (data.FactsTableCount != node.Children.Count)
            {
                throw new InvalidDataException($"Expected {data.FactsTableCount} FactsTable but found {node.Children.Count}.");
            }

            writer.Write(data.FactsTableCount);

            foreach (var child in node.Children)
            {
                writer.Write(child);
            }

            writer.Write(data.TrailingBytes);
        }
Esempio n. 26
0
 public override void ToString(NodeWriter writer)
 {
     writer.EnsureNewLine();
     writer.OpenNode("import");
     writer.Write($" \"{Module}\" \"{Field}\" ");
     Node?.ToString(writer);
     writer.CloseNode();
     writer.EnsureNewLine();
 }
Esempio n. 27
0
        private async Task <string> CompileAsync(string input)
        {
            var ws      = new AdhocWorkspace();
            var project = ws
                          .AddProject("TestProject", "C#")
                          .WithMetadataReferences(new MetadataReference[]
            {
                MetadataReference.CreateFromFile(typeof(object).Assembly.Location)
            });
            var document    = project.AddDocument("TestClass.cs", input);
            var compilation = await document.Project.GetCompilationAsync();

            var tree = await document.GetSyntaxTreeAsync();

            var           model         = compilation.GetSemanticModel(tree);
            StringBuilder resultBuilder = new StringBuilder();
            var           context       = new CompilationContext();
            var           writer        = new NodeWriter(model, resultBuilder, context);

            foreach (var enumDeclarationSyntax in tree.GetRoot().DescendantNodesAndSelf().OfType <EnumDeclarationSyntax>())
            {
                var symbol = model.GetDeclaredSymbol(enumDeclarationSyntax);
                if (context.MainAssembly == null)
                {
                    context.MainAssembly = symbol.ContainingAssembly;
                }

                writer.Write(enumDeclarationSyntax, symbol);
            }

            foreach (var classDeclarationSyntax in tree.GetRoot().DescendantNodesAndSelf().OfType <ClassDeclarationSyntax>())
            {
                var symbol = model.GetDeclaredSymbol(classDeclarationSyntax);
                if (context.MainAssembly == null)
                {
                    context.MainAssembly = symbol.ContainingAssembly;
                }

                writer.Write(classDeclarationSyntax, symbol);
            }

            return(resultBuilder.ToString());
        }
Esempio n. 28
0
        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);
            }
        }
Esempio n. 29
0
        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]);
            }
        }
Esempio n. 30
0
        public void Write(NodeWriter writer, NodeEntry node)
        {
            var data = (FactsTable)node.Value;

            writer.WritePackedInt(data.FactEntries.Count);

            // Sort FactEntries by their hash before writing
            data.FactEntries = new ObservableCollection <FactsTable.FactEntry>(data.FactEntries.OrderBy(_ => _.Hash));

            foreach (var fact in data.FactEntries)
            {
                writer.Write(fact.Hash);
            }

            foreach (var fact in data.FactEntries)
            {
                writer.Write(fact.Value);
            }
        }