/*
<copyright file="BGNCSave.cs" company="BansheeGz">
    Copyright (c) 2018-2021 All Rights Reserved
</copyright>
*/


using System.IO;
using ParadoxNotion.Design;

namespace BansheeGz.BGDatabase
{
    [Category("BansheeGz")]
    [Name("BGDatabase: Save game")]
    [Description("Save game using SaveLoad addon. Set useArray to true if you want to use array instead of file. If you want to use file- provide fileName without extension and path, for example MySave")]
    public class BGNCSave : BGNCSaveLoadA
    {
        protected override void FileAction()
        {
            var filePath = FilePath;
            File.WriteAllBytes(filePath, BGRepo.I.Addons.Get<BGAddonSaveLoad>().Save());
            Log("Game is saved to file " + filePath);
        }

        protected override void ArrayAction()
        {
            array.value = BGRepo.I.Addons.Get<BGAddonSaveLoad>().Save();
            Log("Game is saved to array");
        }
    }
}