It is going very slowly, because I am focusing more on other activities, but it is making some progress. Before I start describing what I am doing now, I need to explain a little why I am doing it. I have been programming for almost 5 years (it will be exactly that on December 24).
However, about 1.5 years ago I was at absolute rock bottom, because I lost 99% of my source files – in other words, everything I had been working on day and night for 3.5 years. I managed it quite easily – I was writing a program for deleting files and I was so sure it would not delete anything it should not that I ran it and did not check what the program was doing.
Unfortunately, it ended with the entire Projects folder of Visual Studio being deleted. Only 3 programs were outside this folder, so they stayed untouched, but hundreds of other programs were gone in a hundredth of a second. As soon as I found out, I started a recovery using GetDataBack (which I bought specially for this occasion), but it did not turn out well.
More than half of the files were corrupted and full of nonsense. So I quickly wrote a program that was supposed to retrieve the correct files from other projects, and the rest I would simply have to program again or throw away, I told myself.
Over the last few days I have been working on these old programs of mine again.
Sometimes it is interesting to see how much I have matured and how I can replace my own code with better code. In that backup I discovered a folder called Hotovo (“Done”), so I immediately moved it into the Projects folder of Visual Studio 2013, because these programs are already finished, so I will have the least work converting them to WPF and English.
Of course, only if I managed to recover everything correctly. I moved the other programs into the Projects folder of Visual Studio 2005. The last program I converted was Horoscopes, which, as the name suggests, is focused on horoscopes. The final WPF version looks something like this:

Then I was putting things in order in the Project VS2005 folder, because I had lots of duplicate projects there. It was a real pain, because in Total Commander I had to find these duplicate projects, then compare them by content, and if the content differed (which it mostly did), figure out which version was better, less damaged and more polished, and in this way put together the best one from two or more versions.
On top of that, I had to write a program for removing diacritics from the content and/or the file name, because many projects differed only in that. I have not completely finished the Projects VS2005 folder yet, and I hope the other Projects VS folders will be in better shape. Most recently I wrote a program for removing duplicate files. You can see it in this picture:

I did this because I had a lot of duplicate files, and now when I open a project and see that the file is not there, I will know there was nothing special in it and that it only contained what was in my shared files. But above all, I will no longer have to check both sides of the comparison in TC when I delete one or both files.
I have so many duplicated files because back in the days of VS 2005 and even later versions I could not create a shared assembly that I could simply link into every project, the way I do now. The code of the program for this cleanup was simple and looked like this:
private static void DeleteTheSameFiles(string folderWithTemplates, string extensionsDelimitedSemicolon, bool isRecursive, params string[] folderWhereSearch) {
int deletedFilesCount = 0;
//-The key is the path to the Visual Studio folder, the value holds all files in it
Dictionary<string, string[]> filesInFolders = new Dictionary<string, string[]>();
foreach(var item in folderWhereSearch) {
filesInFolders.Add(item, Directory.GetFiles(item, "*.*", SearchOption.AllDirectories));
}
string[] extensions = SH.Split(extensionsDelimitedSemicolon, ';');
foreach(var extension in extensions) {
SearchOption searchOption = SearchOption.TopDirectoryOnly;
if (isRecursive) {
searchOption = SearchOption.AllDirectories;
}
string[] files = Directory.GetFiles(folderWithTemplates, "*" + extension, searchOption);
foreach(var item in files) {
foreach(string folderWithDuplicate in folderWhereSearch) {
if (File.Exists(item)) {
DeleteSameFiles(Path.GetFileName(item), item, folderWithDuplicate, File.ReadAllBytes(item), filesInFolders[folderWithDuplicate], ref deletedFilesCount);
}
}
}
}
}
/// <summary>
/// A1 is here so that I do not delete the original file.
/// </summary>
/// <param name="item">
/// <param name="p1">
/// <param name="p2">
/// <param name="p3">
/// <returns> </returns>
private static void DeleteSameFiles(string fileName, string wholeFileName, string folderWhereSearch, byte[] bytes, string[] files, ref int deletedFilesCount) {
wholeFileName = wholeFileName.ToLower();
foreach(var item in files) {
if (Path.GetFileName(item) == fileName) {
string itemLower = item.ToLower();
if (itemLower != wholeFileName) {
if (File.Exists(item)) {
byte[] otherBytes = File.ReadAllBytes(item);
if (CA.AreTheSame(bytes, otherBytes)) {
deletedFilesCount++;
Console.WriteLine("Deleting file number " + deletedFilesCount + ": " + item);
File.Delete(item);
}
}
}
}
}
}
private static string[] GetAllVisualStudioFolders() {
List<string> vr = new List<string>();
vr.Add(@"C:\Users\Radeksunamo\Documents\Visual Studio 2005");
vr.Add(@"C:\Users\Radeksunamo\Documents\Visual Studio 2008");
vr.Add(@"C:\Users\Radeksunamo\Documents\Visual Studio 2010");
vr.Add(@"C:\Users\Radeksunamo\Documents\Visual Studio 2012");
vr.Add(@"C:\Users\Radeksunamo\Documents\Visual Studio 2013");
return vr.ToArray();
}
DeleteTheSameFiles(@"C:\Users\Radeksunamo\Documents\Visual Studio 2005\rbs", ".cs", true, GetAllVisualStudioFolders());