Skip to content

Commit

Permalink
1.11.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizlim authored and Rizlim committed Jun 3, 2019
1 parent 1b45480 commit e676f58
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 12 deletions.
17 changes: 17 additions & 0 deletions src/main/kotlin/PAL2/Database/DataBaseHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,23 @@ fun putSetting(name: String, value: String)
connection.close()
}

fun insSetting(name: String, value: String)
{
val connection = connectToDB()
val sql = "INSERT into Settings values (\'$name\', \'$value\')"
connection.createStatement().execute(sql)
connection.close()
}

fun checkSettingExist(name: String): Boolean
{
val connection = connectToDB()
var rs = connection.createStatement().executeQuery("SELECT COUNT(*) FROM Settings WHERE name = \'$name\'")
val c = rs.getInt(1)
connection.close()
return (c != 0)
}

fun filterSettingsCheck(): FilterSettings
{
val connection = connectToDB()
Expand Down
25 changes: 25 additions & 0 deletions src/main/kotlin/PAL2/GUI/CoreController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ class CoreController : Initializable
populateFiltersList()
}

GlobalScope.launch {
if (GlobalData.db_file.exists())
if(doesTableExist("Settings"))
if (checkSettingExist("tkOnClose"))
{
val setting = getSetting("tkOnClose")
GlobalData.allowTaskKill = setting == "1"
Platform.runLater { closeAddonsWhenPALCloses.isSelected = GlobalData.allowTaskKill }
}
}

GlobalScope.launch {
init()
setSettings()
Expand Down Expand Up @@ -2041,6 +2052,20 @@ class CoreController : Initializable
}
}

@FXML
private lateinit var closeAddonsWhenPALCloses: CheckBox

fun dbSyncOnCloseKill(actionEvent: ActionEvent)
{
if (!checkSettingExist("tkOnClose"))
insSetting("tkOnClose", "0")

val state = closeAddonsWhenPALCloses.isSelected
GlobalData.allowTaskKill = state
val db_state = if (state) "1" else "0"
putSetting("tkOnClose", db_state)
}

@FXML
private lateinit var listViewFilters: ListView<AnchorPane>

Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/PAL2/GlobalData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class GlobalData
var launchList = ArrayList<File>()
var steam_poe = false
var launch_externals = true
var allowTaskKill = true

fun addToListOfAddons(arr: Array<PAL_AddonFullData>)
{
Expand Down
26 changes: 14 additions & 12 deletions src/main/kotlin/PAL2/SystemHandling/AddonUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ fun updateAddon(aid: Int, image: Image)

fun closeAllAddons()
{
taskKill("autohotkey.exe /F")
taskKill("Path of Maps Client.exe")
taskKill("TraderForPoe.exe")
taskKill("javaw.exe")
taskKill("java.exe")
taskKill("POE-Trades-Companion.exe")
taskKill("XenonTrade.exe")
taskKill("LabCompass.exe")
taskKill("Exilence.exe")
taskKill("CurrencyCop.exe")
taskKill("PoE Custom Soundtrack.exe")

if (GlobalData.allowTaskKill)
{
taskKill("autohotkey.exe /F")
taskKill("Path of Maps Client.exe")
taskKill("TraderForPoe.exe")
taskKill("javaw.exe")
taskKill("java.exe")
taskKill("POE-Trades-Companion.exe")
taskKill("XenonTrade.exe")
taskKill("LabCompass.exe")
taskKill("Exilence.exe")
taskKill("CurrencyCop.exe")
taskKill("PoE Custom Soundtrack.exe")
}
}

fun taskKill(name: String): Process
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/CoreUI.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@
<Font name="System Bold" size="16.0" />
</font>
</Text>
<CheckBox fx:id="closeAddonsWhenPALCloses" onAction="#dbSyncOnCloseKill" layoutX="14.0" layoutY="243.0" mnemonicParsing="false" selected="true" text="Close addons when PAL closes">
<font>
<Font size="16.0" />
</font>
</CheckBox>
</children>
</AnchorPane>
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false">
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/update_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<li>FilterBlast Loot Filters support</li>
<li>Generally Code enhancements</li>
<li>Taskkill properly kills AHKs now</li>
<li>Added checkbox for closing addons on close ON BY DEFAULT</li>
<li>Hotfix: SQL sux ok</li>
<li>Hotfix-2: File extension checking</li>
<li>Hotfix-3: More SQL issues</li>
Expand Down

0 comments on commit e676f58

Please sign in to comment.