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