Esempio n. 1
0
        public void Load()
        {
            if (Ai.MyGrid.Storage == null)
            {
                return;
            }

            ConstructDataValues load = null;
            string rawData;
            bool   validData = false;

            if (Ai.MyGrid.Storage.TryGetValue(Ai.Session.ConstructDataGuid, out rawData))
            {
                try
                {
                    var base64 = Convert.FromBase64String(rawData);
                    load      = MyAPIGateway.Utilities.SerializeFromBinary <ConstructDataValues>(base64);
                    validData = load != null;
                }
                catch (Exception e)
                {
                    //Log.Line("Invalid State Loaded, Re-init");
                }
            }
            else
            {
                Log.Line($"Storage didn't contain ConstructDataGuid");
            }

            if (validData && load.Version == Session.VersionControl)
            {
                Repo = load;
            }
            else
            {
                Repo = new ConstructDataValues();
            }

            if (Repo.FocusData == null)
            {
                Repo.FocusData = new FocusData {
                    Target = new long[2], Locked = new FocusData.LockModes[2]
                }
            }
            ;
        }
    }
Esempio n. 2
0
 public override void CleanUp()
 {
     base.CleanUp();
     Data = null;
 }
 public bool Sync(Constructs construct, ConstructDataValues sync, bool localCall = false)
 {
     FocusData.Sync(construct.RootAi, sync.FocusData, localCall);
     return(true);
 }
Esempio n. 4
0
 public void Clean()
 {
     Repo.FocusData = null;
     Repo           = null;
     Ai             = null;
 }