File size: 2,329 Bytes
18a519f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | using System;
using System.IO;
using Codice.Client.Commands;
using Codice.Client.Common;
using Codice.Client.BaseCommands;
using Codice.LogWrapper;
using PlasticGui;
using Codice.Client.BaseCommands.Sync;
namespace Unity.PlasticSCM.Editor.CollabMigration
{
internal class MigrationProgressRender
{
internal static string FixNotificationPath(string wkPath, string notification)
{
if (notification == null)
return string.Empty;
int position = notification.ToLower().IndexOf(wkPath.ToLower());
if (position < 0)
return notification;
return notification.Remove(position, wkPath.Length + 1);
}
internal static string GetProgressString(
CreateWorkspaceFromCollab.Progress status,
BuildProgressSpeedAndRemainingTime.ProgressData progressData,
DateTime now,
double smoothingFactor,
string updateProgressCalculatingMessage,
string updateProgressSingularMessage,
string updateProgressPluralMessage,
string remainingMessage)
{
if (status.CurrentStatus == CreateWorkspaceFromCollab.Progress.Status.Starting)
return updateProgressCalculatingMessage;
progressData.StartTimerIfNotStarted(now);
string updatedSize;
string totalSize;
GetFormattedSizes.ForTransfer(
status.ProcessedSize,
status.TotalSize,
out updatedSize,
out totalSize);
string details = string.Format(
status.TotalFiles == 1 ?
updateProgressSingularMessage :
updateProgressPluralMessage,
updatedSize,
totalSize,
status.ProcessedFiles,
status.TotalFiles,
BuildProgressSpeedAndRemainingTime.ForTransfer(
progressData,
now,
status.TotalSize,
status.ProcessedSize,
smoothingFactor,
remainingMessage));
return details;
}
static ILog mLog = LogManager.GetLogger("MigrationProgressRender");
}
}
|