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; } }
private void RefreshWorldList() { LocalWorlds.LocalWorldsParams = LocalWorlds.GetAllSinglePlayerWorldsParams(_vars.ApplicationDataPath); NeedShowResults = true; }