Open-source multiplayer game server compatible with the RuneScape client
https://www.openrs2.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
package org.openrs2.archive.client
|
|
|
|
import io.ktor.http.ContentType
|
|
|
|
public enum class ArtifactFormat {
|
|
CAB,
|
|
JAR,
|
|
NATIVE,
|
|
PACK200,
|
|
PACKCLASS;
|
|
|
|
public fun getPrefix(os: OperatingSystem): String {
|
|
return when (this) {
|
|
NATIVE -> os.getPrefix()
|
|
else -> ""
|
|
}
|
|
}
|
|
|
|
public fun getExtension(os: OperatingSystem): String {
|
|
return when (this) {
|
|
CAB -> "cab"
|
|
JAR -> "jar"
|
|
NATIVE -> os.getExtension()
|
|
PACK200 -> "pack200"
|
|
PACKCLASS -> "js5"
|
|
}
|
|
}
|
|
|
|
public fun getContentType(os: OperatingSystem): ContentType {
|
|
return when (this) {
|
|
CAB -> CAB_MIME_TYPE
|
|
JAR -> JAR_MIME_TYPE
|
|
NATIVE -> os.getContentType()
|
|
PACK200, PACKCLASS -> ContentType.Application.OctetStream
|
|
}
|
|
}
|
|
|
|
public fun isJar(): Boolean {
|
|
return this != NATIVE
|
|
}
|
|
|
|
private companion object {
|
|
private val CAB_MIME_TYPE = ContentType("application", "vnd.ms-cab-compressed")
|
|
private val JAR_MIME_TYPE = ContentType("application", "java-archive")
|
|
}
|
|
}
|
|
|