Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rcmaehl committed Jun 29, 2021
1 parent 6e1e706 commit 5fc9b5d
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion WhyNotWin11.au3
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,16 @@ Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96)
Return $aresults
EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio

Func _GetFile($sFile, $sFormat = $FO_READ)
Local Const $hFileOpen = FileOpen($sFile, $sFormat)
If $hFileOpen = -1 Then
Return SetError(1, 0, '')
EndIf
Local Const $sData = FileRead($hFileOpen)
FileClose($hFileOpen)
Return $sData
EndFunc ;==>_GetFile

Func _GetTranslationCredit()
Return INIRead(@LocalAppDataDir & "\WhyNotWin11\Langs\" & @MUILang & ".lang", "MetaData", "Translator", "???")
EndFunc
Expand All @@ -788,6 +798,23 @@ Func _HighContrast($sColor)

EndFunc

Func _INIUnicode($sINI)
If FileExists($sINI) = 0 Then
Return FileClose(FileOpen($sINI, $FO_OVERWRITE + $FO_UNICODE))
Else
Local Const $iEncoding = FileGetEncoding($sINI)
Local $fReturn = True
If Not ($iEncoding = $FO_UNICODE) Then
Local $sData = _GetFile($sINI, $iEncoding)
If @error Then
$fReturn = False
EndIf
_SetFile($sData, $sINI, $FO_APPEND + $FO_UNICODE)
EndIf
Return $fReturn
EndIf
EndFunc ;==>_INIUnicode

Func _SetBannerText($hBannerText, $hBanner)

Local $bLinux = False
Expand Down Expand Up @@ -851,6 +878,18 @@ Func _SetBkIcon($ControlID, $iBackground, $sIcon, $iIndex, $iWidth, $iHeight)
Return SetError(0, 0, 1)
EndFunc ;==>_SetBkIcon

Func _SetFile($sString, $sFile, $iOverwrite = $FO_READ)
Local Const $hFileOpen = FileOpen($sFile, $iOverwrite + $FO_APPEND)
FileWrite($hFileOpen, $sString)
FileClose($hFileOpen)
If @error Then
Return SetError(1, 0, False)
EndIf
Return True
EndFunc ;==>_SetFile

Func _Translate($sString)
Return _WinAPI_OemToChar(INIRead(@LocalAppDataDir & "\WhyNotWin11\Langs\" & @MUILang & ".lang", "Strings", $sString, $sString))
_INIUnicode(@LocalAppDataDir & "\WhyNotWin11\Langs\0804.lang")
;Return BinaryToString(StringToBinary(INIRead(@LocalAppDataDir & "\WhyNotWin11\Langs\" & @MUILang & ".lang", "Strings", $sString, $sString)))
Return INIRead(@LocalAppDataDir & "\WhyNotWin11\Langs\0804.lang", "Strings", $sString, $sString)
EndFunc

0 comments on commit 5fc9b5d

Please sign in to comment.