@@ -225,7 +225,17 @@ private bool ParseRegistryFile(string filenameText)
225
225
{
226
226
// special case for when the registryLine begins with a @ - make some tweaks and
227
227
// let the regular processing handle the rest.
228
- registryLine = ParseHelper . ProcessRegistryLine ( registryLine ) ;
228
+ if ( registryLine . StartsWith ( "@=-" , StringComparison . InvariantCulture ) )
229
+ {
230
+ // REG file has a callout to delete the @ Value which won't work *but* the Registry Editor will
231
+ // clear the value of the @ Value instead, so it's still a valid line.
232
+ registryLine = registryLine . Replace ( "@=-" , "\" (Default)\" =\" \" " ) ;
233
+ }
234
+ else if ( registryLine . StartsWith ( "@=" , StringComparison . InvariantCulture ) )
235
+ {
236
+ // This is the Value called "(Default)" so we tweak the line for the UX
237
+ registryLine = registryLine . Replace ( "@=" , "\" (Default)\" =" ) ;
238
+ }
229
239
230
240
// continue until we have nothing left to read
231
241
// switch logic, based off what the current line we're reading is
@@ -235,21 +245,21 @@ private bool ParseRegistryFile(string filenameText)
235
245
registryLine = registryLine . Remove ( 1 , 1 ) ;
236
246
237
247
string imageName = DELETEDKEYIMAGE ;
238
- ParseHelper . CheckKeyLineForBrackets ( ref registryLine , ref imageName ) ;
248
+ CheckKeyLineForBrackets ( ref registryLine , ref imageName ) ;
239
249
240
250
// this is a key, so remove the first [ and last ]
241
- registryLine = ParseHelper . StripFirstAndLast ( registryLine ) ;
251
+ registryLine = StripFirstAndLast ( registryLine ) ;
242
252
243
253
// do not track the result of this node, since it should have no children
244
254
AddTextToTree ( registryLine , imageName ) ;
245
255
}
246
256
else if ( registryLine . StartsWith ( '[' ) )
247
257
{
248
258
string imageName = KEYIMAGE ;
249
- ParseHelper . CheckKeyLineForBrackets ( ref registryLine , ref imageName ) ;
259
+ CheckKeyLineForBrackets ( ref registryLine , ref imageName ) ;
250
260
251
261
// this is a key, so remove the first [ and last ]
252
- registryLine = ParseHelper . StripFirstAndLast ( registryLine ) ;
262
+ registryLine = StripFirstAndLast ( registryLine ) ;
253
263
254
264
treeViewNode = AddTextToTree ( registryLine , imageName ) ;
255
265
lastKeyPath = registryLine ;
@@ -260,7 +270,7 @@ private bool ParseRegistryFile(string filenameText)
260
270
registryLine = registryLine . Replace ( "=-" , string . Empty ) ;
261
271
262
272
// remove the "'s without removing all of them
263
- registryLine = ParseHelper . StripFirstAndLast ( registryLine ) ;
273
+ registryLine = StripFirstAndLast ( registryLine ) ;
264
274
265
275
// Create a new listview item that will be used to display the delete value and store it
266
276
registryValue = new RegistryValue ( registryLine , string . Empty , string . Empty , lastKeyPath ) ;
@@ -290,7 +300,7 @@ private bool ParseRegistryFile(string filenameText)
290
300
291
301
// trim the whitespace and quotes from the name
292
302
name = name . Trim ( ) ;
293
- name = ParseHelper . StripFirstAndLast ( name ) ;
303
+ name = StripFirstAndLast ( name ) ;
294
304
295
305
// Clean out any escaped characters in the value, only for the preview
296
306
name = StripEscapedCharacters ( name ) ;
@@ -316,7 +326,7 @@ private bool ParseRegistryFile(string filenameText)
316
326
317
327
if ( value . StartsWith ( '"' ) && value . EndsWith ( '"' ) )
318
328
{
319
- value = ParseHelper . StripFirstAndLast ( value ) ;
329
+ value = StripFirstAndLast ( value ) ;
320
330
}
321
331
else
322
332
{
@@ -957,12 +967,7 @@ private void SaveFile()
957
967
/// </summary>
958
968
private string StripFirstAndLast ( string line )
959
969
{
960
- if ( line . Length > 1 )
961
- {
962
- line = line . Remove ( line . Length - 1 , 1 ) ;
963
- line = line . Remove ( 0 , 1 ) ;
964
- }
965
-
970
+ line = ParseHelper . StripFirstAndLast ( line ) ;
966
971
return line ;
967
972
}
968
973
@@ -1025,6 +1030,14 @@ private void SetValueToolTip(RegistryValue registryValue)
1025
1030
registryValue . ToolTipText = value ;
1026
1031
}
1027
1032
1033
+ /// <summary>
1034
+ /// Checks a Key line for the closing bracket and treat it as an error if it cannot be found
1035
+ /// </summary>
1036
+ private void CheckKeyLineForBrackets ( ref string registryLine , ref string imageName )
1037
+ {
1038
+ ParseHelper . CheckKeyLineForBrackets ( ref registryLine , ref imageName ) ;
1039
+ }
1040
+
1028
1041
/// <summary>
1029
1042
/// Takes a binary registry value, sees if it has a ; and dumps the rest of the line - this does not work for REG_SZ values
1030
1043
/// </summary>
0 commit comments