File size: 29,407 Bytes
8c763fb | 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Reflection;
namespace Microsoft.PowerShell.Commands.Internal.Format
{
/// <summary>
/// Class to deserialize property bags into formatting objects
/// by using ERS functionality.
/// </summary>
internal sealed class FormatObjectDeserializer
{
internal TerminatingErrorContext TerminatingErrorContext { get; }
/// <summary>
/// Expansion of TAB character to the following string.
/// </summary>
private const string TabExpansionString = " ";
internal FormatObjectDeserializer(TerminatingErrorContext errorContext)
{
TerminatingErrorContext = errorContext;
}
internal bool IsFormatInfoData(PSObject so)
{
if (PSObject.Base(so) is FormatInfoData fid)
{
if (fid is FormatStartData ||
fid is FormatEndData ||
fid is GroupStartData ||
fid is GroupEndData ||
fid is FormatEntryData)
{
return true;
}
// we have an unexpected type (CLSID not matching): this should never happen
ProcessUnknownInvalidClassId(fid.ClassId2e4f51ef21dd47e99d3c952918aff9cd, so, "FormatObjectDeserializerDeserializeInvalidClassId");
return false;
}
// check the type of the object by
// 1) verifying the type name information
// 2) trying to access the property containing CLSID information
if (!Deserializer.IsInstanceOfType(so, typeof(FormatInfoData)))
{
return false;
}
if (GetProperty(so, FormatInfoData.classidProperty) is not string classId)
{
// it's not one of the objects derived from FormatInfoData
return false;
}
// it's one of ours, get the right class and deserialize it accordingly
if (IsClass(classId, FormatStartData.CLSID) ||
IsClass(classId, FormatEndData.CLSID) ||
IsClass(classId, GroupStartData.CLSID) ||
IsClass(classId, GroupEndData.CLSID) ||
IsClass(classId, FormatEntryData.CLSID))
{
return true;
}
// we have an unknown type (CLSID not matching): this should never happen
ProcessUnknownInvalidClassId(classId, so, "FormatObjectDeserializerIsFormatInfoDataInvalidClassId");
return false;
}
/// <summary>
/// Given a raw object out of the pipeline, it deserializes it accordingly to
/// its type.
/// If the object is not one of the well known ones (i.e. derived from FormatInfoData)
/// it just returns the object unchanged.
/// </summary>
/// <param name="so">Object to deserialize.</param>
/// <returns>Deserialized object or null.</returns>
internal object Deserialize(PSObject so)
{
if (PSObject.Base(so) is FormatInfoData fid)
{
if (fid is FormatStartData ||
fid is FormatEndData ||
fid is GroupStartData ||
fid is GroupEndData ||
fid is FormatEntryData)
{
return fid;
}
// we have an unexpected type (CLSID not matching): this should never happen
ProcessUnknownInvalidClassId(fid.ClassId2e4f51ef21dd47e99d3c952918aff9cd, so, "FormatObjectDeserializerDeserializeInvalidClassId");
return null;
}
// check the type of the object by
// 1) verifying the type name information
// 2) trying to access the property containing CLSID information
if (!Deserializer.IsInstanceOfType(so, typeof(FormatInfoData)))
{
return so;
}
if (GetProperty(so, FormatInfoData.classidProperty) is not string classId)
{
// it's not one of the objects derived from FormatInfoData,
// just return it as is
return so;
}
// it's one of ours, get the right class and deserialize it accordingly
if (IsClass(classId, FormatStartData.CLSID) ||
IsClass(classId, FormatEndData.CLSID) ||
IsClass(classId, GroupStartData.CLSID) ||
IsClass(classId, GroupEndData.CLSID) ||
IsClass(classId, FormatEntryData.CLSID))
{
return DeserializeObject(so);
}
// we have an unknown type (CLSID not matching): this should never happen
ProcessUnknownInvalidClassId(classId, so, "FormatObjectDeserializerDeserializeInvalidClassId");
return null;
}
private void ProcessUnknownInvalidClassId(string classId, object obj, string errorId)
{
string msg = StringUtil.Format(FormatAndOut_format_xxx.FOD_ClassIdInvalid, classId);
ErrorRecord errorRecord = new ErrorRecord(
PSTraceSource.NewArgumentException(nameof(classId)),
errorId,
ErrorCategory.InvalidData,
obj);
errorRecord.ErrorDetails = new ErrorDetails(msg);
this.TerminatingErrorContext.ThrowTerminatingError(errorRecord);
}
#region Helper Methods
private static bool IsClass(string x, string y)
{
return string.Equals(x, y, StringComparison.OrdinalIgnoreCase);
}
#if _UNUSED
NOTE: this code is commented out because the current schema does not have the need for
it. We retail it because future schema extensions might require it
/// <summary>
/// ERS helper to reconstitute a string[] out of IEnumerable property.
/// </summary>
/// <param name="rawObject">Object to process.</param>
/// <param name="propertyName">Property to look up.</param>
/// <returns>String[] representation of the property.</returns>
private static string[] ReadStringArrayHelper (object rawObject, string propertyName)
{
// throw if the property is not there
IEnumerable e = (IEnumerable)ERSHelper.GetExtendedProperty (rawObject, propertyName, false);
if (e == null)
return null;
// copy to string collection, since, a priori, we do not know the length
StringCollection temp = new StringCollection ();
foreach (string s in e)
temp.Add (s);
if (temp.Count <= 0)
return null;
// copy to a string[] and return
string[] retVal = new string[temp.Count];
temp.CopyTo (retVal, 0);
return retVal;
}
#endif
#endregion
internal static object GetProperty(PSObject so, string name)
{
PSMemberInfo member = so.Properties[name];
if (member == null)
{
return null;
}
// NOTE: we do not distinguish between property not there and null property
// if an exception is thrown, it would be considered an internal failure
return member.Value;
}
// returns null on error
internal FormatInfoData DeserializeMemberObject(PSObject so, string property)
{
object memberRaw = GetProperty(so, property);
if (memberRaw == null)
return null;
if (so == memberRaw)
{
string msg = StringUtil.Format(FormatAndOut_format_xxx.FOD_RecursiveProperty, property);
ErrorRecord errorRecord = new ErrorRecord(
PSTraceSource.NewArgumentException(nameof(property)),
"FormatObjectDeserializerRecursiveProperty",
ErrorCategory.InvalidData,
so);
errorRecord.ErrorDetails = new ErrorDetails(msg);
this.TerminatingErrorContext.ThrowTerminatingError(errorRecord);
}
return DeserializeObject(PSObject.AsPSObject(memberRaw));
}
internal FormatInfoData DeserializeMandatoryMemberObject(PSObject so, string property)
{
FormatInfoData fid = DeserializeMemberObject(so, property);
VerifyDataNotNull(fid, property);
return fid;
}
private object DeserializeMemberVariable(PSObject so, string property, System.Type t, bool cannotBeNull)
{
object objRaw = GetProperty(so, property);
if (cannotBeNull)
VerifyDataNotNull(objRaw, property);
if (objRaw != null && t != objRaw.GetType())
{
string msg = StringUtil.Format(FormatAndOut_format_xxx.FOD_InvalidPropertyType, t.Name, property);
ErrorRecord errorRecord = new ErrorRecord(
PSTraceSource.NewArgumentException(nameof(property)),
"FormatObjectDeserializerInvalidPropertyType",
ErrorCategory.InvalidData,
so);
errorRecord.ErrorDetails = new ErrorDetails(msg);
this.TerminatingErrorContext.ThrowTerminatingError(errorRecord);
}
return objRaw;
}
/// <summary>
/// Deserialization of string without TAB expansion (RAW)
/// </summary>
/// <param name="so">Object whose the property belongs to.</param>
/// <param name="property">Name of the string property.</param>
/// <returns>String out of the MsObject.</returns>
internal string DeserializeStringMemberVariableRaw(PSObject so, string property)
{
return (string)DeserializeMemberVariable(so, property, typeof(string), false /* cannotBeNull */);
}
/// <summary>
/// Deserialization of string performing TAB expansion.
/// </summary>
/// <param name="so">Object whose the property belongs to.</param>
/// <param name="property">Name of the string property.</param>
/// <returns>String out of the MsObject.</returns>
internal string DeserializeStringMemberVariable(PSObject so, string property)
{
string val = (string)DeserializeMemberVariable(so, property, typeof(string), false /* cannotBeNull */);
// expand TAB's
if (string.IsNullOrEmpty(val))
return val;
return val.Replace("\t", TabExpansionString);
}
internal int DeserializeIntMemberVariable(PSObject so, string property)
{
return (int)DeserializeMemberVariable(so, property, typeof(int), true /* cannotBeNull */);
}
internal bool DeserializeBoolMemberVariable(PSObject so, string property, bool cannotBeNull = true)
{
var val = DeserializeMemberVariable(so, property, typeof(bool), cannotBeNull);
return val != null && (bool)val;
}
internal WriteStreamType DeserializeWriteStreamTypeMemberVariable(PSObject so)
{
object wsTypeValue = GetProperty(so, "writeStream");
if (wsTypeValue == null)
{
return WriteStreamType.None;
}
WriteStreamType rtnWSType;
if (wsTypeValue is WriteStreamType)
{
rtnWSType = (WriteStreamType)wsTypeValue;
}
else if (wsTypeValue is string)
{
if (!Enum.TryParse<WriteStreamType>(wsTypeValue as string, true, out rtnWSType))
{
rtnWSType = WriteStreamType.None;
}
}
else
{
rtnWSType = WriteStreamType.None;
}
return rtnWSType;
}
// returns null on error
internal FormatInfoData DeserializeObject(PSObject so)
{
FormatInfoData fid = FormatInfoDataClassFactory.CreateInstance(so, this);
fid?.Deserialize(so, this);
return fid;
}
internal void VerifyDataNotNull(object obj, string name)
{
if (obj != null)
return;
string msg = StringUtil.Format(FormatAndOut_format_xxx.FOD_NullDataMember, name);
ErrorRecord errorRecord = new ErrorRecord(
new ArgumentException(),
"FormatObjectDeserializerNullDataMember",
ErrorCategory.InvalidData,
null);
errorRecord.ErrorDetails = new ErrorDetails(msg);
this.TerminatingErrorContext.ThrowTerminatingError(errorRecord);
}
}
internal static class FormatInfoDataClassFactory
{
static FormatInfoDataClassFactory()
{
s_constructors = new Dictionary<string, Func<FormatInfoData>>
{
{FormatStartData.CLSID, static () => new FormatStartData()},
{FormatEndData.CLSID, static () => new FormatEndData()},
{GroupStartData.CLSID, static () => new GroupStartData()},
{GroupEndData.CLSID, static () => new GroupEndData()},
{FormatEntryData.CLSID, static () => new FormatEntryData()},
{WideViewHeaderInfo.CLSID, static () => new WideViewHeaderInfo()},
{TableHeaderInfo.CLSID, static () => new TableHeaderInfo()},
{TableColumnInfo.CLSID, static () => new TableColumnInfo()},
{ListViewHeaderInfo.CLSID, static () => new ListViewHeaderInfo()},
{ListViewEntry.CLSID, static () => new ListViewEntry()},
{ListViewField.CLSID, static () => new ListViewField()},
{TableRowEntry.CLSID, static () => new TableRowEntry()},
{WideViewEntry.CLSID, static () => new WideViewEntry()},
{ComplexViewHeaderInfo.CLSID, static () => new ComplexViewHeaderInfo()},
{ComplexViewEntry.CLSID, static () => new ComplexViewEntry()},
{GroupingEntry.CLSID, static () => new GroupingEntry()},
{PageHeaderEntry.CLSID, static () => new PageHeaderEntry()},
{PageFooterEntry.CLSID, static () => new PageFooterEntry()},
{AutosizeInfo.CLSID, static () => new AutosizeInfo()},
{FormatNewLine.CLSID, static () => new FormatNewLine()},
{FrameInfo.CLSID, static () => new FrameInfo()},
{FormatTextField.CLSID, static () => new FormatTextField()},
{FormatPropertyField.CLSID, static () => new FormatPropertyField()},
{FormatEntry.CLSID, static () => new FormatEntry()},
{RawTextFormatEntry.CLSID, static () => new RawTextFormatEntry()}
};
}
// returns null on error
internal static FormatInfoData CreateInstance(PSObject so, FormatObjectDeserializer deserializer)
{
if (so == null)
{
throw PSTraceSource.NewArgumentNullException(nameof(so));
}
// look for the property that defines the type of object
string classId = FormatObjectDeserializer.GetProperty(so, FormatInfoData.classidProperty) as string;
if (classId == null)
{
string msg = StringUtil.Format(FormatAndOut_format_xxx.FOD_InvalidClassidProperty);
ErrorRecord errorRecord = new ErrorRecord(
PSTraceSource.NewArgumentException("classid"),
"FormatObjectDeserializerInvalidClassidProperty",
ErrorCategory.InvalidData,
so);
errorRecord.ErrorDetails = new ErrorDetails(msg);
deserializer.TerminatingErrorContext.ThrowTerminatingError(errorRecord);
}
FormatInfoData fid = CreateInstance(classId, deserializer);
return fid;
}
// returns null on failure
private static FormatInfoData CreateInstance(string clsid, FormatObjectDeserializer deserializer)
{
Func<FormatInfoData> ctor;
if (!s_constructors.TryGetValue(clsid, out ctor))
{
CreateInstanceError(PSTraceSource.NewArgumentException(nameof(clsid)), clsid, deserializer);
return null;
}
try
{
FormatInfoData fid = ctor();
return fid;
}
catch (ArgumentException e)
{
CreateInstanceError(e, clsid, deserializer);
}
catch (NotSupportedException e)
{
CreateInstanceError(e, clsid, deserializer);
}
catch (TargetInvocationException e)
{
CreateInstanceError(e, clsid, deserializer);
}
catch (MemberAccessException e) // also MethodAccessException and MissingMethodException
{
CreateInstanceError(e, clsid, deserializer);
}
catch (System.Runtime.InteropServices.InvalidComObjectException e)
{
CreateInstanceError(e, clsid, deserializer);
}
catch (System.Runtime.InteropServices.COMException e)
{
CreateInstanceError(e, clsid, deserializer);
}
catch (TypeLoadException e)
{
CreateInstanceError(e, clsid, deserializer);
}
catch (Exception e) // will rethrow
{
Diagnostics.Assert(false,
"Unexpected Activator.CreateInstance error in FormatInfoDataClassFactory.CreateInstance: "
+ e.GetType().FullName);
throw;
}
return null;
}
private static void CreateInstanceError(Exception e, string clsid, FormatObjectDeserializer deserializer)
{
string msg = StringUtil.Format(FormatAndOut_format_xxx.FOD_InvalidClassid, clsid);
ErrorRecord errorRecord = new ErrorRecord(
e,
"FormatObjectDeserializerInvalidClassid",
ErrorCategory.InvalidData,
null);
errorRecord.ErrorDetails = new ErrorDetails(msg);
deserializer.TerminatingErrorContext.ThrowTerminatingError(errorRecord);
}
private static readonly Dictionary<string, Func<FormatInfoData>> s_constructors;
}
internal static class FormatInfoDataListDeserializer<T> where T : FormatInfoData
{
private static void ReadListHelper(IEnumerable en, List<T> lst, FormatObjectDeserializer deserializer)
{
deserializer.VerifyDataNotNull(en, "enumerable");
foreach (object obj in en)
{
FormatInfoData fid = deserializer.DeserializeObject(PSObjectHelper.AsPSObject(obj));
T entry = fid as T;
deserializer.VerifyDataNotNull(entry, "entry");
lst.Add(entry);
}
}
internal static void ReadList(PSObject so, string property, List<T> lst, FormatObjectDeserializer deserializer)
{
if (lst == null)
{
throw PSTraceSource.NewArgumentNullException(nameof(lst));
}
object memberRaw = FormatObjectDeserializer.GetProperty(so, property);
ReadListHelper(PSObjectHelper.GetEnumerable(memberRaw), lst, deserializer);
}
}
#region Formatting Objects Deserializer
internal abstract partial class FormatInfoData
{
internal virtual void Deserialize(PSObject so, FormatObjectDeserializer deserializer) { }
}
internal abstract partial class ControlInfoData : PacketInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
// optional
this.groupingEntry = (GroupingEntry)deserializer.DeserializeMemberObject(so, "groupingEntry");
}
}
internal abstract partial class StartData : ControlInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.shapeInfo = (ShapeInfo)deserializer.DeserializeMemberObject(so, "shapeInfo");
}
}
internal sealed partial class AutosizeInfo : FormatInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.objectCount = deserializer.DeserializeIntMemberVariable(so, "objectCount");
}
}
internal sealed partial class FormatStartData : StartData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
// for the base class the shapeInfo is optional, but it's mandatory for this class
deserializer.VerifyDataNotNull(this.shapeInfo, "shapeInfo");
this.pageHeaderEntry = (PageHeaderEntry)deserializer.DeserializeMemberObject(so, "pageHeaderEntry");
this.pageFooterEntry = (PageFooterEntry)deserializer.DeserializeMemberObject(so, "pageFooterEntry");
this.autosizeInfo = (AutosizeInfo)deserializer.DeserializeMemberObject(so, "autosizeInfo");
}
}
internal sealed partial class FormatEntryData : PacketInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.formatEntryInfo = (FormatEntryInfo)deserializer.DeserializeMandatoryMemberObject(so, "formatEntryInfo");
this.outOfBand = deserializer.DeserializeBoolMemberVariable(so, "outOfBand");
this.writeStream = deserializer.DeserializeWriteStreamTypeMemberVariable(so);
this.isHelpObject = so.IsHelpObject;
}
}
internal sealed partial class WideViewHeaderInfo : ShapeInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.columns = deserializer.DeserializeIntMemberVariable(so, "columns");
}
}
internal sealed partial class TableHeaderInfo : ShapeInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
// The "repeatHeader" property was added later (V5, V6) and presents an incompatibility when remoting to older version PowerShell sessions.
// When the property is missing from the serialized object, let the deserialized property be false.
this.repeatHeader = deserializer.DeserializeBoolMemberVariable(so, "repeatHeader", cannotBeNull: false);
this.hideHeader = deserializer.DeserializeBoolMemberVariable(so, "hideHeader");
FormatInfoDataListDeserializer<TableColumnInfo>.ReadList(so, "tableColumnInfoList", this.tableColumnInfoList, deserializer);
}
}
internal sealed partial class TableColumnInfo : FormatInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.width = deserializer.DeserializeIntMemberVariable(so, "width");
this.alignment = deserializer.DeserializeIntMemberVariable(so, "alignment");
this.label = deserializer.DeserializeStringMemberVariable(so, "label");
this.propertyName = deserializer.DeserializeStringMemberVariable(so, "propertyName");
}
}
internal sealed partial class RawTextFormatEntry : FormatEntryInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.text = deserializer.DeserializeStringMemberVariableRaw(so, "text");
}
}
internal abstract partial class FreeFormatEntry : FormatEntryInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
FormatInfoDataListDeserializer<FormatValue>.ReadList(so, "formatValueList", this.formatValueList, deserializer);
}
}
internal sealed partial class ListViewEntry : FormatEntryInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
FormatInfoDataListDeserializer<ListViewField>.ReadList(so, "listViewFieldList", this.listViewFieldList, deserializer);
}
}
internal sealed partial class ListViewField : FormatInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.label = deserializer.DeserializeStringMemberVariable(so, "label");
this.propertyName = deserializer.DeserializeStringMemberVariable(so, "propertyName");
this.formatPropertyField = (FormatPropertyField)deserializer.DeserializeMandatoryMemberObject(so, "formatPropertyField");
}
}
internal sealed partial class TableRowEntry : FormatEntryInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
FormatInfoDataListDeserializer<FormatPropertyField>.ReadList(so, "formatPropertyFieldList", this.formatPropertyFieldList, deserializer);
this.multiLine = deserializer.DeserializeBoolMemberVariable(so, "multiLine");
}
}
internal sealed partial class WideViewEntry : FormatEntryInfo
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.formatPropertyField = (FormatPropertyField)deserializer.DeserializeMandatoryMemberObject(so, "formatPropertyField");
}
}
internal sealed partial class FormatTextField : FormatValue
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.text = deserializer.DeserializeStringMemberVariable(so, "text");
}
}
internal sealed partial class FormatPropertyField : FormatValue
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.propertyValue = deserializer.DeserializeStringMemberVariable(so, "propertyValue");
this.alignment = deserializer.DeserializeIntMemberVariable(so, "alignment");
}
}
internal sealed partial class FormatEntry : FormatValue
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
FormatInfoDataListDeserializer<FormatValue>.ReadList(so, "formatValueList", this.formatValueList, deserializer);
this.frameInfo = (FrameInfo)deserializer.DeserializeMemberObject(so, "frameInfo");
}
}
internal sealed partial class FrameInfo : FormatInfoData
{
internal override void Deserialize(PSObject so, FormatObjectDeserializer deserializer)
{
base.Deserialize(so, deserializer);
this.leftIndentation = deserializer.DeserializeIntMemberVariable(so, "leftIndentation");
this.rightIndentation = deserializer.DeserializeIntMemberVariable(so, "rightIndentation");
this.firstLine = deserializer.DeserializeIntMemberVariable(so, "firstLine");
}
}
#endregion
}
|