private static ScanServerEntity InitData() { MainChatCommandLogic.Instance.ServerLogger.WriteInfo("Creating new ScanServerEntity."); ScanServerEntity data = new ScanServerEntity(); return(data); }
private static void ValidateAndUpdateData(ScanServerEntity data) { MainChatCommandLogic.Instance.ServerLogger.WriteInfo("Validating and Updating Data."); if (data.Clients == null) { data.Clients = new List <ScanSettingsEntity>(); } // add validation and updates in here if ScanServerEntity changes. }
public static void SaveData(ScanServerEntity data) { MainChatCommandLogic.Instance.ServerLogger.WriteInfo("Save Data Started"); TextWriter writer = MyAPIGateway.Utilities.WriteFileInWorldStorage(WorldStorageDataFilename, typeof(ScanServerEntity)); writer.Write(MyAPIGateway.Utilities.SerializeToXML <ScanServerEntity>(data)); writer.Flush(); writer.Close(); MainChatCommandLogic.Instance.ServerLogger.WriteInfo("Save Data End"); }
public static ScanSettingsEntity GetPlayerScanData(ulong steamId) { ScanServerEntity scanServerData = ((MySampleModLogic)MainChatCommandLogic.Instance).ServerData; ScanSettingsEntity playerScanData = scanServerData.Clients.FirstOrDefault(e => e.SteamId == steamId); if (playerScanData == null) { playerScanData = new ScanSettingsEntity { SteamId = steamId }; scanServerData.Clients.Add(playerScanData); } return(playerScanData); }
public override void ServerLoad() { ServerData = ScanDataManager.LoadData(); }