<commit_before>/*
Copyright (c) 2009 <NAME> <EMAIL>

 Permission to use, copy, modify, distribute and sell this software or any part
 thereof and/or its documentation for any purpose is granted without fee provided
 that the above copyright notice and this permission notice appear in all
 copies.

 This software is provided "as is" without express or implied warranty of any kind.
 The author shall have no liability with respect to the infringement of copyrights 
 or patents that any modification to the content of this file or this file itself 
 may incur.
*/

; Version 1.0.0


  !ifndef JRE_DECLARES
  !define JRE_DECLARES

  !include "WordFunc.nsh"
  !include "x64.nsh"


  !macro CUSTOM_PAGE_JREINFO
    Page custom CUSTOM_PAGE_JREINFO
  !macroend

  !define JRE_VERSION "1.8"
  !define JRE_URL "redirect.dmdirc.com/getjava/windows/"


;;;;;;;;;;;;;;;;;;;;;
;  Custom panel
;;;;;;;;;;;;;;;;;;;;;

Function CUSTOM_PAGE_JREINFO

  push $0
  push $1
  push $2
  
  
  Push "${JRE_VERSION}"
  ${If} ${RunningX64}
    ${DisableX64FSRedirection}
    SetRegView 64
    Push "${JRE_VERSION}"
    Call DetectJRE
    Pop $0	; Get return value from stack
    Pop $1
    strcmp $0 "OK" exit
    StrCmp $0 "0" continue
    StrCmp $0 "-1" FoundOld
  ${EndIf}
  continue:
  ${EnableX64FSRedirection}
  SetRegView 32
  Push "${JRE_VERSION}"
  Call DetectJRE
  Pop $0	; Get return value from stack
  Pop $1
  StrCmp $0 "OK" exit
  StrCmp $0 "0" NoFound
  StrCmp $0 "-1" FoundOld


NoFound:
  nsDialogs::create /NOUNLOAD 1018
  pop $1
  !insertmacro MUI_HEADER_TEXT "JRE Installation Required" "This application requires Java ${JRE_VERSION} or higher"
  ${NSD_CreateLabel} 0 0 100% 100% "This application requires installation of the Java Runtime Environment. This will be downloaded and installed as part of the installation."
  pop $1
  goto ShowDialog

FoundOld:
  nsDialogs::create /NOUNLOAD 1018
  pop $1
  !insertmacro MUI_HEADER_TEXT "JRE Update Required" "This application requires Java ${JRE_VERSION} or higher"
  ${NSD_CreateLabel} 0 0 100% 100% "This application requires a more recent version of the Java Runtime Environment. This will be downloaded and installed as part of the installation."
  pop $1
  goto ShowDialog

ShowDialog:

  nsDialogs::Show

exit:


  pop $2
  pop $1
  pop $0

FunctionEnd





; Checks to ensure that the installed version of the JRE (if any) is at least that of
; the JRE_VERSION variable.  The JRE will be downloaded and installed if necessary
; The full path of java.exe will be returned on the stack

Function DownloadAndInstallJREIfNecessary
  Push $0
  Push $1

  DetailPrint "Detecting JRE Version"
  Push "${JRE_VERSION}"
  ${If} ${RunningX64}
    ${DisableX64FSRedirection}
    SetRegView 64
    Push "${JRE_VERSION}"
    Call DetectJRE
    Pop $0	; Get return value from stack
    Pop $1	; get JRE path (or error message)
    strcmp $0 "OK" End
  ${EndIf}
  ${EnableX64FSRedirection}
  SetRegView 32
  Push "${JRE_VERSION}"
  Call DetectJRE
  Pop $0	; Get return value from stack
  Pop $1	; get JRE path (or error message)
  DetailPrint "JRE Version detection complete - result = $1"

  strcmp $0 "OK" End downloadJRE

downloadJRE:
  ${If} ${RunningX64}
    DetailPrint "About to download JRE from ${JRE_URL}x86_64"
    nsisdl::download "${JRE_URL}x86_64" "$TEMP\jre_Setup.exe"
  ${Else}
    DetailPrint "About to download JRE from ${JRE_URL}x86"
    nsisdl::download "${JRE_URL}x86" "$TEMP\jre_Setup.exe"
  ${EndIf}
  Pop $0 # return value = exit code, "OK" if OK
  DetailPrint "Download result = $0"

  strcmp $0 "success" downloadsuccessful
  MessageBox MB_OK "There was a problem downloading required component - Error: $0"
  abort
downloadsuccessful:
<commit_msg>Update URL, use https, no idea if it works.<commit_after>/*
Copyright (c) 2009 <NAME> <EMAIL>

 Permission to use, copy, modify, distribute and sell this software or any part
 thereof and/or its documentation for any purpose is granted without fee provided
 that the above copyright notice and this permission notice appear in all
 copies.

 This software is provided "as is" without express or implied warranty of any kind.
 The author shall have no liability with respect to the infringement of copyrights 
 or patents that any modification to the content of this file or this file itself 
 may incur.
*/

; Version 1.0.0


  !ifndef JRE_DECLARES
  !define JRE_DECLARES

  !include "WordFunc.nsh"
  !include "x64.nsh"


  !macro CUSTOM_PAGE_JREINFO
    Page custom CUSTOM_PAGE_JREINFO
  !macroend

  !define JRE_VERSION "1.8"
  !define JRE_URL "redirect.dmdirc.com/java/windows/"


;;;;;;;;;;;;;;;;;;;;;
;  Custom panel
;;;;;;;;;;;;;;;;;;;;;

Function CUSTOM_PAGE_JREINFO

  push $0
  push $1
  push $2
  
  
  Push "${JRE_VERSION}"
  ${If} ${RunningX64}
    ${DisableX64FSRedirection}
    SetRegView 64
    Push "${JRE_VERSION}"
    Call DetectJRE
    Pop $0	; Get return value from stack
    Pop $1
    strcmp $0 "OK" exit
    StrCmp $0 "0" continue
    StrCmp $0 "-1" FoundOld
  ${EndIf}
  continue:
  ${EnableX64FSRedirection}
  SetRegView 32
  Push "${JRE_VERSION}"
  Call DetectJRE
  Pop $0	; Get return value from stack
  Pop $1
  StrCmp $0 "OK" exit
  StrCmp $0 "0" NoFound
  StrCmp $0 "-1" FoundOld


NoFound:
  nsDialogs::create /NOUNLOAD 1018
  pop $1
  !insertmacro MUI_HEADER_TEXT "JRE Installation Required" "This application requires Java ${JRE_VERSION} or higher"
  ${NSD_CreateLabel} 0 0 100% 100% "This application requires installation of the Java Runtime Environment. This will be downloaded and installed as part of the installation."
  pop $1
  goto ShowDialog

FoundOld:
  nsDialogs::create /NOUNLOAD 1018
  pop $1
  !insertmacro MUI_HEADER_TEXT "JRE Update Required" "This application requires Java ${JRE_VERSION} or higher"
  ${NSD_CreateLabel} 0 0 100% 100% "This application requires a more recent version of the Java Runtime Environment. This will be downloaded and installed as part of the installation."
  pop $1
  goto ShowDialog

ShowDialog:

  nsDialogs::Show

exit:


  pop $2
  pop $1
  pop $0

FunctionEnd





; Checks to ensure that the installed version of the JRE (if any) is at least that of
; the JRE_VERSION variable.  The JRE will be downloaded and installed if necessary
; The full path of java.exe will be returned on the stack

Function DownloadAndInstallJREIfNecessary
  Push $0
  Push $1

  DetailPrint "Detecting JRE Version"
  Push "${JRE_VERSION}"
  ${If} ${RunningX64}
    ${DisableX64FSRedirection}
    SetRegView 64
    Push "${JRE_VERSION}"
    Call DetectJRE
    Pop $0	; Get return value from stack
    Pop $1	; get JRE path (or error message)
    strcmp $0 "OK" End
  ${EndIf}
  ${EnableX64FSRedirection}
  SetRegView 32
  Push "${JRE_VERSION}"
  Call DetectJRE
  Pop $0	; Get return value from stack
  Pop $1	; get JRE path (or error message)
  DetailPrint "JRE Version detection complete - result = $1"

  strcmp $0 "OK" End downloadJRE

downloadJRE:
  ${If} ${RunningX64}
    DetailPrint "About to download JRE from https://${JRE_URL}x86_64"
    nsisdl::download "https://${JRE_URL}x86_64" "$TEMP\jre_Setup.exe"
  ${Else}
    DetailPrint "About to download JRE from https://${JRE_URL}x86"
    nsisdl::download "https://${JRE_URL}x86" "$TEMP\jre_Setup.exe"
  ${EndIf}
  Pop $0 # return value = exit code, "OK" if OK
  DetailPrint "Download result = $0"

  strcmp $0 "success" downloadsuccessful
  MessageBox MB_OK "There was a problem downloading required component - Error: $0"
  abort
downloadsuccessful:

{'fraction_non_alphanumeric': 0.09156529875685068, 'fraction_numerical': 0.028338457425477876, 'mean_word_length': 3.808483290488432, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1415763', 'n_tokens_mistral': 2640, 'n_tokens_neox': 2425, 'n_words': 926}