Esempio n. 1
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>
        /// <param name="stream">The <see cref="Stream"/> to store the data in.</param>
        /// <param name="root">The dynamic value becoming the root of the BYAML file. Must be an array or dictionary of
        /// BYAML compatible values.</param>
        /// <param name="supportPaths">Whether to include a path array. This must be enabled for Mario Kart 8 files.
        /// </param>
        /// <param name="byteOrder">The <see cref="ByteOrder"/> to store data in.</param>
        public static void Save(Stream stream, dynamic root, bool supportPaths = false,
                                ByteOrder byteOrder = ByteOrder.BigEndian)
        {
            ByamlFile byamlFile = new ByamlFile(supportPaths, byteOrder);

            byamlFile.Write(stream, root);
        }
Esempio n. 2
0
        /// <summary>
        /// Deserializes and returns the dynamic value of the BYAML node read from the specified stream.
        /// </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 dynamic Load(Stream stream, bool supportPaths = false, ByteOrder byteOrder = ByteOrder.BigEndian)
        {
            ByamlFile byamlFile = new ByamlFile(supportPaths, byteOrder);

            return(byamlFile.Read(stream));
        }