Software Customization

Areas that need customization:

Customizing the Application Basics

Create a file custom.cfg:

Company=My Company, Inc.
Copyright=Copyright © 2007, My Company, Inc.
Website=http://www.example.com
Software Caption=Sample Application
Custom Application Caption=Sample Caption
CCny=001
Mutex=ezMyCompanyOneCopy

In the application, load those values:

unit dbmod;
 
interface
  ...
const
  CustomDataFolder = 'data\';
  CustomCfgFile    = 'custom.cfg';
var
  ezAppSettings: TStrings;
  ...
 
procedure TDatamod.DataModuleCreate(Sender: TObject);
begin
  ezAppSettings := TStringList.Create();
 
  ezAppSettings.LoadFromFile(ExtractFilePath(Application.ExeName)+CustomDataFolder+CustomCfgFile);
  lbl_ezCompany           := ezAppSettings.GetValue('Company');
  lbl_ezSoftwareCaption   := ezAppSettings.GetValue('Software Caption');
  lbl_ezCopyright         := ezAppSettings.GetValue('Copyright');
  lbl_ezWebsite           := ezAppSettings.GetValue('Website');
  lbl_ezCustomAppCaption  := ezAppSettings.GetValue('Custom Application Caption');
  lbl_ezCustomCompanyCode := ezAppSettings.GetValue('CCny');
  if trim(lbl_ezCustomCompanyCode) = '' then lbl_ezCustomCompanyCode := '001';
  if length(lbl_ezCustomAppCaption) > 0 then lbl_ezCustomAppCaption := ' - '+lbl_ezCustomAppCaption;
  ...
end;

Encrypting Data

Sometimes customization data needs to be encrypted to avoid third-parties from tapering with it. To encrypt these values, use custom component TEncryptStr.

To decrypt the data so that it is ready for use, use something like this:

procedure TDatamod.ezAppSettingsDecryption(Sender: TObject);
var
  i: integer;
begin
  // decode values just loaded, and store them back into ezAppSettings
  for i:=0 to ezAppSettings.Items.count-1 do begin
    ezAppSettings.Items.ValueFromIndex[i] := EncryptStr1.DecodeVigenere(EncryptStr1.Key, ezAppSettings.GetValueFromIndex(i));
  end;
end;

Customizing the Product List

Create a text file called prodlist.cfg, formatted as:

product name=product code
Intuition 2=prod_Intuition2
Intuition 2FC (Feedback Canceller)=prod_Intuition2FC
Intuition 4=prod_Intuition4
Intuition 4+=prod_Intuition4Plus
Intuition 4AD (Adaptive Directionality)=prod_Intune
Intuition Directional=prod_Intuition4D
Sparo (Open Ear OTE, 4 Channels)=prod_Sparo
Sparo AD (Open Ear OTE, 4 Channels)=prod_SparoAD
Sparo 2  (Open Ear OTE, 2 Channels)=prod_Sparo2
...

A list of product short names is a good idea as well. Create a file prodlist-short.cfg:

Intuition 2=prod_Intuition2
Intuition 2FC=prod_Intuition2FC
Intuition 4=prod_Intuition4
Intuition 4+=prod_Intuition4Plus
Intuition 4AD=prod_Intune
Intuition D=prod_Intuition4D
Sparo=prod_Sparo
Sparo AD=prod_SparoAD
Sparo 2=prod_Sparo2
...

Load the product values in the application:

unit dbmod;
 
interface
  ...
const
  CustomDataFolder       = 'data\';
  CustomProdListFile     = 'prodlist.cfg';
  CustomProdLstShortFile = 'prodlist-short.cfg';
var
  ezProductList : TStrings;
  ...
 
procedure TDatamod.DataModuleCreate(Sender: TObject);
begin
  ezProductList := TStringList.Create();
  ezProductList.LoadFromFile(ExtractFilePath(Application.ExeName)+CustomDataFolder+CustomProdListFile,      // longnames list
                             ExtractFilePath(Application.ExeName)+CustomDataFolder+CustomProdLstShortFile); // shortnames list
end;

Use the product names just by referring to their respective product codes. For example:

procedure TfrmMain.InitialSetup();
begin
  lbl_Intuition_4     := Datamod.ezProductList.GetShortNamefromValue('prod_Intuition4');
  lbl_Intuition_4D    := Datamod.ezProductList.GetShortNamefromValue('prod_Intuition4D');
  lbl_Intuition_4Plus := Datamod.ezProductList.GetShortNamefromValue('prod_Intuition4Plus');
  lbl_Sparo           := Datamod.ezProductList.GetShortNamefromValue('prod_Sparo');
  lbl_Sparo_2         := Datamod.ezProductList.GetShortNamefromValue('prod_Sparo2');
  lbl_Sparo_AD        := Datamod.ezProductList.GetShortNamefromValue('prod_SparoAD');
end;

Customizing the Application Graphics

Customizing the User Documentation

#--------------------------------------------------------------------------
# Custom Configuration files and Custom Variables
# Use variables as usual. For example: @CompanyName or \CompanyName
#--------------------------------------------------------------------------
ALIASES = "CompanyName=ACME, Inc." \
          "CompanyNameShort=ACME" \
          "CompanyWebsite=http://www.acme.com" \
          "CompanyLogoJPG=splash01.jpg" \
          "CompanyLogoEPS=splash01.eps" 
@INCLUDE_PATH = includes
@INCLUDE      = customproj.cfg

Add custom values to a custom configuration file. For example, in customproj.cfg:

#--------------------------------------------------------------------------
# Custom Settings
#--------------------------------------------------------------------------
OUTPUT_DIRECTORY  = customoutput\acme
IMAGE_PATH        = images custom\images
ENABLED_SECTIONS  = StandaloneOnly Acme
HTML_HEADER       = includes\header.html
HTML_FOOTER       = includes\footer.html
CHM_FILE          = UserDoc.CHM
 
#--------------------------------------------------------------------------
# Custom Variables
#--------------------------------------------------------------------------
ALIASES = "CompanyName=ACME 2, Inc." \
          "CompanyNameShort=ACME 2" \
          "CompanyWebsite=http://www.acme2.com" \
          "CompanyLogoJPG=ezfit-splash01-acme2.jpg" \
          "CompanyLogoEPS=ezfit-splash01-acme2.eps"

In file 104-hi-swrequirementmatrix.txt, setup list of custom products for the company:

@if Acme1
  ...
@elseif Acme2
  ...
@endif

Customizing External Utilities