Пример #1
0
        public static void Main(params String[] args)
        {
            if (args.Length < 1 || args.Length > 2)
            {
                Console.WriteLine("Usage: HoloXPLOR.DataForge.exe [infile]");
                Console.WriteLine();
                Console.WriteLine("Converts an SC binary `xml` file into an actual XML file, and saves it as a .raw file in the original location");
                return;
            }

            var xml = DataForgeSerializer.ReadFile(args[0], args.Length == 2);

            xml.Save(Path.ChangeExtension(args[0], "raw"));
        }
Пример #2
0
        public static TObject Deserialize <TObject>(String inFile) where TObject : class
        {
            using (MemoryStream ms = new MemoryStream())
            {
                var xmlDoc = DataForgeSerializer.ReadFile(inFile);

                xmlDoc.Save(ms);

                ms.Seek(0, SeekOrigin.Begin);

                XmlSerializer xs = new XmlSerializer(typeof(TObject));

                return(xs.Deserialize(ms) as TObject);
            }
        }