OLD | NEW |
| (Empty) |
1 using System; | |
2 using System.Collections.Generic; | |
3 using System.Linq; | |
4 using System.Text; | |
5 using Microsoft.VisualStudio.Shell; | |
6 | |
7 namespace Google.NaClVsx.Installation | |
8 { | |
9 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] | |
10 public sealed class PortSupplierRegistrationAttribute : RegistrationAttribute | |
11 { | |
12 public PortSupplierRegistrationAttribute(Type portSupplierType) { | |
13 portSupplierType_ = portSupplierType; | |
14 } | |
15 | |
16 public Type PortSupplierType { | |
17 get { return portSupplierType_; } | |
18 set { portSupplierType_ = value; } | |
19 } | |
20 | |
21 public string Name { | |
22 get { return name_; } | |
23 set { name_ = value; } | |
24 } | |
25 | |
26 public bool DisallowUserPorts { | |
27 get { return disallowUserPorts_; } | |
28 set { disallowUserPorts_ = value; } | |
29 } | |
30 | |
31 #region Overrides of RegistrationAttribute | |
32 | |
33 public override void Register(RegistrationContext context) { | |
34 Key key = context.CreateKey(KeyName()); | |
35 key.SetValue("CLSID", ClsIdString()); | |
36 key.SetValue("DisallowUserEnteredPorts", disallowUserPorts_ ? 1 : 0); | |
37 key.SetValue("Name", name_); | |
38 } | |
39 | |
40 public override void Unregister(RegistrationContext context) { | |
41 context.RemoveKey(KeyName()); | |
42 } | |
43 | |
44 #endregion | |
45 | |
46 string ClsIdString() { | |
47 return PortSupplierType.GUID.ToString("B"); | |
48 } | |
49 | |
50 string KeyName() | |
51 { | |
52 return string.Format("AD7Metrics\\PortSupplier\\{0}", ClsIdString()); | |
53 } | |
54 | |
55 private Type portSupplierType_; | |
56 private string name_ = "[Port provider name goes here]"; | |
57 private bool disallowUserPorts_ = false; | |
58 } | |
59 } | |
OLD | NEW |