#comments-start
Copyright 2011-2012 Jeroen De Meerleer
This file is part of Go Cops! 2: The Reanimation
Go Cops! 2: The Reanimation is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Go Cops! 2: The Reanimation is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Go Cops! 2: The Reanimation If not, see <http://www.gnu.org/licenses/>.
#comments-end
func manager()
; Create window
$managergui=guicreate("Go Cops!: Manager", 300, 350)
;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;Extensions-Tab;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
guictrlcreatetab(5, 5, 290, 340)
GUICtrlCreateTabItem("Extensions")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;Installation of New Extensions;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Label
guictrlcreatelabel("Download new extensions", 35, 35)
;combo
$downloadlist=guictrlcreatecombo("", 30, 50, 230)
;downloadbutton
$downloadbut=guictrlcreatebutton("Download extension", 35, 75, 220, 50)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;Modifications of Extensions;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; label
guictrlcreatelabel("Modify extensions", 35, 150)
; combo
$modifylist=guictrlcreatecombo("", 30, 165, 230)
; delete button
$delbut=guictrlcreatebutton("Delete extension", 35, 190, 110, 50)
; edit-button
$editbut=guictrlcreatebutton("Edit extension", 145, 190, 110, 50)
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;Fill combos;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
; set count
$exttotal=0
; declare array
dim $extension[$exttotal+1][5]
; set start values of combos
$setdatalocal=string("Select an extension to modify")
$setdatadown=string("Select an extension to download")
; start loop
while 1
; resize array
redim $extension[$exttotal+1][5]
; read filename
$extension[$exttotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "file" & $exttotal, int(2))
; if filename of extension is not set => exit the loop
if $extension[$exttotal][0] = int(2) then
ExitLoop
Else
; read identification of Extension
$extension[$exttotal][1] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "iden" & $exttotal, int(2))
; set count for installed extensions
$localext=0
; create array
dim $lextension[$localext+1][2]
; start loop
while 1
; resize array
ReDim $lextension[$localext+1][2]
; read title and identification of extension
$lextension[$localext][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext, int(2))
$lextension[$localext][1] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext, int(2))
; if remote extension is found in installed extensions
if $lextension[$localext][1] = $extension[$exttotal][1] Then
; add the extension the modifications combo
$setdatalocal=string($setdatalocal & "|" & $lextension[$localext][0])
; exit the loop
exitloop
; if remote extension is not found in installed extensions
elseif $lextension[$localext][1] = int(2) then
; read name of remote extension
$extension[$exttotal][2] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "title" & $exttotal, int(2))
; add the extension to the download combo
$setdatadown=string($setdatadown & "|" & $extension[$exttotal][2])
; exit the loop
ExitLoop
; if local extension is not set
Else
; add 1 to the count
$localext+=1
EndIf
WEnd
EndIf
; add 1 to the count
$exttotal+=1
WEnd
; set data to the combos
guictrlsetdata($downloadlist, "|" & $setdatadown)
guictrlsetdata($modifylist, "|" & $setdatalocal)
; create the information input
$extinput=guictrlcreateinput("", 30, 250, 230, 85, $ES_MULTILINE)
;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;campaigns-tab;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;
#cs
Process to add the campaigns to the combos is the same as the extensions
If you want information about this process please check the comments above in the extensions-tab section
#ce
GUICtrlCreateTabItem("Campaigns")
inetget($web & "game/camp.php", @appdatadir & "\Go Cops!\temp\camp.ini", 1)
guictrlcreatelabel("Download new campaigns", 35, 35)
$campdownloadlist=guictrlcreatecombo("", 30, 50, 230)
$campdownloadbut=guictrlcreatebutton("Download campaign", 35, 75, 220, 50)
guictrlcreatelabel("Modify campaign", 35, 150)
$campmodifylist=guictrlcreatecombo("", 30, 165, 230)
$campdelbut=guictrlcreatebutton("Delete campaigns", 35, 190, 110, 50)
$campeditbut=guictrlcreatebutton("Edit campaign", 145, 190, 110, 50)
$camptotal=0
dim $campaign[$camptotal+1][5]
$campsetdatalocal=string("Select a campaign to modify")
$campsetdatadown=string("Select a campaign to download")
while 1
redim $campaign[$camptotal+1][5]
$campaign[$camptotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "file" & $camptotal, int(2))
if $campaign[$camptotal][0] = int(2) then
ExitLoop
Else
$campaign[$camptotal][1] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "iden" & $camptotal, int(2))
$localcamp=0
dim $lcampaign[$localcamp+1][2]
while 1
ReDim $lcampaign[$localcamp+1][2]
$lcampaign[$localcamp][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp, int(2))
$lcampaign[$localcamp][1] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "iden" & $localcamp, int(2))
if $lcampaign[$localcamp][1] = $campaign[$camptotal][1] Then
$campsetdatalocal=string($campsetdatalocal & "|" & $lcampaign[$localcamp][0])
exitloop
elseif $lcampaign[$localcamp][1] = int(2) then
$campaign[$camptotal][2] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "title" & $camptotal, int(2))
$campsetdatadown=string($campsetdatadown & "|" & $campaign[$camptotal][2])
ExitLoop
Else
$localcamp+=1
EndIf
WEnd
EndIf
$camptotal+=1
WEnd
guictrlsetdata($campdownloadlist, "|" & $campsetdatadown)
guictrlsetdata($campmodifylist, "|" & $campsetdatalocal)
$campinput=guictrlcreateinput("", 30, 250, 230, 85, $ES_MULTILINE)
;;;;;;;;;;;;;;;;;;;;;
;;;;;;saves-tab;;;;;;
;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateTabItem("Saves")
; create list of the saves
$saveslist=guictrlcreatelist("", 15, 50, 150, 275)
; set count for loop
$savetotal=0
; declare array
dim $saves[$savetotal+1]
; start loop
while 1
; resize array
redim $saves[$savetotal+1]
; read name of the save file
$saves[$savetotal]=iniread(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $savetotal, int(2))
; if save not exists exit the loop
if $saves[$savetotal]=int(2) then ExitLoop
; add the save to the list
guictrlsetdata($saveslist, $saves[$savetotal])
; add 1 to the count
$savetotal+=1
WEnd
; create buttons
$savesdelbut=guictrlcreatebutton("Delete", 175, 50, 100, 75)
$savesrenbut=guictrlcreatebutton("Rename", 175, 125, 100, 75)
$savescpbut=guictrlcreatebutton("Copy", 175, 200, 100, 75)
;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;options-tab;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
GUICtrlCreateTabItem("Options")
; create label for the version to be download
guictrlcreatelabel("Version", 35, 35)
; create combo
$stdv=guictrlcreatecombo ( "", 35, 50, 230)
guictrlsetdata ( $stdv, "stable|devel" )
; create save button
$optsave=guictrlcreatebutton("Save options", 30, 250, 230, 85)
; view the window
guisetstate()
; start the loop
while 1
; get message from the window
$msg=guigetmsg()
select
; message was close
Case $msg=$GUI_EVENT_CLOSE
; delete the window and return to main menu
guidelete($managergui)
return
; case was save option
case $msg=$optsave
; read options
$stdvread = guictrlread ( $stdv )
; save option
iniwrite ( @AppDataDir & "\Go Cops!\settings.ini", "general", "version", $stdvread)
; case was rename a save file
case $msg=$savesrenbut
; read the save file
$saveread=guictrlread($saveslist)
; create window
$savesren = guicreate("Rename", 200, 125)
; create label
guictrlcreatelabel("Enter name", 10, 15)
; create input with the current name inserted
$savesrenctrl=guictrlcreateinput($saveread, 20, 30, 160)
; create button
$renbut=guictrlcreatebutton("Rename", 20, 75, 160, 40)
; view window
guisetstate()
while 1
; get message
$renmsg=guigetmsg()
select
; message was close
Case $renmsg=$GUI_EVENT_CLOSE
; delete the window and exit the loop
guidelete($savesren)
ExitLoop
; message was rename
Case $renmsg=$renbut
; start count
$checksave=0
while 1
; read name of the save file
$rensavecheck=iniread(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $checksave, int(2))
; if save does not exist => exit the loop
if $rensavecheck=int(2) Then
; delete the window
guidelete($savesren)
ExitLoop
; if original name is the same as the current save
elseif $saveread=$rensavecheck Then
; read new filename
$newsaveread=guictrlread($savesrenctrl)
; rename the file
filemove(@AppDatadir & "\Go Cops!\save files\" & $saveread & ".gcs", @AppDatadir & "\Go Cops!\save files\" & $newsaveread & ".gcs")
; rename the save in the settingsfile
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $checksave, $newsaveread)
; delete the window
guidelete($savesren)
; exit the loop
ExitLoop
EndIf
; add 1 to count
$checksave+=1
WEnd
EndSelect
WEnd
; message was copy the save
case $msg=$savescpbut
; read save file
$saveread=guictrlread($saveslist)
; create window
$savescp = guicreate("Copy", 200, 125)
; create a label
guictrlcreatelabel("Enter name of copy", 10, 15)
; create input
$savesinput=guictrlcreateinput($saveread, 20, 30, 160)
; create button
$cpbut=guictrlcreatebutton("Rename", 20, 75, 160, 40)
; view window
guisetstate()
; start loop
while 1
; get message
$cpmsg=guigetmsg()
select
; message was close => close window and exit the loop
Case $cpmsg=$GUI_EVENT_CLOSE
guidelete($savescp)
ExitLoop
case $cpmsg=$cpbut
; set count
$checksave=0
while 1
; read name of save file
$cpsavecheck=iniread(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $checksave, int(2))
; if save is not found => exit the loop
if $cpsavecheck=int(2) Then
; delete the window
guidelete($savesren)
ExitLoop
; file was found
elseif $saveread=$cpsavecheck Then
; read new filename
$newsaveread=guictrlread($savesinput)
; copy the file
filecopy(@AppDatadir & "\Go Cops!\save files\" & $saveread & ".gcs", @AppDatadir & "\Go Cops!\save files\" & $newsaveread & ".gcs")
; start loop
while 1
; check if save exists
$cpsavecheck=iniread(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $checksave, int(2))
; if save does not exist exit the loop
if $cpsavecheck = int(2) then ExitLoop
; add 1 to the count
$checksave+=1
WEnd
; write the file to the settings file
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $checksave, $newsaveread)
; delete the window
guidelete($savescp)
; exit the loop
ExitLoop
EndIf
; add 1 to the count
$checksave+=1
WEnd
EndSelect
WEnd
; message was delete
case $msg=$savesdelbut
; read save file
$saveread=guictrlread($saveslist)
; ask for confimation
$savesconf = MsgBox(4, "Confirmation", "Are you sure you want to delete this saved file?")
; yes is pressed
if $savesconf = 6 Then
; set count
$localsaves=0
; declare array
dim $lsaves[$localsaves+1][5]
; start loop
while 1
; resize array
redim $lsaves[$localsaves+1][5]
; read save-name
$lsaves[$localsaves][0]=iniread(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $localsaves, int(2))
; names are equal
If $saveread = $lsaves[$localsaves][0] Then
; start loop
while 1
; resize array
redim $lsaves[$localsaves+1][5]
; check if next slot is used
$used=iniread(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $localsaves+1, int(2))
; if slot is not used (delete it)
if $used = int(2) Then
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $localsaves)
; exit 2 loops
ExitLoop 2
; if next slot is used => rename it on previous
Else
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "saves", "name" & $localsaves, $used)
EndIf
; add 1 to count
$localsaves+=1
WEnd
; if name is not found => exit the loop
elseif $lsaves[$localsaves][0]=int(2) then
exitloop
; save names were not equal
Else
; add 1 to count
$localsaves+=1
EndIf
WEnd
; delete the file
filedelete(@AppDataDir & "\Go Cops!\save files\" & $saveread & ".gcs")
; file is deleted
msgbox(0, "Save file deleted", "Save file " & $saveread & " has been deleted!")
EndIf
; something changed in the modify list on extensions-tab
case $msg=$modifylist
; read the new name
$ext=guictrlread($modifylist)
; set a count
$localext=0
; start loop
while 1
; resize array
redim $lextension[$localext+1][5]
; read title of the local extension
$lextension[$localext][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext, int(2))
; if both names are equal read the desciption and then exit the loop
If $ext = $lextension[$localext][0] Then
$data=iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "des" & $localext, "No extension selected")
exitloop
EndIf
; add 1 to the count
$localext+=1
WEnd
; set data the input-window
guictrlsetdata($extinput, $data)
; something changed in the modify list on the campaigns-tab
case $msg=$campmodifylist
#cs
the process for this is the same as the modifylist for the extensions.
See case above for information
#ce
$camp=guictrlread($campmodifylist)
$localcamp=0
while 1
redim $lcampaign[$localcamp+1][5]
$lcampaign[$localcamp][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp, int(2))
If $camp = $lcampaign[$localcamp][0] Then
$data=iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "des" & $localcamp, "No campaign selected")
exitloop
EndIf
$localcamp+=1
WEnd
guictrlsetdata($campinput, $data)
; something changed in the downloadlist on the extensionstab
case $msg=$downloadlist
#cs
The process for this is the same as the process for the modifylist.
Please check the case $msg=$modifylist for more information.
#ce
$ext=guictrlread($downloadlist)
$exttotal=0
while 1
redim $extension[$exttotal+1][5]
$extension[$exttotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "title" & $exttotal, int(2))
If $ext = $extension[$exttotal][0] Then
$data=iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "des" & $exttotal, "No extension selected")
exitloop
EndIf
$exttotal+=1
WEnd
guictrlsetdata($extinput, $data)
; something changed in the downloadlist of the campaigns
case $msg=$campdownloadlist
#cs
The process for this is the same as the process for the modifylist.
Please check the case $msg=$modifylist for more information.
#ce
$camp=guictrlread($campdownloadlist)
$camptotal=0
while 1
redim $campaign[$camptotal+1][5]
$campaign[$camptotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "title" & $camptotal, int(2))
If $camp = $campaign[$camptotal][0] Then
$data=iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "des" & $camptotal, "No campaign selected")
exitloop
EndIf
msgbox(0, "", $campaign[$camptotal][0] & @CRLF & $camp)
$camptotal+=1
WEnd
guictrlsetdata($campinput, $data)
; delete an extension
Case $msg=$delbut
; read the name
$mod=guictrlread($modifylist)
; as for confirmation
$extconf = MsgBox(4, "Confirmation", "Are you sure you want to delete this extension?")
; confirmation was given
if $extconf = 6 Then
; start count
$localext=0
; start loop
while 1
; if name of extension to delete and the counted extension are equal
If $mod = $lextension[$localext][0] Then
; start loop
while 1
; resize array
redim $lextension[$localext+1][5]
; read next slot
$used=iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext+1, int(2))
; slot is not used
if $used = int(2) Then
; delete all information
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext)
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $localext)
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext)
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "kind" & $localext)
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "des" & $localext)
; exit 2 loops
ExitLoop 2
; next slot is used
Else
; move the next slot to the previous one
$lextension[$localext][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext+1, int(2))
$lextension[$localext][1] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $localext+1, int(2))
$lextension[$localext][2] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext+1, int(2))
$lextension[$localext][3] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "kind" & $localext+1, int(2))
$lextension[$localext][4] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "des" & $localext+1, int(2))
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext, $lextension[$localext][0])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $localext, $lextension[$localext][1])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext, $lextension[$localext][2])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "kind" & $localext, $lextension[$localext][3])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "des" & $localext, $lextension[$localext][4])
; add 1 to count
$localext+=1
EndIf
WEnd
; names were not equal
Else
$localext+=1
EndIf
WEnd
; delete file
filedelete(@AppDataDir & "\Go Cops!\extensions\" & $mod & ".gce")
; view confirmation
msgbox(0, "Extension Deleted", "Extension " & $mod & "has been deleted!")
EndIf
; campaign must be deleted
Case $msg=$campdelbut
#cs
The process for this is the same as the process for deleting an extension.
Please check the case $msg=$delbut for more information.
#ce
$mod=guictrlread($campmodifylist)
$campconf = MsgBox(4, "Confirmation", "Are you sure you want to delete this extension?")
if $campconf = 6 Then
$localcamp=0
while 1
If $mod = $lcampaign[$localcamp][0] Then
while 1
redim $lcampaign[$localcamp+1][5]
$used=iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "iden" & $localcamp+1, int(2))
if $used = int(2) Then
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "iden" & $localcamp)
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp)
inidelete(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "des" & $localcamp)
ExitLoop 2
Else
$lcampaign[$localext][0] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp+1, int(2))
$lcampaign[$localext][1] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "iden" & $localcamp+1, int(2))
$lcampaign[$localext][2] = iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "des" & $localcamp+1, int(2))
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp, $lcampaign[$localcamp][0])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "iden" & $localcamp, $lcampaign[$localcamp][1])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "des" & $localcamp, $lcampaign[$localcamp][2])
$localext+=1
EndIf
WEnd
Else
$localext+=1
EndIf
WEnd
filedelete(@AppDataDir & "\Go Cops!\campaigns\" & $mod & ".gce")
msgbox(0, "Campaign Deleted", "Campaign " & $mod & "has been deleted!")
EndIf
; extension must be edited
case $msg=$editbut
; read combo
$mod=guictrlread($modifylist)
; run the editor
run('"' & @AppDataDir & '\Go Cops!\core\autoit\SciTE\SciTE.exe" "' & @AppDataDir & '\Go Cops!\extensions\' & $mod & '.gce"' )
; campaign must be edited
case $msg=$campeditbut
; read combo
$mod=guictrlread($campmodifylist)
; run the editor
run('"notepad.exe" "' & @AppDataDir & '\Go Cops!\campaigns\' & $mod & '.gcc"' )
; extension must be downloaded
case $msg=$downloadbut
; read combo
$mod=guictrlread($downloadlist)
; start count
$exttotal=0
; create GUI
$extupdate=guicreate("Instalation", 125, 50)
; create label
guictrlcreatelabel("Installing extensions...", 7, 15)
; view window
guisetstate(@sw_show, $extupdate)
; start loop
while 1
; resize array
redim $extension[$exttotal+1][6]
; read title of the extension
$extension[$exttotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "title" & $exttotal, int(2))
; extension found
If $mod = $extension[$exttotal][0] Then
; start count
$localext=0
; start loop
while 1
; read title of local extension
$read=iniread(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext, int(2))
; slot is not used => exit the loop
if $read = int(2) then ExitLoop
; add 1 to count
$localext += 1
WEnd
; read filename
$data=iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "file" & $exttotal, int(2))
; read the details of the extension
$extension[$exttotal][1] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "title" & $exttotal, int(2))
$extension[$exttotal][2] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "date" & $exttotal, int(2))
$extension[$exttotal][3] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "iden" & $exttotal, int(2))
$extension[$exttotal][4] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "kind" & $exttotal, int(2))
$extension[$exttotal][5] = iniread(@AppDataDir & "\Go Cops!\temp\updates.ini", "extensions", "des" & $exttotal, int(2))
; add details to the settings file
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "title" & $localext, $extension[$exttotal][1])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "date" & $localext, $extension[$exttotal][2])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "iden" & $localext, $extension[$exttotal][3])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "kind" & $localext, $extension[$exttotal][4])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "extensions", "des" & $localext, $extension[$exttotal][5])
; download the extension
inetget($data, @AppDataDir & "\Go Cops!\extensions\" & $extension[$exttotal][1] & ".gce", 1)
; delete GUI
guidelete($extupdate)
; exit the loop
exitloop
EndIf
; add 1 to count
$exttotal+=1
WEnd
; download campaign
case $msg=$campdownloadbut
#cs
The process for this is the same as the process for downloading an extension.
Please check the case $msg=$downloadbut for more information.
#ce
$mod=guictrlread($campdownloadlist)
$camptotal=0
$campupdate=guicreate("Instalation", "125", "50")
guictrlcreatelabel("Installing campaign...", "7", "15")
guisetstate(@sw_show, $campupdate)
while 1
redim $campaign[$camptotal+1][6]
$campaign[$camptotal][0] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "title" & $camptotal, int(2))
If $mod = $campaign[$camptotal][0] Then
$localcamp=0
while 1
$read=iniread(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp, int(2))
if $read = int(2) then ExitLoop
$localcamp += 1
WEnd
$data=iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "file" & $camptotal, int(2))
$extension[$camptotal][1] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "title" & $camptotal, int(2))
$extension[$camptotal][2] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "iden" & $camptotal, int(2))
$extension[$camptotal][3] = iniread(@AppDataDir & "\Go Cops!\temp\camp.ini", "campaigns", "des" & $camptotal, int(2))
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "title" & $localcamp, $extension[$camptotal][1])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "iden" & $localcamp, $extension[$camptotal][2])
iniwrite(@AppDataDir & "\Go Cops!\settings.ini", "campaigns", "des" & $localcamp, $extension[$camptotal][3])
inetget($data, @AppDataDir & "\Go Cops!\campaigns\" & $extension[$camptotal][1] & ".gcc", 1)
guidelete($campupdate)
exitloop
EndIf
$camptotal+=1
WEnd
EndSelect
WEnd
EndFunc