forked from killswitch1111/powerguivsx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeveloperActivityAttribute.cs
More file actions
47 lines (43 loc) · 1.79 KB
/
Copy pathDeveloperActivityAttribute.cs
File metadata and controls
47 lines (43 loc) · 1.79 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
using System;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
namespace PowerShellTools.Project
{
/// <summary>
/// This attribute registers a DeveloperActivity key.
/// If present, the position of the language root node
/// is controlled by the Developer Settings dialog box.
/// </summary>
internal sealed class DeveloperActivityAttribute : RegistrationAttribute
{
private readonly string _regKeyName;
private readonly string _developerActivity;
/// <summary>
/// Creates a new DeveloperActivityAttribute
/// </summary>
/// <param name="developerActivity">Name of language</param>
/// <param name="projectPackageType">Project package type</param>
public DeveloperActivityAttribute(string developerActivity, Type projectPackageType)
{
_developerActivity = developerActivity;
_regKeyName = string.Format(CultureInfo.InvariantCulture, "NewProjectTemplates\\TemplateDirs\\{0}\\/1", projectPackageType.GUID.ToString("B"));
}
/// <summary>
/// Called to register this attribute with the given context
/// </summary>
/// <param name="context">The registration context.</param>
public override void Register(RegistrationContext context)
{
var key = context.CreateKey(_regKeyName);
key.SetValue("DeveloperActivity", _developerActivity);
}
/// <summary>
/// Unregisters this package's load key information
/// </summary>
/// <param name="context">The registration context.</param>
public override void Unregister(RegistrationContext context)
{
context.RemoveKey(_regKeyName);
}
}
}