private void DeleteWorld(LocalWorlds.LocalWorldsParam info) { try { //Try to delete the Server directory if (Directory.Exists(info.WorldServerRootPath.FullName)) { Directory.Delete(info.WorldServerRootPath.FullName, true); } //Try to delete the Client directory if (Directory.Exists(info.WorldClientRootPath.FullName)) { Directory.Delete(info.WorldClientRootPath.FullName, true); } //Recreate the list of all existing Worlds, as one as been deleted LocalWorlds.LocalWorldsParams = LocalWorlds.GetAllSinglePlayerWorldsParams(_vars.ApplicationDataPath); RefreshWorldListAsync(); _currentWorldParameter.Clear(); } catch (Exception e) { logger.Error("Error while trying to delete the files from the {0} world : {1}", info.WorldParameters.WorldName, e.Message); throw; } }
void _btLoad_Pressed(object sender, EventArgs e) { if (_savedGameList.SelectedItems.Count == 1) { LocalWorlds.LocalWorldsParam info = (LocalWorlds.LocalWorldsParam)_savedGameList.SelectedItem; //Assign the choosen World parameter to the Active WorldParameter _currentWorldParameter.WorldName = info.WorldParameters.WorldName; _currentWorldParameter.SeedName = info.WorldParameters.SeedName; _currentWorldParameter.Configuration = info.WorldParameters.Configuration; } }