Move service name to constructor

This commit is contained in:
Fabian Wiesel
2024-02-26 19:41:37 +01:00
parent 58095bc67b
commit c6c60d9dbd

View File

@@ -219,19 +219,15 @@ internal class ServiceInfoWrapper(private val info: NsdServiceInfo) {
get() = info.host.hostAddress get() = info.host.hostAddress
val port: Int val port: Int
get() = info.port get() = info.port
val name: String // If there is more than one service with the same name on the network, it will
get() { // have a number at the end, but will appear as the following:
// If there is more than one service with the same name on the network, it will // "ChildMonitor\\032(number)
// have a number at the end, but will appear as the following: // or
// "ChildMonitor\\032(number) // "ChildMonitor\032(number)
// or // Replace \\032 and \032 with a " "
// "ChildMonitor\032(number) val name: String = info.serviceName
// Replace \\032 and \032 with a " " .replace("\\\\032", " ")
var serviceName = info.serviceName .replace("\\032", " ")
serviceName = serviceName.replace("\\\\032", " ")
serviceName = serviceName.replace("\\032", " ")
return serviceName
}
override fun toString(): String { override fun toString(): String {
return name return name