forked from Plugin-JF-Onkostar/osc-variant
Compare commits
76 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3948cdd697 | |||
| 5a04571a16 | |||
| f5dc366488 | |||
| 8c11c6d891 | |||
| 8a23d5b71b | |||
| 5d293555f8 | |||
| f1c8a002fa | |||
| 86894632b6 | |||
| afb5a2e17a | |||
| f456e278cb | |||
| f28ab1afcd | |||
| ae6b8d48e5 | |||
| 1302963b56 | |||
| 6be11a8951 | |||
| 416204b30a | |||
| 86e988c50e | |||
| 76de86b685 | |||
| d0de76770f | |||
| 8cae6ce706 | |||
| 81a0c6204b | |||
| 21e31f35d1 | |||
| 108aae329c | |||
| 1f51d3e994 | |||
| c514005182 | |||
| a127133ba2 | |||
| e2d4d71063 | |||
| 629cc8aba9 | |||
| 298a142586 | |||
| 9b9a0b4622 | |||
| 9ffc0783ff | |||
| 771d99fa27 | |||
| eadf9326d0 | |||
| bf63d93efa | |||
| ce52f92a7f | |||
| b3054f971e | |||
| e27d31a8bf | |||
| d30c2991c0 | |||
| ce8dca1c10 | |||
| bfa7cc3c6b | |||
| 9256e242eb | |||
| e33b1a3a4c | |||
| 42cbb9ce7e | |||
| 8edd50feb4 | |||
| 31eda3efc9 | |||
| 54cea88486 | |||
| 4040c49521 | |||
| e0b16c16d4 | |||
| c07d4c8976 | |||
| 3ec51099c7 | |||
| 1e7a95bb09 | |||
| abdef90e90 | |||
| a2df2650ed | |||
| f947395c54 | |||
| d3d4ec2646 | |||
| f507893b4d | |||
| af4ec8898a | |||
| 7d6a6ee9b3 | |||
| a605018176 | |||
| a8851c5e4f | |||
| 0b0188bd30 | |||
| 1e553aad58 | |||
| f9c66cfdb1 | |||
| 103075ab78 | |||
| 37c8b47d1f | |||
| d83fa34adb | |||
| 5c91e4d10f | |||
| e84a39b7c4 | |||
| 376bfb2852 | |||
| ad35b99371 | |||
| 224a7dba27 | |||
| 62ab073cfa | |||
| b2adb3c5fe | |||
| a8911f86dd | |||
| b030ce6a53 | |||
| b04ee563f2 | |||
| 6e266feaf5 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.idea/*
|
||||
/target
|
||||
/completion
|
||||
|
||||
*.iml
|
||||
|
||||
796
Cargo.lock
generated
796
Cargo.lock
generated
@@ -3,16 +3,68 @@
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.0"
|
||||
name = "addr2line"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
|
||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aes"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cipher",
|
||||
"cpufeatures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.74"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
@@ -21,32 +73,113 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.3.4"
|
||||
name = "bitflags"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
|
||||
|
||||
[[package]]
|
||||
name = "bzip2"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
|
||||
dependencies = [
|
||||
"bzip2-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bzip2-sys"
|
||||
version = "0.1.11+1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cipher"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||
dependencies = [
|
||||
"crypto-common",
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.3.4"
|
||||
version = "4.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636"
|
||||
checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"bitflags",
|
||||
"clap_lex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.3.2"
|
||||
name = "clap_complete"
|
||||
version = "4.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
|
||||
checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -56,9 +189,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
||||
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
||||
|
||||
[[package]]
|
||||
name = "console"
|
||||
@@ -70,7 +203,90 @@ dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"unicode-width",
|
||||
"windows-sys",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deob"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deranged"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
|
||||
dependencies = [
|
||||
"powerfmt",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dialoguer"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
|
||||
dependencies = [
|
||||
"console",
|
||||
"shell-words",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -80,10 +296,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.3"
|
||||
name = "equivalent"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.28.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
@@ -92,20 +356,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
name = "hex"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "hmac"
|
||||
version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.6"
|
||||
name = "inout"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
@@ -115,48 +412,111 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.146"
|
||||
version = "0.2.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b"
|
||||
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.18.0"
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
|
||||
|
||||
[[package]]
|
||||
name = "osc-variant"
|
||||
version = "0.1.0"
|
||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"console",
|
||||
"quick-xml",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"xml-rs",
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.60"
|
||||
name = "object"
|
||||
version = "0.32.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406"
|
||||
checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osc-variant"
|
||||
version = "0.5.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"clap_complete",
|
||||
"console",
|
||||
"deob",
|
||||
"dialoguer",
|
||||
"quick-xml",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
"sha256",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "password-hash"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"
|
||||
dependencies = [
|
||||
"base64ct",
|
||||
"rand_core",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pbkdf2"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"hmac",
|
||||
"password-hash",
|
||||
"sha2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||
|
||||
[[package]]
|
||||
name = "powerfmt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.28.2"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1"
|
||||
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
@@ -164,33 +524,67 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.28"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.13"
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0"
|
||||
dependencies = [
|
||||
"bitflags 2.4.1",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.164"
|
||||
version = "1.0.189"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
|
||||
checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.164"
|
||||
version = "1.0.189"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
|
||||
checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -199,9 +593,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.9.21"
|
||||
version = "0.9.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9d684e3ec7de3bf5466b32bd75303ac16f0736426e5a4e0d6e489559ce1249c"
|
||||
checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"itoa",
|
||||
@@ -211,10 +605,57 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.18"
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
|
||||
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha256"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7895c8ae88588ccead14ff438b939b0c569cd619116f14b4d13fdff7b8333386"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"hex",
|
||||
"sha2",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shell-words"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
version = "2.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -222,22 +663,96 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.9"
|
||||
name = "tempfile"
|
||||
version = "3.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
|
||||
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"redox_syscall",
|
||||
"rustix",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"powerfmt",
|
||||
"serde",
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.10"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
||||
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||
|
||||
[[package]]
|
||||
name = "unsafe-libyaml"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1865806a559042e51ab5414598446a5871b561d21b6764f2eabb0dd481d880a6"
|
||||
checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
@@ -245,7 +760,16 @@ version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
"windows-targets 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -254,13 +778,28 @@ version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
"windows_aarch64_gnullvm 0.42.2",
|
||||
"windows_aarch64_msvc 0.42.2",
|
||||
"windows_i686_gnu 0.42.2",
|
||||
"windows_i686_msvc 0.42.2",
|
||||
"windows_x86_64_gnu 0.42.2",
|
||||
"windows_x86_64_gnullvm 0.42.2",
|
||||
"windows_x86_64_msvc 0.42.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -269,36 +808,72 @@ version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.2"
|
||||
@@ -306,7 +881,62 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
|
||||
[[package]]
|
||||
name = "xml-rs"
|
||||
version = "0.8.14"
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52839dc911083a8ef63efa4d039d1f58b5e409f923e44c80828f206f66e5541c"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9"
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"byteorder",
|
||||
"bzip2",
|
||||
"constant_time_eq",
|
||||
"crc32fast",
|
||||
"crossbeam-utils",
|
||||
"flate2",
|
||||
"hmac",
|
||||
"pbkdf2",
|
||||
"sha1",
|
||||
"time",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.11.2+zstd.1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4"
|
||||
dependencies = [
|
||||
"zstd-safe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-safe"
|
||||
version = "5.0.2+zstd.1.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"zstd-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-sys"
|
||||
version = "2.0.9+zstd.1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
37
Cargo.toml
37
Cargo.toml
@@ -1,15 +1,36 @@
|
||||
[package]
|
||||
name = "osc-variant"
|
||||
version = "0.1.0"
|
||||
version = "0.6.0"
|
||||
edition = "2021"
|
||||
authors = ["Paul-Christian Volkmer <volkmer_p@ukw.de>"]
|
||||
description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort"
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
|
||||
build = "build.rs"
|
||||
|
||||
[workspace]
|
||||
members = ["libs/deob"]
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.3", features = ["std", "help", "usage", "derive", "error-context" ], default-features = false }
|
||||
clap = { version = "4.4", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_yaml = "0.9"
|
||||
quick-xml = { version = "0.28", features = ["escape-html", "serialize"], default-features=false }
|
||||
xml-rs = "0.8"
|
||||
quick-xml = { version = "0.30", features = ["escape-html", "serialize"], default-features = false }
|
||||
console = "0.15"
|
||||
sha256 = "1.4"
|
||||
dialoguer = "0.11"
|
||||
|
||||
deob = { path = "./libs/deob", optional = true }
|
||||
zip = { version = "0.6", optional = true }
|
||||
|
||||
[features]
|
||||
# Requires env var OSB_KEY to be present at build time
|
||||
unzip-osb = ["dep:deob", "dep:zip"]
|
||||
|
||||
[build-dependencies]
|
||||
clap = { version = "4.4", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
||||
clap_complete = "4.4"
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
@@ -17,3 +38,11 @@ codegen-units = 1
|
||||
lto = "thin"
|
||||
strip = true
|
||||
panic = "abort"
|
||||
|
||||
[package.metadata.deb]
|
||||
copyright = "Copyright (c) 2023 Comprehensive Cancer Center Mainfranken"
|
||||
extended-description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort."
|
||||
assets = [
|
||||
["target/release/osc-variant", "usr/bin/", "755"],
|
||||
["completion/osc-variant.bash", "etc/bash_completion.d/", "644"]
|
||||
]
|
||||
|
||||
10
Makefile
10
Makefile
@@ -32,13 +32,17 @@ binary-all: win-binary-x86_64 linux-binary-x86_64
|
||||
|
||||
.PHONY: win-binary-x86_64
|
||||
win-binary-x86_64:
|
||||
cargo build --release --target=x86_64-pc-windows-gnu
|
||||
cargo build --release --target=x86_64-pc-windows-gnu --features unzip-osb
|
||||
|
||||
.PHONY: linux-binary-x86_64
|
||||
linux-binary-x86_64:
|
||||
cargo build --release --target=x86_64-unknown-linux-gnu
|
||||
cargo build --release --target=x86_64-unknown-linux-gnu --features unzip-osb
|
||||
|
||||
.PHONE: clean
|
||||
.PHONY: install
|
||||
install:
|
||||
cargo install --path .
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
cargo clean
|
||||
rm -rf osc-variant 2>/dev/null || true
|
||||
|
||||
96
README.md
96
README.md
@@ -16,12 +16,67 @@ unvollständigen Ausgabedateien zu erzeugen.
|
||||
|
||||
### Beispiele
|
||||
|
||||
Die folgenden Unterbefehle sind verfügbar
|
||||
|
||||
#### Unterbefehl `sha256sum`
|
||||
|
||||
Das Berechnen der SHA256 Prüfsumme ist mit dem Unterbefehl `sha256sum` auch unter Windows einfach möglich
|
||||
und erzeugt eine Ausgabe analog dem Befehl auf Linux-Systemen:
|
||||
|
||||
```
|
||||
osc-variant sha256sum meine-beispieldatei.osc
|
||||
```
|
||||
|
||||
#### Unterbefehl `list`
|
||||
|
||||
Zum Auflisten der Inhalte einer Datei wird folgender Befehl verwendet:
|
||||
|
||||
```
|
||||
osc-variant list meine-beispieldatei.osc
|
||||
```
|
||||
|
||||
Mit der Option `--filter` kann die Ausgabe eingeschränkt werden.
|
||||
|
||||
#### Unterbefehl `tree`
|
||||
|
||||
Zum Auflisten der Inhalte mit allen Abhängigkeiten, z.B. Daten- und Merkmalskataloge und bei Formularen wird der Befehl
|
||||
`tree` verwendet:
|
||||
|
||||
```
|
||||
osc-variant tree meine-beispieldatei.osc
|
||||
```
|
||||
|
||||
Abhängigkeiten werden je nach Art gekennzeichnet:
|
||||
|
||||
* `+`: Datenkatalog
|
||||
* `-`: Merkmalskatalog
|
||||
* `>`: Formularverweis
|
||||
* `*`: Unterformular
|
||||
|
||||
Für Formularverweise und Unterformulare werden dabei die verwendeten Datenkataloge nicht erneut ausgegeben.
|
||||
|
||||
Achtung! Dies erzeugt eine sehr umfangreiche Ausgabe.
|
||||
|
||||
Mit der Option `--filter` kann auch hier die Ausgabe eingeschränkt werden.
|
||||
|
||||
#### Unterbefehl `diff`
|
||||
|
||||
Zum Vergleich zweier OSC-Dateien wird der Unterbefehl `diff` verwendet.
|
||||
Der optionale Parameter `--strict` vergleicht auch den Inhalt der OSC-Datei.
|
||||
Ohne diesen wird nur das Vorhandensein von Inhalten und die Revision verglichen.
|
||||
|
||||
```
|
||||
osc-variant diff meine-beispieldatei.osc andere-beispieldatei.osc
|
||||
```
|
||||
|
||||
bzw.
|
||||
|
||||
```
|
||||
osc-variant diff meine-beispieldatei.osc andere-beispieldatei.osc --strict
|
||||
```
|
||||
|
||||
#### Unterbefehl `modify`
|
||||
|
||||
Zum Anpassen des Inhalts einer Datei:
|
||||
|
||||
```
|
||||
@@ -29,21 +84,51 @@ osc-variant modify meine-beispieldatei.osc --profile ukw-profil.yml --output ukw
|
||||
```
|
||||
|
||||
Die Parameter `--profile` und `--output` sind optional.
|
||||
Mit dem ebenfalls optionalen Parameter `--interactve` oder `-i` können die Parameter zur kompakten Ausgabe, zum Sortieren
|
||||
und dem Entfernen von Inhalten der Systembibliothek interaktiv gesetzt werden.
|
||||
|
||||
Ohne Profildatei wird die Datei lediglich eingelesen, Leerzeichen am Ende eines XML-Tags entfernt und wieder ausgegeben.
|
||||
|
||||
Ohne eine Angabe der Ausgabedatei wird auf die Standardausgabe ausgegeben.
|
||||
|
||||
#### Unterbefehl `unzip-osb`
|
||||
|
||||
Ab Version 0.6.0 ist die Anwendung zudem in der Lage, die für eine Aktualisierung der OS-Bibliothek genutzten OSB-Dateien zu entpacken:
|
||||
|
||||
```
|
||||
osc-variant unzip-osb OSBIB-6.10.osb
|
||||
```
|
||||
|
||||
#### Kompakte Ausgabe
|
||||
|
||||
OSC-Dateien sind XML-Dateien. Diese Anwendung ermöglicht optional die Ausgabe als kompaktere XML-Datei ohne Zeilenumbrüche.
|
||||
Hierzu ist die Option `--compact` vorgesehen. Es können, je nach Datei, bis zu 30% eingespart werden.
|
||||
|
||||
#### Filter
|
||||
|
||||
Bei der Auflistung von Inhalten ist es möglich, die Anzeige für die Unterbefehle `list` und `tree` anhand des Namens zu filtern.
|
||||
Hierzu ist die Option `--filter=` vorgesehen.
|
||||
Wird diese angewendet, werden nur Inhalte angezeigt, deren Name die angegebene Zeichenkette beinhalten.
|
||||
|
||||
#### Sortierung
|
||||
|
||||
Bei der Auflistung der Inhalte, kann die Option `--sorted` dazu verwendet werden, die angezeigten Einträge alphabetisch zu sortieren.
|
||||
Die Sortierung erfolgt dabei nach Namen des Katalogs oder des Formulars.
|
||||
|
||||
Beim Modifizieren der Inhalte kann ebenfalls die Option `--sorted` dazu verwendet werden, die Einträge im Anschluss an die Modifikation
|
||||
nach Namen und für Formulare der Abhängigkeit von Formularverweisen und Unterformularen zu sortieren.
|
||||
|
||||
Formulare, die von anderen Formularen in einem Formularverweis oder als Unterformular verwendet werden, werden dabei weiter oben angeordnet,
|
||||
da Onkostar einen Formularimport sequenziell, ohne Berücksichtigung von Abhängigkeiten, durchführt.
|
||||
|
||||
Dies erlaubt eine konsistente Reihenfolge der Einträge, wodurch ein direkter Vergleich mit Vorversionen ermöglicht wird.
|
||||
|
||||
##### Entfernen von Inhalten der Systembibliothek bei Modifikation
|
||||
|
||||
Mit der die experimentelle Option `--strip` ist es möglich, die in der OSC-Datei enthaltenen und beim Import nicht genutzten Inhalte aus der Systembibliothek zu entfernen.
|
||||
|
||||
Hierbei werden alle Inhalte entfernt, die im Ordner "ONKOSTAR Bibliothek" enthalten sind, beim Import jedoch ignoriert werden.
|
||||
|
||||
## Profile
|
||||
|
||||
Zum Erstellen von Varianten einer OSC-Datei wird eine Profildatei im YAML-Format verwendet.
|
||||
@@ -53,6 +138,9 @@ In ihr sind die durchzuführenden Änderungen definiert. Eine Profildatei hat di
|
||||
```
|
||||
forms:
|
||||
- name: "ExampleForm"
|
||||
form_field:
|
||||
- name: "formularfeld"
|
||||
hide: true
|
||||
form_references:
|
||||
- name: "ref_first_mtb"
|
||||
referenced_data_form: "Formularverweis.Variante"
|
||||
@@ -79,6 +167,12 @@ und dabei die vorhandenen Angaben für den Formularverweis zu ersetzen.
|
||||
Die Angaben für `referenced_data_form`, `anzeige_auswahl`, `anzeige` und `scripts_code` sind optional.
|
||||
Wird keine Angabe gemacht, wird der bestehende Wert beibehalten.
|
||||
|
||||
Zudem wird im Formular "ExampleForm" das Formularfeld "formularfeld" ausgeblendet, indem der Filter auf "false" gesetzt wird.
|
||||
Dadurch wird das Formularfeld nie angezeigt.
|
||||
Ein zuvor bestehender Filter wird ersetzt.
|
||||
Weiterhin wird die Eigenschaft "Speichern" des Formularfelds auf "Immer speichern" gesetzt um sicherzustellen, dass zuvor
|
||||
enthaltene Daten weiterhin gespeichert bleiben und werden, auch wenn das Formularfeld nicht sichtbar ist.
|
||||
|
||||
**Achtung!** Diese Anwendung überprüft keine Scripts und verwendet angegebene Scripts als "valid" im resultierenden OSC-File.
|
||||
|
||||
Zudem kann die Menükategorie angepasst werden.
|
||||
@@ -88,4 +182,4 @@ Wird sie angeben, sind die Felder `name`, `position` und `column` verpflichtend.
|
||||
Es können beliebig viele Formulare mit beliebig vielen Änderungen zu Formularverweisen in einer Profildatei
|
||||
hinterlegt werden, jedoch ist mindestens eine Angabe zu einem Formularfeld erforderlich.
|
||||
|
||||
Beispiele für eine Profildatei sind unter [`examples/`](examples/) zu finden.
|
||||
Beispiele für eine Profildatei sind unter [`examples/`](/examples) zu finden.
|
||||
|
||||
44
build.rs
Normal file
44
build.rs
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::fs;
|
||||
use std::io::Error;
|
||||
|
||||
use clap_complete::generate_to;
|
||||
use clap_complete::Shell::Bash;
|
||||
|
||||
include!("src/cli.rs");
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
let mut cmd = build_cli();
|
||||
|
||||
let package_name = std::env::var("CARGO_CRATE_NAME").unwrap_or("osc-variant".to_string());
|
||||
|
||||
fs::remove_dir_all("completion").unwrap_or_default();
|
||||
fs::create_dir("completion")?;
|
||||
|
||||
generate_to(Bash, &mut cmd, package_name.as_str(), "completion")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
27
examples/dnpm-master.yml
Normal file
27
examples/dnpm-master.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
forms:
|
||||
- name: 'DNPM Klinik/Anamnese'
|
||||
form_references:
|
||||
- name: MTB
|
||||
referenced_data_form: 'OS.Tumorkonferenz'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: 'DNPM Therapieplan'
|
||||
form_references:
|
||||
- name: referstemtb
|
||||
referenced_data_form: 'OS.Tumorkonferenz'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: reftkhumangenber
|
||||
referenced_data_form: 'OS.Tumorkonferenz'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: reftkreevaluation
|
||||
referenced_data_form: 'OS.Tumorkonferenz'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: 'DNPM UF Einzelempfehlung'
|
||||
form_references:
|
||||
- name: mtb
|
||||
referenced_data_form: 'OS.Tumorkonferenz'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: 'DNPM UF Rebiopsie'
|
||||
form_references:
|
||||
- name: reftumorkonferenz
|
||||
referenced_data_form: 'OS.Tumorkonferenz'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
@@ -4,3 +4,27 @@ forms:
|
||||
- name: MTB
|
||||
referenced_data_form: 'MR.MTB_Anmeldung'
|
||||
anzeige_auswahl: 'MTB Anmeldung vom {Anmeldedatum}'
|
||||
scripts_code: |
|
||||
setFieldValue('AnmeldedatumMTB', getFieldValue('MTB').MTBTermin);
|
||||
setFieldValue('WHOGrad', getFieldValue('MTB').WHOGrad);
|
||||
- name: 'DNPM Therapieplan'
|
||||
form_references:
|
||||
- name: referstemtb
|
||||
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: reftkhumangenber
|
||||
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: reftkreevaluation
|
||||
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: 'DNPM UF Einzelempfehlung'
|
||||
form_references:
|
||||
- name: mtb
|
||||
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
- name: 'DNPM UF Rebiopsie'
|
||||
form_references:
|
||||
- name: reftumorkonferenz
|
||||
referenced_data_form: 'MR.MTB_Empfehlung'
|
||||
anzeige_auswahl: 'MTB vom {Datum}'
|
||||
7
libs/deob/Cargo.toml
Normal file
7
libs/deob/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "deob"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
31
libs/deob/build.rs
Normal file
31
libs/deob/build.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::io::Error;
|
||||
|
||||
fn main() -> Result<(), Error> {
|
||||
cc::Build::new().file("src/deob.c").compile("deob");
|
||||
println!("cargo:rerun-if-changed=src/deob.c");
|
||||
Ok(())
|
||||
}
|
||||
37
libs/deob/src/deob.c
Normal file
37
libs/deob/src/deob.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "deob.h"
|
||||
|
||||
void deob(char * in) {
|
||||
const long long s[2] = { S0, S1 };
|
||||
char d[] = "OSTAR.password$OSB";
|
||||
for (size_t i = 0; i < DL; i++) d[i] = (CS)[i];
|
||||
size_t l = strlen(in) / 2;
|
||||
for (size_t i = 0; i < l; i++) {
|
||||
for (size_t j = 0; j < DL; j++) { DLT(0); DLT(1); }
|
||||
DLS(i);
|
||||
}
|
||||
INZ(l);
|
||||
}
|
||||
43
libs/deob/src/deob.h
Normal file
43
libs/deob/src/deob.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef OSC_VARIANT_DEOB_H
|
||||
#define OSC_VARIANT_DEOB_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define S0 8373972096940928081
|
||||
#define S1 7378413942531504450
|
||||
#define CS (char*)&s
|
||||
#define DL sizeof(d) / sizeof(d[0]) - 2
|
||||
#define I2 i*2
|
||||
#define INZ(var) in[var] = 0
|
||||
#define DLS(idx) in[idx] = (d[DL+1]<<4)|d[DL]
|
||||
#define DLT(idx) d[DL+idx] = (in[I2+idx] == d[j]) ? (char)j : d[DL+idx]
|
||||
|
||||
void deob(char * in);
|
||||
|
||||
#endif //OSC_VARIANT_DEOB_H
|
||||
38
libs/deob/src/lib.rs
Normal file
38
libs/deob/src/lib.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::ffi::{c_char, CStr, CString};
|
||||
|
||||
#[link(name = "deob")]
|
||||
extern "C" {
|
||||
fn deob(key: *const c_char);
|
||||
}
|
||||
|
||||
pub fn deobfuscate(s: &str) -> String {
|
||||
let key = CString::new(s).unwrap_or_default().into_raw();
|
||||
unsafe {
|
||||
deob(key);
|
||||
String::from_utf8_lossy(CStr::from_ptr(key).to_bytes()).to_string()
|
||||
}
|
||||
}
|
||||
57
src/cli.rs
57
src/cli.rs
@@ -22,18 +22,28 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use clap::{Parser, Subcommand};
|
||||
use clap::{Command, CommandFactory, Parser, Subcommand};
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn build_cli() -> Command {
|
||||
Cli::command()
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
#[command(propagate_version = true, arg_required_else_help(true))]
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Command,
|
||||
pub cmd: SubCommand,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Command {
|
||||
pub enum SubCommand {
|
||||
#[command(
|
||||
name = "sha256sum",
|
||||
about = "Berechne SHA256 Prüfsumme für die angegebene Datei"
|
||||
)]
|
||||
Sha256Sum { inputfile: String },
|
||||
#[command(about = "Zeigt alle enthaltenen Kataloge und Formulare mit Revision an.")]
|
||||
List {
|
||||
inputfile: String,
|
||||
@@ -42,6 +52,19 @@ pub enum Command {
|
||||
help = "Sortiere Kataloge und Formulare nach Name (Optional)"
|
||||
)]
|
||||
sorted: bool,
|
||||
#[arg(long = "filter", help = "Filtere Ausgabe nach Name (Optional)")]
|
||||
filter: Option<String>,
|
||||
},
|
||||
#[command(about = "Zeigt Kataloge und Formulare mit Revision und Abhängigkeiten an.")]
|
||||
Tree {
|
||||
inputfile: String,
|
||||
#[arg(
|
||||
long = "sorted",
|
||||
help = "Sortiere Kataloge und Formulare nach Name (Optional)"
|
||||
)]
|
||||
sorted: bool,
|
||||
#[arg(long = "filter", help = "Filtere Ausgabe nach Name (Optional)")]
|
||||
filter: Option<String>,
|
||||
},
|
||||
#[command(about = "Modifiziert die angegebene Datei anhand der Profildatei")]
|
||||
Modify {
|
||||
@@ -52,5 +75,33 @@ pub enum Command {
|
||||
outputfile: Option<String>,
|
||||
#[arg(long = "compact", help = "Kompakte Ausgabe, ohne Einrücken (Optional)")]
|
||||
compact: bool,
|
||||
#[arg(
|
||||
long = "sorted",
|
||||
alias = "x-sorted",
|
||||
help = "Sortiere Kataloge und Formulare nach Name und Abhängigkeiten (Optional)."
|
||||
)]
|
||||
sorted: bool,
|
||||
#[arg(
|
||||
long = "strip",
|
||||
alias = "x-strip",
|
||||
help = "Entferne Einträge aus der Systembibliothek die nicht importiert werden (Optional)."
|
||||
)]
|
||||
strip: bool,
|
||||
#[arg(
|
||||
short = 'i',
|
||||
long = "interactive",
|
||||
help = "Starte interaktiven Dialog zum Modifizieren von OSC-Dateien"
|
||||
)]
|
||||
interactive: bool,
|
||||
},
|
||||
#[command(about = "Vergleiche zwei Dateien anhand der Revision der enthaltenen Inhalte")]
|
||||
Diff {
|
||||
inputfile_a: String,
|
||||
inputfile_b: String,
|
||||
#[arg(long = "strict", help = "Strikter Vergleich des Inhalts")]
|
||||
strict: bool,
|
||||
},
|
||||
#[cfg(feature = "unzip-osb")]
|
||||
#[command(about = "Entpackt eine OSB-Datei")]
|
||||
UnzipOsb { file: String },
|
||||
}
|
||||
|
||||
113
src/main.rs
113
src/main.rs
@@ -28,19 +28,25 @@ use std::fs;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Write;
|
||||
use std::ops::Add;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use clap::Parser;
|
||||
use console::style;
|
||||
use dialoguer::Confirm;
|
||||
use quick_xml::se::Serializer;
|
||||
use serde::Serialize;
|
||||
use sha256::digest;
|
||||
|
||||
use crate::cli::{Cli, Command};
|
||||
use crate::cli::{Cli, SubCommand};
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::profile::Profile;
|
||||
|
||||
mod cli;
|
||||
mod model;
|
||||
mod profile;
|
||||
#[cfg(feature = "unzip-osb")]
|
||||
mod unzip_osb;
|
||||
|
||||
enum FileError {
|
||||
Reading(String, String),
|
||||
@@ -108,19 +114,45 @@ fn read_profile(filename: String) -> Result<Profile, FileError> {
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
Command::List { inputfile, sorted } => {
|
||||
match cli.cmd {
|
||||
SubCommand::List {
|
||||
inputfile,
|
||||
sorted,
|
||||
filter,
|
||||
} => {
|
||||
let mut data = read_inputfile(inputfile)?;
|
||||
if sorted {
|
||||
data.sorted()
|
||||
}
|
||||
if let Some(name) = filter {
|
||||
OnkostarEditor::print_list_filtered(&mut data, name.as_str());
|
||||
return Ok(());
|
||||
}
|
||||
data.print_list();
|
||||
}
|
||||
Command::Modify {
|
||||
SubCommand::Tree {
|
||||
inputfile,
|
||||
sorted,
|
||||
filter,
|
||||
} => {
|
||||
let mut data = read_inputfile(inputfile)?;
|
||||
if sorted {
|
||||
data.sorted()
|
||||
}
|
||||
if let Some(name) = filter {
|
||||
OnkostarEditor::print_tree_filtered(&mut data, name.as_str());
|
||||
return Ok(());
|
||||
}
|
||||
OnkostarEditor::print_tree(&data);
|
||||
}
|
||||
SubCommand::Modify {
|
||||
inputfile,
|
||||
profile,
|
||||
outputfile,
|
||||
compact,
|
||||
sorted,
|
||||
strip,
|
||||
interactive,
|
||||
} => {
|
||||
let data = &mut read_inputfile(inputfile)?;
|
||||
|
||||
@@ -131,6 +163,40 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
data.apply_profile(&profile);
|
||||
}
|
||||
|
||||
let mut compact = compact;
|
||||
let mut sorted = sorted;
|
||||
let mut strip = strip;
|
||||
|
||||
if interactive {
|
||||
compact = Confirm::new()
|
||||
.with_prompt("Kompakte Ausgabe, ohne Einrücken?")
|
||||
.default(compact)
|
||||
.interact()
|
||||
.unwrap();
|
||||
|
||||
sorted = Confirm::new()
|
||||
.with_prompt("Sortiere Kataloge und Formulare nach Name und Abhängigkeiten?")
|
||||
.default(sorted)
|
||||
.interact()
|
||||
.unwrap();
|
||||
|
||||
strip = Confirm::new()
|
||||
.with_prompt(
|
||||
"Entferne Einträge aus der Systembibliothek die nicht importiert werden?",
|
||||
)
|
||||
.default(strip)
|
||||
.interact()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
if sorted {
|
||||
data.sorted();
|
||||
}
|
||||
|
||||
if strip {
|
||||
data.strip_system_library_content();
|
||||
}
|
||||
|
||||
let mut buf = String::new();
|
||||
|
||||
let mut serializer = Serializer::new(&mut buf);
|
||||
@@ -157,6 +223,45 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
}
|
||||
}
|
||||
SubCommand::Diff {
|
||||
inputfile_a,
|
||||
inputfile_b,
|
||||
strict,
|
||||
} => {
|
||||
println!(
|
||||
"Vergleiche Datei A ({}) mit Datei B ({})",
|
||||
style(&inputfile_a).yellow(),
|
||||
style(&inputfile_b).yellow()
|
||||
);
|
||||
|
||||
let data_a = &mut read_inputfile(inputfile_a)?;
|
||||
let data_b = &mut read_inputfile(inputfile_b)?;
|
||||
|
||||
data_a.print_diff(data_b, strict);
|
||||
}
|
||||
SubCommand::Sha256Sum { inputfile } => {
|
||||
match fs::read_to_string(inputfile.clone()) {
|
||||
Ok(content) => {
|
||||
println!(
|
||||
"{} {}",
|
||||
digest(content).as_str(),
|
||||
PathBuf::from(inputfile.clone())
|
||||
.canonicalize()
|
||||
.unwrap_or_default()
|
||||
.to_str()
|
||||
.unwrap_or_default()
|
||||
)
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("{}", FileError::Reading(inputfile, err.to_string()));
|
||||
}
|
||||
};
|
||||
}
|
||||
#[cfg(feature = "unzip-osb")]
|
||||
SubCommand::UnzipOsb { file } => {
|
||||
use crate::unzip_osb::unzip_osb;
|
||||
unzip_osb(file.as_str())
|
||||
}
|
||||
};
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -22,10 +22,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use console::style;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::model::{Listable, Ordner, Sortable};
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::requirements::{Requirement, Requires};
|
||||
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -59,7 +63,11 @@ pub struct DataCatalogue {
|
||||
impl Listable for DataCatalogue {
|
||||
fn to_listed_string(&self) -> String {
|
||||
format!(
|
||||
"Datenkatalog '{}' in Revision '{}'",
|
||||
"Datenkatalog ({}) '{}' in Revision '{}'",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
@@ -70,6 +78,78 @@ impl Sortable for DataCatalogue {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self {
|
||||
self.entries
|
||||
.entry
|
||||
.sort_unstable_by_key(|item| item.sorting_key());
|
||||
self.entries.entry.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Comparable for DataCatalogue {
|
||||
fn get_name(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn get_revision(&self) -> u16 {
|
||||
self.revision
|
||||
}
|
||||
}
|
||||
|
||||
impl Requires for DataCatalogue {
|
||||
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||
let mut result = self
|
||||
.entries
|
||||
.entry
|
||||
.iter()
|
||||
.filter(|&entry| entry.property_catalogue.is_some())
|
||||
.map(|entry| match &entry.property_catalogue {
|
||||
Some(entry) => entry.to_string(),
|
||||
_ => String::new(),
|
||||
})
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_property_catalogue(entry.as_str()) {
|
||||
Some(contained) => Requirement::PropertyCatalogue(contained),
|
||||
None => Requirement::ExternalPropertyCatalogue(entry),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
result.sort_unstable_by_key(|item| item.sorting_key());
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||
format!(
|
||||
"{}\n{}",
|
||||
self.to_listed_string(),
|
||||
self.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|entry| match entry {
|
||||
Requirement::PropertyCatalogue(_) => {
|
||||
Some(format!(" - {}\n", entry.to_string()))
|
||||
}
|
||||
Requirement::ExternalPropertyCatalogue(_) => {
|
||||
Some(format!(" - {}\n", entry.to_string()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
.flatten()
|
||||
.collect::<Vec<_>>()
|
||||
.join("")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for DataCatalogue {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -141,6 +221,23 @@ pub struct Entry {
|
||||
revision: u16,
|
||||
}
|
||||
|
||||
impl Sortable for Entry {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
if let Some(ref mut use_) = self.use_ {
|
||||
use_.program_module
|
||||
.sort_unstable_by_key(|item| item.sorting_key())
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Use {
|
||||
@@ -156,3 +253,9 @@ pub struct ProgramModule {
|
||||
#[serde(rename = "@name")]
|
||||
name: String,
|
||||
}
|
||||
|
||||
impl Sortable for ProgramModule {
|
||||
fn sorting_key(&self) -> String {
|
||||
format!("{}-{}", self.program, self.name)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use console::style;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::requirements::{Requirement, Requires};
|
||||
use crate::model::{
|
||||
apply_profile_to_form_entry, Ansichten, Entries, Filter, FormEntry, FormEntryContainer,
|
||||
Listable, MenuCategory, PlausibilityRules, Script, Sortable,
|
||||
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
||||
Filter, FolderContent, FormEntry, FormEntryContainer, Listable, MenuCategory,
|
||||
PlausibilityRules, RefEntries, Script, Sortable,
|
||||
};
|
||||
use crate::model::{Haeufigkeiten, Ordner};
|
||||
use crate::profile::Profile;
|
||||
@@ -165,6 +171,12 @@ impl FormEntryContainer for DataForm {
|
||||
apply_profile_to_form_entry(entry, form_reference)
|
||||
});
|
||||
|
||||
// Hide form field using filter set to "false" if requested
|
||||
profile_form
|
||||
.form_fields
|
||||
.iter()
|
||||
.for_each(|form_field| apply_profile_to_form_field(entry, form_field));
|
||||
|
||||
if let Some(menu_category) = &profile_form.menu_category {
|
||||
self.menu_category = Some(MenuCategory {
|
||||
name: menu_category.name.clone(),
|
||||
@@ -181,9 +193,25 @@ impl FormEntryContainer for DataForm {
|
||||
impl Listable for DataForm {
|
||||
fn to_listed_string(&self) -> String {
|
||||
format!(
|
||||
"Formular '{}' in Revision '{}'",
|
||||
"Formular ({}) '{}' in Revision '{}' {}",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
style(&self.revision).yellow(),
|
||||
if self
|
||||
.entries
|
||||
.entry
|
||||
.iter()
|
||||
.filter(|entry| entry.procedure_date_status != "none")
|
||||
.count()
|
||||
== 0
|
||||
{
|
||||
style("Formular hat keine Angabe zum Prozedurdatum!").red()
|
||||
} else {
|
||||
style("")
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -192,6 +220,153 @@ impl Sortable for DataForm {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self {
|
||||
self.data_catalogues.data_catalogue.sort_unstable();
|
||||
|
||||
self.entries
|
||||
.entry
|
||||
.sort_unstable_by_key(|item| item.sorting_key());
|
||||
|
||||
self.entries.entry.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
if let Some(ref mut plausibility_rule) = self.plausibility_rules.plausibility_rule {
|
||||
plausibility_rule.sort_unstable_by_key(|item| item.bezeichnung.clone());
|
||||
|
||||
plausibility_rule.iter_mut().for_each(|item| {
|
||||
if let Some(ref mut data_form_entry_names) = item.data_form_entries.entry_name {
|
||||
data_form_entry_names.sort_unstable();
|
||||
}
|
||||
});
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Comparable for DataForm {
|
||||
fn get_name(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn get_revision(&self) -> u16 {
|
||||
self.revision
|
||||
}
|
||||
|
||||
fn compare_by_requirement(a: &Self, b: &Self) -> Ordering {
|
||||
if a.get_name() == b.get_name()
|
||||
|| a.is_system_library_content()
|
||||
|| b.is_system_library_content()
|
||||
{
|
||||
return Ordering::Equal;
|
||||
}
|
||||
|
||||
if a.requires_form_reference(&b.get_name()) || a.requires_subform(&b.get_name()) {
|
||||
return Ordering::Greater;
|
||||
}
|
||||
|
||||
Ordering::Less
|
||||
}
|
||||
}
|
||||
|
||||
impl Requires for DataForm {
|
||||
fn requires_form_reference(&self, name: &str) -> bool {
|
||||
self.entries
|
||||
.entry
|
||||
.iter()
|
||||
.map(|item| {
|
||||
item.type_ == "formReference"
|
||||
&& match item.referenced_data_form.as_ref() {
|
||||
Some(refname) => refname == name,
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
.filter(|&it| it)
|
||||
.last()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
fn requires_subform(&self, name: &str) -> bool {
|
||||
self.entries
|
||||
.entry
|
||||
.iter()
|
||||
.map(|item| {
|
||||
item.type_ == "subform"
|
||||
&& match item.referenced_data_form.as_ref() {
|
||||
Some(refname) => refname == name,
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
.filter(|&it| it)
|
||||
.last()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||
let mut result = self
|
||||
.data_catalogues
|
||||
.data_catalogue
|
||||
.iter()
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataCatalogue(contained),
|
||||
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
result.sort_unstable_by_key(|item| item.sorting_key());
|
||||
|
||||
let referenced_forms = &mut self
|
||||
.entries
|
||||
.entry
|
||||
.iter()
|
||||
.filter(|&entry| entry.get_type() == "formReference")
|
||||
.filter_map(|entry| match &entry.referenced_data_form {
|
||||
Some(name) => Some(name),
|
||||
None => None,
|
||||
})
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_data_form(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataFormReference(contained),
|
||||
None => match all.find_unterformular(entry.as_str()) {
|
||||
Some(contained) => Requirement::UnterformularReference(contained),
|
||||
None => Requirement::ExternalUnterformularReference(entry.to_string()),
|
||||
},
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
referenced_forms.sort_unstable_by_key(|item| item.sorting_key());
|
||||
result.append(referenced_forms);
|
||||
|
||||
let sub_forms = &mut self
|
||||
.entries
|
||||
.entry
|
||||
.iter()
|
||||
.filter(|&entry| entry.get_type() == "subform")
|
||||
.filter_map(|entry| match &entry.referenced_data_form {
|
||||
Some(name) => Some(name),
|
||||
None => None,
|
||||
})
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_data_form(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataFormSubform(contained),
|
||||
None => match all.find_unterformular(entry.as_str()) {
|
||||
Some(contained) => Requirement::UnterformularSubform(contained),
|
||||
None => Requirement::ExternalUnterformularSubform(entry.to_string()),
|
||||
},
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
sub_forms.sort_unstable_by_key(|item| item.sorting_key());
|
||||
result.append(sub_forms);
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for DataForm {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -375,6 +550,9 @@ pub struct Entry {
|
||||
direction_pat_modul: String,
|
||||
#[serde(rename = "SeitenumbruchPatModul")]
|
||||
seitenumbruch_pat_modul: bool,
|
||||
#[serde(rename = "Kontaktliste")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
kontaktliste: Option<String>,
|
||||
#[serde(rename = "MarkierungIgnorieren")]
|
||||
markierung_ignorieren: bool,
|
||||
#[serde(rename = "SucheArt")]
|
||||
@@ -421,6 +599,35 @@ impl FormEntry for Entry {
|
||||
valid: true,
|
||||
});
|
||||
}
|
||||
|
||||
fn hide(&mut self) {
|
||||
self.filter = Some(Filter {
|
||||
condition: "false".into(),
|
||||
valid: true,
|
||||
ref_entries: Some(RefEntries { ref_entry: None }),
|
||||
});
|
||||
self.speichern = "0".into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Sortable for Entry {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
if let Some(ref mut filter) = self.filter {
|
||||
if let Some(ref mut ref_entries) = filter.ref_entries {
|
||||
if let Some(ref mut ref_entry) = ref_entries.ref_entry {
|
||||
ref_entry.sort_unstable()
|
||||
}
|
||||
}
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
||||
@@ -22,13 +22,21 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use crate::profile::{FormReference, Profile};
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::fmt::Debug;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use crate::model::requirements::Requires;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::profile::{FormField, FormReference, Profile};
|
||||
|
||||
pub mod data_catalogue;
|
||||
pub mod data_form;
|
||||
pub mod onkostar_editor;
|
||||
pub mod property_catalogue;
|
||||
pub mod requirements;
|
||||
pub mod unterformular;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -226,6 +234,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_profile_to_form_field<E>(entry: &mut E, form_field: &FormField)
|
||||
where
|
||||
E: FormEntry,
|
||||
{
|
||||
if entry.get_name() == form_field.name && form_field.hide {
|
||||
entry.hide()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FormEntryContainer {
|
||||
fn apply_profile(&mut self, profile: &Profile);
|
||||
}
|
||||
@@ -236,6 +253,29 @@ pub trait Listable {
|
||||
|
||||
pub trait Sortable {
|
||||
fn sorting_key(&self) -> String;
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Comparable: Debug {
|
||||
fn get_name(&self) -> String;
|
||||
fn get_revision(&self) -> u16;
|
||||
fn get_hash(&self) -> String {
|
||||
let mut h = DefaultHasher::new();
|
||||
format!("{:?}", self).hash(&mut h);
|
||||
h.finish().to_string()
|
||||
}
|
||||
fn compare_by_requirement(_: &Self, _: &Self) -> Ordering
|
||||
where
|
||||
Self: Requires,
|
||||
{
|
||||
Ordering::Equal
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FormEntry {
|
||||
@@ -245,4 +285,13 @@ pub trait FormEntry {
|
||||
fn update_anzeige(&mut self, value: String);
|
||||
fn update_anzeige_auswahl(&mut self, value: String);
|
||||
fn update_scripts_code(&mut self, value: String);
|
||||
fn hide(&mut self);
|
||||
}
|
||||
|
||||
pub trait FolderContent {
|
||||
fn get_library_folder(&self) -> String;
|
||||
|
||||
fn is_system_library_content(&self) -> bool {
|
||||
"ONKOSTAR Bibliothek" == self.get_library_folder()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* 2023 Comprehensive Cancer Center Mainfranken
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,16 +22,20 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt::Debug;
|
||||
use std::str::FromStr;
|
||||
|
||||
use console::style;
|
||||
use quick_xml::de::from_str;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::model::data_catalogue::DataCatalogue;
|
||||
use crate::model::data_form::DataForm;
|
||||
use crate::model::property_catalogue::PropertyCatalogue;
|
||||
use crate::model::requirements::Requires;
|
||||
use crate::model::unterformular::Unterformular;
|
||||
use crate::model::{FormEntryContainer, Listable, Sortable};
|
||||
use crate::model::{Comparable, FolderContent, FormEntryContainer, Listable, Sortable};
|
||||
use crate::profile::Profile;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -44,13 +48,73 @@ pub struct OnkostarEditor {
|
||||
}
|
||||
|
||||
impl OnkostarEditor {
|
||||
pub fn find_property_catalogue<'a>(&'a self, name: &str) -> Option<&'a PropertyCatalogue> {
|
||||
match self
|
||||
.editor
|
||||
.property_catalogue
|
||||
.iter()
|
||||
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
|
||||
.nth(0)
|
||||
{
|
||||
Some(x) => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_data_catalogue<'a>(&'a self, name: &str) -> Option<&'a DataCatalogue> {
|
||||
match self
|
||||
.editor
|
||||
.data_catalogue
|
||||
.iter()
|
||||
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
|
||||
.nth(0)
|
||||
{
|
||||
Some(x) => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_data_form<'a>(&'a self, name: &str) -> Option<&'a DataForm> {
|
||||
match self
|
||||
.editor
|
||||
.data_form
|
||||
.iter()
|
||||
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
|
||||
.nth(0)
|
||||
{
|
||||
Some(x) => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_unterformular<'a>(&'a self, name: &str) -> Option<&'a Unterformular> {
|
||||
match self
|
||||
.editor
|
||||
.unterformular
|
||||
.iter()
|
||||
.filter(|&item| item.get_name().eq_ignore_ascii_case(name))
|
||||
.nth(0)
|
||||
{
|
||||
Some(x) => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apply_profile(&mut self, profile: &Profile) {
|
||||
self.editor.data_form.iter_mut().for_each(|data_form| {
|
||||
self.editor
|
||||
.data_form
|
||||
.iter_mut()
|
||||
.filter(|data_form| !data_form.is_system_library_content())
|
||||
.for_each(|data_form| {
|
||||
data_form.apply_profile(profile);
|
||||
});
|
||||
self.editor.unterformular.iter_mut().for_each(|data_form| {
|
||||
self.editor
|
||||
.unterformular
|
||||
.iter_mut()
|
||||
.filter(|data_form| !data_form.is_system_library_content())
|
||||
.for_each(|data_form| {
|
||||
data_form.apply_profile(profile);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
pub fn print_list(&self) {
|
||||
@@ -66,28 +130,271 @@ impl OnkostarEditor {
|
||||
Self::print_items("Unterformulare", &self.editor.unterformular);
|
||||
}
|
||||
|
||||
fn filter_by_name_contains(&mut self, name: &str) {
|
||||
self.editor
|
||||
.property_catalogue
|
||||
.retain(|e| e.get_name().contains(name));
|
||||
self.editor
|
||||
.data_catalogue
|
||||
.retain(|e| e.get_name().contains(name));
|
||||
self.editor
|
||||
.data_form
|
||||
.retain(|e| e.get_name().contains(name));
|
||||
self.editor
|
||||
.unterformular
|
||||
.retain(|e| e.get_name().contains(name));
|
||||
}
|
||||
pub fn print_list_filtered(&mut self, name: &str) {
|
||||
println!(
|
||||
"Die Datei wurde am {} mit {} in Version {} erstellt.\n\nFolgende Inhalte für '{}' sind gespeichert",
|
||||
style(&self.info_xml.datum_xml).yellow(),
|
||||
style(&self.info_xml.name).yellow(),
|
||||
style(&self.info_xml.version).yellow(),
|
||||
name
|
||||
);
|
||||
|
||||
self.filter_by_name_contains(name);
|
||||
|
||||
Self::print_items("Merkmalskataloge", &self.editor.property_catalogue);
|
||||
Self::print_items("Datenkataloge", &self.editor.data_catalogue);
|
||||
Self::print_items("Formulare", &self.editor.data_form);
|
||||
Self::print_items("Unterformulare", &self.editor.unterformular);
|
||||
}
|
||||
|
||||
fn print_items(title: &str, list: &[impl Listable]) {
|
||||
println!("\n{} {}", list.len(), style(title).underlined());
|
||||
print!("\n{} {}", list.len(), style(title).underlined());
|
||||
println!(
|
||||
" - Inhalte der Systembibliothek sind mit ({}), der Benutzerbibliothek mit (u) markiert",
|
||||
style("S").yellow()
|
||||
);
|
||||
list.iter()
|
||||
.for_each(|entry| println!("{}", entry.to_listed_string()));
|
||||
}
|
||||
|
||||
pub fn print_tree(&self) {
|
||||
println!(
|
||||
"Die Datei wurde am {} mit {} in Version {} erstellt.\n\nFolgende Inhalte sind gespeichert",
|
||||
style(&self.info_xml.datum_xml).yellow(),
|
||||
style(&self.info_xml.name).yellow(),
|
||||
style(&self.info_xml.version).yellow()
|
||||
);
|
||||
|
||||
Self::print_items("Merkmalskataloge", &self.editor.property_catalogue);
|
||||
self.print_items_tree("Datenkataloge", &self.editor.data_catalogue);
|
||||
self.print_items_tree("Formulare", &self.editor.data_form);
|
||||
self.print_items_tree("Unterformulare", &self.editor.unterformular);
|
||||
}
|
||||
|
||||
pub fn print_tree_filtered(&mut self, name: &str) {
|
||||
println!(
|
||||
"Die Datei wurde am {} mit {} in Version {} erstellt.\n\nFolgende Inhalte für '{}' sind gespeichert",
|
||||
style(&self.info_xml.datum_xml).yellow(),
|
||||
style(&self.info_xml.name).yellow(),
|
||||
style(&self.info_xml.version).yellow(),
|
||||
name
|
||||
);
|
||||
|
||||
self.filter_by_name_contains(name);
|
||||
|
||||
Self::print_items("Merkmalskataloge", &self.editor.property_catalogue);
|
||||
self.print_items_tree("Datenkataloge", &self.editor.data_catalogue);
|
||||
self.print_items_tree("Formulare", &self.editor.data_form);
|
||||
self.print_items_tree("Unterformulare", &self.editor.unterformular);
|
||||
}
|
||||
|
||||
fn print_items_tree(&self, title: &str, list: &[impl Requires]) {
|
||||
print!("\n{} {}", list.len(), style(title).underlined());
|
||||
println!(
|
||||
" - Inhalte der Systembibliothek sind mit ({}), der Benutzerbibliothek mit (u) markiert",
|
||||
style("S").yellow()
|
||||
);
|
||||
list.iter()
|
||||
.for_each(|entry| println!("{}", entry.to_requirement_string(self)));
|
||||
}
|
||||
|
||||
pub fn sorted(&mut self) {
|
||||
self.editor
|
||||
.property_catalogue
|
||||
.sort_unstable_by_key(|e| e.sorting_key());
|
||||
|
||||
self.editor.property_catalogue.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
self.editor
|
||||
.data_catalogue
|
||||
.sort_unstable_by_key(|e| e.sorting_key());
|
||||
|
||||
self.editor.data_catalogue.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
/*self.editor
|
||||
.data_form
|
||||
.sort_unstable_by_key(|e| e.sorting_key());*/
|
||||
|
||||
self.editor
|
||||
.data_form
|
||||
.sort_unstable_by_key(|e| e.sorting_key());
|
||||
.sort_unstable_by(DataForm::compare_by_requirement);
|
||||
|
||||
self.editor.data_form.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
/*self.editor
|
||||
.unterformular
|
||||
.sort_unstable_by_key(|e| e.sorting_key());*/
|
||||
|
||||
self.editor
|
||||
.unterformular
|
||||
.sort_unstable_by_key(|e| e.sorting_key());
|
||||
.sort_unstable_by(Unterformular::compare_by_requirement);
|
||||
|
||||
self.editor.unterformular.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
}
|
||||
|
||||
pub fn strip_system_library_content(&mut self) {
|
||||
self.editor
|
||||
.property_catalogue
|
||||
.retain(|e| !e.is_system_library_content());
|
||||
|
||||
self.editor
|
||||
.data_catalogue
|
||||
.retain(|e| !e.is_system_library_content());
|
||||
|
||||
self.editor
|
||||
.data_form
|
||||
.retain(|e| !e.is_system_library_content());
|
||||
|
||||
self.editor
|
||||
.unterformular
|
||||
.retain(|e| !e.is_system_library_content());
|
||||
}
|
||||
|
||||
pub fn print_diff(&mut self, other: &mut Self, strict: bool) {
|
||||
println!();
|
||||
|
||||
println!(
|
||||
"Datei A wurde am {} mit {} in Version {} erstellt.",
|
||||
style(&self.info_xml.datum_xml).yellow(),
|
||||
style(&self.info_xml.name).yellow(),
|
||||
style(&self.info_xml.version).yellow()
|
||||
);
|
||||
|
||||
println!(
|
||||
"Datei B wurde am {} mit {} in Version {} erstellt.",
|
||||
style(&other.info_xml.datum_xml).yellow(),
|
||||
style(&other.info_xml.name).yellow(),
|
||||
style(&other.info_xml.version).yellow()
|
||||
);
|
||||
|
||||
self.sorted();
|
||||
other.sorted();
|
||||
|
||||
Self::print_item_diff(
|
||||
"Merkmalskataloge",
|
||||
&self.editor.property_catalogue,
|
||||
&other.editor.property_catalogue,
|
||||
strict,
|
||||
);
|
||||
Self::print_item_diff(
|
||||
"Datenkataloge",
|
||||
&self.editor.data_catalogue,
|
||||
&other.editor.data_catalogue,
|
||||
strict,
|
||||
);
|
||||
Self::print_item_diff(
|
||||
"Formulare",
|
||||
&self.editor.data_form,
|
||||
&other.editor.data_form,
|
||||
strict,
|
||||
);
|
||||
Self::print_item_diff(
|
||||
"Unterformulare",
|
||||
&self.editor.unterformular,
|
||||
&other.editor.unterformular,
|
||||
strict,
|
||||
);
|
||||
}
|
||||
|
||||
fn print_item_diff(
|
||||
title: &str,
|
||||
list_a: &[impl Comparable],
|
||||
list_b: &[impl Comparable],
|
||||
strict: bool,
|
||||
) {
|
||||
println!("\n{}", style(title).underlined());
|
||||
|
||||
let mut has_diff = false;
|
||||
|
||||
let names_a = list_a
|
||||
.iter()
|
||||
.map(|entry| entry.get_name())
|
||||
.collect::<Vec<_>>();
|
||||
let names_b = list_b
|
||||
.iter()
|
||||
.map(|entry| entry.get_name())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
names_b.iter().for_each(|entry| {
|
||||
if !names_a.contains(entry) {
|
||||
println!("{}: {}", entry, style("Nicht in Datei A enthalten!").red());
|
||||
has_diff = true;
|
||||
}
|
||||
});
|
||||
|
||||
names_a.iter().for_each(|entry| {
|
||||
if !names_b.contains(entry) {
|
||||
println!("{}: {}", entry, style("Nicht in Datei B enthalten!").red());
|
||||
has_diff = true;
|
||||
}
|
||||
});
|
||||
|
||||
list_a.iter().for_each(|entry_a| {
|
||||
list_b.iter().for_each(|entry_b| {
|
||||
if entry_a.get_name() == entry_b.get_name() {
|
||||
match entry_a.get_revision().cmp(&entry_b.get_revision()) {
|
||||
Ordering::Less => {
|
||||
println!(
|
||||
"{}: {} (Revision {} < Revision {})",
|
||||
entry_a.get_name(),
|
||||
style("Neuer in Datei B").yellow(),
|
||||
style(entry_a.get_revision()).blue(),
|
||||
style(entry_b.get_revision()).green()
|
||||
);
|
||||
has_diff = true;
|
||||
}
|
||||
Ordering::Greater => {
|
||||
println!(
|
||||
"{}: {} (Revision {} > Revision {})",
|
||||
entry_a.get_name(),
|
||||
style("Neuer in Datei A").yellow(),
|
||||
style(entry_a.get_revision()).green(),
|
||||
style(entry_b.get_revision()).blue()
|
||||
);
|
||||
has_diff = true;
|
||||
}
|
||||
_ => {
|
||||
if strict && entry_a.get_hash() != entry_b.get_hash() {
|
||||
println!(
|
||||
"{}: {} (z.B. GUID oder Reihenfolge von Unterelementen)",
|
||||
entry_a.get_name(),
|
||||
style("Inhaltlich verschieden").yellow()
|
||||
);
|
||||
has_diff = true;
|
||||
} else if strict {
|
||||
println!("{}: {}", entry_a.get_name(), style("Identisch").green())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if !has_diff {
|
||||
println!("Keine Unterschiede")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,12 +423,12 @@ pub struct InfoXML {
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Editor {
|
||||
#[serde(rename = "PropertyCatalogue")]
|
||||
#[serde(rename = "PropertyCatalogue", default)]
|
||||
property_catalogue: Vec<PropertyCatalogue>,
|
||||
#[serde(rename = "DataCatalogue")]
|
||||
#[serde(rename = "DataCatalogue", default)]
|
||||
data_catalogue: Vec<DataCatalogue>,
|
||||
#[serde(rename = "Unterformular")]
|
||||
#[serde(rename = "Unterformular", default)]
|
||||
unterformular: Vec<Unterformular>,
|
||||
#[serde(rename = "DataForm")]
|
||||
#[serde(rename = "DataForm", default)]
|
||||
data_form: Vec<DataForm>,
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
use console::style;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::model::{Listable, Ordner, Sortable};
|
||||
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
@@ -56,7 +56,11 @@ pub struct PropertyCatalogue {
|
||||
impl Listable for PropertyCatalogue {
|
||||
fn to_listed_string(&self) -> String {
|
||||
format!(
|
||||
"Merkmalskatalog '{}' in Revision '{}'",
|
||||
"Merkmalskatalog ({}) '{}' in Revision '{}'",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
@@ -67,6 +71,32 @@ impl Sortable for PropertyCatalogue {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self {
|
||||
if let Some(ref mut versions) = self.versions.entry {
|
||||
versions.sort_unstable_by_key(|item| item.version_number);
|
||||
versions.iter_mut().for_each(|version| {
|
||||
version.sorted();
|
||||
});
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Comparable for PropertyCatalogue {
|
||||
fn get_name(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn get_revision(&self) -> u16 {
|
||||
self.revision
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for PropertyCatalogue {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -105,6 +135,40 @@ pub struct Version {
|
||||
categories: Categories,
|
||||
}
|
||||
|
||||
impl Sortable for Version {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.oid.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
if let Some(ref mut abbildung) = self.abbildung {
|
||||
abbildung.sort_unstable_by_key(|item| item.sorting_key());
|
||||
abbildung.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
}
|
||||
|
||||
self.entries
|
||||
.content
|
||||
.sort_unstable_by_key(|item| item.sorting_key());
|
||||
self.entries.content.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
self.categories
|
||||
.content
|
||||
.sort_unstable_by_key(|item| item.sorting_key());
|
||||
self.categories.content.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct VersionEntries {
|
||||
@@ -131,6 +195,12 @@ pub struct VersionEntry {
|
||||
position: String,
|
||||
}
|
||||
|
||||
impl Sortable for VersionEntry {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.code.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Categories {
|
||||
@@ -155,6 +225,26 @@ pub struct Category {
|
||||
category_entries: CategoryEntries,
|
||||
}
|
||||
|
||||
impl Sortable for Category {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
self.category_entries
|
||||
.content
|
||||
.sort_unstable_by_key(|item| item.sorting_key());
|
||||
self.category_entries.content.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct CategoryEntries {
|
||||
@@ -181,6 +271,12 @@ pub struct CategoryEntry {
|
||||
note: Option<String>,
|
||||
}
|
||||
|
||||
impl Sortable for CategoryEntry {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.code.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Abbildung {
|
||||
@@ -190,6 +286,24 @@ pub struct Abbildung {
|
||||
content: Vec<AbbildungEintrag>,
|
||||
}
|
||||
|
||||
impl Sortable for Abbildung {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.ziel_mk_version_oid.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
self.content.sort_unstable_by_key(|item| item.sorting_key());
|
||||
self.content.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct AbbildungEintrag {
|
||||
@@ -199,6 +313,12 @@ pub struct AbbildungEintrag {
|
||||
entry_to: AbbildungEntry,
|
||||
}
|
||||
|
||||
impl Sortable for AbbildungEintrag {
|
||||
fn sorting_key(&self) -> String {
|
||||
format!("{}-{}", self.entry_from.code, self.entry_to.code)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct AbbildungEntry {
|
||||
|
||||
163
src/model/requirements.rs
Normal file
163
src/model/requirements.rs
Normal file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use crate::model::data_catalogue::DataCatalogue;
|
||||
use crate::model::data_form::DataForm;
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::property_catalogue::PropertyCatalogue;
|
||||
use crate::model::unterformular::Unterformular;
|
||||
use crate::model::{Comparable, Listable, Sortable};
|
||||
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
pub enum Requirement<'a> {
|
||||
PropertyCatalogue(&'a PropertyCatalogue),
|
||||
DataCatalogue(&'a DataCatalogue),
|
||||
ExternalPropertyCatalogue(String),
|
||||
ExternalDataCatalogue(String),
|
||||
DataFormReference(&'a DataForm),
|
||||
UnterformularReference(&'a Unterformular),
|
||||
#[allow(dead_code)]
|
||||
ExternalDataFormReference(String),
|
||||
ExternalUnterformularReference(String),
|
||||
|
||||
DataFormSubform(&'a DataForm),
|
||||
UnterformularSubform(&'a Unterformular),
|
||||
#[allow(dead_code)]
|
||||
ExternalDataFormSubform(String),
|
||||
ExternalUnterformularSubform(String),
|
||||
}
|
||||
|
||||
impl Sortable for Requirement<'_> {
|
||||
fn sorting_key(&self) -> String {
|
||||
match self {
|
||||
Requirement::PropertyCatalogue(item) => item.get_name(),
|
||||
Requirement::DataCatalogue(item) => item.get_name(),
|
||||
Requirement::DataFormReference(item) => item.get_name(),
|
||||
Requirement::UnterformularReference(item) => item.get_name(),
|
||||
Requirement::DataFormSubform(item) => item.get_name(),
|
||||
Requirement::UnterformularSubform(item) => item.get_name(),
|
||||
Requirement::ExternalPropertyCatalogue(name)
|
||||
| Requirement::ExternalDataCatalogue(name)
|
||||
| Requirement::ExternalDataFormReference(name)
|
||||
| Requirement::ExternalDataFormSubform(name)
|
||||
| Requirement::ExternalUnterformularReference(name)
|
||||
| Requirement::ExternalUnterformularSubform(name) => name.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for Requirement<'_> {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Requirement::PropertyCatalogue(item) => item.to_listed_string(),
|
||||
Requirement::DataCatalogue(item) => item.to_listed_string(),
|
||||
Requirement::DataFormReference(item) => item.to_listed_string(),
|
||||
Requirement::UnterformularReference(item) => item.to_listed_string(),
|
||||
Requirement::DataFormSubform(item) => item.to_listed_string(),
|
||||
Requirement::UnterformularSubform(item) => item.to_listed_string(),
|
||||
Requirement::ExternalPropertyCatalogue(name) => {
|
||||
format!("Merkmalskatalog (-) '{}' - hier nicht enthalten", name)
|
||||
}
|
||||
Requirement::ExternalDataCatalogue(name) => {
|
||||
format!("Datenkatalog (-) '{}' - hier nicht enthalten", name)
|
||||
}
|
||||
Requirement::ExternalDataFormReference(name)
|
||||
| Requirement::ExternalDataFormSubform(name) => {
|
||||
format!("Formular (-) '{}' - hier nicht enthalten", name)
|
||||
}
|
||||
Requirement::ExternalUnterformularReference(name)
|
||||
| Requirement::ExternalUnterformularSubform(name) => {
|
||||
format!("Unterformular (-) '{}' - hier nicht enthalten", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Requires
|
||||
where
|
||||
Self: Listable,
|
||||
{
|
||||
fn requires_form_reference(&self, _: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn requires_subform(&self, _: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement>;
|
||||
|
||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||
format!(
|
||||
"{}\n{}",
|
||||
self.to_listed_string(),
|
||||
self.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|entry| match entry {
|
||||
Requirement::DataCatalogue(x) => {
|
||||
let inner = x
|
||||
.get_required_entries(all)
|
||||
.iter()
|
||||
.map(|inner_entry| match inner_entry {
|
||||
Requirement::PropertyCatalogue(_) => Some(inner_entry.to_string()),
|
||||
Requirement::ExternalPropertyCatalogue(_) => {
|
||||
Some(inner_entry.to_string())
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
.map(|item| format!(" - {}\n", item.unwrap()))
|
||||
.collect::<Vec<_>>()
|
||||
.join("");
|
||||
|
||||
if inner.is_empty() {
|
||||
Some(format!(" + {}\n", x.to_listed_string()))
|
||||
} else {
|
||||
Some(format!(" + {}\n{}", x.to_listed_string(), inner))
|
||||
}
|
||||
}
|
||||
Requirement::ExternalDataCatalogue(_) => {
|
||||
Some(format!(" + {}\n", entry.to_string()))
|
||||
}
|
||||
Requirement::DataFormReference(_)
|
||||
| Requirement::ExternalDataFormReference(_)
|
||||
| Requirement::UnterformularReference(_)
|
||||
| Requirement::ExternalUnterformularReference(_) => {
|
||||
Some(format!(" > {}\n", entry.to_string()))
|
||||
}
|
||||
Requirement::DataFormSubform(_)
|
||||
| Requirement::ExternalDataFormSubform(_)
|
||||
| Requirement::UnterformularSubform(_)
|
||||
| Requirement::ExternalUnterformularSubform(_) => {
|
||||
Some(format!(" * {}\n", entry.to_string()))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.filter(Option::is_some)
|
||||
.flatten()
|
||||
.collect::<Vec<_>>()
|
||||
.join("")
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashSet;
|
||||
|
||||
use console::style;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::model::onkostar_editor::OnkostarEditor;
|
||||
use crate::model::requirements::{Requirement, Requires};
|
||||
use crate::model::{
|
||||
apply_profile_to_form_entry, Ansichten, Entries, Filter, FormEntry, FormEntryContainer,
|
||||
Listable, MenuCategory, PlausibilityRules, Script, Sortable,
|
||||
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
||||
Filter, FolderContent, FormEntry, FormEntryContainer, Listable, MenuCategory,
|
||||
PlausibilityRules, RefEntries, Script, Sortable,
|
||||
};
|
||||
use crate::model::{Haeufigkeiten, Ordner};
|
||||
use crate::profile::Profile;
|
||||
@@ -176,6 +182,12 @@ impl FormEntryContainer for Unterformular {
|
||||
apply_profile_to_form_entry(entry, form_reference)
|
||||
});
|
||||
|
||||
// Hide form field using filter set to "false" if requested
|
||||
profile_form
|
||||
.form_fields
|
||||
.iter()
|
||||
.for_each(|form_field| apply_profile_to_form_field(entry, form_field));
|
||||
|
||||
if let Some(menu_category) = &profile_form.menu_category {
|
||||
self.menu_category = Some(MenuCategory {
|
||||
name: menu_category.name.clone(),
|
||||
@@ -191,18 +203,19 @@ impl FormEntryContainer for Unterformular {
|
||||
|
||||
impl Listable for Unterformular {
|
||||
fn to_listed_string(&self) -> String {
|
||||
if self.hat_unterformulare {
|
||||
return format!(
|
||||
"Unterformular '{}' in Revision '{}' {}",
|
||||
format!(
|
||||
"Unterformular ({}) '{}' in Revision '{}' {}",
|
||||
match self.is_system_library_content() {
|
||||
true => style("S").yellow(),
|
||||
_ => style("u"),
|
||||
},
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow(),
|
||||
if self.hat_unterformulare {
|
||||
style("Unterformular mit Markierung 'hat Unterformulare'!").red()
|
||||
);
|
||||
} else {
|
||||
style("")
|
||||
}
|
||||
format!(
|
||||
"Unterformular '{}' in Revision '{}'",
|
||||
style(&self.name).yellow(),
|
||||
style(&self.revision).yellow()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -211,6 +224,154 @@ impl Sortable for Unterformular {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self {
|
||||
self.data_catalogues.data_catalogue.sort_unstable();
|
||||
|
||||
self.entries
|
||||
.entry
|
||||
.sort_unstable_by_key(|item| item.sorting_key());
|
||||
|
||||
self.entries.entry.iter_mut().for_each(|item| {
|
||||
item.sorted();
|
||||
});
|
||||
|
||||
if let Some(ref mut plausibility_rule) = self.plausibility_rules.plausibility_rule {
|
||||
plausibility_rule.sort_unstable_by_key(|item| item.bezeichnung.clone());
|
||||
|
||||
plausibility_rule.iter_mut().for_each(|item| {
|
||||
if let Some(ref mut data_form_entry_names) = item.data_form_entries.entry_name {
|
||||
data_form_entry_names.sort_unstable();
|
||||
}
|
||||
});
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl Comparable for Unterformular {
|
||||
fn get_name(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn get_revision(&self) -> u16 {
|
||||
self.revision
|
||||
}
|
||||
|
||||
fn compare_by_requirement(a: &Self, b: &Self) -> Ordering {
|
||||
if a.get_name() == b.get_name()
|
||||
|| a.is_system_library_content()
|
||||
|| b.is_system_library_content()
|
||||
{
|
||||
return Ordering::Equal;
|
||||
}
|
||||
|
||||
if a.requires_form_reference(&b.get_name()) || a.requires_subform(&b.get_name()) {
|
||||
return Ordering::Greater;
|
||||
}
|
||||
|
||||
Ordering::Less
|
||||
}
|
||||
}
|
||||
|
||||
impl Requires for Unterformular {
|
||||
fn requires_form_reference(&self, name: &str) -> bool {
|
||||
self.entries
|
||||
.entry
|
||||
.iter()
|
||||
.map(|item| {
|
||||
item.type_ == "formReference"
|
||||
&& match item.referenced_data_form.as_ref() {
|
||||
Some(refname) => refname == name,
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
.filter(|&it| it)
|
||||
.last()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
fn requires_subform(&self, name: &str) -> bool {
|
||||
self.entries
|
||||
.entry
|
||||
.iter()
|
||||
.map(|item| {
|
||||
item.type_ == "subform"
|
||||
&& match item.referenced_data_form.as_ref() {
|
||||
Some(refname) => refname == name,
|
||||
_ => false,
|
||||
}
|
||||
})
|
||||
.filter(|&it| it)
|
||||
.last()
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||
let mut result = self
|
||||
.data_catalogues
|
||||
.data_catalogue
|
||||
.iter()
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_data_catalogue(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataCatalogue(contained),
|
||||
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
result.sort_unstable_by_key(|item| item.sorting_key());
|
||||
|
||||
let referenced_forms = &mut self
|
||||
.entries
|
||||
.entry
|
||||
.iter()
|
||||
.filter(|&entry| entry.get_type() == "formReference")
|
||||
.filter_map(|entry| match &entry.referenced_data_form {
|
||||
Some(name) => Some(name),
|
||||
None => None,
|
||||
})
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_data_form(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataFormReference(contained),
|
||||
None => match all.find_unterformular(entry.as_str()) {
|
||||
Some(contained) => Requirement::UnterformularReference(contained),
|
||||
None => Requirement::ExternalUnterformularReference(entry.to_string()),
|
||||
},
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
referenced_forms.sort_unstable_by_key(|item| item.sorting_key());
|
||||
result.append(referenced_forms);
|
||||
|
||||
let sub_forms = &mut self
|
||||
.entries
|
||||
.entry
|
||||
.iter()
|
||||
.filter(|&entry| entry.get_type() == "subform")
|
||||
.filter_map(|entry| match &entry.referenced_data_form {
|
||||
Some(name) => Some(name),
|
||||
None => None,
|
||||
})
|
||||
.collect::<HashSet<_>>()
|
||||
.into_iter()
|
||||
.map(|entry| match all.find_data_form(entry.as_str()) {
|
||||
Some(contained) => Requirement::DataFormSubform(contained),
|
||||
None => match all.find_unterformular(entry.as_str()) {
|
||||
Some(contained) => Requirement::UnterformularSubform(contained),
|
||||
None => Requirement::ExternalUnterformularSubform(entry.to_string()),
|
||||
},
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
sub_forms.sort_unstable_by_key(|item| item.sorting_key());
|
||||
result.append(sub_forms);
|
||||
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
impl FolderContent for Unterformular {
|
||||
fn get_library_folder(&self) -> String {
|
||||
self.ordner.bibliothek.name.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
@@ -395,6 +556,9 @@ pub struct Entry {
|
||||
direction_pat_modul: String,
|
||||
#[serde(rename = "SeitenumbruchPatModul")]
|
||||
seitenumbruch_pat_modul: bool,
|
||||
#[serde(rename = "Kontaktliste")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
kontaktliste: Option<String>,
|
||||
#[serde(rename = "MarkierungIgnorieren")]
|
||||
markierung_ignorieren: bool,
|
||||
#[serde(rename = "SucheArt")]
|
||||
@@ -441,6 +605,35 @@ impl FormEntry for Entry {
|
||||
valid: true,
|
||||
});
|
||||
}
|
||||
|
||||
fn hide(&mut self) {
|
||||
self.filter = Some(Filter {
|
||||
condition: "false".into(),
|
||||
valid: true,
|
||||
ref_entries: Some(RefEntries { ref_entry: None }),
|
||||
});
|
||||
self.speichern = "0".into()
|
||||
}
|
||||
}
|
||||
|
||||
impl Sortable for Entry {
|
||||
fn sorting_key(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
|
||||
fn sorted(&mut self) -> &Self
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
if let Some(ref mut filter) = self.filter {
|
||||
if let Some(ref mut ref_entries) = filter.ref_entries {
|
||||
if let Some(ref mut ref_entry) = ref_entries.ref_entry {
|
||||
ref_entry.sort_unstable()
|
||||
}
|
||||
}
|
||||
}
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
|
||||
@@ -50,6 +50,8 @@ pub struct Form {
|
||||
pub name: String,
|
||||
#[serde(default)]
|
||||
pub form_references: Vec<FormReference>,
|
||||
#[serde(default)]
|
||||
pub form_fields: Vec<FormField>,
|
||||
pub menu_category: Option<MenuCategory>,
|
||||
}
|
||||
|
||||
@@ -68,6 +70,13 @@ impl FormReference {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct FormField {
|
||||
pub name: String,
|
||||
#[serde(default)]
|
||||
pub hide: bool,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct MenuCategory {
|
||||
pub name: String,
|
||||
@@ -93,6 +102,9 @@ mod tests {
|
||||
referenced_data_form: 'OS.Tumorkonferenz.VarianteUKW'
|
||||
anzeige: 'Datum: {Datum}'
|
||||
anzeige_auswahl: 'TK vom {Datum}'
|
||||
form_fields:
|
||||
- name: eingabefeld
|
||||
hide: true
|
||||
";
|
||||
|
||||
match Profile::from_str(content) {
|
||||
@@ -101,6 +113,7 @@ mod tests {
|
||||
assert_eq!(profile.forms[0].name, "DNPM Therapieplan");
|
||||
assert!(profile.forms[0].menu_category.is_some());
|
||||
assert_eq!(profile.forms[0].form_references.len(), 1);
|
||||
assert_eq!(profile.forms[0].form_fields.len(), 1)
|
||||
}
|
||||
Err(e) => panic!("Cannot deserialize profile: {}", e),
|
||||
}
|
||||
@@ -212,4 +225,29 @@ mod tests {
|
||||
let actual = Profile::from_str(content);
|
||||
assert!(actual.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_deserialize_form_fields() {
|
||||
let content = "forms:
|
||||
- name: 'DNPM Therapieplan'
|
||||
form_fields:
|
||||
- name: formularfeld_to_keep
|
||||
hide: false
|
||||
- name: formularfeld_to_hide
|
||||
hide: true
|
||||
";
|
||||
|
||||
match Profile::from_str(content) {
|
||||
Ok(profile) => {
|
||||
assert_eq!(profile.forms.len(), 1);
|
||||
assert_eq!(profile.forms[0].name, "DNPM Therapieplan");
|
||||
assert_eq!(profile.forms[0].form_fields.len(), 2);
|
||||
assert_eq!(profile.forms[0].form_fields[0].name, "formularfeld_to_keep");
|
||||
assert!(!profile.forms[0].form_fields[0].hide);
|
||||
assert_eq!(profile.forms[0].form_fields[1].name, "formularfeld_to_hide");
|
||||
assert!(profile.forms[0].form_fields[1].hide);
|
||||
}
|
||||
Err(e) => panic!("Cannot deserialize profile: {}", e),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
132
src/unzip_osb.rs
Normal file
132
src/unzip_osb.rs
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
use console::style;
|
||||
use deob::deobfuscate;
|
||||
use std::{fs, io};
|
||||
|
||||
macro_rules! started {
|
||||
( $o:expr ) => {
|
||||
println!("{: <6}{}", style("[..]").cyan(), $o);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! ok {
|
||||
( $o:expr ) => {
|
||||
use console::Term;
|
||||
let _ = Term::stdout().move_cursor_up(1);
|
||||
println!("{: <6}{}", style("[OK]").green(), $o);
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! error {
|
||||
( $o:expr, $e:expr ) => {
|
||||
use console::Term;
|
||||
let _ = Term::stdout().move_cursor_up(1);
|
||||
println!("{: <6}{} - Error: {}", style("[ERR]").red(), $o, $e);
|
||||
};
|
||||
}
|
||||
|
||||
pub fn unzip_osb(path: &str) {
|
||||
println!("Entpacke OSB-Datei {}\n", style(path).yellow());
|
||||
|
||||
let pw = deobfuscate(env!("OSB_KEY").trim());
|
||||
|
||||
let file = match fs::File::open(path) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
println!(
|
||||
"{: <6}Abbruch! - Kann Datei nicht entpacken: {}",
|
||||
style("[ERR]").red(),
|
||||
err
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
let mut archive = match zip::ZipArchive::new(file) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
println!(
|
||||
"{: <6}Abbruch! - Kann Datei nicht entpacken: {}",
|
||||
style("[ERR]").red(),
|
||||
err
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
for i in 0..archive.len() {
|
||||
let mut file = if let Ok(Ok(file)) = archive.by_index_decrypt(i, pw.as_bytes()) {
|
||||
file
|
||||
} else {
|
||||
println!(
|
||||
"{: <6}Abbruch! - Kann Datei nicht entpacken",
|
||||
style("[ERR]").red()
|
||||
);
|
||||
return;
|
||||
};
|
||||
|
||||
let outpath = match file.enclosed_name() {
|
||||
Some(path) => path.to_owned(),
|
||||
None => continue,
|
||||
};
|
||||
|
||||
started!(outpath.display());
|
||||
|
||||
if !file.is_dir() {
|
||||
if let Some(p) = outpath.parent() {
|
||||
if !p.exists() {
|
||||
fs::create_dir_all(p).unwrap();
|
||||
}
|
||||
}
|
||||
let mut outfile = match fs::File::create(&outpath) {
|
||||
Ok(file) => file,
|
||||
Err(err) => {
|
||||
error!(outpath.display(), err);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
match io::copy(&mut file, &mut outfile) {
|
||||
Ok(_) => {}
|
||||
Err(err) => {
|
||||
error!(outpath.display(), err);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
ok!(outpath.display());
|
||||
} else {
|
||||
if !outpath.exists() {
|
||||
match fs::create_dir_all(&outpath) {
|
||||
Ok(_) => {}
|
||||
Err(err) => {
|
||||
error!(outpath.display(), err);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
ok!(outpath.display());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user