public void SaveGameFile(DataEntities.Game game) { string fileContents = ""; fileContents = Newtonsoft.Json.JsonConvert.SerializeObject(game, Newtonsoft.Json.Formatting.Indented); var path = System.IO.Path.Combine(_GameDirectory, GetFileNameFromFileType(DataEntities.FileLists.FileList.FileTypes.Game)); var gameFileHander = new BusinessImplementation.GameFileHandler(this.Game); gameFileHander.CreateGameFolder(); if (File.Exists(path) == false) //Create game file if it doesn't exist { using (StreamWriter sw = new StreamWriter(path)) { sw.Write(""); } } using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path)) { sw.Write(fileContents); } }
public GameHandler() { //Where are of the files are saved to BusinessImplementation.FileHandler._GamePath = AppDomain.CurrentDomain.BaseDirectory; BusinessImplementation.FileHandler.UpdateGamePaths(); //Creates and updates files if needed using (var fileHandlerBLL = new BusinessImplementation.FileHandler(Game)) { fileHandlerBLL.UpdateAllFiles(); this.Game = fileHandlerBLL.Game; //This is retrieved from the fileHandlerBLL } //this.Game = BusinessImplementation.FileHandler.LoadGameFile(); }
public DataEntities.Game GetGame() { var ret = new DataEntities.Game(); //var modPath = Path.Combine(FileHandler.GamePath, "mods", directory); var jsonPath = Path.Combine(FileHandler._GameDirectory, "game.json"); if (File.Exists(jsonPath)) { var cereal = Newtonsoft.Json.JsonConvert.DeserializeObject <DataEntities.Game>(File.ReadAllText(jsonPath)); ret = cereal; } else //Couldn't find file { ret = new DataEntities.Game(); } return(ret); }
public FileHandler(DataEntities.Game game) { this.Game = game; }
public ProcessInput(DataEntities.Game game) { this.Game = game; }
public ModHandler(DataEntities.Game game) { this.Game = game; }
public CommandHandler(DataEntities.Game game) { this.Game = game; }
public Location(DataEntities.Game game) { this.Game = game; }
public GenerateRandomObject(DataEntities.Game game) { this.Game = game; }