void PerformCopy()
{
if (saveOnNextCopy)
{
mSettings.Save(CopySettingsLocation);
}
string targetDirectory = mSettings.DestinationFolder;
if (!targetDirectory.EndsWith("\\") && !targetDirectory.EndsWith("/"))
{
targetDirectory += "\\";
}
PercentageFinished = 0;
IsCopying = true;
ShouldContinue = true;
string whereToCopyFrom = mSettings.EffectiveSourceFolder;
CurrentActivityInfo = "Obtaining list of files to copy...";
var allFiles = GetListOfAllFilesToCopy(whereToCopyFrom);
int processedCount = 0;
int countCopied = 0;
int errorCount = 0;
int skippedCount = 0;
int totalCount = allFiles.Count;
foreach (string fileUnmodified in allFiles)
{
if (!ShouldContinue)
{
break;
}
CopyIndividualFile(targetDirectory,
ref processedCount, ref countCopied, ref errorCount,
ref skippedCount, totalCount, fileUnmodified);
}
string errorText = "";
if (errorCount != 0)
{
errorText = errorCount + " Errors. ";
var message = $"{errorCount} errors occurred while copying the project. See output window for details";
showErrorAction(message);
}
string output = errorText + countCopied + " Copied. " + skippedCount + " Skipped.";
if (!ShouldContinue)
{
output += " User cancelled";
}
PluginManager.ReceiveOutput(output);
IsCopying = false;
if (AfterCopyFinished != null)
{
AfterCopyFinished(this, null);
}
lastCopy = System.DateTime.Now;
}