commit 07/10/2025
This commit is contained in:
@@ -12,6 +12,7 @@ import org.tinylog.Logger
|
||||
import oshi.SystemInfo
|
||||
import oshi.hardware.CentralProcessor
|
||||
import oshi.hardware.GlobalMemory
|
||||
import oshi.hardware.NetworkIF
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.time.LocalDateTime
|
||||
@@ -39,6 +40,7 @@ class Somecodes {
|
||||
val si = SystemInfo()
|
||||
val processor: CentralProcessor = si.hardware.processor
|
||||
val memory : GlobalMemory = si.hardware.memory
|
||||
|
||||
val datetimeformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")
|
||||
val dateformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy")
|
||||
val dateformat2: DateTimeFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy")
|
||||
@@ -263,6 +265,18 @@ class Somecodes {
|
||||
, (usedMemory.toDouble() / totalMemory * 100))
|
||||
}
|
||||
|
||||
fun GetNetworkStatus(networkname: String) : String{
|
||||
val networks: List<NetworkIF> = si.hardware.networkIFs.toList()
|
||||
//TODO cari network yang sesuai dengan networkname
|
||||
// networks.forEach { net ->
|
||||
//
|
||||
// println(net.name+" "+net.displayName+" ")
|
||||
// net.updateAttributes()
|
||||
// println("upload: ${SizetoHuman(net.bytesSent)} sent, download: ${SizetoHuman(net.bytesRecv)} received")
|
||||
// }
|
||||
return ""
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a value is a valid non-blank string.
|
||||
* @param value The value to check.
|
||||
|
||||
Reference in New Issue
Block a user