Calculates the total percentage of a specific step that should report within a specific range. If a step needs to report between 50 -> 75 %, this method should be used as CalculateProgress(percentage, 50, 75). The percentage of the current step, a value between 0 and 100. The start percent
(int percentageOfCurrentStep, int stepStartPercentage, int stepEndPercentage)
| 297 | /// <param name="stepEndPercentage">The end percentage of the range the current step represents.</param> |
| 298 | /// <returns>The calculated percentage that can be reported about the total progress.</returns> |
| 299 | internal static int CalculateProgress(int percentageOfCurrentStep, int stepStartPercentage, int stepEndPercentage) |
| 300 | { |
| 301 | // Ensure we are between 0 and 100 |
| 302 | percentageOfCurrentStep = Math.Max(Math.Min(percentageOfCurrentStep, 100), 0); |
| 303 | |
| 304 | var range = stepEndPercentage - stepStartPercentage; |
| 305 | var singleValue = range / 100d; |
| 306 | var totalPercentage = (singleValue * percentageOfCurrentStep) + stepStartPercentage; |
| 307 | |
| 308 | return (int)totalPercentage; |
| 309 | } |
| 310 | |
| 311 | static string getApplicationName() |
| 312 | { |
no outgoing calls