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


using System.IO;
using MaxyGames.uNode;

namespace BansheeGz.BGDatabase
{
    [NodeMenu("BansheeGz", "DB: Load game")]
    public class BGUNLoad : BGUNSaveLoadA
    {
        public override void Execute(object graph)
        {
            var filePath = FilePath;
            if (!File.Exists(filePath))
            {
                Log("Unable to load game, cause file " + filePath + " does not exist!");
                return;
            }

            BGRepo.I.Addons.Get<BGAddonSaveLoad>().Load(File.ReadAllBytes(filePath));
            Log("Game is loaded from file " + filePath);
        }
    }
}