Skip to content

Commit cb5ff10

Browse files
committed
Output
1 parent e9b782d commit cb5ff10

File tree

1 file changed

+23
-32
lines changed

1 file changed

+23
-32
lines changed

src/CLU/Microsoft.Azure.Commands.Compute/Models/PSSyncOutputEvents.cs

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -78,36 +78,32 @@ public void ProgressUploadStatus(double precentComplete, double avgThroughputMbp
7878

7979
private void LogProgress(int activityId, string activity, double precentComplete, TimeSpan remainingTime, double avgThroughputMbps)
8080
{
81-
var message = String.Format(Rsrc.PSSyncOutputEventsLogProgress,
82-
precentComplete,
83-
FormatDuration(remainingTime),
84-
avgThroughputMbps);
85-
var progressCommand = String.Format(@"Write-Progress -Id {0} -Activity '{1}' -Status '{2}' -SecondsRemaining {3} -PercentComplete {4}", activityId, activity, message, (int)remainingTime.TotalSeconds, (int)precentComplete);
86-
// TODO: CLU
87-
/*
8881
using (var ps = System.Management.Automation.PowerShell.Create())
8982
{
9083
ps.Runspace = runspace;
84+
var message = String.Format(Rsrc.PSSyncOutputEventsLogProgress,
85+
precentComplete,
86+
FormatDuration(remainingTime),
87+
avgThroughputMbps);
88+
var progressCommand = String.Format(@"Write-Progress -Id {0} -Activity '{1}' -Status '{2}' -SecondsRemaining {3} -PercentComplete {4}", activityId, activity, message, (int)remainingTime.TotalSeconds, (int)precentComplete);
9189
// TODO: CLU
90+
Console.WriteLine(progressCommand);
9291
//ps.AddScript(progressCommand);
9392
//ps.Invoke();
9493
}
95-
*/
9694
}
9795

9896
private void LogProgressComplete(int activityId, string activity)
9997
{
100-
var progressCommand = String.Format(@"Write-Progress -Id {0} -Activity '{1}' -Status '{2}' -Completed", activityId, activity, Rsrc.PSSyncOutputEventsLogProgressCompleteCompleted);
101-
// TODO: CLU
102-
/*
10398
using (var ps = System.Management.Automation.PowerShell.Create())
10499
{
105-
ps.Runspace = runspace;
100+
var progressCommand = String.Format(@"Write-Progress -Id {0} -Activity '{1}' -Status '{2}' -Completed", activityId, activity, Rsrc.PSSyncOutputEventsLogProgressCompleteCompleted);
106101
// TODO: CLU
102+
Console.WriteLine(progressCommand);
103+
ps.Runspace = runspace;
107104
//ps.AddScript(progressCommand);
108105
//ps.Invoke();
109106
}
110-
*/
111107
}
112108

113109
public void MessageCreatingNewPageBlob(long pageBlobSize)
@@ -117,32 +113,29 @@ public void MessageCreatingNewPageBlob(long pageBlobSize)
117113

118114
private void LogMessage(string format, params object[] parameters)
119115
{
120-
var message = String.Format(format, parameters);
121-
var verboseMessage = String.Format("Write-Host '{0}'", message);
122-
// TODO: CLU
123-
/*
124116
using (var ps = System.Management.Automation.PowerShell.Create())
125117
{
126118
ps.Runspace = runspace;
119+
var message = String.Format(format, parameters);
120+
var verboseMessage = String.Format("Write-Host '{0}'", message);
127121
// TODO: CLU
122+
Console.WriteLine(verboseMessage);
128123
//ps.AddScript(verboseMessage);
129124
//ps.Invoke();
130125
}
131-
*/
132126
}
133127

134128
private void LogError(Exception e)
135129
{
136-
// TODO: CLU
137-
/*
138130
using (var ps = System.Management.Automation.PowerShell.Create())
139131
{
140132
ps.Runspace = runspace;
141-
ps.AddCommand("Write-Error");
142-
ps.AddParameter("ErrorRecord", new ErrorRecord(e, String.Empty, ErrorCategory.NotSpecified, null));
133+
// TODO: CLU
134+
Console.Error.WriteLine(new ErrorRecord(e, String.Empty, ErrorCategory.NotSpecified, null));
135+
//ps.AddCommand("Write-Error");
136+
//ps.AddParameter("ErrorRecord", new ErrorRecord(e, String.Empty, ErrorCategory.NotSpecified, null));
143137
//ps.Invoke();
144138
}
145-
*/
146139
}
147140

148141
public void MessageResumingUpload()
@@ -247,24 +240,20 @@ public void DebugEmptyBlockDetected(IndexRange range)
247240

248241
private void LogDebug(string format, params object[] parameters)
249242
{
250-
var message = String.Format(format, parameters);
251-
var debugMessage = String.Format("Write-Debug -Message '{0}'", message);
252-
// TODO: CLU
253-
/*
254243
using (var ps = System.Management.Automation.PowerShell.Create())
255244
{
256245
ps.Runspace = runspace;
257246
// TODO: CLU
247+
var message = String.Format(format, parameters);
248+
var debugMessage = String.Format("Write-Debug -Message '{0}'", message);
249+
Console.WriteLine(debugMessage);
258250
//ps.AddScript(debugMessage);
259251
//ps.Invoke();
260252
}
261-
*/
262253
}
263254

264255
public void ProgressEmptyBlockDetection(int processedRangeCount, int totalRangeCount)
265256
{
266-
// TODO: CLU
267-
/*
268257
using (var ps = System.Management.Automation.PowerShell.Create())
269258
{
270259
if (processedRangeCount >= totalRangeCount)
@@ -273,6 +262,7 @@ public void ProgressEmptyBlockDetection(int processedRangeCount, int totalRangeC
273262
var progressCommand1 = String.Format(@"Write-Progress -Id {0} -Activity '{1}' -Status '{2}' -Completed", 2, Rsrc.PSSyncOutputEventsProgressEmptyBlockDetection, Rsrc.PSSyncOutputEventsEmptyBlockDetectionCompleted);
274263
ps.Runspace = runspace;
275264
// TODO: CLU
265+
Console.WriteLine(progressCommand1);
276266
//ps.AddScript(progressCommand1);
277267
//ps.Invoke();
278268
return;
@@ -281,18 +271,19 @@ public void ProgressEmptyBlockDetection(int processedRangeCount, int totalRangeC
281271
var progressCommand = String.Format(@"Write-Progress -Id {0} -Activity '{1}' -Status '{2}' -SecondsRemaining {3} -PercentComplete {4}", 2, Rsrc.PSSyncOutputEventsProgressEmptyBlockDetection, Rsrc.PSSyncOutputEventsEmptyBlockDetectionDetecting, -1, ((double)processedRangeCount / totalRangeCount) * 100);
282272
ps.Runspace = runspace;
283273
// TODO: CLU
274+
Console.WriteLine(progressCommand);
284275
//ps.AddScript(progressCommand);
285276
//ps.Invoke();
286277
}
287-
*/
288278
}
289279

290280
public void WriteVerboseWithTimestamp(string message, params object[] args)
291281
{
292282
// TODO: CLU
293-
/*
294283
var messageWithTimeStamp = string.Format(CultureInfo.CurrentCulture, "{0:T} - {1}", DateTime.Now, string.Format(message, args));
295284
var progressCommand = String.Format(@"Write-Verbose -Message {0}", messageWithTimeStamp);
285+
Console.WriteLine(progressCommand);
286+
/*
296287
using (var ps = System.Management.Automation.PowerShell.Create())
297288
{
298289
ps.Runspace = runspace;

0 commit comments

Comments
 (0)