From ef895b8f3259324b39550de2d1de17a367a005f3 Mon Sep 17 00:00:00 2001 From: Debayan Sutradhar Date: Fri, 17 Apr 2020 13:00:07 +0530 Subject: [PATCH] Updated logic --- .idea/vcs.xml | 5 ++--- src/PCHWRMClient/Main.java | 8 ++++++-- src/PCHWRMClient/dash.java | 4 +++- src/PCHWRMClient/io.java | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index def6a6a..94a25f7 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,7 +1,6 @@ - + - - + \ No newline at end of file diff --git a/src/PCHWRMClient/Main.java b/src/PCHWRMClient/Main.java index 58da2ed..d69bd9c 100644 --- a/src/PCHWRMClient/Main.java +++ b/src/PCHWRMClient/Main.java @@ -3,22 +3,26 @@ import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Scene; +import javafx.scene.image.Image; import javafx.stage.Stage; public class Main extends Application { @Override - public void start(Stage primaryStage) throws Exception { + public void start(Stage primaryStage) + { Platform.setImplicitExit(false); dash d = new dash(this, primaryStage); Scene s = new Scene(d); primaryStage.setScene(s); + primaryStage.getIcons().add(new Image(getClass().getResource("assets/icon.png").toExternalForm())); primaryStage.setResizable(false); - primaryStage.setTitle("PCHWRM By github.com/dubbadhar <3"); + primaryStage.setTitle("PCHWRM Client By github.com/dubbadhar <3"); primaryStage.show(); primaryStage.setOnCloseRequest(event->{ try { if(d.isConnected){ + d.writeToOS("QUIT"); Thread.sleep(500); d.isConnected=false; } diff --git a/src/PCHWRMClient/dash.java b/src/PCHWRMClient/dash.java index afd9f3b..5699507 100644 --- a/src/PCHWRMClient/dash.java +++ b/src/PCHWRMClient/dash.java @@ -118,9 +118,11 @@ public void minimizeToTraySetup() exitItem.addActionListener(l->{ try { if(isConnected){ + writeToOS("QUIT"); Thread.sleep(500); isConnected=false; } + tray.remove(ti); Platform.exit(); } catch (Exception e) @@ -519,7 +521,7 @@ public ArrayList getValuesFromWMI() throws Exception String out = io.getShellOutput("powershell.exe get-wmiobject -namespace root\\OpenHardwareMonitor -query 'SELECT Value,Name,SensorType FROM Sensor'").replace("\r\n\r\n__GENUS : 2\r\n__CLASS : Sensor\r\n__SUPERCLASS : \r\n__DYNASTY : \r\n__RELPATH : \r\n__PROPERTY_COUNT : 3\r\n__DERIVATION : {}\r\n__SERVER : \r\n__NAMESPACE : \r\n__PATH : \r\n",""); ArrayList returnable = new ArrayList<>(); - String[] x = out.split("PSComputerName :"); + String[] x = out.split("PSComputerName {3}:"); for(int i =0;i