Esempio n. 1
0
        public bool LoadState()
        {
            if (Display.Storage == null)
            {
                return(false);
            }

            string rawData;
            bool   loadedSomething = false;

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

                if (loadedState != null)
                {
                    Value           = loadedState;
                    loadedSomething = true;
                }

                if (Session.Enforced.Debug == 3)
                {
                    Log.Line($"Loaded - DisplayId [{Display.EntityId}]:\n{Value.ToString()}");
                }
            }

            return(loadedSomething);
        }
Esempio n. 2
0
 internal void UpdateState(DisplayStateValues newState)
 {
     if (newState.MId > State.Value.MId)
     {
         State.Value = newState;
         if (Session.Enforced.Debug >= 3)
         {
             Log.Line($"UpdateState: DisplayId [{Display.EntityId}]");
         }
     }
 }
 public DataDisplayState(long entityId, DisplayStateValues state) : base(entityId)
 {
     State = state;
 }