Example #1
0
        public static void Save(HiScoreTable table, string filepath)
        {
#if DEBUG
            if (null == table)
            {
                throw new ArgumentNullException(nameof(table));
            }
            if (string.IsNullOrEmpty(filepath))
            {
                throw new ArgumentNullException(nameof(filepath));
            }
#endif
            Logger.WriteLine(Logger.Stage.RUN_MAIN, "saving hiscore table...");
            filepath.BinarySerialize(table);
            Logger.WriteLine(Logger.Stage.RUN_MAIN, "saving hiscore table... done!");
        }
        public static void Save(HiScoreTable table, string filepath)
        {
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }
            if (filepath == null)
            {
                throw new ArgumentNullException("filepath");
            }

            Logger.WriteLine(Logger.Stage.RUN_MAIN, "saving hiscore table...");

            IFormatter formatter = CreateFormatter();
            Stream     stream    = CreateStream(filepath, true);

            formatter.Serialize(stream, table);
            stream.Flush();
            stream.Close();

            Logger.WriteLine(Logger.Stage.RUN_MAIN, "saving hiscore table... done!");
        }