Exemplo n.º 1
0
 private static void WriteToBinary(FxVfxFile vfx, string path)
 {
     using (var writer = new BinaryWriter(new FileStream(path, FileMode.OpenOrCreate)))
     {
         vfx.Write(writer);
     }
 }
Exemplo n.º 2
0
        private static void WriteToXml(FxVfxFile vfx, string path)
        {
            var xmlWriterSettings = new XmlWriterSettings()
            {
                Encoding = Encoding.UTF8,
                Indent   = true
            };

            using (var writer = XmlWriter.Create(path, xmlWriterSettings))
            {
                vfx.WriteXml(writer);
            }
        }
Exemplo n.º 3
0
        private static FxVfxFile ReadFromBinary(string path, IDictionary <ulong, FxVfxNodeDefinition> tppDefinitions, IDictionary <ulong, FxVfxNodeDefinition> gzDefinitions)
        {
            var vfx = new FxVfxFile(tppDefinitions, gzDefinitions);

            using (var reader = new BinaryReader(new FileStream(path, FileMode.Open)))
            {
                if (vfx.Read(reader, Path.GetFileNameWithoutExtension(path)))
                {
                    return(vfx);
                }
            }

            return(null);
        }
Exemplo n.º 4
0
        public static FxVfxFile ReadFromXml(string path, IDictionary <ulong, FxVfxNodeDefinition> tppDefinitions, IDictionary <ulong, FxVfxNodeDefinition> gzDefinitions)
        {
            var xmlReaderSettings = new XmlReaderSettings
            {
                IgnoreWhitespace = true
            };

            var vfx = new FxVfxFile(tppDefinitions, gzDefinitions);

            using (var reader = XmlReader.Create(path, xmlReaderSettings))
            {
                var success = vfx.ReadXml(reader);
                if (!success)
                {
                    return(null);
                }
            }

            return(vfx);
        }