forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSMISerializer.cs
More file actions
43 lines (39 loc) · 1.61 KB
/
Copy pathPSMISerializer.cs
File metadata and controls
43 lines (39 loc) · 1.61 KB
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
using Microsoft.Management.Infrastructure;
using Dbg = System.Management.Automation.Diagnostics;
namespace System.Management.Automation
{
/// <summary>
/// This class provides public functionality for serializing a PSObject to a CimInstance
/// </summary>
internal class PSMISerializer
{
//TODO, insivara : Depth implementation will be added subsequently
/// <summary>
/// Default depth of serialization
/// </summary>
private static int s_mshDefaultMISerializationDepth = 1;
internal PSMISerializer()
{
}
/// <summary>
/// Serializes an object into CimInstance
/// </summary>
/// <param name="source">The input object to serialize. Serializes to a default depth of 1</param>
/// <returns>The serialized object, as CimInstance</returns>n
public static CimInstance Serialize(Object source)
{
return Serialize(source, s_mshDefaultMISerializationDepth);
}
/// <summary>
/// Serializes an object into CimInstance
/// </summary>
/// <param name="source">The input object to serialize. Serializes to a default depth of 1</param>
/// <param name="serializationDepth">The input object to serialize. Serializes to a default depth of 1</param>
/// <returns>The serialized object, as CimInstance</returns>n
public static CimInstance Serialize(Object source, int serializationDepth)
{
MISerializer serializer = new MISerializer(serializationDepth);
return serializer.Serialize(source);
}
}
}