tmp
This commit is contained in:
parent
76336dfbb0
commit
02987a0a53
54 changed files with 1487 additions and 332 deletions
|
|
@ -7,6 +7,7 @@ import com.pixelized.shared.lwa.model.campaign.factory.CampaignJsonV1Factory
|
|||
import com.pixelized.shared.lwa.model.campaign.factory.CampaignJsonV2Factory
|
||||
import com.pixelized.shared.lwa.model.characterSheet.factory.CharacterSheetJsonFactory
|
||||
import com.pixelized.shared.lwa.model.characterSheet.factory.CharacterSheetJsonV1Factory
|
||||
import com.pixelized.shared.lwa.model.tag.TagJsonFactory
|
||||
import com.pixelized.shared.lwa.parser.dice.DiceParser
|
||||
import com.pixelized.shared.lwa.parser.expression.ExpressionParser
|
||||
import com.pixelized.shared.lwa.parser.word.WordParser
|
||||
|
|
@ -45,6 +46,7 @@ val factoryDependencies
|
|||
factoryOf(::CampaignJsonV2Factory)
|
||||
factoryOf(::AlteredCharacterSheetFactory)
|
||||
factoryOf(::AlterationJsonFactory)
|
||||
factoryOf(::TagJsonFactory)
|
||||
}
|
||||
|
||||
val parserDependencies
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
package com.pixelized.shared.lwa.model.tag
|
||||
|
||||
data class Tag(
|
||||
val id: String,
|
||||
val label: String,
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.pixelized.shared.lwa.model.tag
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
sealed interface TagJson {
|
||||
val id: String
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.pixelized.shared.lwa.model.tag
|
||||
|
||||
class TagJsonFactory {
|
||||
|
||||
fun convertFromJson(
|
||||
json: TagJson,
|
||||
): Tag {
|
||||
return when (json) {
|
||||
is TagJsonV1 -> Tag(
|
||||
id = json.id,
|
||||
label = json.label,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun convertToJson(
|
||||
tag: Tag,
|
||||
): TagJson {
|
||||
return TagJsonV1(
|
||||
id = tag.id,
|
||||
label = tag.label,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.pixelized.shared.lwa.model.tag
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class TagJsonV1(
|
||||
override val id: String,
|
||||
val label: String,
|
||||
) : TagJson
|
||||
|
|
@ -16,4 +16,16 @@ sealed interface ApiSynchronisation : SocketMessage {
|
|||
override val timestamp: Long,
|
||||
override val characterSheetId: String,
|
||||
) : ApiSynchronisation, CharacterSheetIdMessage
|
||||
|
||||
@Serializable
|
||||
data class AlterationUpdate(
|
||||
override val timestamp: Long,
|
||||
val alterationId: String,
|
||||
) : ApiSynchronisation
|
||||
|
||||
@Serializable
|
||||
data class AlterationDelete(
|
||||
override val timestamp: Long,
|
||||
val alterationId: String,
|
||||
) : ApiSynchronisation
|
||||
}
|
||||
|
|
@ -53,4 +53,14 @@ class PathProvider(
|
|||
OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}alterations/"
|
||||
}
|
||||
}
|
||||
|
||||
fun tagsPath(
|
||||
os: OperatingSystem = this.operatingSystem,
|
||||
app: String = this.appName,
|
||||
): String {
|
||||
return when (os) {
|
||||
OperatingSystem.Windows -> "${storePath(os = os, app = app)}tags\\"
|
||||
OperatingSystem.Macintosh -> "${storePath(os = os, app = app)}tags/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue