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); }
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(); }
private void SaveFile(GridTrackerObject Data) { //Log.Warn(StoragePath); FileSaver.Save(StoragePath, Data); }