216 lines
7 KiB
AutoIt
216 lines
7 KiB
AutoIt
|
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||
|
#AutoIt3Wrapper_Icon=Untitled design (7).ico
|
||
|
#AutoIt3Wrapper_Outfile_x64=..\..\Logiciels\WSA-APKManager.Exe
|
||
|
#AutoIt3Wrapper_Res_Comment=WSA APK Manager
|
||
|
#AutoIt3Wrapper_Res_Description=WSA APK Manager
|
||
|
#AutoIt3Wrapper_Res_Fileversion=1.0.0.2
|
||
|
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
|
||
|
#AutoIt3Wrapper_Res_ProductName=WSA APK Manager
|
||
|
#AutoIt3Wrapper_Res_ProductVersion=1.0.0.0
|
||
|
#AutoIt3Wrapper_Res_CompanyName=Tyleo Softwares
|
||
|
#AutoIt3Wrapper_Res_LegalCopyright=Tyleo Softwares
|
||
|
#AutoIt3Wrapper_Res_LegalTradeMarks=Tyleo Softwares
|
||
|
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||
|
|
||
|
#include "MetroGUI-UDF\MetroGUI_UDF.au3"
|
||
|
#include "TyleoAboutMe.au3"
|
||
|
|
||
|
#cs
|
||
|
|
||
|
Tyleo Software Project Base v1
|
||
|
Created With CNP and DevTools Base Folder
|
||
|
|
||
|
All Softwares created with this base are Free and Open Sourced.
|
||
|
Join our Guilded Server ! https://www.guilded.gg/i/2DRlM7Mp
|
||
|
|
||
|
#ce
|
||
|
|
||
|
if RegRead("HKEY_CURRENT_USER\Software\Classes\wsa","URL Protocol") Then
|
||
|
MsgBox(0+16,"Error !","No WSA Installed on your System.")
|
||
|
Exit(1)
|
||
|
Else
|
||
|
; OK
|
||
|
EndIf
|
||
|
|
||
|
$State = " STABLE"
|
||
|
|
||
|
$CurrentVer = FileGetVersion(@AutoItExe)
|
||
|
$CurrentVer = $CurrentVer & $State
|
||
|
|
||
|
$ProgName = "WSA-APK Installer/Manager " & $CurrentVer & @CRLF & "This App are not affiliated" & @CRLF & "with Microsoft Corporation or WSA Devs"
|
||
|
|
||
|
#include <GUIConstantsEx.au3>
|
||
|
#include <GUIListBox.au3>
|
||
|
#include <WindowsConstants.au3>
|
||
|
#include <File.au3>
|
||
|
#include "WinAccent.au3"
|
||
|
#Region ### START Koda GUI section ### Form=
|
||
|
|
||
|
$WSAAPK_Data = @ScriptDir
|
||
|
|
||
|
if Run("adb connect 127.0.0.1:58526") Then
|
||
|
|
||
|
Else
|
||
|
MsgBox(0+16,"Error, No ADB","No ADB Installed.")
|
||
|
EndIf
|
||
|
|
||
|
if FileExists($WSAAPK_Data) Then
|
||
|
; Nothing
|
||
|
Else
|
||
|
DirCreate($WSAAPK_Data)
|
||
|
EndIf
|
||
|
|
||
|
$Apks = $WSAAPK_Data & "\APK"
|
||
|
if FileExists($Apks) Then
|
||
|
;Nothing
|
||
|
Else
|
||
|
DirCreate($Apks)
|
||
|
MsgBox(0,"Data Folder Created","Add your APK's in it using explorer or this program." & @CRLF & "Location : " & @AppDataDir & "\WSA-Tyleo")
|
||
|
EndIf
|
||
|
|
||
|
|
||
|
Global $GUI = GUICreate("WSA-APK Installer/Manager " & $CurrentVer, 474, 437, 261, 174)
|
||
|
Global $Actions = GUICtrlCreateMenu("Actions")
|
||
|
Global $Actions_All = GUICtrlCreateMenuItem("Install All", $Actions)
|
||
|
Global $Actions_Sel = GUICtrlCreateMenuItem("Install Selected", $Actions)
|
||
|
Global $Actions_S1 = GUICtrlCreateMenuItem("",$Actions)
|
||
|
Global $Actions_Connect = GUICtrlCreateMenuItem("Connect ADB" & @TAB & "127.0.0.1:58526",$Actions)
|
||
|
Global $Actions_ConnectCustom = GUICtrlCreateMenuItem("Connect ADB" & @TAB & "Custom IP/Port",$Actions)
|
||
|
Global $Actions_S2 = GUICtrlCreateMenuItem("",$Actions)
|
||
|
Global $Actions_FixApkName = GUICtrlCreateMenuItem("Fix APK Spaces",$Actions)
|
||
|
Global $Actions_FIxAllSpaces = GUICtrlCreateMenuItem("Fix All APK Names Spaces",$Actions)
|
||
|
Global $Manage = GUICtrlCreateMenu("Manage")
|
||
|
Global $Manage_Add = GUICtrlCreateMenuItem("Add APK", $Manage)
|
||
|
Global $Manage_Remove = GUICtrlCreateMenuItem("Remove APK", $Manage)
|
||
|
Global $Manage_Rename = GUICtrlCreateMenuItem("Rename APK", $Manage)
|
||
|
Global $About = GUICtrlCreateMenu("About")
|
||
|
Global $About_Dev = GUICtrlCreateMenuItem("About Us",$About)
|
||
|
Global $About_Ver = GUICtrlCreateMenuItem("WSA-APK Installer/Manager " & $CurrentVer,$About)
|
||
|
GUICtrlSetState($About_Ver, $GUI_DISABLE)
|
||
|
Global $ApkBank = GUICtrlCreateList("", 0, 0, 473, 418, -1, 0)
|
||
|
GUICtrlSetBkColor($ApkBank,$CurrentAccent)
|
||
|
GUICtrlSetColor($ApkBank,0xFFFFFF)
|
||
|
GUICtrlSetFont($ApkBank,13,900,"","Segoe UI")
|
||
|
|
||
|
$ButtonBKColor = $CurrentAccent
|
||
|
|
||
|
EmptyBankCheck($ApkBank)
|
||
|
|
||
|
GUISetState(@SW_SHOW)
|
||
|
#EndRegion ### END Koda GUI section ###
|
||
|
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
|
||
|
While 1
|
||
|
$nMsg = GUIGetMsg()
|
||
|
Switch $nMsg
|
||
|
Case $GUI_EVENT_CLOSE
|
||
|
Exit
|
||
|
|
||
|
Case $Manage_Add
|
||
|
$lBrowse = FileSaveDialog("Select APK File to Add",@DesktopDir,"APK (*.apk)")
|
||
|
ConsoleWrite($lBrowse)
|
||
|
FileCopy($lBrowse, @ScriptDir & "\APK")
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
|
||
|
EmptyBankCheck($ApkBank)
|
||
|
|
||
|
Case $Manage_Remove
|
||
|
|
||
|
$dTarg = GUICtrlRead($ApkBank)
|
||
|
$dTargFull = @ScriptDir & "\APK\" & $dTarg & ".apk"
|
||
|
$Confirm = MsgBox(4,"Remove ?","Are you sure to remove " & $dTarg & " ?")
|
||
|
|
||
|
if $Confirm = "6" Then
|
||
|
FileDelete($dTargFull)
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
EndIf
|
||
|
|
||
|
EmptyBankCheck($ApkBank)
|
||
|
|
||
|
Case $Manage_Rename
|
||
|
$rTarg = GUICtrlRead($ApkBank)
|
||
|
$rTargFull = @ScriptDir & "\APK\" & $rTarg & ".apk"
|
||
|
$rTargNewName = InputBox("Rename APK","Type the new name. Never include extension (.apk)",$rTarg)
|
||
|
FileMove(@ScriptDir & "\APK\" & $rTarg & ".apk", @ScriptDir & "\APK\" & $rTargNewName & ".apk")
|
||
|
FixApkSpaces(@ScriptDir & "\APK\" & $rTargNewName & ".apk")
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
|
||
|
Case $Actions_Connect
|
||
|
Run("adb connect 127.0.0.1:58526", @SW_HIDE)
|
||
|
|
||
|
Case $Actions_ConnectCustom
|
||
|
$CustomIP = InputBox("Type Custom IP:Port","IP:Port","127.0.0.1:58526","",120,120)
|
||
|
Run("adb connect " & $CustomIP, @SW_HIDE)
|
||
|
|
||
|
Case $Actions_Sel
|
||
|
$InstallApk = GUICtrlRead($ApkBank)
|
||
|
Run("adb install " & ".\APK\" & $InstallApk & ".apk")
|
||
|
|
||
|
Case $Actions_FixApkName
|
||
|
$ApkToFix = GUICtrlRead($ApkBank)
|
||
|
FixApkSpaces($ApkToFix)
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
|
||
|
Case $Actions_FIxAllSpaces
|
||
|
$iApks_pool = _FileListToArray(@ScriptDir & "\APK","*.apk",$FLTA_FILES,True)
|
||
|
For $i In $iApks_pool
|
||
|
FixApkSpacesEx2($i)
|
||
|
ConsoleWrite(@CRLF & $i)
|
||
|
Next
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
|
||
|
Case $Actions_All
|
||
|
GUISetState(@SW_HIDE,$GUI)
|
||
|
$iApks_pool = _FileListToArray(".\APK\","*.apk",$FLTA_FILES,True)
|
||
|
For $i In $iApks_pool
|
||
|
FixApkSpaces($i)
|
||
|
Next
|
||
|
|
||
|
$iApks_pool = _FileListToArray(".\APK\","*.apk",$FLTA_FILES,False)
|
||
|
For $i In $iApks_pool
|
||
|
RunWait("adb install " & $i,@ScriptDir & "\APK", @SW_HIDE)
|
||
|
Next
|
||
|
RefreshApkBank($Apks, $ApkBank)
|
||
|
GUISetState(@SW_SHOW,$GUI)
|
||
|
MsgBox(0,"","Installation Ended.")
|
||
|
|
||
|
Case $About_Dev
|
||
|
TyleoAbout($ProgName)
|
||
|
|
||
|
EndSwitch
|
||
|
WEnd
|
||
|
|
||
|
Func RefreshApkBank($Source, $Controler)
|
||
|
GUICtrlSetData($Controler,"")
|
||
|
$fApks_pool = _FileListToArray($Source,"*.apk",$FLTA_FILES,False)
|
||
|
$fApks = _ArrayDelete($fApks_pool,0)
|
||
|
$fApks = _ArrayTrim($fApks_pool,4,1)
|
||
|
$fApks = _ArrayToString($fApks_pool)
|
||
|
GUICtrlSetData($Controler,$fApks)
|
||
|
Return True
|
||
|
EndFunc
|
||
|
|
||
|
Func FixApkSpaces($Target)
|
||
|
$fName = $Target & ".apk"
|
||
|
$fName = StringReplace($fName, " ", "-")
|
||
|
FileMove(".\APK\" & $Target & ".apk",".\APK\" & $fName)
|
||
|
ConsoleWrite(@CRLF & "Tried to process : " & $fName & "BY|ON" & $Target)
|
||
|
Return True
|
||
|
EndFunc
|
||
|
|
||
|
Func FixApkSpacesEx2($Target)
|
||
|
$fName = $Target
|
||
|
$fName = StringReplace($fName, " ", "-")
|
||
|
FileMove($Target,".\APK\" & $fName & ".apk")
|
||
|
ConsoleWrite(@CRLF & "Tried to process : " & $fName & "BY|ON" & $Target)
|
||
|
Return True
|
||
|
EndFunc
|
||
|
|
||
|
Func EmptyBankCheck($Controler)
|
||
|
$BankData = GUICtrlRead($Controler)
|
||
|
if $BankData = "-1" Then
|
||
|
GUICtrlSetData($Controler,"No APK Files, Add Files with menu !")
|
||
|
Return 76
|
||
|
EndIf
|
||
|
EndFunc
|