Ejemplo n.º 1
0
        public bool LoadState()
        {
            if (Enhancer.Storage == null)
            {
                return(false);
            }

            string rawData;
            bool   loadedSomething = false;

            if (Enhancer.Storage.TryGetValue(Session.Instance.EnhancerStateGuid, out rawData))
            {
                EnhancerStateValues loadedState = null;
                var base64 = Convert.FromBase64String(rawData);
                loadedState = MyAPIGateway.Utilities.SerializeFromBinary <EnhancerStateValues>(base64);

                if (loadedState != null)
                {
                    State           = loadedState;
                    loadedSomething = true;
                }
                if (Session.Enforced.Debug == 3)
                {
                    Log.Line($"Loaded - EnhancerId [{Enhancer.EntityId}]:\n{State.ToString()}");
                }
            }
            return(loadedSomething);
        }