@@ -66,7 +66,7 @@ public static string GetSubstringByString(this string a, string b, string c)
66
66
67
67
/// <summary>
68
68
/// Transform a string to it's hexadecimal representation.
69
- /// <para>Obtenir un string dans sa représentation hexadecimale.</para>
69
+ /// <para>Obtenir un string dans sa représentation hexadecimale.</para>
70
70
/// <param name="str">The string to transform.</param>
71
71
/// </summary>
72
72
/// <returns>A string.</returns>
@@ -101,7 +101,7 @@ public static double Eval(this string expression, string filter = null)
101
101
102
102
/// <summary>
103
103
/// Convert a hex-formatted string to byte array.
104
- /// <para>Convertir une représentation hexadécimal en tableau de bytes.</para>
104
+ /// <para>Convertir une représentation hexadécimal en tableau de bytes.</para>
105
105
/// </summary>
106
106
/// <param name="hex">A string looking like "300D06092A864886F70D0101050500".</param>
107
107
/// <returns>A byte array.</returns>
@@ -128,28 +128,24 @@ public static byte[] HexStringToByteArray(this string hex)
128
128
/// </summary>
129
129
/// <param name="report">The Ghidra report as a string</param>
130
130
/// <returns>Byte array constructed from the report</returns>
131
- public static byte [ ] GhidraStrReportToBytes ( string report , int sizeOf = - 1 )
131
+ public static byte [ ] GhidraStrReportToBytes ( string report , int sizeOfOutput = - 1 )
132
132
{
133
133
string [ ] lines = report . Split ( new [ ] { '\n ' , '\r ' } , StringSplitOptions . RemoveEmptyEntries ) ;
134
- byte [ ] byteArray = new byte [ sizeOf == - 1 ? lines . Length : sizeOf ] ;
134
+ byte [ ] byteArray = new byte [ sizeOfOutput <= - 1 ? lines . Length : sizeOfOutput ] ;
135
135
136
136
foreach ( string line in lines )
137
137
{
138
138
Match match = Regex . Match ( line , @"\b([0-9a-fA-F]+)\s+([0-9a-fA-F]{2})\s+.*?\[(\d+)\]" ) ;
139
139
if ( match . Success )
140
- {
141
- string byteHex = match . Groups [ 2 ] . Value ;
142
- int index = int . Parse ( match . Groups [ 3 ] . Value ) ;
143
- byteArray [ index ] = Convert . ToByte ( byteHex , 16 ) ;
144
- }
140
+ byteArray [ int . Parse ( match . Groups [ 3 ] . Value ) ] = Convert . ToByte ( match . Groups [ 2 ] . Value , 16 ) ;
145
141
}
146
142
147
143
return byteArray ;
148
144
}
149
145
150
146
/// <summary>
151
147
/// Verify is the string is in base64 format.
152
- /// <para>Vérifie si un string est en format base64.</para>
148
+ /// <para>Vérifie si un string est en format base64.</para>
153
149
/// </summary>
154
150
/// <param name="base64String">The base64 string.</param>
155
151
/// <returns>A tuple boolean, byte array.</returns>
@@ -193,7 +189,7 @@ public static Stream ToStream(this string str, Encoding encoding = null)
193
189
194
190
/// <summary>
195
191
/// Adds an element to a double string array.
196
- /// <para>Ajoute un élément à une liste double de strings.</para>
192
+ /// <para>Ajoute un élément à une liste double de strings.</para>
197
193
/// </summary>
198
194
/// <param name="original">The original double array.</param>
199
195
/// <param name="bytesToRead">The new array to add.</param>
0 commit comments