forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStateDescriptor.cs
More file actions
87 lines (77 loc) · 2.46 KB
/
Copy pathStateDescriptor.cs
File metadata and controls
87 lines (77 loc) · 2.46 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
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
//-----------------------------------------------------------------------
// <copyright file="StateDescriptor.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace Microsoft.Management.UI.Internal
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics.CodeAnalysis;
/// <summary>
/// Base proxy class for other classes which wish to have save and restore functionality.
/// </summary>
/// <typeparam name="T">There are no restrictions on T.</typeparam>
[Serializable]
[SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")]
public abstract class StateDescriptor<T>
{
private Guid id;
private string name;
/// <summary>
/// Creates a new instances of the StateDescriptor class and creates a new GUID.
/// </summary>
protected StateDescriptor()
{
this.Id = Guid.NewGuid();
}
/// <summary>
/// Constructor overload to provide name.
/// </summary>
/// <param name="name">The friendly name for the StateDescriptor.</param>
protected StateDescriptor(string name)
: this()
{
this.Name = name;
}
/// <summary>
/// Gets the global unique identification number.
/// </summary>
public Guid Id
{
get
{
return this.id;
}
protected set
{
this.id = value;
}
}
/// <summary>
/// Gets or sets the friendly display name.
/// </summary>
public string Name
{
get
{
return this.name;
}
set
{
this.name = value;
}
}
/// <summary>
/// Saves a snapshot of the subject's current state.
/// </summary>
/// <param name="subject">The object whose state will be saved.</param>
public abstract void SaveState(T subject);
/// <summary>
/// Restores the state of subject to the saved state.
/// </summary>
/// <param name="subject">The object whose state will be restored.</param>
public abstract void RestoreState(T subject);
}
}