Class ServerBackupsViewModel
- Namespace
- McServerLauncher.ViewModels
- Assembly
- McServerLauncher.dll
Manages world backups for a server: lists existing zip snapshots, and lets the user trigger one manually, restore an earlier one, or delete one. Automatic backups (before every start, after an explicit stop) are triggered by ServerViewModel itself; this view model is just the UI surface over the same WorldBackupService.
public class ServerBackupsViewModel : ObservableObject, INotifyPropertyChanged, INotifyPropertyChanging
- Inheritance
-
ServerBackupsViewModel
- Implements
- Inherited Members
Remarks
The list is two piles, not one, and it says so. Retention counts the automatic backups (start, stop, while playing) together against one limit and the user's own (manual, before a restore) against another — WorldBackupService explains why. A flat list of five read as "five of each kind" with some missing, when it was the automatic pile, full. So the summary shows each pile against its limit, and the row the next backup of its pile will push out says so.
Grouped by day, and named by time and reason rather than by file: the zip's name is the same facts written for a file system, and it is still there as the row's tooltip.
Constructors
ServerBackupsViewModel(ServerViewModel)
public ServerBackupsViewModel(ServerViewModel server)
Parameters
serverServerViewModel
Properties
AutomaticCount
public int AutomaticCount { get; }
Property Value
AutomaticCountText
public string AutomaticCountText { get; }
Property Value
AutomaticFill
How full each pile is, 0–100, for the bar under its count.
public double AutomaticFill { get; }
Property Value
BackupNowCommand
Gets an IAsyncRelayCommand instance wrapping McServerLauncher.ViewModels.ServerBackupsViewModel.BackupNow().
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand BackupNowCommand { get; }
Property Value
CanBackupNow
A backup can be made at any time now, running or not.
public bool CanBackupNow { get; }
Property Value
Remarks
It used to need the server stopped, because zipping a world the JVM is writing to gives a torn copy. That is still true; what changed is that the server is now asked to let go of the world first — see LiveWorldBackup.
CanRestore
Restoring still needs the server stopped, and always will.
public bool CanRestore { get; }
Property Value
Remarks
It deletes the world folder and unpacks another one in its place. There is no asking
Minecraft to tolerate that. Nor while a start is getting ready: it would open whatever the
restore had left half done. (Changes to that arrive with IsRunning, which
NotifyCommandStates raises for both.)
Config
public ServerConfig Config { get; }
Property Value
DeleteCommand
Gets an IAsyncRelayCommand<T> instance wrapping Delete(BackupItemViewModel).
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand<BackupItemViewModel?> DeleteCommand { get; }
Property Value
Filter
[ExcludeFromCodeCoverage]
public BackupFilter Filter { get; set; }
Property Value
Groups
The backups the filter lets through, by day, newest first.
public ObservableCollection<BackupDayGroup> Groups { get; }
Property Value
IsAllFilter
public bool IsAllFilter { get; }
Property Value
IsAutomaticFilter
public bool IsAutomaticFilter { get; }
Property Value
IsBusy
[ExcludeFromCodeCoverage]
public bool IsBusy { get; set; }
Property Value
IsEmpty
public bool IsEmpty { get; }
Property Value
IsFilterEmpty
There are backups, and none of the kind the filter asks for.
public bool IsFilterEmpty { get; }
Property Value
IsManualFilter
public bool IsManualFilter { get; }
Property Value
Items
Every backup, newest first, whatever the filter.
public ObservableCollection<BackupItemViewModel> Items { get; }
Property Value
ManualCount
public int ManualCount { get; }
Property Value
ManualCountText
public string ManualCountText { get; }
Property Value
ManualFill
public double ManualFill { get; }
Property Value
NextBackupText
public string NextBackupText { get; }
Property Value
RefreshCommand
Gets an IRelayCommand instance wrapping McServerLauncher.ViewModels.ServerBackupsViewModel.Refresh().
[ExcludeFromCodeCoverage]
public IRelayCommand RefreshCommand { get; }
Property Value
RestoreCommand
Gets an IAsyncRelayCommand<T> instance wrapping Restore(BackupItemViewModel).
[ExcludeFromCodeCoverage]
public IAsyncRelayCommand<BackupItemViewModel?> RestoreCommand { get; }
Property Value
ShowAllCommand
Gets an IRelayCommand instance wrapping McServerLauncher.ViewModels.ServerBackupsViewModel.ShowAll().
[ExcludeFromCodeCoverage]
public IRelayCommand ShowAllCommand { get; }
Property Value
ShowAutomaticCommand
Gets an IRelayCommand instance wrapping McServerLauncher.ViewModels.ServerBackupsViewModel.ShowAutomatic().
[ExcludeFromCodeCoverage]
public IRelayCommand ShowAutomaticCommand { get; }
Property Value
ShowManualCommand
Gets an IRelayCommand instance wrapping McServerLauncher.ViewModels.ServerBackupsViewModel.ShowManual().
[ExcludeFromCodeCoverage]
public IRelayCommand ShowManualCommand { get; }
Property Value
StatusText
[ExcludeFromCodeCoverage]
public string StatusText { get; set; }
Property Value
TotalSizeText
public string TotalSizeText { get; }
Property Value
Methods
EnsureLoaded()
Loads the backup list the first time the tab is shown.
public void EnsureLoaded()
RefreshIfLoaded()
Re-reads the list, but only when there is one on screen to be wrong.
public void RefreshIfLoaded()
Remarks
The server's folder can be changed from its settings, which leaves this tab listing the snapshots of a different server. Loading it here instead would defeat EnsureLoaded(): the list is deliberately not read until somebody opens the tab.