Don't you like advertising? Neither do I...

...but CoolSoft is free, supported only by donations and a few (and non intrusive) banners.

Please add CoolSoft to your whitelist (click here to know how).

Thanks for your support.

 
 

DeCodEx

warning

Warning, JavaScript is disabled!

JavaScript is not available, maybe because you disabled it globally into your browser settings or you are using an addon like NoScript.

We do not have any dangerous JavaScript running here.
Please enable JavaScript; if you're using NoScript this image will help you adding CoolSoft to your whitelist.

Thanks for your comprehension and enjoy CoolSoft.

decodex

DeCodEx stands for Designer Code Extractor.

If you are using the new .NET Framework 2.0, I hope you know about the existance of Partial Types.

Partial types allows you to split the definition and implementation of a class or a struct across multiple files.
You can put one part of a class in one file and another part of the class in a different file by using the new partial keyword

VisualStudio 2005/2008 itself uses partial types to manage Form and UserControl sources, separing Designer code from User code.
This is a better solution, if compared with the old #Region...#End Region used in VisualStudio 2002/2003.

OK, we all agree on this but... have you ever tried to convert a .NET 1.1 project to 2.0?
The conversion usually completes smootly, depending on how well was the old code written (VS2005 is more meticolous regarding type-conversions and Object usage).
Anyway, during the conversion, Forms and UserControls are not splitted to the new (so called) Designer+User format.

Since I was tired having all of my user code mixed with VisualStudio one, I created DeCodEx to split an old-style source file into User+Designer partial files.
Splitting is accomplished by moving regions, fields and methods from the original Form1.vb (or .cs) to the new Form1.Designer.vb (.cs) file.
Moved blocks can be even left commented in the original file (see picture below).

Features

  • given a project file, you can select which Forms /  UserControls will be converted
  • source code is parsed with a compiler-like parser; no Regular Expressions are used to ensure better results
  • VB.NET and C# sources are fully supported
  • C# fields were declared outside the #region; DeCodEx parses those fields type and moves only the ones derived from Control or Component
  • splitting is done in a safe way, no lines were dropped: each original line will appear in Designer or in User file
  • you can set force DeCodEx to leave the orinigal lines as commented in the original source file; a special line comment prefix will be added, allowing you to remove these lines afterward
  • could create a backup of your project before starting conversion
  • detailed activity log and error management
  • can be run outside VisualStudio

Here you can see the result after the splitting (click to see the full image):

DeCodEx code sample
Version history 

ver. 1.1.0 - (22 Feb 2012)

  • NEW: Added support for VS2001 projects. NEW: Added support for multiple classes into the same source file.

ver. 1.0.0 - (12 Jan 2009)

  • FIX:Attributes applied to class level are not duplicated in .designer file anymore. They will appear in user file only (thanks to Steve Schoon).

ver. 0.9.7 - (18 Oct 2008)

  • NEW: While adding project items, DeCodEx tests if file is missing, readonly or the corresponding .designer file already exists; if one of these conditions is true, the item can't be selected and drawn in red. This could help if your sources are coming from SourceSafe (thanks to Paul).
  • NEW: Main dialog now saves its size and position.

ver. 0.9.6 - (21 May 2008)

  • FIX: Fixed a bug reading source files which contain extended ASCII chars, like German umlaute (üöä...) which causes this chars to be replaced by squares (thanks to Petra).

ver. 0.9.5 - (21 Apr 2008)

  • User can now add his own "Windows Form Designer" region names, if its locale is not (still) supported.
    They are loaded from two files (inside bin folder):
    - RegionNames.txt contains "official" localizations and is mantained by CoolSoft; it'll be updated at each new version of DeCodEx; DO NOT EDIT THIS FILE.
    - RegionNames.user.txt contains user customized names and won't be touched by setup procedure.
    Again, please send me your localized names and I'll add them to official ones.

ver. 0.9.4 - (14 Apr 2008)

  • NEW: "Windows Form Designer" region name is localized (still wondering why >:-) ).
    DeCodEx now recognizes this name (and the corresponding UserControl one) in localized version of VisualStudio; currently supported locales are:
    ENG: "Windows Form Designer generated code"
    ITA: "Codice generato da Progettazione Windows Form" (thanks to Paolo)
    Send me region names of your unsupported locale...
  • NEW: Log only supported project items (Forms and UserControls).
  • NEW: Log all movable-types (types that DeCodEx will move to Designer file).
  • FIX: C# form (and user control) constructors are wrongly moved to *.Designer.cs file (thanks to Michael).

ver. 0.9.3 - (28 Feb 2008)

  • NEW: In case of code parsing errors, they are reported into log for further investigation ver. 0.9.2 - (28 Feb 2008)
  • NEW: Argument exception in frmMain.vb:line 83 while parsing project (reported by Dan Sifuentes)

ver. 0.9.1 - (27 Feb 2008)

  • NEW: Menu item to check for new version
  • FIX: Some cosmetic fixes to GUI

ver. 0.9.0 - (01 Feb 2008)

  • First public release

Download

DeCodEx_setup_1.1.0.exe
Release date 2012-Feb-22 Size 465,862 bytes
MD5 362717678c9743f1d11e1a6651ec479e
SHA1 cd34cb6ab6701cfecab5da2db17a29d61b3d39e5
SHA256 ca1d3b4cd555c0ef9b3d6df86d409621eff3cfd12bae0fb041c6704b09f0cd31

Comments

This software is great and has been very helpfull to me. One problem that I stumbled across is that when you have an additional class declared in your form, the designer code has:

Partial Class formClass
    Inherits formBaseClass
End Class
Partial Class secondClassInForm
...

So all of the designer generated code is in the second sub class. The sub class code is also still in the original Form Page so it is repeated twice, so to fix this you only have to delete it in the designer. Not a big issue considering how much time this saves us but I thought you might like to know.

I had backups turned off and had it set to remove code (not comment it out).

Cheers,
Poohshoes

Thank you for this nice prog.

One thing I have found: If you convert a VS10 project and a form uses feature > framework 2.0 like linq the form would not converted. Any chance to get this corrected?

Thank you
Wolfgang

Nice to see that my tool is still used... ;)

Please send me a minimal project (with just one form) that shows the issue and I'll take a look.