コード例 #1
0
 private static void WriteToBinary(FxVfxFile vfx, string path)
 {
     using (var writer = new BinaryWriter(new FileStream(path, FileMode.OpenOrCreate)))
     {
         vfx.Write(writer);
     }
 }
コード例 #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);
            }
        }
コード例 #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);
        }
コード例 #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);
        }