File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ class TH155Addr
28
28
[ DllImport ( "TH155Addr.dll" , EntryPoint = "TH155AddrGetState" ) ]
29
29
public static extern int TH155AddrGetState ( ) ;
30
30
[ DllImport ( "TH155Addr.dll" , EntryPoint = "TH155GetRTChildStr" ) ]
31
- public static extern int TH155GetRTChildStr ( string param , [ Out , MarshalAs ( UnmanagedType . LPStr ) ] StringBuilder result ) ;
31
+ public static extern int TH155GetRTChildStr ( string param , byte [ ] buffer ) ; //[ Out, MarshalAs(UnmanagedType.LPStr)]
32
32
33
33
[ DllImport ( "TH155Addr.dll" , EntryPoint = "TH155EnumRTCHild" ) ]
34
34
public static extern int TH155EnumRTCHild ( ) ;
@@ -56,9 +56,15 @@ class TH155Addr
56
56
57
57
public static string TH155GetRTChildStr ( string param )
58
58
{
59
- StringBuilder result = new StringBuilder ( 256 ) ;
60
- TH155GetRTChildStr ( param , result ) ;
61
- return result . ToString ( ) ;
59
+ byte [ ] buffer = new byte [ 256 ] ;
60
+ TH155GetRTChildStr ( param , buffer ) ;
61
+ int i ;
62
+ for ( i = 0 ; i < 256 ; i ++ )
63
+ {
64
+ if ( buffer [ i ] == '\0 ' )
65
+ break ;
66
+ }
67
+ return Encoding . GetEncoding ( "Shift_JIS" ) . GetString ( buffer . Take ( i ) . ToArray ( ) ) ;
62
68
}
63
69
64
70
}
You can’t perform that action at this time.
0 commit comments