No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MigrationProgressRender.cs 2.3KB

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