/// <summary> /// Removes a voxel model by its name /// </summary> /// <param name="name"></param> public void DeleteModel(string name) { VisualVoxelModel model; if (_models.TryGetValue(name, out model)) { lock (_syncRoot) { _models.Remove(name); } VoxelModelStorage.Delete(model.VoxelModel.Name); } }
/// <summary> /// Adds a new voxel model or updates it /// </summary> /// <param name="model"></param> public void SaveModel(VisualVoxelModel model) { model.VoxelModel.UpdateHash(); lock (_syncRoot) { if (_models.ContainsKey(model.VoxelModel.Name)) { _models.Remove(model.VoxelModel.Name); VoxelModelStorage.Delete(model.VoxelModel.Name); } _models.Add(model.VoxelModel.Name, model); VoxelModelStorage.Save(model.VoxelModel); } }
public void Rename(string oldName, string newName) { lock (_syncRoot) { VisualVoxelModel model; if (!_models.TryGetValue(oldName, out model)) { throw new InvalidOperationException("No such model to rename"); } model.VoxelModel.Name = newName; VoxelModelStorage.Delete(oldName); VoxelModelStorage.Save(model.VoxelModel); _models.Remove(oldName); _models.Add(newName, model); } }