Example #1
0
        /// <summary>
        /// Deserializes and returns the dynamic value of the BYAML node read from the specified stream keeping the references, do not use this if you intend to edit the byml.
        /// </summary>
        /// <param name="stream">The <see cref="Stream"/> to read the data from.</param>
        /// <param name="supportPaths">Whether to expect a path array offset. This must be enabled for Mario Kart 8
        /// files.</param>
        /// <param name="byteOrder">The <see cref="ByteOrder"/> to read data in.</param>
        public static BymlFileData FastLoadN(Stream stream, bool supportPaths = false, ByteOrder byteOrder = ByteOrder.LittleEndian)
        {
            ByamlFile byamlFile = new ByamlFile(supportPaths, byteOrder, 3, true);
            var       r         = byamlFile.Read(stream);

            return(new BymlFileData()
            {
                byteOrder = byamlFile._byteOrder, RootNode = r, Version = byamlFile._version, SupportPaths = supportPaths
            });
        }
Example #2
0
 static string GetNodeName(dynamic node) =>
 "T" + ((byte)ByamlFile.GetNodeType(node)).ToString();
Example #3
0
        /// <summary>
        /// Serializes the given dynamic value which requires to be an array or dictionary of BYAML compatible values
        /// and stores it in the specified stream.
        /// </summary>
        public static void SaveN(Stream stream, BymlFileData file)
        {
            ByamlFile byamlFile = new ByamlFile(file.SupportPaths, file.byteOrder, file.Version);

            byamlFile.Write(stream, file.RootNode);
        }