Exemplo n.º 1
0
        private bool LoadFile(out GridTrackerObject Data)
        {
            GridTrackerObject Info = new GridTrackerObject();


            if (!File.Exists(StoragePath))
            {
                Data = Info;
                return(true);
            }


            try
            {
                Info = JsonConvert.DeserializeObject <GridTrackerObject>(File.ReadAllText(StoragePath));
            }
            catch (Exception e)
            {
                Log.Warn(e, "For some reason the file is broken");
                Data = Info;
                return(false);
            }


            Data = Info;
            return(true);
        }
Exemplo n.º 2
0
        public void ServerStarted(string HangarDirectory)
        {
            HangarFolderDir = HangarDirectory;

            Log.Warn("Starting AutoGridBackup System!");
            //Log.Warn(MySession.Static.CurrentPath);

            Directory.CreateDirectory(Path.Combine(MySession.Static.CurrentPath, "Storage"));
            StoragePath = Path.Combine(MySession.Static.CurrentPath, "Storage", "QuantumHangarGridTracker.json");

            LoadFile(out GridTrackerObject Data);
            Grids = Data;

            InitilizeReadSystem();
        }
Exemplo n.º 3
0
 private void SaveFile(GridTrackerObject Data)
 {
     //Log.Warn(StoragePath);
     FileSaver.Save(StoragePath, Data);
 }