@@ -75,12 +75,6 @@ public override IntPtr MarshalManagedToNative(Object managedObj)
75
75
return FromManaged ( filePath ) ;
76
76
}
77
77
78
- public override Object MarshalNativeToManaged ( IntPtr pNativeData )
79
- {
80
- throw new InvalidOperationException (
81
- string . Format ( "{0} cannot be used to retrieve data from libgit2." , GetType ( ) . Name ) ) ;
82
- }
83
-
84
78
#endregion
85
79
86
80
public static IntPtr FromManaged ( FilePath filePath )
@@ -99,43 +93,32 @@ public static IntPtr FromManaged(FilePath filePath)
99
93
/// converting it to a managed FilePath instance. The marshaler will free the native pointer
100
94
/// after conversion.
101
95
/// </summary>
102
- internal class LaxFilePathMarshaler : EncodingMarshaler
96
+ internal class LaxFilePathMarshaler : LaxUtf8Marshaler
103
97
{
104
98
private static readonly LaxFilePathMarshaler staticInstance = new LaxFilePathMarshaler ( ) ;
105
99
106
- private static readonly Encoding encoding = new UTF8Encoding ( true , false ) ;
107
-
108
- public LaxFilePathMarshaler ( ) : base ( encoding )
109
- { }
110
-
111
100
#region ICustomMarshaler
112
101
113
- public override IntPtr MarshalManagedToNative ( object managedObj )
114
- {
115
- throw new InvalidOperationException (
116
- string . Format ( "{0} cannot be used to pass data to libgit2." , GetType ( ) . Name ) ) ;
117
- }
118
-
119
102
public override Object MarshalNativeToManaged ( IntPtr pNativeData )
120
103
{
121
104
return FromNative ( pNativeData ) ;
122
105
}
123
106
124
107
#endregion
125
108
126
- public static ICustomMarshaler GetInstance ( String cookie )
109
+ public new static ICustomMarshaler GetInstance ( String cookie )
127
110
{
128
111
return staticInstance ;
129
112
}
130
113
131
- public static FilePath FromNative ( IntPtr pNativeData )
114
+ public new static FilePath FromNative ( IntPtr pNativeData )
132
115
{
133
- return FromNative ( encoding , pNativeData ) ;
116
+ return LaxUtf8Marshaler . FromNative ( pNativeData ) ;
134
117
}
135
118
136
- public static FilePath FromBuffer ( byte [ ] buffer )
119
+ public new static FilePath FromBuffer ( byte [ ] buffer )
137
120
{
138
- return FromBuffer ( encoding , buffer ) ;
121
+ return LaxUtf8Marshaler . FromBuffer ( buffer ) ;
139
122
}
140
123
}
141
124
}
0 commit comments