Reflector to the Rescue

Partho Sarathi

19 Jul, 2010 · 2 minutes read

  • Share:

I was trying to get a list of all un-versioned C# code files in my working copy. Some examples on the internet pointed to Windows Power Shell which is able to pipe the output of one command to another (kind of what we have in linux).

The command was:-

  (svn stat) -match '^\?.*\.cs$'
    

The following command gave a much cleaner output (just the full path of the files)

  (svn stat "--no-ignore") -match '^\?.*\.cs$' -replace '^.\s+',''

The next command deleted those files from the PC.

  (svn stat "--no-ignore") -match '^\?.*\.cs$' -replace '^.\s+','' | rm

I did not pay attention to what the command does and executed it. Net result was that my precious source codes were gone. I looked for the files in the recycle bin. But, being a command line program, it does not seem to use the recycle bin. Then I tried NTFS undelete which is able to restore files that were deleted ‘permanently’ too. What happens is that when you delete a file (SHIFT + DELETE, skipping the recycle bin), windows merely marks the space the file occupied in the disk as free. This is done for performance reasons (a delete operation would take time that is comparable to writing to a file, otherwise).

However, to my dismay, NTFS undelete was unable to find the file. Perhaps it was because of Windows 7 and it’s ways of handling different versions of a file.

It seemed like I would have to re-create the files again. But, then it occurred to me that reflector could come in handy. I had compiled the project previously. So, the debug directory had the compiled assemblies. I used reflector to get the source files back. Although not the exact as the original, the decompiled code was good enough for me to re-create the custom user-control.

  • Share:

The cleanest blogging platform


2024 © Maxotek. All rights reserved.