Monday, October 4, 2010

mail.rul

//===========================================================================
//
//  File Name:    Setup.rul
//
//  Description:  Blank setup main script file
//
//  Comments:     Blank setup is an empty setup project. If you want to
//      create a new project via. step-by step instructions use the
//      Project Assistant.
//
//===========================================================================
// Included header files ----------------------------------------------------
#include "ifx.h"
#include "diskspace.rul"
 #include "addint.rul"
 #include "concatenate.rul"
 #include "createlist.rul" 
  #include "readwritetext.rul"
  #include "listinfo.rul"
        
        
         

 
  
//---------------------------------------------------------------------------                                                                       
// OnFirstUIBefore
//
// First Install UI Sequence - Before Move Data
//
// The OnFirstUIBefore event is called by OnShowUI when the setup is
// running in first install mode. By default this event displays UI allowing
// the end user to specify installation parameters.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIBefore()
    number  nResult, nLevel, nSize, nSetupType,listID, listInfo,nvVar, nSum;
    number nFirst, nSecond;
    string  szTitle, szMsg,sconcat ,szOpt1,sfirststring,ssecondstring, svconcat, szOpt2, szLicenseFile,sthirdstring,szString, svSum;
    string  szName, szCompany, szTargetPath, szDir, szFeatures, szTargetdir;
    BOOL    bLicenseAccepted,bIsEnoughDiskSpace,hMSI,concatenate_example, list_add_example,list_info_example;
begin        
          list_info_example= list_info();  
          
              if(list_info_example) then
             
                 // SdShowInfoList (szTitle, szMsg, listInfo);
                 endif;
                      
               list_info();
               readandwrite();
               readline();
               nFirst=2;
               nSecond=3;
               nSum = Addint(nFirst, nSecond);
               NumToStr ( svSum, nSum );
               MessageBox(svSum, INFORMATION);
            
        ////concatenate///
              sfirststring="hello";
             ssecondstring="Everybody";
            sconcat=concatenate(sfirststring,ssecondstring);
           
             //NumToStr( svconcat, sconcat);
             MessageBox(sconcat, INFORMATION);
      list_add_example= ListAddStrings();
      if( list_add_example) then
       szString = "Keyboard";
        MessageBox (szString, INFORMATION);
        endif;
    
  
    
  
   
   // prototype BOOL ExFn_GetSystemInfo(hMSI);
   //Add_to_int=Add_to_integer();
  //if(Add_to_int) then
  
   // MessageBox ("sum", INFORMATION);
   //endif;
   bIsEnoughDiskSpace=Get_disk_Space();
 
   if!(bIsEnoughDiskSpace) then 
        MessageBox ("not enough space", SEVERE);
    //abort;
  endif; 
   
    nSetupType = COMPLETE;
    szDir = TARGETDIR;
    szName = "";
    szCompany = "";
    bLicenseAccepted = FALSE;
    // ExFn_GetSystemInfo(hMSI);
// Beginning of UI Sequence
Dlg_Start:
    nResult = 0;
Dlg_SdWelcome:
    szTitle = "";
    szMsg = "";
    //{{IS_SCRIPT_TAG(Dlg_SdWelcome)
    nResult = SdWelcome( szTitle, szMsg );
    //}}IS_SCRIPT_TAG(Dlg_SdWelcome)
    if (nResult = BACK) goto Dlg_Start;
Dlg_SdLicense2:
    szTitle = "";
    szOpt1 = "";
    szOpt2 = "";
    //{{IS_SCRIPT_TAG(License_File_Path)
    szLicenseFile = SUPPORTDIR ^ "License.rtf";
    //}}IS_SCRIPT_TAG(License_File_Path)
    //{{IS_SCRIPT_TAG(Dlg_SdLicense2)
    nResult = SdLicense2Rtf( szTitle, szOpt1, szOpt2, szLicenseFile, bLicenseAccepted );
    //}}IS_SCRIPT_TAG(Dlg_SdLicense2)
    if (nResult = BACK) then
        goto Dlg_SdWelcome;
    else
        bLicenseAccepted = TRUE;
    endif;
Dlg_SdRegisterUser:
    szMsg = "";
    szTitle = "";
    //{{IS_SCRIPT_TAG(Dlg_SdRegisterUser)
    nResult = SdRegisterUser( szTitle, szMsg, szName, szCompany );
    //}}IS_SCRIPT_TAG(Dlg_SdRegisterUser)
    if (nResult = BACK) goto Dlg_SdLicense2;
Dlg_SetupType2:  
    szTitle = "";
    szMsg = "";
    nResult = CUSTOM;
    //{{IS_SCRIPT_TAG(Dlg_SetupType2)
    nResult = SetupType2( szTitle, szMsg, "", nSetupType, 0 );
    //}}IS_SCRIPT_TAG(Dlg_SetupType2)
    if (nResult = BACK) then
        goto Dlg_SdRegisterUser;
    else
        nSetupType = nResult;
        if (nSetupType != CUSTOM) then
            szTargetPath = TARGETDIR;
            nSize = 0;
            FeatureCompareSizeRequired( MEDIA, szTargetPath, nSize );
            if (nSize != 0) then     
                MessageBox( szSdStr_NotEnoughSpace, WARNING );
                goto Dlg_SetupType2;
            endif;
        endif;  
    endif;
Dlg_SdAskDestPath2:
    if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SetupType2;
 szTitle = "";
    szMsg = "";
    if (nSetupType = CUSTOM) then
                //{{IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
  nResult = SdAskDestPath2( szTitle, szMsg, szDir );
                //}}IS_SCRIPT_TAG(Dlg_SdAskDestPath2)
        TARGETDIR = szDir;
    endif;
    if (nResult = BACK) goto Dlg_SetupType2;
Dlg_SdFeatureTree:
    if ((nResult = BACK) && (nSetupType != CUSTOM)) goto Dlg_SdAskDestPath2;
    szTitle = "";
    szMsg = "";
    szTargetdir = TARGETDIR;
    szFeatures = "";
    nLevel = 2;
    if (nSetupType = CUSTOM) then
        //{{IS_SCRIPT_TAG(Dlg_SdFeatureTree)
        nResult = SdFeatureTree( szTitle, szMsg, szTargetdir, szFeatures, nLevel );
        //}}IS_SCRIPT_TAG(Dlg_SdFeatureTree)
        if (nResult = BACK) goto Dlg_SdAskDestPath2; 
    endif;
Dlg_SQLServer:
    nResult = OnSQLServerInitialize( nResult );
    if( nResult = BACK ) goto Dlg_SdFeatureTree;
Dlg_ObjDialogs:
    nResult = ShowObjWizardPages( nResult );
    if (nResult = BACK) goto Dlg_SQLServer;
   
Dlg_SdStartCopy2:
    szTitle = "";
    szMsg = "";
    //{{IS_SCRIPT_TAG(Dlg_SdStartCopy2)
    nResult = SdStartCopy2( szTitle, szMsg );
    //}}IS_SCRIPT_TAG(Dlg_SdStartCopy2)
    if (nResult = BACK) goto Dlg_ObjDialogs;
    // Added in 11.0 - Set appropriate StatusEx static text.
    SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_FIRSTUI ) );

    return 0;
end;
//---------------------------------------------------------------------------
// OnMaintUIBefore
//
// Maintenance UI Sequence - Before Move Data
//
// The OnMaintUIBefore event is called by OnShowUI when the setup is
// running in maintenance mode. By default this event displays UI that
// allows the end user to add or remove features, repair currently
// installed features or uninstall the application.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMaintUIBefore()
    number nResult, nType, nMediaFlags;
    string szTitle, szMsg, szIgnore;
begin

 // nType defaults to MODIFY.
 nType = MODIFY;
    //Initialize SQL
    OnSQLServerInitializeMaint();
// Beginning of UI Sequence
Dlg_Start:
    // Added in Version 9.5 - Support for REMOVEONLY option.
    if( !REMOVEONLY ) then
     // In standard mode show maintenance dialog
     Disable( BACKBUTTON );
     nType = SdWelcomeMaint( szTitle, szMsg, nType );
     Enable( BACKBUTTON );
        nResult = NEXT;
    else
        // Hide the initial progress dialog as otherwise the user can
        // click on it, and hide the MessageBox.
        Disable( DIALOGCACHE );
        // In RemoveOnly mode, set to remove.
        nType = REMOVEALL;
    endif;
 // Show Uninstall Confirmation Dialog
    if ( nType = REMOVEALL ) then
  nResult = MessageBox( SdLoadString( IFX_MAINTUI_MSG ), MB_YESNO );
  if (nResult != IDYES ) then
           
            if( REMOVEONLY ) then
                // In REMOVEONLY mode, abort the setup.
                abort;
            else
                // In non-REMOVEONLY mode, redisplay the previous dialog.
       goto Dlg_Start;
            endif;
  endif;
 endif;
Dlg_SdFeatureTree:
 if ( nType = MODIFY ) then
  szTitle = "";
  szMsg = SdLoadString( SD_STR_COMPONENT_MAINT_MSG );
  nResult = SdFeatureTree( szTitle, szMsg, TARGETDIR, "", -1 );
  if ( nResult = BACK ) goto Dlg_Start;
    endif;
Dlg_ObjDialogs:
    nResult = ShowObjWizardPages( nResult );
    if ( ( nResult = BACK ) && ( nType != MODIFY ) ) goto Dlg_Start;
    if ( ( nResult = BACK ) && ( nType = MODIFY ) ) goto Dlg_SdFeatureTree;
 switch(nType)
        case REMOVEALL:
     
   // Ensure that all previously installed features are removed
   // for media that supports updating.
   MediaGetData( MEDIA, MEDIA_FIELD_MEDIA_FLAGS, nMediaFlags, szIgnore );
  
   if( nMediaFlags & MEDIA_FLAG_UPDATEMODE_SUPPORTED ) then
    FeatureRemoveAllInMediaAndLog();
   else
    FeatureRemoveAllInMedia();
   endif;
            // Added in 11.0 - Set appropriate StatusEx static text.
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REMOVEALL ) );
        case REPAIR:
   
   // Changed for DevStudio 9, Disk1 files are now always updated when installed
   // so when running from ADDREMOVE we need to prevent these files from being
   // updated since this will result in files being updated that are locked by the setup.
   // Updating these files when running from ADDREMOVE should not be needed since updates
   // are not run directly from Add/Remove.
            if( ADDREMOVE ) then
                // Reinstall all previously installed features, except
                // disk1 features.
                FeatureUpdate( "" );
            else
                // Reinstall all previously installed features.
                FeatureReinstall();
            endif;
            // Added in 11.0 - Set appropriate StatusEx static text.
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_REPAIR ) );
        case MODIFY:
           
            // Added in 11.0 - Set appropriate StatusEx static text.
            SetStatusExStaticText( SdLoadString( IDS_IFX_STATUSEX_STATICTEXT_MAINTUI_MODIFY ) );
    endswitch;

end;
//---------------------------------------------------------------------------
// OnFirstUIAfter
//
// First Install UI Sequence - After Move Data
//
// The OnFirstUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in first install mode. By default
// this event displays UI that informs the end user that the setup has been
// completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnFirstUIAfter()
    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
    NUMBER bvOpt1, bvOpt2;
 NUMBER bShowUpdateServiceDlg;
begin
    ShowObjWizardPages(NEXT);
   
    szTitle = "";
    szMsg1 = "";
    szMsg2 = "";
    szOpt1 = "";
    szOpt2 = "";
 bvOpt1   = FALSE;
    bvOpt2   = FALSE;   
 // Set this to true if you have the update service enabled, and if you want to check for updates.
 // Note: the ISUS Starter Edition does not support checking for updates programatically.  So,
 // only set this to true if you have at least the ISUS Professional Edition.
 bShowUpdateServiceDlg = FALSE;
   
    //{{IS_SCRIPT_TAG(Dlg_SdDinishEx)
   
    if ( BATCH_INSTALL ) then
     SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
    else
 
  // If the update service is enabled, show finish dialog that includes
  // update check option.
  if( bShowUpdateServiceDlg && ( ENABLED_ISERVICES & SERVICE_ISUPDATE ) ) then
   if( SdFinishUpdateEx( szTitle, szMsg1, szMsg2, szOpt1, szOpt2, TRUE ) ) then
    // Don't check for updates in silent mode.
    if( MODE != SILENTMODE ) then
     UpdateServiceCheckForUpdates( "", FALSE );
    endif;
   endif;
  else
   SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
  endif;
    endif;
    //}}IS_SCRIPT_TAG(Dlg_SdDinishEx)
end;
//---------------------------------------------------------------------------
// OnMaintUIAfter
//
// The OnMaintUIAfter event called by OnShowUI after the file transfer
// of the setup when the setup is running in maintenance mode. By default
// this event displays UI that informs the end user that the maintenance setup
// has been completed successfully.
//
// Note: This event will not be called automatically in a
// program...endprogram style setup.
//---------------------------------------------------------------------------
function OnMaintUIAfter()
    STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
    NUMBER bvOpt1, bvOpt2;
begin
    ShowObjWizardPages(NEXT);
   
    // Added - Version 9.5 - Use appropriate strings for complete
    // uninstall.
    if( REMOVEALLMODE ) then
        szTitle = SdLoadString(IFX_SDFINISH_REMOVE_TITLE);
        szMsg1  = SdLoadString(IFX_SDFINISH_REMOVE_MSG1);
    else
        szTitle = SdLoadString(IFX_SDFINISH_MAINT_TITLE);   
        szMsg1  = SdLoadString(IFX_SDFINISH_MAINT_MSG1);
    endif;
 szMsg2 = "";   
    szOpt1 = "";
    szOpt2 = "";
 bvOpt1   = FALSE;
    bvOpt2   = FALSE;   
    if ( BATCH_INSTALL ) then
     SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
    else   
        SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bvOpt1 , bvOpt2 );
    endif;
end;

No comments:

Post a Comment