Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 46 additions & 42 deletions src/System.Management.Automation/engine/ProgressRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class ProgressRecord
throw PSTraceSource.NewArgumentException("activity", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "statusDescription");
}

_id = activityId;
_activity = activity;
_status = statusDescription;
this.id = activityId;
this.activity = activity;
this.status = statusDescription;
}

/// <summary>
Expand All @@ -77,14 +77,14 @@ class ProgressRecord
/// <param name="other"></param>
internal ProgressRecord(ProgressRecord other)
{
_activity = other._activity;
_currentOperation = other._currentOperation;
_id = other._id;
_parentId = other._parentId;
_percent = other._percent;
_secondsRemaining = other._secondsRemaining;
_status = other._status;
_type = other._type;
this.activity = other.activity;
this.currentOperation = other.currentOperation;
this.id = other.id;
this.parentId = other.parentId;
this.percent = other.percent;
this.secondsRemaining = other.secondsRemaining;
this.status = other.status;
this.type = other.type;
}

/// <summary>
Expand All @@ -100,7 +100,7 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _id;
return id;
}
}

Expand Down Expand Up @@ -133,15 +133,15 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _parentId;
return parentId;
}
set
{
if (value == ActivityId)
{
throw PSTraceSource.NewArgumentException("value", ProgressRecordStrings.ParentActivityIdCantBeActivityId);
}
_parentId = value;
parentId = value;
}
}

Expand All @@ -165,15 +165,15 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _activity;
return activity;
}
set
{
if (String.IsNullOrEmpty(value))
{
throw PSTraceSource.NewArgumentException("value", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "value");
}
_activity = value;
activity = value;
}
}

Expand All @@ -191,15 +191,15 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _status;
return status;
}
set
{
if (String.IsNullOrEmpty(value))
{
throw PSTraceSource.NewArgumentException("value", ProgressRecordStrings.ArgMayNotBeNullOrEmpty, "value");
}
_status = value;
status = value;
}
}

Expand All @@ -219,13 +219,13 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _currentOperation;
return currentOperation;
}
set
{
// null or empty string is allowed

_currentOperation = value;
currentOperation = value;
}
}

Expand All @@ -244,7 +244,7 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _percent;
return percent;
}
set
{
Expand All @@ -257,7 +257,7 @@ internal ProgressRecord(ProgressRecord other)
"value", value, ProgressRecordStrings.PercentMayNotBeMoreThan100, "PercentComplete");
}

_percent = value;
percent = value;
}
}

Expand All @@ -283,13 +283,13 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _secondsRemaining;
return secondsRemaining;
}
set
{
// negative values are allowed

_secondsRemaining = value;
secondsRemaining = value;
}
}

Expand All @@ -307,7 +307,7 @@ internal ProgressRecord(ProgressRecord other)
{
get
{
return _type;
return type;
}
set
{
Expand All @@ -316,7 +316,7 @@ internal ProgressRecord(ProgressRecord other)
throw PSTraceSource.NewArgumentException("value");
}

_type = value;
type = value;
}
}

Expand All @@ -343,14 +343,14 @@ public override
String.Format(
System.Globalization.CultureInfo.CurrentCulture,
"parent = {0} id = {1} act = {2} stat = {3} cur = {4} pct = {5} sec = {6} type = {7}",
_parentId,
_id,
_activity,
_status,
_currentOperation,
_percent,
_secondsRemaining,
_type);
parentId,
id,
activity,
status,
currentOperation,
percent,
secondsRemaining,
type);
}

#endregion
Expand Down Expand Up @@ -467,29 +467,33 @@ internal static int GetPercentageComplete(DateTime startTime, TimeSpan expectedD

#endregion

#region DO NOT REMOVE OR RENAME THESE FIELDS - it will break remoting compatibility with Windows PowerShell

[DataMemberAttribute()]
private int _id;
private int id;

[DataMemberAttribute()]
private int _parentId = -1;
private int parentId = -1;

[DataMemberAttribute()]
private string _activity;
private string activity;

[DataMemberAttribute()]
private string _status;
private string status;

[DataMemberAttribute()]
private string _currentOperation;
private string currentOperation;

[DataMemberAttribute()]
private int _percent = -1;
private int percent = -1;

[DataMemberAttribute()]
private int _secondsRemaining = -1;
private int secondsRemaining = -1;

[DataMemberAttribute()]
private ProgressRecordType _type = ProgressRecordType.Processing;
private ProgressRecordType type = ProgressRecordType.Processing;

#endregion

#region Serialization / deserialization for remoting

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ namespace System.Management.Automation.Host
public sealed
class ChoiceDescription
{

#region DO NOT REMOVE OR RENAME THESE FIELDS - it will break remoting compatibility with Windows PowerShell compatibility with Windows PowerShell

private readonly string label = null;
private string helpMessage = "";

#endregion

/// <summary>
///
/// Initializes an new instance of ChoiceDescription and defines the Label value.
Expand Down Expand Up @@ -46,7 +54,7 @@ class ChoiceDescription
throw PSTraceSource.NewArgumentException("label", DescriptionsStrings.NullOrEmptyErrorTemplate, "label");
}

_label = label;
this.label = label;
}

/// <summary>
Expand Down Expand Up @@ -92,8 +100,8 @@ class ChoiceDescription
throw PSTraceSource.NewArgumentNullException("helpMessage");
}

_label = label;
_helpMessage = helpMessage;
this.label = label;
this.helpMessage = helpMessage;
}

/// <summary>
Expand All @@ -118,9 +126,9 @@ class ChoiceDescription
{
get
{
Dbg.Assert(_label != null, "label should not be null");
Dbg.Assert(this.label != null, "label should not be null");

return _label;
return this.label;
}
}

Expand Down Expand Up @@ -149,9 +157,9 @@ class ChoiceDescription
{
get
{
Dbg.Assert(_helpMessage != null, "helpMessage should not be null");
Dbg.Assert(this.helpMessage != null, "helpMessage should not be null");

return _helpMessage;
return this.helpMessage;
}
set
{
Expand All @@ -160,12 +168,9 @@ class ChoiceDescription
throw PSTraceSource.NewArgumentNullException("value");
}

_helpMessage = value;
this.helpMessage = value;
}
}

private readonly string _label = null;
private string _helpMessage = "";
}
}

Expand Down
Loading