Changeset 1509


Ignore:
Timestamp:
Apr 12, 2010, 6:24:32 PM (16 years ago)
Author:
John Small
Message:

Ticket 429: Speed up deletion of obsolete FM3.INI state keys and delete
obsolete LastToolbox key.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfgmgr.cmd

    r1504 r1509  
    3030   Change log:
    3131      16 Mar 09 JBS Added code to copy discontinued directory container state ini keys to new names
     32      12 Apr 10 JBS Ticket 429: Speed up the deletion of obsolete state-related FM3.INI keys.
     33      12 Apr 10 JBS Ticket 429: Add code to delete obsolete "LastToolBox" key(s).
    3234
    3335*/
     
    595597        call SysIni cfg.inifile, 'FM/3', 'LastToolbar', LastToolbar
    596598      end
     599   if LastToolbox \= 'ERROR:' then
     600      call SysIni cfg.inifile, 'FM/3', 'LastToolBox', 'DELETE:'
    597601   if SysIni(cfg.inifile, 'FM/3', 'FM2Shutdown.Toolbar') = 'ERROR:' then
    598                 call SysIni cfg.inifile, 'FM/3', 'FM2Shutdown.Toolbar', LastToolbar
     602      call SysIni cfg.inifile, 'FM/3', 'FM2Shutdown.Toolbar', LastToolbar
    599603   if SysIni(cfg.inifile, 'FM/4', 'LastToolbar') = 'ERROR:' then
    600                 call SysIni cfg.inifile, 'FM/4', 'LastToolbar', LastToolbar
     604      call SysIni cfg.inifile, 'FM/4', 'LastToolbar', LastToolbar
     605   if SysIni(cfg.inifile, 'FM/4', 'LastToolbox') \= 'ERROR:' then
     606      call SysIni cfg.inifile, 'FM/4', 'LastToolBox', 'DELETE:'
    601607   do /* Copy old details keys to new names */
    602       /* Check for old/new version numbers first? */
     608      /* Check to see if this has already been done */
     609      DetailsKeysConverted = SysIni(cfg.inifile, 'FM/3', 'DetailsKeysConverted')
    603610      StateNames = SysIni(cfg.inifile, 'FM/3', 'LastSetups')
    604611      KeyFragments = 'Dir Filter Pos Sort View'
     
    610617         if pos('FM2Shutdown' || null, StateNames) = 0 then
    611618            StateNames = StateNames || 'FM2Shutdown' || null
     619      call charout , 'One-time conversion of states to new format...'
    612620      do while StateNames \= ''
    613621         parse var StateNames StateName (null) StateNames
     
    617625               NumDirCnrs = c2d(reverse(NumDirCnrs)) - 1  /* for 0 to num-1 loop */
    618626               do d = 0 to NumDirCnrs
     627                  d2 = NumDirCnrs + 1 - d /* Work from the last to the first */
    619628                  do f = 1 to NumKeyFragments
     629                     call charout , '.'
    620630                     frag = word(KeyFragments, f)
    621                      OldKey = StateName || '.DirCnr' || frag || '.' || d
     631                     OldKey = StateName || '.DirCnr' || frag || '.' || d2
    622632                     OldKeyValue = SysIni(cfg.inifile, 'FM/3', OldKey)
    623                      NewKey = StateName || '.DirCnr.' || d || '.' || frag
    624                      NewKeyValue = SysIni(cfg.inifile, 'FM/3', NewKey)
    625                      if (OldKeyValue \= 'ERROR:' & NewKeyValue = 'ERROR:') then
    626                         rcx = SysIni(cfg.inifile, 'FM/3', NewKey, OldKeyValue)
     633                     if OldKeyValue = 'ERROR:' then
     634                        do
     635                           f = NumKeyFragments  /* Force end of loop for this container */
     636                           d = NumDirCnrs       /* Force end of loop for dir cnrs for this state */
     637                        end
     638                     else
     639                        do
     640                           call SysIni cfg.inifile, 'FM/3', OldKey, 'DELETE:'
     641                           NewKey = StateName || '.DirCnr.' || d || '.' || frag
     642                           call SysIni cfg.inifile, 'FM/3', NewKey, OldKeyValue
     643                        end
    627644                  end
    628645               end
     646               say
    629647            end
    630648      end
Note: See TracChangeset for help on using the changeset viewer.