Cinchoo – TABS to Spaces converter tool

ChoTABSToSpacesConversionTool

Download Binary (Zip)

Download Source (Zip)

This tool converts tab characters to space characters and vice verse in text files. It is written in using WPF/C#/VS.NET 2010.

Features

  • Converts any text files
  • Works with single file as well as files in a folder
  • Number of Tab Size can be customized
  • Runs on Windows 95/98/ME/NT4/2k/2k3/2k8/XP/Vista/7

How to use

  • Click ‘Start’ whenever you are ready to convert files. Any time you can can start this conversion process.
  • Type a full path of the file or folder in ‘Choose a File / Folder’ text box, then click ‘Add’ button to add it to ‘File(s) / Folder(s)’ list box. Or you can click ‘Browse’ button, to choose the file for conversion.
  • At any time, you can select an item in ‘File(s) / Folder(s)’ list box, remove it using ‘Remove’ button.
  • Type a output folder name in ‘Output Folder’ text box. This is where all the converted files will be written. If the folder not exists, will be created automatically.
  • In ‘Valid File Exts’ text box, you can specify the type of files to be considered for conversion. Multiple file extensions can be specified in comma separated format.
  • Choose mode either ‘TAB to spaces’ or ‘Spaces to TAB’ to convert files in respective way.
  • Specify ‘Tab Size’ in the range of 1-60, amount of spaces for a TAB character.
  • In ‘Status’ box, you can view the statues of the file conversion.
  • Click ‘Clear’ button anytime to clear the ‘Status’ box.

Tips

  • You can drag and drop file(s) or folder(s) to this tool for easy conversion process.

Cinchoo – Configuration framework, part 10

Inside Configuration Object Load Events

Download sample source files (Require .NET 4.0 / Visual Studio 2010)

In this section, I’ll go over the details of possible configuration object events you can define and their usage.

Load Events

Following are the events fired while loading  each Configuration object member values from underlying configuration source
  • BeforeConfigurationObjectMemberLoaded – Event fired before each configuration object member loaded.
  • AfterConfigurationObjectMemberLoaded – Event fired after each configuration object member loaded.
  • ConfigurationObjectMemberLoadError – Event fired when configuration object member had some error while loading.
Following are the events fired while loading  Configuration object from underlying configuration source
  • AfterConfigurationObjectLoaded - Event fired when configuration object loaded successfully.
  • ConfigurationObjectLoadError - Event fired when configuration object had some error while loading.

Order of events fired

Below diagram depicts the order of events fired while loading configuration parameters from the sources.

While loading each configuration member value from underlying source, framework fires BeforeConfigurationObjectMemberLoaded event when the configuration member value is different from underlying source value. In there you have chance to do validate, modify, massage the new value or do anything in here.

[ChoBeforeConfigurationObjectMemberLoadedHandler]
void OnBeforeConfigurationObjectMemberLoaded(object sender, ChoPreviewConfigurationObjectMemberEventArgs e)
{
}

Set ChoPreviewConfigurationObjectMemberEventArgs.Cancel to true/false, whether to continue the process of loading the value or not. Default is false.

If the value of ChoPreviewConfigurationObjectMemberEventArgs.Cancel is false, the framework will try to load the ChoPreviewConfigurationObjectMemberEventArgs.State (usually it carries the converted configuration member source value, which you have chance to inspect / modify it in this event handler) to the corresponding configuration object member. ChoPreviewConfigurationObjectMemberEventArgs.OriginalState contains the raw (unconverted) configuration member source value.  ChoPreviewConfigurationObjectMemberEventArgs.MemberName contains the configuration member name.

Then framework will fire AfterConfigurationObjectMemberLoaded event, where you have a chance to perform any post member related operations.

Above steps repeated for each member of the configuration object.

Any error will be captured and reported in the configuration log file. (Will talk about it later.)

Finally framework will fire AfterConfigurationObjectLoaded event after successful loading of configuration object. If for any reason finds any failure or exception during the loading operation, framework will fire ConfigurationObjectLoadError event, where you have chance to perform any recovery steps based on the error/exception.