OLD | NEW |
| (Empty) |
1 using System; | |
2 using System.Collections.Generic; | |
3 using System.Diagnostics; | |
4 using System.Linq; | |
5 using System.Runtime.InteropServices; | |
6 using System.Text; | |
7 using Microsoft.VisualStudio; | |
8 using Microsoft.VisualStudio.Debugger.Interop; | |
9 | |
10 namespace Google.MsAd7.BaseImpl | |
11 { | |
12 public abstract class PortSupplier : IDebugPortSupplier3, IDebugPortSupplierDe
scription2 | |
13 { | |
14 protected PortSupplier(string name, string description) { | |
15 name_ = name; | |
16 description_ = description; | |
17 Debug.WriteLine("PortSupplier ctor"); | |
18 } | |
19 | |
20 public string Name { | |
21 get { return name_; } | |
22 } | |
23 | |
24 public string Description { | |
25 get { return description_; } | |
26 } | |
27 | |
28 #region Implementation of IDebugPortSupplier3 | |
29 | |
30 public int GetPortSupplierName(out string pbstrName) { | |
31 pbstrName = name_; | |
32 return VSConstants.S_OK; | |
33 } | |
34 | |
35 public int GetPortSupplierId(out Guid pguidPortSupplier) { | |
36 pguidPortSupplier = this.GetType().GUID; | |
37 return VSConstants.S_OK; | |
38 } | |
39 | |
40 public int GetPort(ref Guid guidPort, out IDebugPort2 ppPort) { | |
41 Debug.WriteLine("PortSupplier.GetPort"); | |
42 ppPort = ports_[guidPort]; | |
43 return VSConstants.S_OK; | |
44 } | |
45 | |
46 public int EnumPorts(out IEnumDebugPorts2 ppEnum) { | |
47 Debug.WriteLine("PortSupplier.EnumPorts"); | |
48 | |
49 ppEnum = new Ad7Enumerators.PortEnumerator(ports_.Values); | |
50 return VSConstants.S_OK; | |
51 } | |
52 | |
53 public int CanAddPort() { | |
54 Debug.WriteLine("PortSupplier.CanAddPort"); | |
55 return VSConstants.S_OK; | |
56 } | |
57 | |
58 public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) { | |
59 Debug.WriteLine("PortSupplier.AddPort"); | |
60 var port = CreatePort(pRequest); | |
61 ports_.Add(port.Guid, port); | |
62 ppPort = port; | |
63 return VSConstants.S_OK; | |
64 } | |
65 | |
66 | |
67 public int RemovePort(IDebugPort2 pPort) { | |
68 Debug.WriteLine("PortSupplier.RemovePort"); | |
69 throw new NotImplementedException(); | |
70 } | |
71 | |
72 public int CanPersistPorts() { | |
73 return VSConstants.S_OK; | |
74 } | |
75 | |
76 public int EnumPersistedPorts(BSTR_ARRAY PortNames, out IEnumDebugPorts2 ppE
num) { | |
77 Debug.WriteLine("PortSupplier.EnumPersistedPorts"); | |
78 throw new NotImplementedException(); | |
79 } | |
80 | |
81 #endregion | |
82 | |
83 protected abstract Port CreatePort(IDebugPortRequest2 rq); | |
84 Dictionary<Guid, IDebugPort2> ports_ = new Dictionary<Guid, IDebugPort2>(); | |
85 private string name_; | |
86 private string description_; | |
87 | |
88 #region Implementation of IDebugPortSupplierDescription2 | |
89 | |
90 public int GetDescription(enum_PORT_SUPPLIER_DESCRIPTION_FLAGS[] pdwFlags, o
ut string pbstrText) { | |
91 pbstrText = description_; | |
92 return VSConstants.S_OK; | |
93 } | |
94 | |
95 #endregion | |
96 } | |
97 } | |
OLD | NEW |