diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2017-09-27 07:32:58 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2017-09-27 07:32:58 +0300 |
commit | 4673fe8eeec6a3a7b690b513bb46d70b005aa0eb (patch) | |
tree | a8cb0f917f6aecf162132e75783c5e1211e5a50a /Duplicati/CommandLine/Commands.cs | |
parent | bd98273067007cfe2fe6d4728f4e7d12672a101c (diff) |
Convert if statement to switch statement.
When the comparison is performed on an enum, using a switch statement
can allow for additional compiler optimizations.
Diffstat (limited to 'Duplicati/CommandLine/Commands.cs')
-rw-r--r-- | Duplicati/CommandLine/Commands.cs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/Duplicati/CommandLine/Commands.cs b/Duplicati/CommandLine/Commands.cs index a43415f33..e66ba7196 100644 --- a/Duplicati/CommandLine/Commands.cs +++ b/Duplicati/CommandLine/Commands.cs @@ -550,22 +550,29 @@ namespace Duplicati.CommandLine {
if (previousPhase == Duplicati.Library.Main.OperationPhase.Backup_PostBackupTest)
output.MessageEvent("Remote backup verification completed");
-
- if (phase == Duplicati.Library.Main.OperationPhase.Backup_ProcessingFiles)
+
+ switch (phase)
{
- output.MessageEvent("Scanning local files ...");
- periodicOutput.SetReady();
+ case Duplicati.Library.Main.OperationPhase.Backup_ProcessingFiles:
+ output.MessageEvent("Scanning local files ...");
+ periodicOutput.SetReady();
+ break;
+ case Duplicati.Library.Main.OperationPhase.Backup_Finalize:
+ periodicOutput.SetFinished();
+ break;
+ case Duplicati.Library.Main.OperationPhase.Backup_PreBackupVerify:
+ output.MessageEvent("Checking remote backup ...");
+ break;
+ case Duplicati.Library.Main.OperationPhase.Backup_PostBackupVerify:
+ output.MessageEvent("Checking remote backup ...");
+ break;
+ case Duplicati.Library.Main.OperationPhase.Backup_PostBackupTest:
+ output.MessageEvent("Verifying remote backup ...");
+ break;
+ case Duplicati.Library.Main.OperationPhase.Backup_Compact:
+ output.MessageEvent("Compacting remote backup ...");
+ break;
}
- else if (phase == Duplicati.Library.Main.OperationPhase.Backup_Finalize)
- periodicOutput.SetFinished();
- else if (phase == Duplicati.Library.Main.OperationPhase.Backup_PreBackupVerify)
- output.MessageEvent("Checking remote backup ...");
- else if (phase == Duplicati.Library.Main.OperationPhase.Backup_PostBackupVerify)
- output.MessageEvent("Checking remote backup ...");
- else if (phase == Duplicati.Library.Main.OperationPhase.Backup_PostBackupTest)
- output.MessageEvent("Verifying remote backup ...");
- else if (phase == Duplicati.Library.Main.OperationPhase.Backup_Compact)
- output.MessageEvent("Compacting remote backup ...");
};
periodicOutput.WriteOutput += (progress, files, size, counting) => {
|