Update Rails version in railsinstaller.iss.

; RailsInstaller - InnoSetup Script
; Adaptation from RubyInstaller installer script
;

; PRE-CHECK
; Verify that RubyPath is defined by ISCC using
; /d command line arguments.
;
; Usage:
;  iscc rubyinstaller.iss /dInstallerVersion=0.1.0
;                         /dStagePath=stage
;                         /dRubyPath=Ruby/1.9.2
;                         [/dInstVersion=26-OCT-2009]

; Full example:
; iscc resouces\railsinstaller\railsinstaller.iss \
;       /dInstallerVersion=2.1.0 \
;       /dStagePath=stage \
;       /dRubyPath=Ruby1.9.2 \
;       /opkg
;       /frailsinstaller-2.1.0.exe

#if Defined(InstallerVersion) == 0
  #error Please provide a InstallerVersion definition using a /d parameter.
#endif

#if Defined(StagePath) == 0
  #error Please provide a StagePath value to the Ruby files using a /d parameter.
#endif

#if Defined(RubyPath) == 0
  #error Please provide a RubyPath value to the Ruby files using a /d parameter.
#else
  #if FileExists(StagePath + '/' + RubyPath + '\bin\ruby.exe') == 0
    #error No Ruby installation (bin\ruby.exe) found inside defined RubyPath. Please verify.
  #endif
#endif

#if Defined(InstVersion) == 0
  #define InstVersion GetDateTimeString('dd-mmm-yy"T"hhnn', '', '')
#endif

; Build Installer details using above values
#define InstallerName "RailsInstaller"
#define InstallerNameWithVersion InstallerName + " " + InstallerVersion
#define InstallerPublisher "RailsInstaller Team"
#define InstallerHomepage "http://www.railsinstaller.org/"

#define CurrentYear GetDateTimeString('yyyy', '', '')

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications!
AppId={{613C3EA5-1248-4E35-B61A-6D0B31BBC0DB}
AppName={#InstallerName}
AppVerName={#InstallerNameWithVersion}
AppPublisher={#InstallerPublisher}
AppPublisherURL={#InstallerHomepage}
AppVersion={#InstallerVersion}
DefaultGroupName={#InstallerName}
DefaultDirName={sd}\RailsInstaller
DisableProgramGroupPage=true
LicenseFile=LICENSE.txt
Compression=lzma2/ultra64
SolidCompression=true
AlwaysShowComponentsList=false
DisableReadyPage=true
InternalCompressLevel=ultra64
VersionInfoCompany={#InstallerPublisher}
VersionInfoCopyright=(c) {#CurrentYear} {#InstallerPublisher}
VersionInfoDescription=Rails development environment installer for Windows
VersionInfoTextVersion={#InstallerVersion}
VersionInfoVersion={#InstallerVersion}
UninstallDisplayIcon={app}\bin\ruby.exe
WizardImageFile={#ResourcesPath}\images\RailsInstallerWizardImage.bmp
WizardSmallImageFile={#ResourcesPath}\images\RailsInstallerWizardImageSmall.bmp
PrivilegesRequired=lowest
ChangesAssociations=yes
ChangesEnvironment=yes

#if Defined(SignPackage) == 1
SignTool=risigntool sign /a /d $q{#InstallerNameWithVersion}$q /du $q{#InstallerHomepage}$q /t $qhttp://timestamp.comodoca.com/authenticode$q $f
#endif

[Languages]
Name: en; MessagesFile: compiler:Default.isl

[Messages]
en.InstallingLabel=Installing [name], this will take a few minutes...
en.WelcomeLabel1=Welcome to [name]!
en.WelcomeLabel2=This will install [name/ver] on your computer which includes Ruby 1.9.3, Rails 3.2.19, Git, Sqlite3, DevKit, and TinyTDS with FreeTDS.  Please close any console applications before continuing.
en.WizardLicense={#InstallerName} License Agreement
en.LicenseLabel=
en.LicenseLabel3=Please read the following License Agreements and accept the terms before continuing the installation.
en.LicenseAccepted=I &accept all of the Licenses
en.LicenseNotAccepted=I &decline any of the Licenses
en.WizardSelectDir=Installation Destination and Optional Tasks
en.SelectDirDesc=This is the location that Ruby, DevKit, Git, Rails and Sqlite will be installed to.
en.SelectDirLabel3=[name] will be installed into the following folder. Click Install to continue or click Browse to use a different one.
en.SelectDirBrowseLabel=Please avoid any folder name that contains spaces (e.g. Program Files).
en.DiskSpaceMBLabel=Required free disk space: ~[mb] MB

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: {#StagePath}\{#RubyPath}\*; DestDir: {app}\{#RubyPath}; Excludes: "devkit.*, operating_system.*"; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\Git\*; DestDir: {app}\Git; Check: InstallGit; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\DevKit\*; DestDir: {app}\DevKit; Excludes: "config.yml"; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\DevKit\config.yml; DestDir: {app}\DevKit; AfterInstall: UpdateDevKitConfig('{app}\{#RubyPath}', '{app}\DevKit\config.yml')
Source: {#StagePath}\Sites\*; DestDir: {sd}\Sites; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\scripts\*; DestDir: {app}\scripts; Flags: recursesubdirs createallsubdirs
; TODO: Instead of running the full vcredist, simply extract and bundle the dll
;       files with an associated manifest.
; Source: {#StagePath}\pkg\vcredist_x86.exe; DestDir: {tmp}; Flags: deleteafterinstall
Source: setup_environment.bat; DestDir: {app}\{#RubyPath}

[Registry]
; FIXME: Proper registry keys for RailsInstaller (admin)
;Root: HKLM; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdmin

; FIXME: Proper registry key for RailsInstaller (user)
;Root: HKCU; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsNotAdmin

[Icons]
Name: {group}\Interactive Ruby; Filename: {app}\{#RubyPath}\bin\irb.bat; WorkingDir: {app}\{#RubyPath} ; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists
Name: {group}\RubyGems Documentation Server; Filename: {app}\{#RubyPath}\bin\gem.bat; Parameters: server; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists runminimized
Name: {group}\Command Prompt with Ruby and Rails; Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; IconFilename: {sys}\cmd.exe; Flags: createonlyiffileexists
Name: {group}\Git Bash; Filename: {sys}\cmd.exe; Parameters: "/c """"{app}\Git\bin\sh.exe"" --login -i"""; WorkingDir: {sd}\Sites; IconFilename: {app}\Git\etc\git.ico; Check: InstallGit; Flags: createonlyiffileexists
; {%HOMEPATH%}
Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe}

[Run]
Filename: "{app}\{#RubyPath}\bin\ruby.exe"; Parameters: "dk.rb install --force"; WorkingDir: "{app}\DevKit"; Flags: runhidden
Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; Description: "Configure git and ssh when installation has completed."; Check: InstallGit; Flags: postinstall nowait skipifsilent

; TODO: Instead of running the full vcredist, simply extract and bundle the dll
;       files with an associated manifest.
; Filename: "{tmp}\vcredist_x86.exe"; StatusMsg: "Installing Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)..." ; Parameters: "/q"; WorkingDir: "{tmp}"; Flags: runhidden

[Code]
#include "util.iss"
#include "railsinstaller_gui.iss"

function GetInstallDate(Param: String): String;
begin
  Result := GetDateTimeString('yyyymmdd', #0 , #0);
end;

procedure CurStepChanged(const CurStep: TSetupStep);
begin

  // TODO move into ssPostInstall just after install completes?
  if CurStep = ssInstall then
  begin
    if UsingWinNT then
    begin
      Log(Format('Selected Tasks - Path: %d', [PathChkBox.State]));

      if IsModifyPath then
        ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']);
		if InstallGit then
			ModifyPath([ExpandConstant('{app}') + '\Git\cmd']);

    end else
      MsgBox('Looks like you''ve got on older, unsupported Windows version.' #13 +
             'Proceeding with a reduced feature set installation.',
             mbInformation, MB_OK);
  end;
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  {* store install choices so we can use during uninstall *}
  if IsModifyPath then
    SetPreviousData(PreviousDataKey, 'PathModified', 'yes');
  if InstallGit then
	SetPreviousData(PreviousDataKey, 'GitInstalled', 'yes');

  SetPreviousData(PreviousDataKey, 'RailsInstallerId', '{#InstallerVersion}');
end;

procedure CurUninstallStepChanged(const CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    if UsingWinNT then
    begin
      if GetPreviousData('PathModified', 'no') = 'yes' then
	    begin
        ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']);
	    if GetPreviousData('GitInstalled', 'no') = 'yes' then
		  ModifyPath([ExpandConstant('{app}') + '\Git\cmd']);
		end
    end;
  end;
end;

procedure UpdateDevKitConfig(RubyPath: string; FileName: string);
var
  S: String;
begin
  // Make YAML happy :-)
  S := ExpandConstant(RubyPath);
  StringChangeEx(S, '\', '/', True);

  // Update DevKit config.yml with the installation path
  SaveStringToFile(ExpandConstant(FileName), '- ' + S, False);
end;

; RailsInstaller - InnoSetup Script
; Adaptation from RubyInstaller installer script
;

; PRE-CHECK
; Verify that RubyPath is defined by ISCC using
; /d command line arguments.
;
; Usage:
;  iscc rubyinstaller.iss /dInstallerVersion=0.1.0
;                         /dStagePath=stage
;                         /dRubyPath=Ruby/1.9.2
;                         [/dInstVersion=26-OCT-2009]

; Full example:
; iscc resouces\railsinstaller\railsinstaller.iss \
;       /dInstallerVersion=2.1.0 \
;       /dStagePath=stage \
;       /dRubyPath=Ruby1.9.2 \
;       /opkg
;       /frailsinstaller-2.1.0.exe

#if Defined(InstallerVersion) == 0
  #error Please provide a InstallerVersion definition using a /d parameter.
#endif

#if Defined(StagePath) == 0
  #error Please provide a StagePath value to the Ruby files using a /d parameter.
#endif

#if Defined(RubyPath) == 0
  #error Please provide a RubyPath value to the Ruby files using a /d parameter.
#else
  #if FileExists(StagePath + '/' + RubyPath + '\bin\ruby.exe') == 0
    #error No Ruby installation (bin\ruby.exe) found inside defined RubyPath. Please verify.
  #endif
#endif

#if Defined(InstVersion) == 0
  #define InstVersion GetDateTimeString('dd-mmm-yy"T"hhnn', '', '')
#endif

; Build Installer details using above values
#define InstallerName "RailsInstaller"
#define InstallerNameWithVersion InstallerName + " " + InstallerVersion
#define InstallerPublisher "RailsInstaller Team"
#define InstallerHomepage "http://www.railsinstaller.org/"

#define CurrentYear GetDateTimeString('yyyy', '', '')

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications!
AppId={{613C3EA5-1248-4E35-B61A-6D0B31BBC0DB}
AppName={#InstallerName}
AppVerName={#InstallerNameWithVersion}
AppPublisher={#InstallerPublisher}
AppPublisherURL={#InstallerHomepage}
AppVersion={#InstallerVersion}
DefaultGroupName={#InstallerName}
DefaultDirName={sd}\RailsInstaller
DisableProgramGroupPage=true
LicenseFile=LICENSE.txt
Compression=lzma2/ultra64
SolidCompression=true
AlwaysShowComponentsList=false
DisableReadyPage=true
InternalCompressLevel=ultra64
VersionInfoCompany={#InstallerPublisher}
VersionInfoCopyright=(c) {#CurrentYear} {#InstallerPublisher}
VersionInfoDescription=Rails development environment installer for Windows
VersionInfoTextVersion={#InstallerVersion}
VersionInfoVersion={#InstallerVersion}
UninstallDisplayIcon={app}\bin\ruby.exe
WizardImageFile={#ResourcesPath}\images\RailsInstallerWizardImage.bmp
WizardSmallImageFile={#ResourcesPath}\images\RailsInstallerWizardImageSmall.bmp
PrivilegesRequired=lowest
ChangesAssociations=yes
ChangesEnvironment=yes

#if Defined(SignPackage) == 1
SignTool=risigntool sign /a /d $q{#InstallerNameWithVersion}$q /du $q{#InstallerHomepage}$q /t $qhttp://timestamp.comodoca.com/authenticode$q $f
#endif

[Languages]
Name: en; MessagesFile: compiler:Default.isl

[Messages]
en.InstallingLabel=Installing [name], this will take a few minutes...
en.WelcomeLabel1=Welcome to [name]!
en.WelcomeLabel2=This will install [name/ver] on your computer which includes Ruby 1.9.3, Rails 3.2.18, Git, Sqlite3, DevKit, and TinyTDS with FreeTDS.  Please close any console applications before continuing.
en.WizardLicense={#InstallerName} License Agreement
en.LicenseLabel=
en.LicenseLabel3=Please read the following License Agreements and accept the terms before continuing the installation.
en.LicenseAccepted=I &accept all of the Licenses
en.LicenseNotAccepted=I &decline any of the Licenses
en.WizardSelectDir=Installation Destination and Optional Tasks
en.SelectDirDesc=This is the location that Ruby, DevKit, Git, Rails and Sqlite will be installed to.
en.SelectDirLabel3=[name] will be installed into the following folder. Click Install to continue or click Browse to use a different one.
en.SelectDirBrowseLabel=Please avoid any folder name that contains spaces (e.g. Program Files).
en.DiskSpaceMBLabel=Required free disk space: ~[mb] MB

[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: {#StagePath}\{#RubyPath}\*; DestDir: {app}\{#RubyPath}; Excludes: "devkit.*, operating_system.*"; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\Git\*; DestDir: {app}\Git; Check: InstallGit; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\DevKit\*; DestDir: {app}\DevKit; Excludes: "config.yml"; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\DevKit\config.yml; DestDir: {app}\DevKit; AfterInstall: UpdateDevKitConfig('{app}\{#RubyPath}', '{app}\DevKit\config.yml')
Source: {#StagePath}\Sites\*; DestDir: {sd}\Sites; Flags: recursesubdirs createallsubdirs
Source: {#StagePath}\scripts\*; DestDir: {app}\scripts; Flags: recursesubdirs createallsubdirs
; TODO: Instead of running the full vcredist, simply extract and bundle the dll
;       files with an associated manifest.
; Source: {#StagePath}\pkg\vcredist_x86.exe; DestDir: {tmp}; Flags: deleteafterinstall
Source: setup_environment.bat; DestDir: {app}\{#RubyPath}

[Registry]
; FIXME: Proper registry keys for RailsInstaller (admin)
;Root: HKLM; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdmin

; FIXME: Proper registry key for RailsInstaller (user)
;Root: HKCU; Subkey: Software\RailsInstaller; ValueType: string; ValueName: ; ValueData: ; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsNotAdmin

[Icons]
Name: {group}\Interactive Ruby; Filename: {app}\{#RubyPath}\bin\irb.bat; WorkingDir: {app}\{#RubyPath} ; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists
Name: {group}\RubyGems Documentation Server; Filename: {app}\{#RubyPath}\bin\gem.bat; Parameters: server; IconFilename: {app}\{#RubyPath}\bin\ruby.exe; Flags: createonlyiffileexists runminimized
Name: {group}\Command Prompt with Ruby and Rails; Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; IconFilename: {sys}\cmd.exe; Flags: createonlyiffileexists
Name: {group}\Git Bash; Filename: {sys}\cmd.exe; Parameters: "/c """"{app}\Git\bin\sh.exe"" --login -i"""; WorkingDir: {sd}\Sites; IconFilename: {app}\Git\etc\git.ico; Check: InstallGit; Flags: createonlyiffileexists
; {%HOMEPATH%}
Name: {group}\{cm:UninstallProgram,{#InstallerName}}; Filename: {uninstallexe}

[Run]
Filename: "{app}\{#RubyPath}\bin\ruby.exe"; Parameters: "dk.rb install --force"; WorkingDir: "{app}\DevKit"; Flags: runhidden
Filename: {sys}\cmd.exe; Parameters: /E:ON /K {app}\{#RubyPath}\setup_environment.bat {app}; WorkingDir: {sd}\Sites; Description: "Configure git and ssh when installation has completed."; Check: InstallGit; Flags: postinstall nowait skipifsilent

; TODO: Instead of running the full vcredist, simply extract and bundle the dll
;       files with an associated manifest.
; Filename: "{tmp}\vcredist_x86.exe"; StatusMsg: "Installing Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)..." ; Parameters: "/q"; WorkingDir: "{tmp}"; Flags: runhidden

[Code]
#include "util.iss"
#include "railsinstaller_gui.iss"

function GetInstallDate(Param: String): String;
begin
  Result := GetDateTimeString('yyyymmdd', #0 , #0);
end;

procedure CurStepChanged(const CurStep: TSetupStep);
begin

  // TODO move into ssPostInstall just after install completes?
  if CurStep = ssInstall then
  begin
    if UsingWinNT then
    begin
      Log(Format('Selected Tasks - Path: %d', [PathChkBox.State]));

      if IsModifyPath then
        ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']);
		if InstallGit then
			ModifyPath([ExpandConstant('{app}') + '\Git\cmd']);

    end else
      MsgBox('Looks like you''ve got on older, unsupported Windows version.' #13 +
             'Proceeding with a reduced feature set installation.',
             mbInformation, MB_OK);
  end;
end;

procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
  {* store install choices so we can use during uninstall *}
  if IsModifyPath then
    SetPreviousData(PreviousDataKey, 'PathModified', 'yes');
  if InstallGit then
	SetPreviousData(PreviousDataKey, 'GitInstalled', 'yes');

  SetPreviousData(PreviousDataKey, 'RailsInstallerId', '{#InstallerVersion}');
end;

procedure CurUninstallStepChanged(const CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    if UsingWinNT then
    begin
      if GetPreviousData('PathModified', 'no') = 'yes' then
	    begin
        ModifyPath([ExpandConstant('{app}') + '\{#RubyPath}\bin']);
	    if GetPreviousData('GitInstalled', 'no') = 'yes' then
		  ModifyPath([ExpandConstant('{app}') + '\Git\cmd']);
		end
    end;
  end;
end;

procedure UpdateDevKitConfig(RubyPath: string; FileName: string);
var
  S: String;
begin
  // Make YAML happy :-)
  S := ExpandConstant(RubyPath);
  StringChangeEx(S, '\', '/', True);

  // Update DevKit config.yml with the installation path
  SaveStringToFile(ExpandConstant(FileName), '- ' + S, False);
end;


Update dotnetfx40full.iss

Update dotnetfx40full.iss

// requires Windows 7, Windows 7 Service Pack 1, Windows Server 2003 Service Pack 2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2008 R2 SP1, Windows Vista Service Pack 1, Windows XP Service Pack 3
// requires Windows Installer 3.1
// requires Internet Explorer 5.01
// WARNING: express setup (downloads and installs the components depending on your OS) if you want to deploy it on cd or network download the full bootsrapper on website below
// http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992

[CustomMessages]
dotnetfx40full_title=.NET Framework 4.0 Full

dotnetfx40full_size=3 MB - 197 MB

;http://www.microsoft.com/globaldev/reference/lcid-all.mspx
en.dotnetfx40full_lcid=1033
de.dotnetfx40full_lcid=1031
es.dotnetfx40full_lcid=3082

[Code]
const
	dotnetfx40full_url = 'http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe';

procedure dotnetfx40full();
begin
	if (not netfxinstalled(NetFx40Full, '')) then
		AddProduct('dotNetFx40_Full_setup.exe',
			CustomMessage('dotnetfx40full_lcid') + ' /q /passive /norestart',
			CustomMessage('dotnetfx40full_title'),
			CustomMessage('dotnetfx40full_size'),
			dotnetfx40full_url,
			false, false);
end;

// requires Windows 7, Windows 7 Service Pack 1, Windows Server 2003 Service Pack 2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2008 R2 SP1, Windows Vista Service Pack 1, Windows XP Service Pack 3
// requires Windows Installer 3.1
// requires Internet Explorer 5.01
// WARNING: express setup (downloads and installs the components depending on your OS) if you want to deploy it on cd or network download the full bootsrapper on website below
// http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9cfb2d51-5ff4-4491-b0e5-b386f32c0992

[CustomMessages]
dotnetfx40full_title=.NET Framework 4.0 Full

dotnetfx40full_size=3 MB - 197 MB
es.dotnetfx40full_size=3 MB - 197 MB

;http://www.microsoft.com/globaldev/reference/lcid-all.mspx
en.dotnetfx40full_lcid=1033
de.dotnetfx40full_lcid=1031
es.dotnetfx40full_lcid=3082

[Code]
const
	dotnetfx40full_url = 'http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe';

procedure dotnetfx40full();
begin
	if (not netfxinstalled(NetFx40Full, '')) then
		AddProduct('dotNetFx40_Full_setup.exe',
			CustomMessage('dotnetfx40full_lcid') + ' /q /passive /norestart',
			CustomMessage('dotnetfx40full_title'),
			CustomMessage('dotnetfx40full_size'),
			dotnetfx40full_url,
			false, false);
end;


Remove source from the installer

Remove source from the installer

Now that the git repository is publically available the installer isn't
the optimal way to distribute the source.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define VCREDIST GetEnv("VS100COMNTOOLS") + "..\..\VC\redist"
[Setup]
AppName=Address Space Monitor
AppVerName=Address Space Monitor 0.7a
AppPublisher=Charles Bailey
AppCopyright=Copyright (c) 2007-2010 Charles Bailey
AppPublisherURL=http://www.hashpling.org
AppSupportURL=http://www.hashpling.org/asm/
AppUpdatesURL=http://www.hashpling.org/asm/
DefaultDirName={pf}\memmon
DefaultGroupName=Address Space Monitor
OutputBaseFilename=asmsetup-0_7
OutputDir=installer
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none
ArchitecturesInstallIn64BitMode=x64
LicenseFile=licence.txt
VersionInfoVersion=0.7.0.0

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Types]
Name: full; Description: "Install win32 and x64 versions"; Check: Is64BitInstallMode
Name: t64bitonly; Description: "Install x64 version"; Check: Is64BitInstallMode
Name: t32bitonly; Description: "Install win32 version"
Name: custom; Description: "Custom"; Flags: iscustom

[Components]
Name: "common"; Description: "common files"; Types: full t32bitonly t64bitonly custom; Flags: fixed
Name: "c32bitexe"; Description: "win32 program files"; Types: full t32bitonly custom
Name: "c64bitexe"; Description: "x64 program files"; Types: full t64bitonly; Check: Is64BitInstallMode

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "win32\release\joinrec.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\memcat.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\memdiff.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\memmon.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\splitrec.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "{#VCREDIST}\x86\Microsoft.VC100.CRT\msvcp100.dll"; DestDir: "{app}\bin"; Components: c32bitexe
Source: "{#VCREDIST}\x86\Microsoft.VC100.CRT\msvcr100.dll"; DestDir: "{app}\bin"; Components: c32bitexe
Source: "x64\release\joinrec.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\memcat.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\memdiff.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\memmon.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\splitrec.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "{#VCREDIST}\amd64\Microsoft.VC100.CRT\msvcr100.dll"; DestDir: "{app}\bin64"; Components: c64bitexe
Source: "{#VCREDIST}\amd64\Microsoft.VC100.CRT\msvcp100.dll"; DestDir: "{app}\bin64"; Components: c64bitexe
Source: "readme.txt"; DestDir: "{app}"; Flags: isreadme; Components: common
Source: "licence.txt"; DestDir: "{app}"; Components: common
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\Address Space Monitor"; Filename: "{app}\bin\memmon.exe"; Comment: "Run Address Space Monitor"; Components: c32bitexe
Name: "{commondesktop}\Address Space Monitor"; Filename: "{app}\bin\memmon.exe"; Comment: "Run Address Space Monitor"; Tasks: desktopicon; Components: c32bitexe
Name: "{group}\Address Space Monitor (64-bit)"; Filename: "{app}\bin64\memmon.exe"; Comment: "Run Address Space Monitor (64-bit)"; Components: c64bitexe
Name: "{commondesktop}\Address Space Monitor (64-bit)"; Filename: "{app}\bin64\memmon.exe"; Comment: "Run Address Space Monitor (64-bit)"; Tasks: desktopicon; Components: c64bitexe
Name: "{group}\ReadMe"; Filename: "{app}\readme.txt"; Comment: "View the readme file for Address Space Monitor"; Components: common
Name: "{group}\Licence"; Filename: "{app}\licence.txt"; Comment: "View the licence for Address Space Monitor"; Components: common

[InstallDelete]
Type: files; Name: "{app}\bin\Microsoft.VC80.CRT.manifest"
Type: files; Name: "{app}\bin\msvcm80.dll"
Type: files; Name: "{app}\bin\msvcp80.dll"
Type: files; Name: "{app}\bin\msvcr80.dll"
Type: files; Name: "{app}\bin64\Microsoft.VC80.CRT.manifest"
Type: files; Name: "{app}\bin64\msvcm80.dll"
Type: files; Name: "{app}\bin64\msvcp80.dll"
Type: files; Name: "{app}\bin64\msvcr80.dll"
Type: files; Name: "{app}\Changelog"
Type: files; Name: "{app}\src\Changelog"
Type: files; Name: "{app}\bin\Microsoft.VC90.CRT.manifest"
Type: files; Name: "{app}\bin\msvcm90.dll"
Type: files; Name: "{app}\bin\msvcp90.dll"
Type: files; Name: "{app}\bin\msvcr90.dll"
Type: files; Name: "{app}\bin64\Microsoft.VC90.CRT.manifest"
Type: files; Name: "{app}\bin64\msvcm90.dll"
Type: files; Name: "{app}\bin64\msvcp90.dll"
Type: files; Name: "{app}\bin64\msvcr90.dll"

[Registry]
Root: HKCU; SubKey: "SOFTWARE\hashpling.org"; Flags: dontcreatekey uninsdeletekeyifempty
Root: HKCU; SubKey: "SOFTWARE\hashpling.org\memmon"; Flags: dontcreatekey uninsdeletekey

;[Run]
;Filename: "{app}\memmon.exe"; Description: "{cm:LaunchProgram,memmon}"; Flags: nowait postinstall skipifsilent

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define VCREDIST GetEnv("VS100COMNTOOLS") + "..\..\VC\redist"
[Setup]
AppName=Address Space Monitor
AppVerName=Address Space Monitor 0.7a
AppPublisher=Charles Bailey
AppCopyright=Copyright (c) 2007-2010 Charles Bailey
AppPublisherURL=http://www.hashpling.org
AppSupportURL=http://www.hashpling.org/asm/
AppUpdatesURL=http://www.hashpling.org/asm/
DefaultDirName={pf}\memmon
DefaultGroupName=Address Space Monitor
OutputBaseFilename=asmsetup-0_7
OutputDir=installer
Compression=lzma
SolidCompression=yes
PrivilegesRequired=none
ArchitecturesInstallIn64BitMode=x64
LicenseFile=licence.txt
VersionInfoVersion=0.7.0.0

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Types]
Name: full; Description: "Install win32 and x64 versions"; Check: Is64BitInstallMode
Name: t64bitonly; Description: "Install x64 version"; Check: Is64BitInstallMode
Name: t32bitonly; Description: "Install win32 version"
Name: custom; Description: "Custom"; Flags: iscustom

[Components]
Name: "common"; Description: "common files"; Types: full t32bitonly t64bitonly custom; Flags: fixed
Name: "c32bitexe"; Description: "win32 program files"; Types: full t32bitonly custom
Name: "c64bitexe"; Description: "x64 program files"; Types: full t64bitonly; Check: Is64BitInstallMode
Name: "source"; Description: "source files"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "win32\release\joinrec.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\memcat.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\memdiff.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\memmon.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "win32\release\splitrec.exe"; DestDir: "{app}\bin"; Flags: ignoreversion; Components: c32bitexe
Source: "{#VCREDIST}\x86\Microsoft.VC100.CRT\msvcp100.dll"; DestDir: "{app}\bin"; Components: c32bitexe
Source: "{#VCREDIST}\x86\Microsoft.VC100.CRT\msvcr100.dll"; DestDir: "{app}\bin"; Components: c32bitexe
Source: "x64\release\joinrec.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\memcat.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\memdiff.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\memmon.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "x64\release\splitrec.exe"; DestDir: "{app}\bin64"; Flags: ignoreversion; Components: c64bitexe
Source: "{#VCREDIST}\amd64\Microsoft.VC100.CRT\msvcr100.dll"; DestDir: "{app}\bin64"; Components: c64bitexe
Source: "{#VCREDIST}\amd64\Microsoft.VC100.CRT\msvcp100.dll"; DestDir: "{app}\bin64"; Components: c64bitexe
Source: "readme.txt"; DestDir: "{app}"; Flags: isreadme; Components: common
Source: "licence.txt"; DestDir: "{app}"; Components: common
Source: "readme.txt"; DestDir: "{app}\src"; Components: source
Source: "licence.txt"; DestDir: "{app}\src"; Components: source
Source: "memtools.sln"; DestDir: "{app}\src"; Components: source
Source: "memtools.iss"; DestDir: "{app}\src"; Components: source
Source: "no_deprecate.vsprops"; DestDir: "{app}\src"; Components: source
Source: "fmtlib\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\fmtlib"; Components: source
Source: "joinrec\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\joinrec"; Components: source
Source: "memcat\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\memcat"; Components: source
Source: "memdiff\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\memdiff"; Components: source
Source: "memlib\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\memlib"; Components: source
Source: "memmon\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\memmon"; Components: source
Source: "memtest\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\memtest"; Components: source
Source: "splitrec\*"; Excludes: "*.aps,.*,*.user"; DestDir: "{app}\src\splitrec"; Components: source
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\Address Space Monitor"; Filename: "{app}\bin\memmon.exe"; Comment: "Run Address Space Monitor"; Components: c32bitexe
Name: "{commondesktop}\Address Space Monitor"; Filename: "{app}\bin\memmon.exe"; Comment: "Run Address Space Monitor"; Tasks: desktopicon; Components: c32bitexe
Name: "{group}\Address Space Monitor (64-bit)"; Filename: "{app}\bin64\memmon.exe"; Comment: "Run Address Space Monitor (64-bit)"; Components: c64bitexe
Name: "{commondesktop}\Address Space Monitor (64-bit)"; Filename: "{app}\bin64\memmon.exe"; Comment: "Run Address Space Monitor (64-bit)"; Tasks: desktopicon; Components: c64bitexe
Name: "{group}\ReadMe"; Filename: "{app}\readme.txt"; Comment: "View the readme file for Address Space Monitor"; Components: common
Name: "{group}\Licence"; Filename: "{app}\licence.txt"; Comment: "View the licence for Address Space Monitor"; Components: common

[InstallDelete]
Type: files; Name: "{app}\bin\Microsoft.VC80.CRT.manifest"
Type: files; Name: "{app}\bin\msvcm80.dll"
Type: files; Name: "{app}\bin\msvcp80.dll"
Type: files; Name: "{app}\bin\msvcr80.dll"
Type: files; Name: "{app}\bin64\Microsoft.VC80.CRT.manifest"
Type: files; Name: "{app}\bin64\msvcm80.dll"
Type: files; Name: "{app}\bin64\msvcp80.dll"
Type: files; Name: "{app}\bin64\msvcr80.dll"
Type: files; Name: "{app}\Changelog"
Type: files; Name: "{app}\src\Changelog"
Type: files; Name: "{app}\bin\Microsoft.VC90.CRT.manifest"
Type: files; Name: "{app}\bin\msvcm90.dll"
Type: files; Name: "{app}\bin\msvcp90.dll"
Type: files; Name: "{app}\bin\msvcr90.dll"
Type: files; Name: "{app}\bin64\Microsoft.VC90.CRT.manifest"
Type: files; Name: "{app}\bin64\msvcm90.dll"
Type: files; Name: "{app}\bin64\msvcp90.dll"
Type: files; Name: "{app}\bin64\msvcr90.dll"

[Registry]
Root: HKCU; SubKey: "SOFTWARE\hashpling.org"; Flags: dontcreatekey uninsdeletekeyifempty
Root: HKCU; SubKey: "SOFTWARE\hashpling.org\memmon"; Flags: dontcreatekey uninsdeletekey

;[Run]
;Filename: "{app}\memmon.exe"; Description: "{cm:LaunchProgram,memmon}"; Flags: nowait postinstall skipifsilent


Remove large dictonaries

Remove large dictonaries

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Markdown Edit"
#define MyAppVersion "0.2.4"
#define MyAppPublisher "Mike Ward"
#define MyAppURL "http://mike-ward.net/markdownedit"
#define MyAppExeName "mde.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{24E78DF4-D32B-4B48-A58D-84EA579B0E6E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=..\..\LICENSE.txt
OutputBaseFilename=MarkdownEditSetup
SetupIconFile=..\MarkdownEdit\logo.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\MarkdownEdit\bin\Release\mde.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\CommonMark.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\ICSharpCode.AvalonEdit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\MahApps.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\NHunspell.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Hunspellx64.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Hunspellx86.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Google.Apis.Auth.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.Auth.PlatformServices.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.Drive.v2.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.PlatformServices.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\log4net.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Microsoft.Threading.Tasks.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Microsoft.Threading.Tasks.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Microsoft.Threading.Tasks.Extensions.Desktop.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\System.Net.Http.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\System.Net.Http.Primitives.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Zlib.Portable.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\en_us.aff"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\en_us.dic"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Themes\milk-toast.json"; DestDir: "{app}\Themes"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Themes\solarized-light.json"; DestDir: "{app}\Themes"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Themes\solarized-dark.json"; DestDir: "{app}\Themes"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Themes\zenburn.json"; DestDir: "{app}\Themes"; Flags: ignoreversion

Source: "Fonts\OpenSans-Regular.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Regular"; Flags: onlyifdoesntexist uninsneveruninstall;
Source: "Fonts\OpenSans-Bold.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Bold"; Flags: onlyifdoesntexist uninsneveruninstall;
Source: "Fonts\OpenSans-Italic.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Italic"; Flags: onlyifdoesntexist uninsneveruninstall;
Source: "Fonts\OpenSans-BoldItalic.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Bold Italic"; Flags: onlyifdoesntexist uninsneveruninstall;

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Code]
function IsDotNetDetected(): boolean;
var
    key: string;
    release: cardinal;
    success: boolean;
begin
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full';
    success := RegQueryDWordValue(HKLM, key, 'Release', release);
    success := success and (release >= 379893);
    result := success;
end;

function InitializeSetup(): Boolean;
begin
    if not IsDotNetDetected() then begin
        MsgBox('Markdown Edit requires Microsoft .NET 4.5.2'#13#13
               'Download it at http://smallestdotnet.com'#13
               ,mbError, MB_OK);
        result := false;
    end
    else
        result := true;
end;

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Markdown Edit"
#define MyAppVersion "0.2.4"
#define MyAppPublisher "Mike Ward"
#define MyAppURL "http://mike-ward.net/markdownedit"
#define MyAppExeName "mde.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{24E78DF4-D32B-4B48-A58D-84EA579B0E6E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=..\..\LICENSE.txt
OutputBaseFilename=MarkdownEditSetup
SetupIconFile=..\MarkdownEdit\logo.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\MarkdownEdit\bin\Release\mde.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\CommonMark.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\ICSharpCode.AvalonEdit.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\MahApps.Metro.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\NHunspell.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Hunspellx64.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Hunspellx86.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\System.Windows.Interactivity.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Google.Apis.Auth.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.Auth.PlatformServices.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.Core.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.Drive.v2.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Google.Apis.PlatformServices.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\log4net.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Microsoft.Threading.Tasks.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Microsoft.Threading.Tasks.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Microsoft.Threading.Tasks.Extensions.Desktop.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\System.Net.Http.Extensions.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\System.Net.Http.Primitives.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Zlib.Portable.dll"; DestDir: "{app}"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\en_us.aff"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\en_us.dic"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\french.aff"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\french.dic"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\german.aff"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\german.dic"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\italian.aff"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\italian.dic"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\spanish.aff"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\SpellCheck\Dictionaries\spanish.dic"; DestDir: "{app}\SpellCheck\Dictionaries"; Flags: ignoreversion

Source: "..\MarkdownEdit\bin\Release\Themes\milk-toast.json"; DestDir: "{app}\Themes"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Themes\solarized-light.json"; DestDir: "{app}\Themes"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Themes\solarized-dark.json"; DestDir: "{app}\Themes"; Flags: ignoreversion
Source: "..\MarkdownEdit\bin\Release\Themes\zenburn.json"; DestDir: "{app}\Themes"; Flags: ignoreversion

Source: "Fonts\OpenSans-Regular.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Regular"; Flags: onlyifdoesntexist uninsneveruninstall;
Source: "Fonts\OpenSans-Bold.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Bold"; Flags: onlyifdoesntexist uninsneveruninstall;
Source: "Fonts\OpenSans-Italic.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Italic"; Flags: onlyifdoesntexist uninsneveruninstall;
Source: "Fonts\OpenSans-BoldItalic.ttf"; DestDir: "{fonts}"; FontInstall: "Open Sans Bold Italic"; Flags: onlyifdoesntexist uninsneveruninstall;

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Code]
function IsDotNetDetected(): boolean;
var
    key: string;
    release: cardinal;
    success: boolean;
begin
    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\full';
    success := RegQueryDWordValue(HKLM, key, 'Release', release);
    success := success and (release >= 379893);
    result := success;
end;

function InitializeSetup(): Boolean;
begin
    if not IsDotNetDetected() then begin
        MsgBox('Markdown Edit requires Microsoft .NET 4.5.2'#13#13
               'Download it at http://smallestdotnet.com'#13
               ,mbError, MB_OK);
        result := false;
    end
    else
        result := true;
end;


Installer fixed

Installer fixed

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Visual Leak Detector"
#define MyAppVersion "2.4"
#define MyAppPublisher "VLD Team"
#define MyAppURL "http://vld.codeplex.com/"
#define MyAppRegKey "Software\Visual Leak Detector"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{851FBFF7-5148-40A2-A654-942BE80F5B90}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={reg:HKLM\{#MyAppRegKey},InstallPath|{pf}\{#MyAppName}}
DefaultGroupName={#MyAppName}
LicenseFile=license-free.txt
OutputBaseFilename=vld-{#MyAppVersion}-setup
Compression=lzma
SolidCompression=True
MinVersion=0,5.0
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes
AllowNoIcons=yes
DisableDirPage=auto
DirExistsWarning=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Icons]
Name: "{group}\View Documentation"; Filename: "http://vld.codeplex.com/documentation"

[Files]
Source: "dbghelp\x64\dbghelp.dll"; DestDir: "{app}\dbghelp\x64"; Flags: ignoreversion
Source: "dbghelp\x64\Microsoft.DTfW.DHL.manifest"; DestDir: "{app}\dbghelp\x64"; Flags: ignoreversion
Source: "dbghelp\x86\dbghelp.dll"; DestDir: "{app}\dbghelp\x86"; Flags: ignoreversion
Source: "dbghelp\x86\Microsoft.DTfW.DHL.manifest"; DestDir: "{app}\dbghelp\x86"; Flags: ignoreversion
Source: "..\Win32\Release\vld.lib"; DestDir: "{app}\lib\Win32"; Flags: ignoreversion
Source: "..\Win32\Release\vld_x86.dll"; DestDir: "{app}\bin\Win32"; Flags: ignoreversion
Source: "..\x64\Release\vld.lib"; DestDir: "{app}\lib\Win64"; Flags: ignoreversion
Source: "..\x64\Release\vld_x64.dll"; DestDir: "{app}\bin\Win64"; Flags: ignoreversion
Source: "..\vld.h"; DestDir: "{app}\include"; Flags: ignoreversion
Source: "..\vld_def.h"; DestDir: "{app}\include"; Flags: ignoreversion
Source: "..\vld.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "version.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\AUTHORS.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\CHANGES.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\COPYING.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\callstack.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\dllspatches.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\ntapi.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\stdafx.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\utility.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld_hooks.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldapi.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldheap.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\callstack.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\criticalsection.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\crtmfcpatch.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\map.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\ntapi.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\resource.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\set.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\stdafx.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\tree.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\utility.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld_def.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldheap.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldint.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.dll.dependency.x64.manifest"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.dll.dependency.x86.manifest"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.rc"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.vcxproj"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.vcxproj.filters"; DestDir: "{app}\src"; Flags: ignoreversion

[Tasks]
Name: "modifypath"; Description: "Add VLD directory to your environmental path"
Name: "modifyVSProps"; Description: "Add VLD directory to VS2010-2013"

[ThirdParty]
UseRelativePaths=True

[Registry]
Root: "HKLM"; Subkey: "{#MyAppRegKey}"; Flags: uninsdeletekeyifempty
Root: "HKLM"; Subkey: "{#MyAppRegKey}"; ValueType: string; ValueName: "InstalledVersion"; ValueData: "{#MyAppVersion}"
Root: "HKLM"; Subkey: "{#MyAppRegKey}"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
Root: "HKLM"; Subkey: "{#MyAppRegKey}"; ValueType: string; ValueName: "IniFile"; ValueData: "{app}\vld.ini"

[Code]
const
    ModPathName = 'modifypath';
    ModPathType = 'system';

function ModPathDir(): TArrayOfString;
begin
    setArrayLength(Result, 2);
    Result[0] := ExpandConstant('{app}\bin\Win32');
    Result[1] := ExpandConstant('{app}\bin\Win64');
end;

#include "modpath.iss"

function GetUninstallString(regPath: string): String;
var
  sUnInstPath: String;
  sUnInstString: String;
begin
  sUnInstPath := ExpandConstant(regPath);
  sUnInstString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstString);
  Result := sUnInstString;
end;

function UninstallOldVersion(regPath: string; params: string): Boolean;
var
  iResultCode: Integer;
begin
  // default return value
  Result := False;

  if MsgBox('VLD is already installed. Uninstall the current version?',
    mbConfirmation, MB_YESNO) = IDYES then
  begin
    regPath := RemoveQuotes(regPath);
    if Exec(regPath, params,'', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
      Result := True;
  end
end;

function UninstallOldVersions(): Boolean;
var
  nsisUnInstallString: String;
  isUnInstallString: String;
begin
  nsisUnInstallString := GetUninstallString('Software\Microsoft\Windows\CurrentVersion\Uninstall\Visual Leak Detector');
  isUnInstallString := GetUninstallString('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  Result := True;
  if (nsisUnInstallString <> '') then
  begin
    Result := UninstallOldVersion(nsisUnInstallString, '/S');
  end
  else if (isUnInstallString <> '') then
  begin
    Result := UninstallOldVersion(isUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES');
  end;
end;

function EncodeString(str: string): string;
begin
  Result := str;
  StringChangeEx(Result, '(', '%28', True);
  StringChangeEx(Result, ')', '%29', True);
end;

procedure UpdateString(var dirList: string; path: string; suffix: string);
begin
  if dirList = '' then
    dirList := path + suffix
  else if (Pos(path, dirList) = 0) and (Pos(EncodeString(path), dirList) = 0) then
    dirList := path + dirList;
  Log(dirList);
end;

procedure ModifyProps(filename: string; libfolder: string);
var
  XMLDocument: Variant;
  XMLParent, XMLNode, XMLNodes: Variant;
  IncludeDirectoriesNode: Variant;
  AdditionalIncludeDirectories: string;
  LibraryDirectoriesNode: Variant;
  AdditionalLibraryDirectories: string;
begin
  if not FileExists(filename) then
    Exit;
  XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0');
  try
    XMLDocument.async := False;
    XMLDocument.load(filename);
    if (XMLDocument.parseError.errorCode = 0) then
    begin
      XMLDocument.setProperty('SelectionLanguage', 'XPath');
      XMLDocument.setProperty('SelectionNamespaces', 'xmlns:b=''http://schemas.microsoft.com/developer/msbuild/2003''');
      XMLNodes := XMLDocument.SelectNodes('//b:Project');
      if XMLNodes.Length = 0 then
        Exit;
      XMLParent := XMLNodes.Item[0];
      XMLNodes := XMLParent.SelectNodes('//b:ItemDefinitionGroup');
      if XMLNodes.Length > 0 then
        XMLParent := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'ItemDefinitionGroup',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        XMLParent := XMLParent.AppendChild(XMLNode);
      end;
      XMLNodes := XMLParent.SelectNodes('//b:ClCompile');
      if XMLNodes.Length > 0 then
        XMLParent := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'ClCompile',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        XMLParent := XMLParent.AppendChild(XMLNode);
      end;
      XMLNodes := XMLParent.SelectNodes('//b:AdditionalIncludeDirectories');
      if XMLNodes.Length > 0 then
        IncludeDirectoriesNode := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'AdditionalIncludeDirectories',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        IncludeDirectoriesNode := XMLParent.AppendChild(XMLNode);
      end;
      XMLNodes := XMLParent.SelectNodes('//b:AdditionalLibraryDirectories');
      if XMLNodes.Length > 0 then
        LibraryDirectoriesNode := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'AdditionalLibraryDirectories',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        LibraryDirectoriesNode := XMLParent.AppendChild(XMLNode);
      end;
      AdditionalIncludeDirectories := '';
      if not VarIsNull(IncludeDirectoriesNode) then
        AdditionalIncludeDirectories := IncludeDirectoriesNode.Text;
      AdditionalLibraryDirectories := '';;
      if not VarIsNull(LibraryDirectoriesNode) then
        AdditionalLibraryDirectories := LibraryDirectoriesNode.Text;
      UpdateString(AdditionalIncludeDirectories, ExpandConstant('{app}\include;'), '%(AdditionalIncludeDirectories)');
      UpdateString(AdditionalLibraryDirectories, ExpandConstant('{app}\lib\' + libfolder + ';'), '%(AdditionalLibraryDirectories)');
      IncludeDirectoriesNode.Text := AdditionalIncludeDirectories;
      LibraryDirectoriesNode.Text := AdditionalLibraryDirectories;
      XMLDocument.save(filename);
    end;
  except
    ShowExceptionMessage;
  end;
end;

procedure ModifyAllProps();
var
  Path: string;
begin
  Path := GetEnv('LOCALAPPDATA')+'\Microsoft\MSBuild\v4.0\';
  if DirExists(Path) then
  begin
    ModifyProps(Path + 'Microsoft.Cpp.Win32.user.props', 'Win32');
    ModifyProps(Path + 'Microsoft.Cpp.x64.user.props', 'Win64');
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    if not UninstallOldVersions() then
      Abort();
    if IsTaskSelected('modifyVSProps') then
      ModifyAllProps();
  end;
  CurStepChangedModPath(CurStep);
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  CurUninstallStepChangedModPath(CurUninstallStep);
end;

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Visual Leak Detector"
#define MyAppVersion "2.4"
#define MyAppPublisher "VLD Team"
#define MyAppURL "http://vld.codeplex.com/"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{851FBFF7-5148-40A2-A654-942BE80F5B90}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=license-free.txt
OutputBaseFilename=vld-{#MyAppVersion}-setup
Compression=lzma
SolidCompression=True
MinVersion=0,5.0
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes
AllowNoIcons=yes
DisableDirPage=auto
DirExistsWarning=no

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Icons]
Name: "{group}\View Documentation"; Filename: "http://vld.codeplex.com/documentation"

[Files]
Source: "dbghelp\x64\dbghelp.dll"; DestDir: "{app}\dbghelp\x64"; Flags: ignoreversion
Source: "dbghelp\x64\Microsoft.DTfW.DHL.manifest"; DestDir: "{app}\dbghelp\x64"; Flags: ignoreversion
Source: "dbghelp\x86\dbghelp.dll"; DestDir: "{app}\dbghelp\x86"; Flags: ignoreversion
Source: "dbghelp\x86\Microsoft.DTfW.DHL.manifest"; DestDir: "{app}\dbghelp\x86"; Flags: ignoreversion
Source: "..\Win32\Release\vld.lib"; DestDir: "{app}\lib\Win32"; Flags: ignoreversion
Source: "..\Win32\Release\vld_x86.dll"; DestDir: "{app}\bin\Win32"; Flags: ignoreversion
Source: "..\x64\Release\vld.lib"; DestDir: "{app}\lib\Win64"; Flags: ignoreversion
Source: "..\x64\Release\vld_x64.dll"; DestDir: "{app}\bin\Win64"; Flags: ignoreversion
Source: "..\vld.h"; DestDir: "{app}\include"; Flags: ignoreversion
Source: "..\vld_def.h"; DestDir: "{app}\include"; Flags: ignoreversion
Source: "..\vld.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "version.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\AUTHORS.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\CHANGES.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\COPYING.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\callstack.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\dllspatches.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\ntapi.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\stdafx.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\utility.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld_hooks.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldapi.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldheap.cpp"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\callstack.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\criticalsection.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\crtmfcpatch.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\map.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\ntapi.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\resource.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\set.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\stdafx.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\tree.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\utility.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld_def.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldheap.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vldint.h"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.dll.dependency.x64.manifest"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.dll.dependency.x86.manifest"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.rc"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.vcxproj"; DestDir: "{app}\src"; Flags: ignoreversion
Source: "..\vld.vcxproj.filters"; DestDir: "{app}\src"; Flags: ignoreversion

[Tasks]
Name: "modifypath"; Description: "Add VLD directory to your environmental path"

[ThirdParty]
UseRelativePaths=True

[Code]
const
    ModPathName = 'modifypath';
    ModPathType = 'system';

function ModPathDir(): TArrayOfString;
begin
    setArrayLength(Result, 2);
    Result[0] := ExpandConstant('{app}\bin\Win32');
    Result[1] := ExpandConstant('{app}\bin\Win64');
end;

#include "modpath.iss"

function GetUninstallString(regPath: string): String;
var
  sUnInstPath: String;
  sUnInstString: String;
begin
  sUnInstPath := ExpandConstant(regPath);
  sUnInstString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstString);
  Result := sUnInstString;
end;

function UninstallOldVersion(regPath: string; params: string): Boolean;
var
  iResultCode: Integer;
begin
  // default return value
  Result := False;

  if MsgBox('VLD is already installed. Uninstall the current version?',
    mbConfirmation, MB_YESNO) = IDYES then
  begin
    regPath := RemoveQuotes(regPath);
    if Exec(regPath, params,'', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
      Result := True;
  end
end;

function UninstallOldVersions(): Boolean;
var
  nsisUnInstallString: String;
  isUnInstallString: String;
begin
  nsisUnInstallString := GetUninstallString('Software\Microsoft\Windows\CurrentVersion\Uninstall\Visual Leak Detector');
  isUnInstallString := GetUninstallString('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  Result := True;
  if (nsisUnInstallString <> '') then
  begin
    Result := UninstallOldVersion(nsisUnInstallString, '/S');
  end
  else if (isUnInstallString <> '') then
  begin
    Result := UninstallOldVersion(isUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES');
  end;
end;

function EncodeString(str: string): string;
begin
  Result := str;
  StringChangeEx(Result, '(', '%28', True);
  StringChangeEx(Result, ')', '%29', True);
end;

procedure UpdateString(var dirList: string; path: string; suffix: string);
begin
  if dirList = '' then
    dirList := path + suffix
  else if (Pos(path, dirList) = 0) and (Pos(EncodeString(path), dirList) = 0) then
    dirList := path + dirList;
  Log(dirList);
end;

procedure ModifyProps(filename: string; libfolder: string);
var
  XMLDocument: Variant;
  XMLParent, XMLNode, XMLNodes: Variant;
  IncludeDirectoriesNode: Variant;
  AdditionalIncludeDirectories: string;
  LibraryDirectoriesNode: Variant;
  AdditionalLibraryDirectories: string;
begin
  if not FileExists(filename) then
    Exit;
  XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0');
  try
    XMLDocument.async := False;
    XMLDocument.load(filename);
    if (XMLDocument.parseError.errorCode = 0) then
    begin
      XMLDocument.setProperty('SelectionLanguage', 'XPath');
      XMLDocument.setProperty('SelectionNamespaces', 'xmlns:b=''http://schemas.microsoft.com/developer/msbuild/2003''');
      XMLNodes := XMLDocument.SelectNodes('//b:Project');
      if XMLNodes.Length = 0 then
        Exit;
      XMLParent := XMLNodes.Item[0];
      XMLNodes := XMLParent.SelectNodes('//b:ItemDefinitionGroup');
      if XMLNodes.Length > 0 then
        XMLParent := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'ItemDefinitionGroup',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        XMLParent := XMLParent.AppendChild(XMLNode);
      end;
      XMLNodes := XMLParent.SelectNodes('//b:ClCompile');
      if XMLNodes.Length > 0 then
        XMLParent := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'ClCompile',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        XMLParent := XMLParent.AppendChild(XMLNode);
      end;
      XMLNodes := XMLParent.SelectNodes('//b:AdditionalIncludeDirectories');
      if XMLNodes.Length > 0 then
        IncludeDirectoriesNode := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'AdditionalIncludeDirectories',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        IncludeDirectoriesNode := XMLParent.AppendChild(XMLNode);
      end;
      XMLNodes := XMLParent.SelectNodes('//b:AdditionalLibraryDirectories');
      if XMLNodes.Length > 0 then
        LibraryDirectoriesNode := XMLNodes.Item[0]
      else
      begin
        XMLNode := XMLDocument.CreateNode(1, 'AdditionalLibraryDirectories',
                    'http://schemas.microsoft.com/developer/msbuild/2003');
        LibraryDirectoriesNode := XMLParent.AppendChild(XMLNode);
      end;
      AdditionalIncludeDirectories := '';
      if not VarIsNull(IncludeDirectoriesNode) then
        AdditionalIncludeDirectories := IncludeDirectoriesNode.Text;
      AdditionalLibraryDirectories := '';;
      if not VarIsNull(LibraryDirectoriesNode) then
        AdditionalLibraryDirectories := LibraryDirectoriesNode.Text;
      UpdateString(AdditionalIncludeDirectories, ExpandConstant('{app}\include;'), '%(AdditionalIncludeDirectories)');
      UpdateString(AdditionalLibraryDirectories, ExpandConstant('{app}\lib\' + libfolder + ';'), '%(AdditionalLibraryDirectories)');
      IncludeDirectoriesNode.Text := AdditionalIncludeDirectories;
      LibraryDirectoriesNode.Text := AdditionalLibraryDirectories;
      XMLDocument.save(filename);
    end;
  except
    ShowExceptionMessage;
  end;
end;

procedure ModifyAllProps();
var
  Path: string;
begin
  Path := GetEnv('LOCALAPPDATA')+'\Microsoft\MSBuild\v4.0\';
  if DirExists(Path) then
  begin
    ModifyProps(Path + 'Microsoft.Cpp.Win32.user.props', 'Win32');
    ModifyProps(Path + 'Microsoft.Cpp.x64.user.props', 'Win64');
  end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    if not UninstallOldVersions() then
      Abort();
    ModifyAllProps();
  end;
  CurStepChangedModPath(CurStep);
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  CurUninstallStepChangedModPath(CurUninstallStep);
end;


trigger new build

trigger new build

#define app "..\..\dist\win-unpacked"
#define modules "..\..\modules"
#define internals "..\..\internals"
#define executable "FIRST LEGO League TMS.exe"
#define add_firewall_rule "advfirewall firewall add rule protocol=tcp dir=in enable=yes action=allow profile=private"

[Setup]
AppName=FIRST LEGO League TMS
AppVersion=2018.1-alpha-9.1
DefaultDirName=C:\FIRST_Lego_League_TMS
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
DisableProgramGroupPage=yes

[Dirs]
Name: "{app}\data"
Name: "{app}\logs"
Name: "{app}\tmp"

[Files]
Source: "{#app}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs;
Source: "{#modules}\*"; DestDir: "{app}\modules"; Flags: ignoreversion recursesubdirs;
Source: "{#internals}\*"; DestDir: "{app}\internals"; Flags: ignoreversion recursesubdirs;

[Run]
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "{#add_firewall_rule} name=""FIRST LEGO League TMS"" program=""{app}\{#executable}"""
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "{#add_firewall_rule} name=""FIRST LEGO League TMS"" program=""{app}\internals\caddy\caddy.exe"""
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "{#add_firewall_rule} name=""FIRST LEGO League TMS"" program=""{app}\internals\mongo\bin\mongod.exe"""

[Icons]
Name: "{commondesktop}\FIRST LEGO League TMS"; Filename: "{app}\{#executable}"
Name: "{commonprograms}\FIRST LEGO League TMS"; Filename: "{app}\{#executable}"

[UninstallDelete]
Type: filesandordirs; Name: "{app}\data"
Type: filesandordirs; Name: "{app}\logs"
Type: filesandordirs; Name: "{app}\tmp"

[UninstallRun]
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "advfirewall firewall delete rule name=""FIRST LEGO League TMS"""

#define app "..\..\dist\win-unpacked"
#define modules "..\..\modules"
#define internals "..\..\internals"
#define executable "FIRST LEGO League TMS.exe"
#define add_firewall_rule "advfirewall firewall add rule protocol=tcp dir=in enable=yes action=allow profile=private"

[Setup]
AppName=FIRST LEGO League TMS
AppVersion=2018.1-alpha-9
DefaultDirName=C:\FIRST_Lego_League_TMS
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
DisableProgramGroupPage=yes

[Dirs]
Name: "{app}\data"
Name: "{app}\logs"
Name: "{app}\tmp"

[Files]
Source: "{#app}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs;
Source: "{#modules}\*"; DestDir: "{app}\modules"; Flags: ignoreversion recursesubdirs;
Source: "{#internals}\*"; DestDir: "{app}\internals"; Flags: ignoreversion recursesubdirs;

[Run]
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "{#add_firewall_rule} name=""FIRST LEGO League TMS"" program=""{app}\{#executable}"""
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "{#add_firewall_rule} name=""FIRST LEGO League TMS"" program=""{app}\internals\caddy\caddy.exe"""
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "{#add_firewall_rule} name=""FIRST LEGO League TMS"" program=""{app}\internals\mongo\bin\mongod.exe"""

[Icons]
Name: "{commondesktop}\FIRST LEGO League TMS"; Filename: "{app}\{#executable}"
Name: "{commonprograms}\FIRST LEGO League TMS"; Filename: "{app}\{#executable}"

[UninstallDelete]
Type: filesandordirs; Name: "{app}\data"
Type: filesandordirs; Name: "{app}\logs"
Type: filesandordirs; Name: "{app}\tmp"

[UninstallRun]
Filename: "{sys}\netsh.exe";  StatusMsg: "Adding firewall rules..."; Parameters: "advfirewall firewall delete rule name=""FIRST LEGO League TMS"""


Create a desktop shortcut when installing

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "MultiMiner"

#define MyAppVersion GetEnv("MM_AppVersion")
#if MyAppVersion == ""
#define MyAppVersion "1.0"
#endif

#define MyAppPublisher "Nate Woolls"
#define MyAppURL "https://github.com/nwoolls/multiminer"
#define MyAppExeName "MultiMiner.Win.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A59A265F-E97D-4A84-8E78-E8C59EB861CE}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={localappdata}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename={#MyAppName}-{#MyAppVersion}
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest

[Files]
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Win.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Interop.IWshRuntimeLibrary.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Interop.Shell32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Coinchoose.Api.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Engine.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Xgminer.Api.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Xgminer.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Miners\bfgminer\Extract bfgminer here.txt"; DestDir: "{app}\Miners\bfgminer\"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Miners\cgminer\Extract cgminer here.txt"; DestDir: "{app}\Miners\cgminer\"; Flags: ignoreversion

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"

[UninstallDelete]
Type: dirifempty; Name: "{app}"

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "MultiMiner"

#define MyAppVersion GetEnv("MM_AppVersion")
#if MyAppVersion == ""
#define MyAppVersion "1.0"
#endif

#define MyAppPublisher "Nate Woolls"
#define MyAppURL "https://github.com/nwoolls/multiminer"
#define MyAppExeName "MultiMiner.Win.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A59A265F-E97D-4A84-8E78-E8C59EB861CE}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={localappdata}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename={#MyAppName}-{#MyAppVersion}
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest

[Files]
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Win.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Interop.IWshRuntimeLibrary.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Interop.Shell32.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Coinchoose.Api.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Engine.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Xgminer.Api.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\MultiMiner.Xgminer.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Newtonsoft.Json.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Miners\bfgminer\Extract bfgminer here.txt"; DestDir: "{app}\Miners\bfgminer\"; Flags: ignoreversion
Source: "..\MultiMiner.Win\bin\Release\Miners\cgminer\Extract cgminer here.txt"; DestDir: "{app}\Miners\cgminer\"; Flags: ignoreversion

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Run]
Filename: "{app}\{#MyAppExeName}"; Flags: nowait postinstall skipifsilent; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"

[UninstallDelete]
Type: dirifempty; Name: "{app}"


Update Cosmos.iss

Update Cosmos.iss

; Do NOT change this next line in Dev Kit
#ifndef ChangeSetVersion
#define ChangeSetVersion "20150130"
#endif

#ifndef BuildConfiguration
; Currently we dont use "UserKit" but this allows us to test/compile from Inno
; IDE so that we don't get an undefined error.
; We default to devkit so we dont have to wait on compression.
#define BuildConfiguration "DevKit"
;#define BuildConfiguration "UserKit"
#endif

#ifndef VSVersion
  #define VSVersion "vs2019"
#endif

#ifndef RealPath
  #define RealPath {userappdata}
#endif

#if BuildConfiguration == "DevKit"
	; devkit releases are not compressed
	#pragma warning "Building Dev Kit release"
#else
	; userkit releases get compressed, and get languages included
	#pragma message "Building User Kit release"
	#define Compress true
	#define IncludeUILanguages true
#endif

[Setup]
AppId=CosmosUserKit
AppName=Cosmos User Kit
AppVerName=Cosmos User Kit v{#ChangeSetVersion}
AppCopyright=Copyright (c) 2007-2021 The Cosmos Project
AppPublisher=Cosmos Project
AppPublisherURL=http://www.gocosmos.org/
AppSupportURL=http://www.gocosmos.org/
AppUpdatesURL=http://www.gocosmos.org/
AppVersion={#ChangeSetVersion}
SetupMutex=CosmosSetupMutexName,Global\CosmoSetupMutexName
UsePreviousAppDir=false
DefaultDirName={#RealPath}\Cosmos User Kit
DefaultGroupName=Cosmos User Kit
OutputDir=.\Setup\Output
OutputBaseFilename=CosmosUserKit-{#ChangeSetVersion}-{#VSVersion}
#ifdef Compress
Compression=lzma2/ultra64
InternalCompressLevel=ultra64
SolidCompression=true
#else
Compression=none
InternalCompressLevel=none
#endif
SourceDir=..
;Left Image should be 164x314
WizardImageFile=.\setup\images\cosmos.bmp
;Small Image should be 55x55
WizardSmallImageFile=.\setup\images\cosmos_small.bmp
AllowCancelDuringInstall=false
UninstallLogMode=overwrite
ChangesAssociations=yes
DisableWelcomePage=True
DisableReadyPage=True
DisableReadyMemo=True
FlatComponentsList=False
AlwaysShowComponentsList=False
ShowComponentSizes=False
LicenseFile=LICENSE.txt
DisableDirPage=no

[Messages]
SelectDirDesc=If the user installing the Cosmos User Kit is not the admin, please choose the users AppData/Roaming directory

[Dirs]
Name: {app}; Flags: uninsalwaysuninstall

[InstallDelete]
Type: filesandordirs; Name: "{app}"

[Files]
; Tools
Source: ".\Build\Tools\*.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\Tools\NAsm\*.exe"; DestDir: "{app}\Build\Tools\NAsm"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\Tools\Cygwin\*"; DestDir: "{app}\Build\Tools\cygwin"; Flags: ignoreversion uninsremovereadonly overwritereadonly
Source: ".\Build\Tools\mkisofs\*"; DestDir: "{app}\Build\Tools\mkisofs"; Flags: ignoreversion uninsremovereadonly overwritereadonly
Source: ".\Build\VSIP\IL2CPU\*"; DestDir: "{app}\Build\IL2CPU"; Flags: ignoreversion uninsremovereadonly recursesubdirs
;Source: ".\Build\VSIP\XSharp\*"; DestDir: "{app}\Build\XSharp"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Deploy.USB.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Deploy.Pixie.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Build.Common.dll"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Debug.GDB.exe"; DestDir: "{app}\Build\VSIP\"; Flags: ignoreversion uninsremovereadonly
; Kernel assemblies
Source: ".\Build\VSIP\Cosmos.Debug.Kernel*"; DestDir: "{app}\Kernel"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Core*"; DestDir: "{app}\Kernel"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.HAL*"; DestDir: "{app}\Kernel"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.System*"; DestDir: "{app}\Kernel"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.Common*"; DestDir: "{app}\Kernel"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\IL2CPU.API*"; DestDir: "{app}\Kernel"; Flags: ignoreversion uninsremovereadonly
; Packages
Source: ".\Build\VSIP\Packages\*.nupkg"; DestDir: "{app}\packages\"; Flags: ignoreversion uninsremovereadonly
; Icon
Source: ".\Artwork\Cosmos.ico"; DestDir: "{app}"; Flags: ignoreversion uninsremovereadonly
; XSharp
Source: ".\Artwork\XSharp\XSharp.ico"; DestDir: "{app}\XSharp\"; Flags: ignoreversion uninsremovereadonly
Source: "..\IL2CPU\source\Cosmos.Core.DebugStub\*.xs"; DestDir: "{app}\XSharp\DebugStub\"; Flags: ignoreversion uninsremovereadonly
; HyperV
Source: ".\Build\HyperV\*"; DestDir: "{app}\Build\HyperV"; Flags: ignoreversion uninsremovereadonly overwritereadonly recursesubdirs
; VMware
Source: ".\Build\VMware\*"; DestDir: "{app}\Build\VMware"; Flags: ignoreversion uninsremovereadonly overwritereadonly recursesubdirs
; ISO
Source: ".\Build\syslinux\isolinux.bin"; DestDir: "{app}\Build\ISO\"
Source: ".\Build\syslinux\ldlinux.c32"; DestDir: "{app}\Build\ISO\"
Source: ".\Build\syslinux\libcom32.c32"; DestDir: "{app}\Build\ISO\"
Source: ".\Build\syslinux\mboot.c32"; DestDir: "{app}\Build\ISO\"
Source: ".\Build\syslinux\syslinux.cfg"; DestDir: "{app}\Build\ISO\"
; USB
Source: ".\Build\syslinux\ldlinux.c32"; DestDir: "{app}\Build\USB\"
Source: ".\Build\syslinux\libcom32.c32"; DestDir: "{app}\Build\USB\"
Source: ".\Build\syslinux\mboot.c32"; DestDir: "{app}\Build\USB\"
Source: ".\Build\syslinux\syslinux.cfg"; DestDir: "{app}\Build\USB\"
; PXE
Source: ".\Build\syslinux\pxelinux.0"; DestDir: "{app}\Build\PXE"
Source: ".\Build\syslinux\mboot.c32"; DestDir: "{app}\Build\PXE\"
Source: ".\Build\syslinux\ldlinux.c32"; DestDir: "{app}\Build\PXE\"
Source: ".\Build\syslinux\libcom32.c32"; DestDir: "{app}\Build\PXE\"
Source: ".\Build\syslinux\syslinux.cfg"; DestDir: "{app}\Build\PXE\pxelinux.cfg"; DestName: "default"
; VSIP
Source: ".\Build\Tools\VSIXBootstrapper.exe"; DestDir: "{app}\Build\Tools"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.VS.DebugEngine.vsix"; DestDir: "{app}\VSIX\"; Flags: ignoreversion uninsremovereadonly
Source: ".\Build\VSIP\Cosmos.VS.ProjectSystem.vsix"; DestDir: "{app}\VSIX\"; Flags: ignoreversion uninsremovereadonly

[Registry]
; Regiter .xs Extension
Root: HKCR; Subkey: ".xs"; ValueType: string; ValueName: ""; ValueData: "XSharp"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "XSharp"; ValueType: string; ValueName: ""; ValueData: "X# source file"; Flags: uninsdeletekey
Root: HKCR; Subkey: "XSharp\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\XSharp\XSharp.ico,0"
Root: HKCR; Subkey: "XSharp\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Build\XSharp\XSC.exe"" ""%1"""
; User Kit Folder
Root: HKLM; SubKey: Software\Cosmos; ValueType: string; ValueName: "UserKit"; ValueData: {app}; Flags: uninsdeletekey
; Dev Kit Folder - Set by builder only, but we delete it here. See comments in builder.
; HKCU because Builder doesn't run as admin
; Note HKCU is not part of registry redirection
Root: HKCU; SubKey: Software\Cosmos; ValueType: none; ValueName: "DevKit"; Flags: deletekey

[ThirdParty]
UseRelativePaths=True

[Run]
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "sources Remove -Name ""Cosmos Local Package Feed"""; WorkingDir: "{app}"; Description: "Uninstall Kernel Packages"; StatusMsg: "Uninstalling Kernel Packages"
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "sources Add -Name ""Cosmos Local Package Feed"" -Source ""{app}\packages\\"""; WorkingDir: "{app}"; Description: "Install Kernel Packages"; StatusMsg: "Installing Kernel Packages"

Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /u:Cosmos.VS.ProjectSystem"; Description: "Remove Cosmos Project System"; StatusMsg: "Removing Visual Studio Extension: Cosmos Project System"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /u:Cosmos.VS.DebugEngine"; Description: "Remove Cosmos Debug Engine"; StatusMsg: "Removing Visual Studio Extension: Cosmos Debug Engine"

Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q Cosmos.VS.DebugEngine.vsix"; WorkingDir: "{app}\VSIX\"; Description: "Install Cosmos Debug Engine"; StatusMsg: "Installing Visual Studio Extension: Cosmos Debug Engine"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q Cosmos.VS.ProjectSystem.vsix"; WorkingDir: "{app}\VSIX\"; Description: "Install Cosmos Project System"; StatusMsg: "Installing Visual Studio Extension: Cosmos Project System"

[UninstallRun]
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "sources Remove -Name ""Cosmos Local Package Feed"""; WorkingDir: "{app}"; StatusMsg: "Uninstalling Kernel Packages"

Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /u:Cosmos.VS.ProjectSystem"; StatusMsg: "Removing Visual Studio Extension: Cosmos Project System"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /u:Cosmos.VS.DebugEngine"; StatusMsg: "Removing Visual Studio Extension: Cosmos Debug Engine"

[Code]
function IsAppRunning(const FileName: string): Boolean;
var
  FWMIService: Variant;
  FSWbemLocator: Variant;
  FWbemObjectSet: Variant;
begin
  Result := false;
  FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
  FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
  FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
  Result := (FWbemObjectSet.Count > 0);
  FWbemObjectSet := Unassigned;
  FWMIService := Unassigned;
  FSWbemLocator := Unassigned;
end;

function IsAppRunningWithResponse(const FileName: string): Boolean;
var
  Retry: Integer;
begin
  Result := IsAppRunning(FileName);
  if Result then
    MsgBox(FileName  + ' is running. Please close the application before running the installer.', mbError, MB_OK);
end;

function InitializeSetup: boolean;
var
  Retry: Integer;
begin
for Retry := 0 to 2 do
  begin
    Result := not IsAppRunningWithResponse('devenv.exe');
    if not Result then
    begin
      continue;
    end;
    Result := not IsAppRunningWithResponse('VSIXInstaller.exe');
    if not Result then
    begin
      continue;
    end;
    Result := not IsAppRunningWithResponse('ServiceHub.IdentityHost.exe');
    if not Result then
    begin
      continue;
    end;
    Result := not IsAppRunningWithResponse('ServiceHub.VSDetouredHost.exe');
    if not Result then
    begin
      continue;
    end;
    Result := not IsAppRunningWithResponse('ServiceHub.Host.Node.x86.exe');
    if not Result then
    begin
      continue;
    end;
    Result := not IsAppRunningWithResponse('ServiceHub.SettingsHost.exe');
    if not Result then
    begin
      continue;
    end;
    Result := not IsAppRunningWithResponse('ServiceHub.Host.CLR.x86.exe');
    if not Result then
    begin
      continue;
    end
    else
    begin
      break;
    end;
  end;
end;

function ExecWithResult(const Filename, Params, WorkingDir: String; const ShowCmd: Integer;
  const Wait: TExecWait; var ResultCode: Integer; var ResultString: AnsiString): Boolean;
var
  TempFilename: AnsiString;
  Command: String;
begin
  TempFilename :=
    ExpandConstant('{tmp}\~execwithresult.txt');
  Command :=
    Format('"%s" /S /C ""%s" %s > "%s""', [ExpandConstant('{cmd}'), Filename, Params, TempFilename]);
  Result :=
    Exec(ExpandConstant('{cmd}'), Command, WorkingDir, ShowCmd, Wait, ResultCode);
  if not Result then
    Exit;
  LoadStringFromFile(TempFilename, ResultString);
  DeleteFile(TempFilename);
  if (Length(ResultString) >= 2) and (ResultString[Length(ResultString) - 1] = #13) and (ResultString[Length(ResultString)] = #10) then
    Delete(ResultString, Length(ResultString) - 1, 2);
end;

function ExecWithoutResult(const Filename, Params, WorkingDir: String; const ShowCmd: Integer;
  const Wait: TExecWait; var ResultCode: Integer): Boolean;
var
  Command: String;
begin
  Command :=
    Format('"%s" /S /C ""%s" %s"', [ExpandConstant('{cmd}'), Filename, Params]);
  Result :=
    Exec(ExpandConstant('{cmd}'), Command, WorkingDir, ShowCmd, Wait, ResultCode);
  if not Result then
    Exit;
end;

function GetVSPath(): String;
var
  Command: AnsiString;
  Params: AnsiString;
  Success: Boolean;
  ResultCode: Integer;
  ResultText: AnsiString;
begin
  Command := ExpandConstant('{app}\Build\Tools\vswhere.exe');
  Params := '-latest -version "[15.0,16.0)" -requires Microsoft.Component.MSBuild -property installationPath';
  Success :=
    ExecWithResult(Command, Params, '', SW_HIDE, ewWaitUntilTerminated, ResultCode, ResultText)
      or (ResultCode <> 0);
  if Success then
    Result := ResultText;
end;

function GetVsixInstallerPath(): String;
var
  VsPath: String;
begin
  VsPath := GetVSPath();
  Result := VsPath + '\Common7\IDE\vsixinstaller.exe';
end;

function GetVsixInstallCommand(Param: String): String;
var
  Command: String;
begin
  Command := GetVsixInstallerPath();
  Result := Command;
end;

function GetVsixInstallParams(const Filename: String): String;
var
  Params: String;
begin
  Params := ' "' + ExpandConstant('{app}\') + Filename + '"';
  Result := Params;
end;

function GetVsixUninstallParams(const Filename: String): String;
var
  Params: String;
begin
  Params := ' /uninstall:"' + Filename + '"';
  Result := Params;
end;

function GetMSBuildDirectory(Param: String): String;
var
  VSPath: String;
begin
  VSPath := GetVSPath();
  Result := VsPath + '\MSBuild';
end;

function GetUninstallString(): String;
var
  sUnInstPath: String;
  sUnInstallString: String;
begin
  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
  sUnInstallString := '';
  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
  Result := sUnInstallString;
end;

/////////////////////////////////////////////////////////////////////
// Uninstall previously installed application.
/////////////////////////////////////////////////////////////////////
function UnInstallOldVersion(): Integer;
var
  sUnInstallString: String;
  iResultCode: Integer;
begin
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString

  // default return value
  Result := 0;

  // get the uninstall string of the old app
  sUnInstallString := GetUninstallString();
  if sUnInstallString <> '' then begin
    sUnInstallString := RemoveQuotes(sUnInstallString);
    if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
      Result := 3
    else
      Result := 2;
  end else
    Result := 1;
end;

[Languages]
Name: en; MessagesFile: compiler:Default.isl; InfoBeforeFile: .\setup\Readme.txt
#ifdef IncludeUILanguages
Name: eu; MessagesFile: .\setup\Languages\Basque-1-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: ca; MessagesFile: .\setup\Languages\Catalan-4-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: cs; MessagesFile: .\setup\Languages\Czech-5-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: da; MessagesFile: .\setup\Languages\Danish-4-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: nl; MessagesFile: .\setup\Languages\Dutch-8-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: fi; MessagesFile: .\setup\Languages\Finnish-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: fr; MessagesFile: .\setup\Languages\French-15-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: de; MessagesFile: .\setup\Languages\German-2-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: hu; MessagesFile: .\setup\Languages\Hungarian-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: it; MessagesFile: .\setup\Languages\Italian-14-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: no; MessagesFile: .\setup\Languages\Norwegian-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: pl; MessagesFile: .\setup\Languages\Polish-8-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: pt; MessagesFile: .\setup\Languages\PortugueseStd-1-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: ru; MessagesFile: .\setup\Languages\Russian-19-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: sk; MessagesFile: .\setup\Languages\Slovak-6-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: sl; MessagesFile: .\setup\Languages\Slovenian-3-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
;Unofficial:
Name: bg; MessagesFile: .\setup\Languages\InOfficial\Bulgarian-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: el; MessagesFile: .\setup\Languages\InOfficial\Greek-4-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: is; MessagesFile: .\setup\Languages\InOfficial\Icelandic-1-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: id; MessagesFile: .\setup\Languages\InOfficial\Indonesian-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: ja; MessagesFile: .\setup\Languages\InOfficial\Japanese-5-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: ko; MessagesFile: .\setup\Languages\InOfficial\Korean-5-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: ms; MessagesFile: .\setup\Languages\InOfficial\Malaysian-2-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: es; MessagesFile: .\setup\Languages\InOfficial\SpanishStd-2-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: sv; MessagesFile: .\setup\Languages\InOfficial\Swedish-8-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: tr; MessagesFile: .\setup\Languages\InOfficial\Turkish-3-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: uk; MessagesFile: .\setup\Languages\InOfficial\Ukrainian-5-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: cn; MessagesFile: .\setup\Languages\InOfficial\ChineseSimp-11-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
Name: tw; MessagesFile: .\setup\Languages\InOfficial\ChineseTrad-2-5.1.0.isl; InfoBeforeFile: .\setup\Readme.txt
#endif

[Messages]
en.BeveledLabel=English
#ifdef IncludeUILanguages
eu.BeveledLabel=Basque
ca.BeveledLabel=Catalan
cs.BeveledLabel=Czech
da.BeveledLabel=Danish
nl.BeveledLabel=Dutch
fi.BeveledLabel=Finnish
fr.BeveledLabel=French
de.BeveledLabel=German
hu.BeveledLabel=Hungarian
it.BeveledLabel=Italian
no.BeveledLabel=Norwegian
pl.BeveledLabel=Polish
pt.BeveledLabel=Portuguese
ru.BeveledLabel=Russian
sk.BeveledLabel=Slovak
sl.BeveledLabel=Slovenian
;Unofficial:
bg.BeveledLabel=Bulgarian
el.BeveledLabel=Greek
is.BeveledLabel=Icelandic
id.BeveledLabel=Indonesian
ja.BeveledLabel=Japanese
ko.BeveledLabel=Korean
ms.BeveledLabel=Malaysian
es.BeveledLabel=Spanish
sv.BeveledLabel=Swedish
tr.BeveledLabel=Turkish
uk.BeveledLabel=Ukrainian
cn.BeveledLabel=Chinese Simplified
tw.BeveledLabel=Chinese Traditional
#endif