@@ -14,7 +14,7 @@ namespace Rubberduck.VBEditor.SafeComWrappers
14
14
15
15
[ ComImport ( ) , Guid ( "00020400-0000-0000-C000-000000000046" ) ]
16
16
[ InterfaceType ( ComInterfaceType . InterfaceIsIUnknown ) ]
17
- interface IDispatch
17
+ internal interface IDispatch
18
18
{
19
19
[ PreserveSig ] int GetTypeInfoCount ( [ Out ] out uint pctinfo ) ;
20
20
[ PreserveSig ] int GetTypeInfo ( [ In ] uint iTInfo , [ In ] uint lcid , [ Out ] out ComTypes . ITypeInfo pTypeInfo ) ;
@@ -31,7 +31,7 @@ int Invoke([In] int dispIdMember,
31
31
[ Out ] out uint pArgErr ) ;
32
32
}
33
33
34
- class IDispatchHelper
34
+ internal class IDispatchHelper
35
35
{
36
36
public enum StandardDispIds : int
37
37
{
@@ -49,13 +49,11 @@ public enum InvokeKind : int
49
49
public static object PropertyGet_NoArgs ( IDispatch obj , int memberId )
50
50
{
51
51
var pDispParams = new ComTypes . DISPPARAMS ( ) ;
52
- object pVarResult ;
53
52
var pExcepInfo = new ComTypes . EXCEPINFO ( ) ;
54
- uint ErrArg ;
55
53
Guid guid = new Guid ( ) ;
56
-
54
+
57
55
int hr = obj . Invoke ( memberId , ref guid , 0 , ( uint ) ( InvokeKind . DISPATCH_METHOD | InvokeKind . DISPATCH_PROPERTYGET ) ,
58
- ref pDispParams , out pVarResult , ref pExcepInfo , out ErrArg ) ;
56
+ ref pDispParams , out var pVarResult , ref pExcepInfo , out uint ErrArg ) ;
59
57
60
58
if ( hr < 0 )
61
59
{
@@ -97,11 +95,6 @@ public ComWrapperEnumerator(object source, Func<object, TWrapperItem> itemWrappe
97
95
}
98
96
}
99
97
100
- public void Dispose ( )
101
- {
102
- if ( ! IsWrappingNullReference ) Marshal . ReleaseComObject ( _enumeratorRCW ) ;
103
- }
104
-
105
98
void IEnumerator . Reset ( )
106
99
{
107
100
if ( ! IsWrappingNullReference )
@@ -121,7 +114,10 @@ void IEnumerator.Reset()
121
114
122
115
bool IEnumerator . MoveNext ( )
123
116
{
124
- if ( IsWrappingNullReference ) return false ;
117
+ if ( IsWrappingNullReference )
118
+ {
119
+ return false ;
120
+ }
125
121
126
122
_currentItem = null ;
127
123
@@ -139,5 +135,13 @@ bool IEnumerator.MoveNext()
139
135
140
136
return ( celtFetched == 1 ) ; // celtFetched will be 0 when we reach the end of the collection
141
137
}
138
+
139
+ public void Dispose ( )
140
+ {
141
+ if ( ! IsWrappingNullReference )
142
+ {
143
+ Marshal . ReleaseComObject ( _enumeratorRCW ) ;
144
+ }
145
+ }
142
146
}
143
147
}
0 commit comments