Link to home
Create AccountLog in
Avatar of PresageSolutions
PresageSolutionsFlag for United States of America

asked on

Certain .cs files in our project have either gone corrupt or have been encrypted. Is there any way to get the code back.

Hello All,

We recently inherited code from a developer who it seems have deliberately corrupted certain cs files in the dotnet project or either has encrypted them.

We are in a big problem as we are not able to run or executed the project in the VS 2005 or create the executable.

Is tehre any way to get code back for a certain .cs file ?

I am attaching one such file.

SInce this is important and urgent i am willing to put a high score for this question if we can get help in time.

Regards,
Nitin K
SetPasswordDialogForm.Designer.c.txt
Avatar of bigbadger1
bigbadger1

If you have a compiled copy of the application you could try decompiling it using "reflector for .NET". http://www.aisto.com/roeder/dotnet/ 
This isn't a perfect solution because it is decompiled code meaning that the compiler can change aspects of the code so they decompile slightly differently but if you have a known set of corrupted files this should get you going. I have used reflector many times to check up on the build manager in my organization to verify that he is compiling the latest revision of the code with all the modifications made. It produces clean c# code and is an indispensable tool.

Oh and go get some version control software SVN, CSV, Visual Source Safe. The cost in time is nothing to the cost of lost code.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of PresageSolutions

ASKER

WHERE CAN I FIND FileDisassembler  ?
Hi PresageSolutions;

Once you have gone to this link:

Lutz Reflector for .NET - To download click on Reflector.zip link
 http://www.aisto.com/roeder/dotnet

You will see the hot link called Add-Ins to the right of the words ".NET Reflector, Version 5.1.2.0, Add-Ins" when you click on Add-Ins it will take you to this web site:
http://www.codeplex.com/reflectoraddins
The fifth add in on the list should be FileDisassembler .

Fernando
Hi I did exactly as you mentioned and i do get a lot of files. But some files i am not able to get back.

Like -

1. In the source directory called SAM there is a file called SetPasswordDialogForm.Designer.cs.
2. but when i disassemble all the dlls that are there in the SAM/Bin/release directory i am not able to get back the SetPasswordDialogForm.Designer.cs file back after the disassembling is complete ?

Can you please help me here ?

Thanks!
Nitin K
It looks like the program load all of the designer code in the .cs file by the same name, in this case SetPasswordDialogForm.cs, as it did in version 1.1 of the .Net Framework.
When I said "This isn't a perfect solution because it is decompiled code meaning that the compiler can change aspects of the code so they decompile slightly differently" this is part of what I was talking about.

Once you have assembled the code, a disassembler no longer has a reference to how the code was originally organized in files the folder structure or the file names is lost. What is retained is the essence of the code, the aspects that made it work.

I'm sorry to say that no disassembler is going to give you back file for file comment for comment the code as it was written. What you should be getting back is code that is functionally identical. It is up to you to work through what was lost and rebuild.
Hi TheLearnedOne;

I have posted links to Reflector and a plug-in and he was able to recover most of the code if not all with a little reconfiguration.

Fernando
PresageSolutions; Can I ask you why you gave a grade of B to the solution of this question? Please note the following from the EE - Help pages
https://www.experts-exchange.com/help.jsp#hi97

What's the right grade to give?


Grade Fairly
 It is your responsibility to manage your questions, and to close them, in due course. That doesn't mean you have to take the first answer that comes along if it doesn't resolve the issue, but it does mean that the Moderators pay attention to people who don't close their questions. The Moderators consider abandoning questions to be an "abuse of the points system" and grounds for suspension.
Grading at Experts Exchange is not like school. It's more like the "10-point Must" system in professional boxing; in other words, an answer is worth an A, unless it doesn't resolve your issue. If it requires you to do a little more research, or figure out one more piece of code, then it's worth a B. If you think it's not worth a B, the custom is to offer the Experts an opportunity to earn a better grade.
When you give a C, it shows up as part of your grading record. If you show a pattern of giving low grades, many Experts will simply avoid your questions. For more information about grading, please see the section regarding Closing Your Questions.  

What is the right grade to give?

Although Experts Exchange uses an A-C scale here at Experts Exchange, it works differently than, say, school grades. If one or more Experts' proposals are accepted as answers, they should usually be given an A or B grade, since they have taken the time to provide you with a working solution. If a possible solution is incomplete, ask for clarification or details before accepting the answer and grading it. People should not be given lower grades because of incorrect grammar or because you just accepted their answer or comment to close the question. The following is a good guideline to follow when grading:

A: The Expert(s) either provided you with a thorough answer or they provided you with a link to information that thoroughly answered your question. An "A" can also be given to any answer that you found informative or enlightening beyond the direct question that you asked.

B: The Expert(s) provided an acceptable solution, or a link to an acceptable solution, that you were able to use, although you may have needed a bit more information to complete the task.

C: Because Experts' reliability is often judged by their grading records, many Experts would like the opportunity to clarify if you have questions about their solutions. If you have given the Expert(s) ample time to respond to your clarification posts and you have responded to each of their posts providing requested information; or if the answers, after clarification, lack finality or do not completely address the issue presented, then a "C" grade is an option. You also have the option here of just asking Community Support to delete the question.

D: This grade can only be given by Moderators and Zone Advisors.  
 
Remember, the Experts helping you today are probably going to be helping you next time you post a question. Give them a fair chance to earn an 'Excellent!' grade and they'll provide you with some amazing support. It's also true that a "C" is the lowest grade you can give, and the Experts know that -- so use it judiciously.
The use of a C in a vindictive manner is likely to be changed by a Moderator. You may not like the answer you get, and in some cases, you may not like the way it is delivered, but if it is deemed to be accurate, no less than a B is an acceptable grade.