Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Rizlim authored and Rizlim committed Feb 14, 2019
1 parent c4b4b5e commit f70d487
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 22 deletions.
41 changes: 33 additions & 8 deletions src/main/kotlin/PAL2/GUI/CoreController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import javafx.stage.DirectoryChooser
import javafx.stage.FileChooser
import javafx.stage.Stage
import kotlinx.coroutines.*
import org.apache.commons.io.FileUtils
import java.awt.Desktop
import java.io.File
import java.net.URI
Expand All @@ -54,6 +55,10 @@ class CoreController : Initializable
init()
setSettings()
showMOTD()
if (GlobalData.launchPOEonLaunch)
{
PAL2.SystemHandling.launchPoE()
}
}
core_tabpane.tabs.remove(addonDescTab)
}
Expand Down Expand Up @@ -602,14 +607,11 @@ class CoreController : Initializable
@FXML
fun launchPoE(event: MouseEvent)
{
if (event.button == MouseButton.PRIMARY)
{
PAL2.SystemHandling.launchPoE()
}
else if (event.button == MouseButton.SECONDARY)
if (event.button == MouseButton.SECONDARY)
{
launchAddons()
GlobalData.launch_addons = true
}
PAL2.SystemHandling.launchPoE()

}

Expand Down Expand Up @@ -1128,7 +1130,7 @@ class CoreController : Initializable
private lateinit var sGeneral: AnchorPane


val settingsArray = arrayOf("About", "AutoHotKey", "General Settings", "Folders")
val settingsArray = arrayOf("About", "AutoHotKey", "General Settings", "Folders", "Log")
fun populateSettingsList()
{
Platform.runLater { listViewSettings.items.addAll(settingsArray) }
Expand All @@ -1147,7 +1149,15 @@ class CoreController : Initializable
private fun SETAbout()
{
Platform.runLater {
hyperlinkVersion.text = GlobalData.version
if (GlobalData.debugging)
{
hyperlinkVersion.text = "DEBUGGING MODE ${GlobalData.version}"
}
else
{
hyperlinkVersion.text = GlobalData.version
}

}
}

Expand Down Expand Up @@ -1221,6 +1231,7 @@ class CoreController : Initializable
"AutoHotKey" -> showAHK()
"General Settings" -> showGeneralSettings()
"Folders" -> showFolders()
"Log" -> showLog()
}
}
}
Expand Down Expand Up @@ -1250,13 +1261,21 @@ class CoreController : Initializable
Platform.runLater { sAbout.isVisible = true }
}

private fun showLog()
{
hideAll()
Platform.runLater { debugLog.text = FileUtils.readFileToString(File("PAL_Logger.log")) }
Platform.runLater { anchorLog.isVisible = true }
}

private fun hideAll()
{
Platform.runLater {
sAutoHotKey.isVisible = false
sFolders.isVisible = false
sGeneral.isVisible = false
sAbout.isVisible = false
anchorLog.isVisible = false
}
}

Expand Down Expand Up @@ -1460,6 +1479,12 @@ class CoreController : Initializable
}
}

@FXML
private lateinit var anchorLog: AnchorPane

@FXML
private lateinit var debugLog: TextArea

@FXML
private lateinit var reddit: Hyperlink

Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/PAL2/GlobalData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class GlobalData
{
companion object
{
var version = "1.0.4"
var version = "1.0.5"
var debugging = false
var install_dir = ""
var github_token = ""
Expand All @@ -23,6 +23,7 @@ class GlobalData
var first_launch_after_update = true
var primaryPoEFile: File? = null
var poeLocations = ArrayList<String>()
var logFile = ""

var loot_filter_path = ""
var show_update_note = false
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/PAL2/Launcher.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import PAL2.GUI.CoreApplication
import SystemHandling.deleteFile
import SystemHandling.verifyFolder
import javafx.application.Application
import mu.KotlinLogging
import org.apache.commons.io.FileUtils
import org.kohsuke.github.GitHubBuilder
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.io.PrintStream
import java.util.Locale
import kotlin.Exception

Expand Down
14 changes: 12 additions & 2 deletions src/main/kotlin/PAL2/SystemHandling/LaunchHandling.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ fun launchAddon(aid: Int)

private fun launch_poe(exe: String)
{
logger.debug { "CALLED: LAUNCH_POE(exe) | exe = \'$exe\'" }

if (exe.contains("PathOfExileSteam.exe") || exe.contains("PathOfExile_x64Steam.exe"))
{
logger.debug { "Attempting to run Steam PoE" }
runSteamPoE()
}
else if (exe.contains("PathOfExile.exe") || exe.contains("PathOfExile_x64.exe"))
Expand All @@ -51,21 +54,27 @@ private fun launch_poe(exe: String)
val executable: String
if (exe.contains("PathOfExile_x64.exe"))
{
logger.debug { "Found PathOfExile_x64.exe" }
executable = "PathOfExile_x64.exe"
dir = exe.replace(executable, "")
logger.debug { "dir = $dir" }
}
else
{
logger.debug { "ELSE case" }
executable = "PathOfExile.exe"
dir = exe.replace(executable, "")
logger.debug { "dir = $dir" }
}
try
{
Runtime.getRuntime().exec(exe, null, File(dir))
logger.debug { "Runtime command: \"$exe\", NULL, ${File(dir)}" }
logger.debug { "dir = $dir" }
Runtime.getRuntime().exec("\"$exe\"", null, File(dir))
}
catch (e: IOException)
{
e.printStackTrace()
logger.error { e.printStackTrace() }
}

}
Expand Down Expand Up @@ -162,6 +171,7 @@ fun launchPoE()
{
if (f.exists())
{
launchAddons()
launch_poe(f.path)
}
}
Expand Down
13 changes: 11 additions & 2 deletions src/main/resources/CoreUI.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
Expand Down Expand Up @@ -394,7 +395,7 @@
</image>
</ImageView>
<Hyperlink fx:id="patreon" layoutX="116.0" layoutY="307.0" onAction="#patreon" text="Support PAL on Patreon" textFill="#0066cc" />
<Hyperlink fx:id="hyperlinkVersion" onAction="#showUpdates" alignment="CENTER_RIGHT" layoutX="324.0" prefHeight="23.0" prefWidth="126.0" text="1.0.0" textAlignment="RIGHT" textFill="#0066cc">
<Hyperlink fx:id="hyperlinkVersion" alignment="CENTER_RIGHT" layoutX="324.0" onAction="#showUpdates" prefHeight="23.0" prefWidth="126.0" text="1.0.0" textAlignment="RIGHT" textFill="#0066cc">
<font>
<Font size="16.0" />
</font></Hyperlink>
Expand Down Expand Up @@ -516,7 +517,15 @@
</Text>
</children>
</AnchorPane>
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
<AnchorPane fx:id="anchorLog" layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false">
<children>
<TextArea fx:id="debugLog" layoutX="10.0" layoutY="35.0" prefHeight="430.0" prefWidth="430.0" />
<Text fill="WHITE" layoutX="14.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Log">
<font>
<Font size="29.0" />
</font>
</Text>
</children></AnchorPane>
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
Expand Down
24 changes: 15 additions & 9 deletions src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<configuration status="WARN">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

<File name="MyFile" fileName="PAL_Logger.log">
<PatternLayout pattern="%d{yyyy-mm-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</File>
</appenders>

<loggers>
<root level="debug">
<appender-ref ref="Console"/>
<appender-ref ref="MyFile"/>
</root>
</loggers>
</configuration>
7 changes: 7 additions & 0 deletions src/main/resources/update_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@

</style>
<body>
<div class="block_1 hline-bottom"><h1>Version 1.0.5</h1></div>
<ul>
<li>Potential Fix for addons not launching.</li>
<li>Added a log to the settings page.</li>
<li>Still investigating PoE not launching upon click.</li>
</ul>

<div class="block_1 hline-bottom"><h1>Version 1.0.4</h1></div>
<ul>
<li>You can now set the addons on launch by selecting them in the installed tab and clicking to enable.</li>
Expand Down

0 comments on commit f70d487

Please sign in to comment.