forked from Plugin-JF-Onkostar/osc-variant
Compare commits
74 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f3bbef5d22 | |||
| ef8f6ab1b5 | |||
| a1e5133516 | |||
| 13bcd74f6c | |||
| 6fdbe06106 | |||
| 31c162e977 | |||
| 2413e4b9b8 | |||
| c9ecb8e944 | |||
| 774b57d78e | |||
| a52eb9742e | |||
| 4c76504000 | |||
| 4676a63c69 | |||
| e250e330a5 | |||
| 349b571e09 | |||
| 90423b5b4e | |||
| d45ded939e | |||
| 7ab5523f3c | |||
| f02ea9b065 | |||
| a08abd7688 | |||
| bf7b8cd9ba | |||
| 821b30e452 | |||
| 6a0a356120 | |||
| 352f5e23fc | |||
| 7b13251d34 | |||
| 6da1c48c28 | |||
| e2d5eedd02 | |||
| a55db66e57 | |||
| dce2a5cdda | |||
| 93981f7709 | |||
| b6694b9e53 | |||
| 0e690cbb85 | |||
| 0d6525c398 | |||
| df643b5e60 | |||
| 1746026af8 | |||
| 7cdfe0068f | |||
| 1f5ec80cc6 | |||
| f851e9c424 | |||
| 7ef1638b58 | |||
| 4745a75f2e | |||
| f089ad0b32 | |||
| 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 |
610
Cargo.lock
generated
610
Cargo.lock
generated
@@ -18,16 +18,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anstyle"
|
name = "aes"
|
||||||
version = "1.0.2"
|
version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea"
|
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]]
|
[[package]]
|
||||||
name = "async-trait"
|
name = "async-trait"
|
||||||
version = "0.1.73"
|
version = "0.1.74"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0"
|
checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -49,6 +60,24 @@ dependencies = [
|
|||||||
"rustc-demangle",
|
"rustc-demangle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "base64ct"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
version = "0.10.4"
|
version = "0.10.4"
|
||||||
@@ -59,10 +88,37 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "byteorder"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
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]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
@@ -70,6 +126,7 @@ version = "1.0.83"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"jobserver",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -80,10 +137,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "cipher"
|
||||||
version = "4.4.2"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6"
|
checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"
|
||||||
|
dependencies = [
|
||||||
|
"crypto-common",
|
||||||
|
"inout",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap"
|
||||||
|
version = "4.4.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
@@ -91,9 +158,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.4.2"
|
version = "4.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
|
checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle",
|
"anstyle",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
@@ -101,18 +168,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_complete"
|
name = "clap_complete"
|
||||||
version = "4.4.0"
|
version = "4.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "586a385f7ef2f8b4d86bddaa0c094794e7ccbfe5ffef1f434fe928143fc783a5"
|
checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_derive"
|
name = "clap_derive"
|
||||||
version = "4.4.2"
|
version = "4.4.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
|
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
@@ -122,9 +189,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.5.1"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961"
|
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
@@ -136,18 +203,42 @@ dependencies = [
|
|||||||
"lazy_static",
|
"lazy_static",
|
||||||
"libc",
|
"libc",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"windows-sys",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cpufeatures"
|
name = "constant_time_eq"
|
||||||
version = "0.2.9"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1"
|
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cpufeatures"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"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]]
|
[[package]]
|
||||||
name = "crypto-common"
|
name = "crypto-common"
|
||||||
version = "0.1.6"
|
version = "0.1.6"
|
||||||
@@ -158,6 +249,35 @@ dependencies = [
|
|||||||
"typenum",
|
"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]]
|
[[package]]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.10.7"
|
version = "0.10.7"
|
||||||
@@ -166,6 +286,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer",
|
"block-buffer",
|
||||||
"crypto-common",
|
"crypto-common",
|
||||||
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -180,6 +301,32 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno"
|
||||||
|
version = "0.3.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e"
|
||||||
|
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]]
|
[[package]]
|
||||||
name = "generic-array"
|
name = "generic-array"
|
||||||
version = "0.14.7"
|
version = "0.14.7"
|
||||||
@@ -198,9 +345,9 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.0"
|
version = "0.14.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a"
|
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@@ -215,21 +362,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "hmac"
|
||||||
version = "2.0.0"
|
version = "0.12.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d"
|
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
|
||||||
|
dependencies = [
|
||||||
|
"digest",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indicatif"
|
||||||
|
version = "0.17.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25"
|
||||||
|
dependencies = [
|
||||||
|
"console",
|
||||||
|
"instant",
|
||||||
|
"number_prefix",
|
||||||
|
"portable-atomic",
|
||||||
|
"unicode-width",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "inout"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "instant"
|
||||||
|
version = "0.1.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.9"
|
version = "1.0.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jobserver"
|
||||||
|
version = "0.1.27"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
@@ -238,15 +434,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.147"
|
version = "0.2.150"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.4.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.6.3"
|
version = "2.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
|
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
@@ -257,6 +459,12 @@ dependencies = [
|
|||||||
"adler",
|
"adler",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "number_prefix"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.32.1"
|
version = "0.32.1"
|
||||||
@@ -268,15 +476,42 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "osc-variant"
|
name = "osc-variant"
|
||||||
version = "0.4.0"
|
version = "0.7.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"clap_complete",
|
"clap_complete",
|
||||||
"console",
|
"console",
|
||||||
|
"deob",
|
||||||
|
"dialoguer",
|
||||||
|
"indicatif",
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"sha256",
|
"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]]
|
[[package]]
|
||||||
@@ -286,19 +521,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "pkg-config"
|
||||||
version = "1.0.66"
|
version = "0.3.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b"
|
||||||
|
|
||||||
|
[[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 = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.30.0"
|
version = "0.31.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956"
|
checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -313,12 +566,40 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "redox_syscall"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 1.3.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.23"
|
version = "0.1.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.38.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.1",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.15"
|
version = "1.0.15"
|
||||||
@@ -327,18 +608,18 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.188"
|
version = "1.0.192"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e"
|
checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.188"
|
version = "1.0.192"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2"
|
checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -347,9 +628,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_yaml"
|
name = "serde_yaml"
|
||||||
version = "0.9.25"
|
version = "0.9.27"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a49e178e4452f45cb61d0cd8cebc1b0fafd3e41929e996cef79aa3aca91f574"
|
checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
@@ -359,10 +640,21 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sha2"
|
name = "sha1"
|
||||||
version = "0.10.7"
|
version = "0.10.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8"
|
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 = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"cpufeatures",
|
"cpufeatures",
|
||||||
@@ -383,10 +675,22 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "shell-words"
|
||||||
version = "2.0.31"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398"
|
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.39"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -394,10 +698,61 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tempfile"
|
||||||
version = "1.32.0"
|
version = "3.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9"
|
checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5"
|
||||||
|
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.34.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
@@ -406,21 +761,21 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.16.0"
|
version = "1.17.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.11"
|
version = "1.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c"
|
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.10"
|
version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unsafe-libyaml"
|
name = "unsafe-libyaml"
|
||||||
@@ -440,7 +795,16 @@ version = "0.45.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||||
dependencies = [
|
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]]
|
[[package]]
|
||||||
@@ -449,13 +813,28 @@ version = "0.42.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm",
|
"windows_aarch64_gnullvm 0.42.2",
|
||||||
"windows_aarch64_msvc",
|
"windows_aarch64_msvc 0.42.2",
|
||||||
"windows_i686_gnu",
|
"windows_i686_gnu 0.42.2",
|
||||||
"windows_i686_msvc",
|
"windows_i686_msvc 0.42.2",
|
||||||
"windows_x86_64_gnu",
|
"windows_x86_64_gnu 0.42.2",
|
||||||
"windows_x86_64_gnullvm",
|
"windows_x86_64_gnullvm 0.42.2",
|
||||||
"windows_x86_64_msvc",
|
"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]]
|
[[package]]
|
||||||
@@ -464,38 +843,135 @@ version = "0.42.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
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]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
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]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.42.2"
|
version = "0.42.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.48.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
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",
|
||||||
|
]
|
||||||
|
|||||||
24
Cargo.toml
24
Cargo.toml
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "osc-variant"
|
name = "osc-variant"
|
||||||
version = "0.4.0"
|
version = "0.7.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Paul-Christian Volkmer <volkmer_p@ukw.de>"]
|
authors = ["Paul-Christian Volkmer <volkmer_p@ukw.de>"]
|
||||||
description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort"
|
description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort"
|
||||||
@@ -9,13 +9,25 @@ readme = "README.md"
|
|||||||
|
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
members = ["libs/deob"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.4", 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 = { version = "1.0", features = ["derive"] }
|
||||||
serde_yaml = "0.9"
|
serde_yaml = "0.9"
|
||||||
quick-xml = { version = "0.30", features = ["escape-html", "serialize"], default-features = false }
|
quick-xml = { version = "0.31", features = ["escape-html", "serialize"], default-features = false }
|
||||||
console = "0.15"
|
console = "0.15"
|
||||||
sha256 = "1.4"
|
sha256 = "1.4"
|
||||||
|
dialoguer = "0.11"
|
||||||
|
indicatif = "0.17"
|
||||||
|
|
||||||
|
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]
|
[build-dependencies]
|
||||||
clap = { version = "4.4", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
clap = { version = "4.4", features = ["std", "help", "usage", "derive", "error-context"], default-features = false }
|
||||||
@@ -30,6 +42,14 @@ panic = "abort"
|
|||||||
|
|
||||||
[package.metadata.deb]
|
[package.metadata.deb]
|
||||||
copyright = "Copyright (c) 2023 Comprehensive Cancer Center Mainfranken"
|
copyright = "Copyright (c) 2023 Comprehensive Cancer Center Mainfranken"
|
||||||
|
extended-description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort."
|
||||||
assets = [
|
assets = [
|
||||||
|
["target/release/osc-variant", "usr/bin/", "755"],
|
||||||
["completion/osc-variant.bash", "etc/bash_completion.d/", "644"]
|
["completion/osc-variant.bash", "etc/bash_completion.d/", "644"]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[package.metadata.generate-rpm]
|
||||||
|
assets = [
|
||||||
|
{ source = "target/release/osc-variant", dest = "/usr/bin/", mode = "755" },
|
||||||
|
{ source = "completion/osc-variant.bash", dest = "/etc/bash_completion.d/", mode = "644" }
|
||||||
|
]
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -32,11 +32,11 @@ binary-all: win-binary-x86_64 linux-binary-x86_64
|
|||||||
|
|
||||||
.PHONY: win-binary-x86_64
|
.PHONY: win-binary-x86_64
|
||||||
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
|
.PHONY: linux-binary-x86_64
|
||||||
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
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
|
|||||||
67
README.md
67
README.md
@@ -16,6 +16,10 @@ unvollständigen Ausgabedateien zu erzeugen.
|
|||||||
|
|
||||||
### Beispiele
|
### 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
|
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:
|
und erzeugt eine Ausgabe analog dem Befehl auf Linux-Systemen:
|
||||||
|
|
||||||
@@ -23,21 +27,40 @@ und erzeugt eine Ausgabe analog dem Befehl auf Linux-Systemen:
|
|||||||
osc-variant sha256sum meine-beispieldatei.osc
|
osc-variant sha256sum meine-beispieldatei.osc
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Unterbefehl `list`
|
||||||
|
|
||||||
Zum Auflisten der Inhalte einer Datei wird folgender Befehl verwendet:
|
Zum Auflisten der Inhalte einer Datei wird folgender Befehl verwendet:
|
||||||
|
|
||||||
```
|
```
|
||||||
osc-variant list meine-beispieldatei.osc
|
osc-variant list meine-beispieldatei.osc
|
||||||
```
|
```
|
||||||
|
|
||||||
Zum Auflisten der Inhalte mit allen Abhängigkeiten, z.B. Daten- und Merkmalkataloge und bei Formularen wird der Befehl
|
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:
|
`tree` verwendet:
|
||||||
|
|
||||||
```
|
```
|
||||||
osc-variant tree meine-beispieldatei.osc
|
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.
|
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.
|
Zum Vergleich zweier OSC-Dateien wird der Unterbefehl `diff` verwendet.
|
||||||
Der optionale Parameter `--strict` vergleicht auch den Inhalt der OSC-Datei.
|
Der optionale Parameter `--strict` vergleicht auch den Inhalt der OSC-Datei.
|
||||||
Ohne diesen wird nur das Vorhandensein von Inhalten und die Revision verglichen.
|
Ohne diesen wird nur das Vorhandensein von Inhalten und die Revision verglichen.
|
||||||
@@ -52,6 +75,8 @@ bzw.
|
|||||||
osc-variant diff meine-beispieldatei.osc andere-beispieldatei.osc --strict
|
osc-variant diff meine-beispieldatei.osc andere-beispieldatei.osc --strict
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Unterbefehl `modify`
|
||||||
|
|
||||||
Zum Anpassen des Inhalts einer Datei:
|
Zum Anpassen des Inhalts einer Datei:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -59,11 +84,41 @@ osc-variant modify meine-beispieldatei.osc --profile ukw-profil.yml --output ukw
|
|||||||
```
|
```
|
||||||
|
|
||||||
Die Parameter `--profile` und `--output` sind optional.
|
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 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.
|
Ohne eine Angabe der Ausgabedatei wird auf die Standardausgabe ausgegeben.
|
||||||
|
|
||||||
|
##### Enthaltene Profile
|
||||||
|
|
||||||
|
Die im Ordner [`examples/`](/examples) enthaltenen Profile für Standorte sind in der ausführbaren Anwendung enthalten
|
||||||
|
und die Dateien müssen nicht explizit als Datei vorliegen:
|
||||||
|
|
||||||
|
* `--profile examples/dnpm-ukm.yml` => `--profile UKM`
|
||||||
|
* `--profile examples/dnpm-ukw.yml` => `--profile UKW`
|
||||||
|
* `--profile examples/dnpm-umg.yml` => `--profile UMG`
|
||||||
|
|
||||||
|
#### 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
|
||||||
|
```
|
||||||
|
|
||||||
|
Dieser Befehl kennt die beiden optionalen Parameter
|
||||||
|
|
||||||
|
* `-d`: Optionale Angabe des Zielverzeichnisses. Wenn keine Angabe vorhanden ist, wird das aktuelle Verzeichnis verwendet.
|
||||||
|
* `-p`/`--password`: Optionale Angabe des Passworts zum Entpacken der OSB-Datei.
|
||||||
|
|
||||||
|
#### Unterbefehl `check`
|
||||||
|
|
||||||
|
Der Unterbefehl `check` prüft eine OSC-Datei auf bekannte Probleme und gibt eine Liste mit erkannten Problemen aus.
|
||||||
|
|
||||||
|
Eine Liste mit bekannten Problemen wird mit `check --list` ausgegeben.
|
||||||
|
|
||||||
#### Kompakte Ausgabe
|
#### Kompakte Ausgabe
|
||||||
|
|
||||||
OSC-Dateien sind XML-Dateien. Diese Anwendung ermöglicht optional die Ausgabe als kompaktere XML-Datei ohne Zeilenumbrüche.
|
OSC-Dateien sind XML-Dateien. Diese Anwendung ermöglicht optional die Ausgabe als kompaktere XML-Datei ohne Zeilenumbrüche.
|
||||||
@@ -71,9 +126,9 @@ Hierzu ist die Option `--compact` vorgesehen. Es können, je nach Datei, bis zu
|
|||||||
|
|
||||||
#### Filter
|
#### Filter
|
||||||
|
|
||||||
Bei der Auflistung von Inhalten ist es möglich, die Ausgaben anhand des Namens zu filtern.
|
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.
|
Hierzu ist die Option `--filter=` vorgesehen.
|
||||||
Wird diese angewendet, werden nur Inhalte ausgegeben, deren Name die angegebene Zeichenkette beinhalten.
|
Wird diese angewendet, werden nur Inhalte angezeigt, deren Name die angegebene Zeichenkette beinhalten.
|
||||||
|
|
||||||
#### Sortierung
|
#### Sortierung
|
||||||
|
|
||||||
@@ -81,7 +136,11 @@ Bei der Auflistung der Inhalte, kann die Option `--sorted` dazu verwendet werden
|
|||||||
Die Sortierung erfolgt dabei nach Namen des Katalogs oder des Formulars.
|
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
|
Beim Modifizieren der Inhalte kann ebenfalls die Option `--sorted` dazu verwendet werden, die Einträge im Anschluss an die Modifikation
|
||||||
nach Namen zu sortieren.
|
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.
|
Dies erlaubt eine konsistente Reihenfolge der Einträge, wodurch ein direkter Vergleich mit Vorversionen ermöglicht wird.
|
||||||
|
|
||||||
##### Entfernen von Inhalten der Systembibliothek bei Modifikation
|
##### Entfernen von Inhalten der Systembibliothek bei Modifikation
|
||||||
|
|||||||
2
build.rs
2
build.rs
@@ -35,7 +35,7 @@ fn main() -> Result<(), Error> {
|
|||||||
|
|
||||||
let package_name = std::env::var("CARGO_CRATE_NAME").unwrap_or("osc-variant".to_string());
|
let package_name = std::env::var("CARGO_CRATE_NAME").unwrap_or("osc-variant".to_string());
|
||||||
|
|
||||||
fs::remove_dir_all("completion")?;
|
fs::remove_dir_all("completion").unwrap_or_default();
|
||||||
fs::create_dir("completion")?;
|
fs::create_dir("completion")?;
|
||||||
|
|
||||||
generate_to(Bash, &mut cmd, package_name.as_str(), "completion")?;
|
generate_to(Bash, &mut cmd, package_name.as_str(), "completion")?;
|
||||||
|
|||||||
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,6 +4,10 @@ forms:
|
|||||||
- name: MTB
|
- name: MTB
|
||||||
referenced_data_form: 'MR.MTB_Anmeldung'
|
referenced_data_form: 'MR.MTB_Anmeldung'
|
||||||
anzeige_auswahl: 'MTB Anmeldung vom {Anmeldedatum}'
|
anzeige_auswahl: 'MTB Anmeldung vom {Anmeldedatum}'
|
||||||
|
scripts_code: |
|
||||||
|
setFieldValue('AnmeldedatumMTB', getFieldValue('MTB').MTBTermin);
|
||||||
|
setFieldValue('WHOGrad', getFieldValue('MTB').WHOGrad);
|
||||||
|
setFieldValue('Leitlinienstatus', getFieldValue('MTB').Leitlinienstatus);
|
||||||
- name: 'DNPM Therapieplan'
|
- name: 'DNPM Therapieplan'
|
||||||
form_references:
|
form_references:
|
||||||
- name: referstemtb
|
- name: referstemtb
|
||||||
|
|||||||
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"
|
||||||
32
libs/deob/build.rs
Normal file
32
libs/deob/build.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* 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");
|
||||||
|
println!("cargo:rerun-if-changed=src/deob.h");
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
30
osc-variant.wxs
Normal file
30
osc-variant.wxs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||||
|
<Product Id="*"
|
||||||
|
Language="1033"
|
||||||
|
Manufacturer="CCC Mainfranken"
|
||||||
|
Name="OSC-Variant"
|
||||||
|
UpgradeCode="{83088581-5db3-49a2-8932-27da356818c7}"
|
||||||
|
Version="0.6.0">
|
||||||
|
|
||||||
|
<Package InstallScope="perMachine" Compressed="yes" />
|
||||||
|
|
||||||
|
<MediaTemplate EmbedCab="yes" />
|
||||||
|
|
||||||
|
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||||
|
<Directory Id="ProgramFiles64Folder">
|
||||||
|
<Directory Id="INSTALLFOLDER" Name="osc-variant">
|
||||||
|
<Component Id="MainExecutable" Guid="*">
|
||||||
|
<File Id="OscVariantExe" Name="osc-variant.exe" KeyPath="yes" Source="target/x86_64-pc-windows-gnu/release/osc-variant.exe" />
|
||||||
|
<File Id="LicenseTxt" Name="LICENSE.txt" Source="LICENSE.txt" />
|
||||||
|
</Component>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Feature Id="Complete">
|
||||||
|
<ComponentRef Id="MainExecutable" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
</Product>
|
||||||
|
</Wix>
|
||||||
245
src/checks/mod.rs
Normal file
245
src/checks/mod.rs
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
/*
|
||||||
|
* 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::fmt::{Display, Formatter};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use console::style;
|
||||||
|
|
||||||
|
#[cfg(feature = "unzip-osb")]
|
||||||
|
pub mod osb;
|
||||||
|
pub mod osc;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
pub enum CheckNotice {
|
||||||
|
/// This will result in Error if importing file and has a support code
|
||||||
|
ErrorWithCode {
|
||||||
|
code: String,
|
||||||
|
description: String,
|
||||||
|
line: Option<usize>,
|
||||||
|
example: Option<String>,
|
||||||
|
},
|
||||||
|
/// This will result in Error if importing file
|
||||||
|
Error {
|
||||||
|
description: String,
|
||||||
|
line: Option<usize>,
|
||||||
|
},
|
||||||
|
/// Other known issues
|
||||||
|
Warning {
|
||||||
|
description: String,
|
||||||
|
line: Option<usize>,
|
||||||
|
},
|
||||||
|
/// Other known issues
|
||||||
|
Info {
|
||||||
|
description: String,
|
||||||
|
line: Option<usize>,
|
||||||
|
},
|
||||||
|
/// Ok
|
||||||
|
Ok(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Display for CheckNotice {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
match self {
|
||||||
|
CheckNotice::ErrorWithCode {
|
||||||
|
code,
|
||||||
|
description,
|
||||||
|
line,
|
||||||
|
example,
|
||||||
|
} => match line {
|
||||||
|
Some(line) => write!(
|
||||||
|
f,
|
||||||
|
"{: <7} ({}) at Line {}: {}{}",
|
||||||
|
style("ERROR").red().bold(),
|
||||||
|
code,
|
||||||
|
line,
|
||||||
|
description,
|
||||||
|
match example {
|
||||||
|
Some(example) => format!("\n 🔥 '{}'", style(example).dim()),
|
||||||
|
_ => String::new(),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
None => write!(
|
||||||
|
f,
|
||||||
|
"{: <7} ({}): {}{}",
|
||||||
|
style("ERROR").red().bold(),
|
||||||
|
code,
|
||||||
|
description,
|
||||||
|
match example {
|
||||||
|
Some(example) => format!("\n 🔥 '{}'", style(example).dim()),
|
||||||
|
_ => String::new(),
|
||||||
|
}
|
||||||
|
),
|
||||||
|
},
|
||||||
|
CheckNotice::Error { description, line } => match line {
|
||||||
|
Some(line) => write!(
|
||||||
|
f,
|
||||||
|
"{: <7} at Line {}: {}",
|
||||||
|
style("ERROR").red().bold(),
|
||||||
|
line,
|
||||||
|
description
|
||||||
|
),
|
||||||
|
None => write!(f, "{: <7} {}", style("ERROR").red().bold(), description),
|
||||||
|
},
|
||||||
|
CheckNotice::Warning { description, line } => match line {
|
||||||
|
Some(line) => write!(
|
||||||
|
f,
|
||||||
|
"{: <7} at Line {}: {}",
|
||||||
|
style("WARNING").yellow().bold(),
|
||||||
|
line,
|
||||||
|
description
|
||||||
|
),
|
||||||
|
None => write!(
|
||||||
|
f,
|
||||||
|
"{: <7} {}",
|
||||||
|
style("WARNING").yellow().bold(),
|
||||||
|
description
|
||||||
|
),
|
||||||
|
},
|
||||||
|
CheckNotice::Info { description, line } => match line {
|
||||||
|
Some(line) => write!(
|
||||||
|
f,
|
||||||
|
"{: <7} at Line {}: {}",
|
||||||
|
style("INFO").blue().bold(),
|
||||||
|
line,
|
||||||
|
description
|
||||||
|
),
|
||||||
|
None => write!(f, "{: <7} {}", style("INFO").blue().bold(), description),
|
||||||
|
},
|
||||||
|
CheckNotice::Ok(msg) => write!(f, "{: <7} {}", style("OK").green(), msg),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Checkable {
|
||||||
|
fn check(&self) -> Vec<CheckNotice>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Fixable {
|
||||||
|
fn fix(&mut self) -> bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
pub fn check_file(file: &Path, password: Option<String>) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
|
match file.extension() {
|
||||||
|
Some(ex) => match ex.to_str() {
|
||||||
|
#[cfg(feature = "unzip-osb")]
|
||||||
|
Some("osb") => match password {
|
||||||
|
Some(password) => osb::check_file(file, password.as_str()),
|
||||||
|
None => {
|
||||||
|
use deob::deobfuscate;
|
||||||
|
osb::check_file(file, deobfuscate(env!("OSB_KEY").trim()).as_str())
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Some("osc") => osc::check_file(file),
|
||||||
|
_ => Err(CheckNotice::Error {
|
||||||
|
description: "Keine prüfbare Datei".to_string(),
|
||||||
|
line: None,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
_ => Err(CheckNotice::Error {
|
||||||
|
description: "Keine prüfbare Datei".to_string(),
|
||||||
|
line: None,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn print_checks() {
|
||||||
|
println!(
|
||||||
|
"{}",
|
||||||
|
style("Die folgenden Probleme sind bekannt\n")
|
||||||
|
.yellow()
|
||||||
|
.bold()
|
||||||
|
);
|
||||||
|
|
||||||
|
struct Problem<'a> {
|
||||||
|
code: &'a str,
|
||||||
|
name: &'a str,
|
||||||
|
description: &'a str,
|
||||||
|
fixable: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> Display for Problem<'a> {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"{} {} {}\n\n{}",
|
||||||
|
style(self.code).bold(),
|
||||||
|
style(self.name).underlined(),
|
||||||
|
match self.fixable {
|
||||||
|
true => style("(Behebbar)").green(),
|
||||||
|
false => style("(Nicht behebbar)").red(),
|
||||||
|
},
|
||||||
|
self.description
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vec![
|
||||||
|
Problem {
|
||||||
|
code: "2023-0001",
|
||||||
|
name: "Unterformular mit Markierung 'hat Unterformulare'",
|
||||||
|
description: " Aktuell gibt es keine Unterformulare in Unterformularen, daher\n \
|
||||||
|
sollte dies nicht vorkommen.\n\n \
|
||||||
|
Eine mögliche Ursache ist die Speicherung eines Unterformulars als Formular.",
|
||||||
|
fixable: false,
|
||||||
|
},
|
||||||
|
Problem {
|
||||||
|
code: "2023-0002",
|
||||||
|
name: "Formular hat keine Angabe zum Prozedurdatum",
|
||||||
|
description: " Formulare benötigen die Angabe des Prozedurdatums, anderenfalls\n \
|
||||||
|
führt dies zu Problemen in Onkostar.\n\n \
|
||||||
|
Unterformulare können ein Prozedurdatum haben, müssen es aber nicht.\n\n \
|
||||||
|
Eine mögliche Ursache ist die Speicherung eines Formulars als Unterformular.",
|
||||||
|
fixable: false,
|
||||||
|
},
|
||||||
|
Problem {
|
||||||
|
code: "2023-0003",
|
||||||
|
name: "Leerzeichen am Ende der Plausibilitätsregel-Bezeichnung (OSTARSUPP-13334)",
|
||||||
|
description:
|
||||||
|
" Treten Leerzeichen am Ende der Plausibilitätsregel-Bezeichnung auf,\n \
|
||||||
|
führt dies zu Fehlern beim Import der OSC-Datei.\n\n \
|
||||||
|
Das Problem wird beim Verwenden des Unterbefehls 'modify' automatisch\n \
|
||||||
|
behoben und Leerzeichen entfernt.
|
||||||
|
",
|
||||||
|
fixable: true,
|
||||||
|
},
|
||||||
|
Problem {
|
||||||
|
code: "2023-0004",
|
||||||
|
name: "Verweis auf noch nicht definiertes Formular (OSTARSUPP-13212)",
|
||||||
|
description: " Wenn ein Formular einen Verweis auf ein anderes Formular enthält,\n \
|
||||||
|
das nicht vor diesem Formular in der OSC-Datei definiert ist, wird der\n \
|
||||||
|
Formularverweis beim Import der OSC-Datei nicht übernommen.\n\n \
|
||||||
|
Dies kann bei wechselseitiger Abhängigkeit zwischen zwei (Unter-)Formularen\n \
|
||||||
|
auftreten.\n\n \
|
||||||
|
In diesem Fall kann ein erneuter/zweiter Import helfen, da das Onkostar in\n \
|
||||||
|
diesem Fall alle Formulare importiert hat und der Formularverweis dann \n \
|
||||||
|
gespeichert werden kann.
|
||||||
|
",
|
||||||
|
fixable: false,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.for_each(|problem| println!("{}\n", problem))
|
||||||
|
}
|
||||||
108
src/checks/osb.rs
Normal file
108
src/checks/osb.rs
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* 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::Read;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use indicatif::ProgressBar;
|
||||||
|
|
||||||
|
use crate::checks::{osc, CheckNotice};
|
||||||
|
|
||||||
|
#[cfg(feature = "unzip-osb")]
|
||||||
|
pub fn check_file(file: &Path, password: &str) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
|
let file = match fs::File::open(file) {
|
||||||
|
Ok(file) => file,
|
||||||
|
Err(err) => {
|
||||||
|
return Err(CheckNotice::Error {
|
||||||
|
description: format!("Kann Datei nicht lesen: {}", err),
|
||||||
|
line: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut archive = match zip::ZipArchive::new(file) {
|
||||||
|
Ok(file) => file,
|
||||||
|
Err(err) => {
|
||||||
|
return Err(CheckNotice::Error {
|
||||||
|
description: format!("Kann Datei nicht lesen: {}", err),
|
||||||
|
line: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut result = vec![];
|
||||||
|
|
||||||
|
let progress_bar = ProgressBar::new(archive.len() as u64);
|
||||||
|
|
||||||
|
for i in 0..archive.len() {
|
||||||
|
progress_bar.inc(1);
|
||||||
|
if let Ok(Ok(mut zip_file)) = archive.by_index_decrypt(i, password.as_bytes()) {
|
||||||
|
if zip_file.is_file() && zip_file.name().ends_with(".osc") {
|
||||||
|
let mut buf = String::new();
|
||||||
|
let _ = zip_file.read_to_string(&mut buf);
|
||||||
|
match osc::check(buf) {
|
||||||
|
Ok(ref mut check_result) => {
|
||||||
|
result.push(CheckNotice::Info {
|
||||||
|
description: format!("Prüfe Eintrag '{}'", zip_file.name()),
|
||||||
|
line: None,
|
||||||
|
});
|
||||||
|
if check_result.is_empty() {
|
||||||
|
result.push(CheckNotice::Ok(format!(
|
||||||
|
"Keine Probleme in '{}' erkannt",
|
||||||
|
zip_file.name()
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
result.append(check_result)
|
||||||
|
}
|
||||||
|
Err(_) => result.push(CheckNotice::Warning {
|
||||||
|
description: format!(
|
||||||
|
"Überspringe Eintrag '{}': Inhalt kann nicht geprüft werden",
|
||||||
|
zip_file.name(),
|
||||||
|
),
|
||||||
|
line: None,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if zip_file.is_file() {
|
||||||
|
result.push(CheckNotice::Warning {
|
||||||
|
description: format!(
|
||||||
|
"Überspringe Eintrag '{}': Keine OSC-Datei",
|
||||||
|
zip_file.name()
|
||||||
|
),
|
||||||
|
line: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Err(CheckNotice::Error {
|
||||||
|
description: format!("Kann Datei nicht lesen"),
|
||||||
|
line: None,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
progress_bar.finish_and_clear();
|
||||||
|
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
78
src/checks/osc.rs
Normal file
78
src/checks/osc.rs
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* 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::path::Path;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use crate::checks::{CheckNotice, Checkable};
|
||||||
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
|
|
||||||
|
pub fn check_file(file: &Path) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
|
match fs::read_to_string(file) {
|
||||||
|
Ok(content) => check(content),
|
||||||
|
_ => Err(CheckNotice::Error {
|
||||||
|
description: "Kann Datei nicht lesen".to_string(),
|
||||||
|
line: None,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn check(content: String) -> Result<Vec<CheckNotice>, CheckNotice> {
|
||||||
|
let mut result = content
|
||||||
|
.lines()
|
||||||
|
.enumerate()
|
||||||
|
.flat_map(|(line, content)| check_line(line, content.to_string()))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
let inner_checks = &mut match OnkostarEditor::from_str(content.as_str()) {
|
||||||
|
Ok(data) => data.check(),
|
||||||
|
Err(err) => {
|
||||||
|
return Err(CheckNotice::Error {
|
||||||
|
description: format!("Interner Fehler: {}", err),
|
||||||
|
line: None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
result.append(inner_checks);
|
||||||
|
|
||||||
|
Ok(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn check_line(line: usize, content: String) -> Vec<CheckNotice> {
|
||||||
|
let mut result = vec![];
|
||||||
|
|
||||||
|
if content.contains(" </Bezeichnung>") {
|
||||||
|
result.append(&mut vec![CheckNotice::ErrorWithCode {
|
||||||
|
code: "2023-0003".to_string(),
|
||||||
|
description:
|
||||||
|
"Leerzeichen am Ende der Plausibilitätsregel-Bezeichnung (OSTARSUPP-13334)"
|
||||||
|
.to_string(),
|
||||||
|
line: Some(line),
|
||||||
|
example: Some(content.trim().to_string()),
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
45
src/cli.rs
45
src/cli.rs
@@ -78,7 +78,7 @@ pub enum SubCommand {
|
|||||||
#[arg(
|
#[arg(
|
||||||
long = "sorted",
|
long = "sorted",
|
||||||
alias = "x-sorted",
|
alias = "x-sorted",
|
||||||
help = "Sortiere Kataloge und Formulare nach Name (Optional)."
|
help = "Sortiere Kataloge und Formulare nach Name und Abhängigkeiten (Optional)."
|
||||||
)]
|
)]
|
||||||
sorted: bool,
|
sorted: bool,
|
||||||
#[arg(
|
#[arg(
|
||||||
@@ -87,6 +87,17 @@ pub enum SubCommand {
|
|||||||
help = "Entferne Einträge aus der Systembibliothek die nicht importiert werden (Optional)."
|
help = "Entferne Einträge aus der Systembibliothek die nicht importiert werden (Optional)."
|
||||||
)]
|
)]
|
||||||
strip: bool,
|
strip: bool,
|
||||||
|
#[arg(
|
||||||
|
short = 'i',
|
||||||
|
long = "interactive",
|
||||||
|
help = "Starte interaktiven Dialog zum Modifizieren von OSC-Dateien"
|
||||||
|
)]
|
||||||
|
interactive: bool,
|
||||||
|
#[arg(
|
||||||
|
long = "fix",
|
||||||
|
help = "Erweiterte Problembehandlung und Reparatur der OSC-Datei"
|
||||||
|
)]
|
||||||
|
fix: bool,
|
||||||
},
|
},
|
||||||
#[command(about = "Vergleiche zwei Dateien anhand der Revision der enthaltenen Inhalte")]
|
#[command(about = "Vergleiche zwei Dateien anhand der Revision der enthaltenen Inhalte")]
|
||||||
Diff {
|
Diff {
|
||||||
@@ -95,4 +106,36 @@ pub enum SubCommand {
|
|||||||
#[arg(long = "strict", help = "Strikter Vergleich des Inhalts")]
|
#[arg(long = "strict", help = "Strikter Vergleich des Inhalts")]
|
||||||
strict: bool,
|
strict: bool,
|
||||||
},
|
},
|
||||||
|
#[command(about = if cfg!(feature = "unzip-osb") { "Prüfe eine OSB- oder OSC-Datei auf bekannte Problemen" } else { "Prüfe eine OSC-Datei auf bekannte Problemen" })]
|
||||||
|
Check {
|
||||||
|
#[arg(help = "Die zu prüfende Datei", group = "check-file", required = true)]
|
||||||
|
file: Option<String>,
|
||||||
|
#[arg(
|
||||||
|
short = 'p',
|
||||||
|
long = "password",
|
||||||
|
help = "Passwort der OSB-Datei (Optional - für OSB-Dateien)",
|
||||||
|
requires = "check-file",
|
||||||
|
hide = !cfg!(feature = "unzip-osb")
|
||||||
|
)]
|
||||||
|
password: Option<String>,
|
||||||
|
#[arg(
|
||||||
|
long = "list",
|
||||||
|
help = "Prüfe nicht und zeige Liste mit Checks auf bekannte Problemen",
|
||||||
|
conflicts_with = "check-file"
|
||||||
|
)]
|
||||||
|
list: bool,
|
||||||
|
},
|
||||||
|
#[cfg(feature = "unzip-osb")]
|
||||||
|
#[command(about = "Entpackt eine OSB-Datei")]
|
||||||
|
UnzipOsb {
|
||||||
|
file: String,
|
||||||
|
#[arg(
|
||||||
|
short = 'p',
|
||||||
|
long = "password",
|
||||||
|
help = "Passwort der OSB-Datei (Optional)"
|
||||||
|
)]
|
||||||
|
password: Option<String>,
|
||||||
|
#[arg(short = 'd', help = "Zielverzeichnis (Optional)")]
|
||||||
|
dir: Option<String>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
95
src/main.rs
95
src/main.rs
@@ -28,11 +28,13 @@ use std::fs;
|
|||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use crate::checks::{check_file, print_checks, CheckNotice};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use console::style;
|
use console::style;
|
||||||
|
use dialoguer::Confirm;
|
||||||
use quick_xml::se::Serializer;
|
use quick_xml::se::Serializer;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sha256::digest;
|
use sha256::digest;
|
||||||
@@ -41,9 +43,12 @@ use crate::cli::{Cli, SubCommand};
|
|||||||
use crate::model::onkostar_editor::OnkostarEditor;
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
|
|
||||||
|
mod checks;
|
||||||
mod cli;
|
mod cli;
|
||||||
mod model;
|
mod model;
|
||||||
mod profile;
|
mod profile;
|
||||||
|
#[cfg(feature = "unzip-osb")]
|
||||||
|
mod unzip_osb;
|
||||||
|
|
||||||
enum FileError {
|
enum FileError {
|
||||||
Reading(String, String),
|
Reading(String, String),
|
||||||
@@ -149,16 +154,53 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
compact,
|
compact,
|
||||||
sorted,
|
sorted,
|
||||||
strip,
|
strip,
|
||||||
|
interactive,
|
||||||
|
fix,
|
||||||
} => {
|
} => {
|
||||||
let data = &mut read_inputfile(inputfile)?;
|
let data = &mut read_inputfile(inputfile)?;
|
||||||
|
|
||||||
if let Some(profile) = profile {
|
if let Some(profile) = profile {
|
||||||
let profile = read_profile(profile.clone()).map_err(|_| {
|
let profile = if profile.contains(".") {
|
||||||
|
read_profile(profile.clone()).map_err(|_| {
|
||||||
FileError::Reading(profile, "Kann Profildatei nicht lesen!".into())
|
FileError::Reading(profile, "Kann Profildatei nicht lesen!".into())
|
||||||
})?;
|
})?
|
||||||
|
} else {
|
||||||
|
Profile::embedded_profile(profile.as_str())?
|
||||||
|
};
|
||||||
|
|
||||||
data.apply_profile(&profile);
|
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 fix {
|
||||||
|
// No operation as of now
|
||||||
|
}
|
||||||
|
|
||||||
if sorted {
|
if sorted {
|
||||||
data.sorted();
|
data.sorted();
|
||||||
}
|
}
|
||||||
@@ -227,6 +269,53 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
SubCommand::Check {
|
||||||
|
file,
|
||||||
|
list,
|
||||||
|
password,
|
||||||
|
} => {
|
||||||
|
if list {
|
||||||
|
print_checks();
|
||||||
|
} else {
|
||||||
|
match check_file(Path::new(file.unwrap_or_default().as_str()), password) {
|
||||||
|
Ok(notices) => {
|
||||||
|
println!(
|
||||||
|
"Es wurden {} Probleme gefunden\n",
|
||||||
|
notices
|
||||||
|
.iter()
|
||||||
|
.filter(|notice| match notice {
|
||||||
|
CheckNotice::ErrorWithCode { .. }
|
||||||
|
| CheckNotice::Error { .. } => true,
|
||||||
|
_ => false,
|
||||||
|
})
|
||||||
|
.count()
|
||||||
|
);
|
||||||
|
notices
|
||||||
|
.iter()
|
||||||
|
.for_each(|check_notice| println!("{}", check_notice));
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
println!("{}", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(feature = "unzip-osb")]
|
||||||
|
SubCommand::UnzipOsb {
|
||||||
|
file,
|
||||||
|
password,
|
||||||
|
dir,
|
||||||
|
} => {
|
||||||
|
use crate::unzip_osb::{unzip_osb, unzip_osb_using_password};
|
||||||
|
match password {
|
||||||
|
Some(password) => unzip_osb_using_password(
|
||||||
|
file.as_str(),
|
||||||
|
dir.unwrap_or_default().as_str(),
|
||||||
|
password.as_str(),
|
||||||
|
),
|
||||||
|
None => unzip_osb(file.as_str(), dir.unwrap_or_default().as_str()),
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::model::onkostar_editor::OnkostarEditor;
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
use crate::model::requirements::{Requirement, Requires};
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
use crate::model::{Comparable, FolderContent, Listable, Ordner, Sortable};
|
use crate::model::{Ansichten, Comparable, FolderContent, Listable, Ordner, Sortable};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
@@ -58,6 +58,9 @@ pub struct DataCatalogue {
|
|||||||
entries: Entries,
|
entries: Entries,
|
||||||
#[serde(rename = "Ordner")]
|
#[serde(rename = "Ordner")]
|
||||||
ordner: Ordner,
|
ordner: Ordner,
|
||||||
|
#[serde(rename = "Ansichten", default)]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
ansichten: Option<Ansichten>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Listable for DataCatalogue {
|
impl Listable for DataCatalogue {
|
||||||
@@ -102,7 +105,8 @@ impl Comparable for DataCatalogue {
|
|||||||
|
|
||||||
impl Requires for DataCatalogue {
|
impl Requires for DataCatalogue {
|
||||||
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||||
self.entries
|
let mut result = self
|
||||||
|
.entries
|
||||||
.entry
|
.entry
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|&entry| entry.property_catalogue.is_some())
|
.filter(|&entry| entry.property_catalogue.is_some())
|
||||||
@@ -116,7 +120,10 @@ impl Requires for DataCatalogue {
|
|||||||
Some(contained) => Requirement::PropertyCatalogue(contained),
|
Some(contained) => Requirement::PropertyCatalogue(contained),
|
||||||
None => Requirement::ExternalPropertyCatalogue(entry),
|
None => Requirement::ExternalPropertyCatalogue(entry),
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>();
|
||||||
|
result.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String {
|
||||||
|
|||||||
@@ -22,17 +22,20 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use console::style;
|
use console::style;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::checks::CheckNotice::ErrorWithCode;
|
||||||
|
use crate::checks::{CheckNotice, Checkable};
|
||||||
use crate::model::onkostar_editor::OnkostarEditor;
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
use crate::model::requirements::{Requirement, Requires};
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
||||||
Filter, FolderContent, FormEntry, FormEntryContainer, Listable, MenuCategory,
|
Filter, FolderContent, FormEntry, FormEntryContainer, Kennzahlen, Listable, MenuCategory,
|
||||||
PlausibilityRules, RefEntries, Script, Sortable,
|
PlausibilityRules, PunkteKategorien, RefEntries, Script, Sortable,
|
||||||
};
|
};
|
||||||
use crate::model::{Haeufigkeiten, Ordner};
|
use crate::model::{Haeufigkeiten, Ordner};
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
@@ -79,18 +82,26 @@ pub struct DataForm {
|
|||||||
#[serde(rename = "EmailTemplate")]
|
#[serde(rename = "EmailTemplate")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
mail_template: Option<String>,
|
mail_template: Option<String>,
|
||||||
#[serde(rename = "ErkrankungText")]
|
#[serde(rename = "ErkrankungText", default)]
|
||||||
erkrankung_text: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
erkrankung_text: Option<String>,
|
||||||
#[serde(rename = "ErkrankungTextLong")]
|
#[serde(rename = "ErkrankungTextLong")]
|
||||||
erkrankung_text_long: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
erkrankung_text_long: Option<String>,
|
||||||
#[serde(rename = "ErkrankungProzedurText")]
|
#[serde(rename = "ErkrankungProzedurText")]
|
||||||
erkrankung_prozedur_text: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
erkrankung_prozedur_text: Option<String>,
|
||||||
#[serde(rename = "ErkrankungSummary")]
|
#[serde(rename = "ErkrankungSummary")]
|
||||||
erkrankung_summary: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
erkrankung_summary: Option<String>,
|
||||||
#[serde(rename = "ErkrankungBigSummary")]
|
#[serde(rename = "ErkrankungBigSummary")]
|
||||||
erkrankung_big_summary: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
erkrankung_big_summary: Option<String>,
|
||||||
#[serde(rename = "Kontext")]
|
#[serde(rename = "Kontext")]
|
||||||
kontext: String,
|
kontext: String,
|
||||||
|
#[serde(rename = "Datenart")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
datenart: Option<String>,
|
||||||
#[serde(rename = "TudokReadonly")]
|
#[serde(rename = "TudokReadonly")]
|
||||||
tudok_readonly: bool,
|
tudok_readonly: bool,
|
||||||
#[serde(rename = "VitalstatusRelevant")]
|
#[serde(rename = "VitalstatusRelevant")]
|
||||||
@@ -137,6 +148,9 @@ pub struct DataForm {
|
|||||||
guid: String,
|
guid: String,
|
||||||
#[serde(rename = "Revision")]
|
#[serde(rename = "Revision")]
|
||||||
revision: u16,
|
revision: u16,
|
||||||
|
#[serde(rename = "VerknuepftGUID")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
verknuepft_guid: Option<String>,
|
||||||
#[serde(rename = "SeitenzahlSichtbar")]
|
#[serde(rename = "SeitenzahlSichtbar")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
seitenanzahl_sichtbar: Option<bool>,
|
seitenanzahl_sichtbar: Option<bool>,
|
||||||
@@ -147,12 +161,15 @@ pub struct DataForm {
|
|||||||
#[serde(rename = "Haeufigkeiten")]
|
#[serde(rename = "Haeufigkeiten")]
|
||||||
haeufigkeiten: Haeufigkeiten,
|
haeufigkeiten: Haeufigkeiten,
|
||||||
#[serde(rename = "Kennzahlen")]
|
#[serde(rename = "Kennzahlen")]
|
||||||
kennzahlen: String,
|
kennzahlen: Kennzahlen,
|
||||||
#[serde(rename = "Ordner")]
|
#[serde(rename = "Ordner")]
|
||||||
ordner: Ordner,
|
ordner: Ordner,
|
||||||
#[serde(rename = "MenuCategory")]
|
#[serde(rename = "MenuCategory")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
menu_category: Option<MenuCategory>,
|
menu_category: Option<MenuCategory>,
|
||||||
|
#[serde(rename = "PunkteKategorien")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
punkte_kategorien: Option<PunkteKategorien>,
|
||||||
#[serde(rename = "Ansichten")]
|
#[serde(rename = "Ansichten")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
ansichten: Option<Ansichten>,
|
ansichten: Option<Ansichten>,
|
||||||
@@ -252,9 +269,54 @@ impl Comparable for DataForm {
|
|||||||
fn get_revision(&self) -> u16 {
|
fn get_revision(&self) -> u16 {
|
||||||
self.revision
|
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 {
|
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> {
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||||
let mut result = self
|
let mut result = self
|
||||||
.data_catalogues
|
.data_catalogues
|
||||||
@@ -267,6 +329,7 @@ impl Requires for DataForm {
|
|||||||
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
result.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
|
||||||
let referenced_forms = &mut self
|
let referenced_forms = &mut self
|
||||||
.entries
|
.entries
|
||||||
@@ -287,58 +350,33 @@ impl Requires for DataForm {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
referenced_forms.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
result.append(referenced_forms);
|
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
|
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::DataCatalogue(x) => {
|
|
||||||
let inner = x
|
|
||||||
.get_required_entries(all)
|
|
||||||
.iter()
|
|
||||||
.map(|inner_entry| match inner_entry {
|
|
||||||
Requirement::PropertyCatalogue(y) => Some(y.to_listed_string()),
|
|
||||||
Requirement::ExternalPropertyCatalogue(name) => Some(format!(
|
|
||||||
"Merkmalskatalog (-) '{}' - hier nicht enthalten",
|
|
||||||
style(name).yellow()
|
|
||||||
)),
|
|
||||||
_ => 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()))
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.filter(Option::is_some)
|
|
||||||
.flatten()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FolderContent for DataForm {
|
impl FolderContent for DataForm {
|
||||||
@@ -347,6 +385,30 @@ impl FolderContent for DataForm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Checkable for DataForm {
|
||||||
|
fn check(&self) -> Vec<CheckNotice> {
|
||||||
|
if self
|
||||||
|
.entries
|
||||||
|
.entry
|
||||||
|
.iter()
|
||||||
|
.filter(|entry| entry.procedure_date_status != "none")
|
||||||
|
.count()
|
||||||
|
== 0
|
||||||
|
{
|
||||||
|
return vec![ErrorWithCode {
|
||||||
|
code: "2023-0002".to_string(),
|
||||||
|
description: format!(
|
||||||
|
"Formular '{}' hat keine Angabe zum Prozedurdatum",
|
||||||
|
self.name
|
||||||
|
),
|
||||||
|
line: None,
|
||||||
|
example: None,
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct DataCatalogues {
|
pub struct DataCatalogues {
|
||||||
@@ -415,6 +477,9 @@ pub struct Entry {
|
|||||||
grafik_ausrichtung: Option<String>,
|
grafik_ausrichtung: Option<String>,
|
||||||
#[serde(rename = "Mandatory")]
|
#[serde(rename = "Mandatory")]
|
||||||
mandatory: String,
|
mandatory: String,
|
||||||
|
#[serde(rename = "Datenart", default)]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
datenart: Option<String>,
|
||||||
#[serde(rename = "Filter")]
|
#[serde(rename = "Filter")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
filter: Option<Filter>,
|
filter: Option<Filter>,
|
||||||
@@ -434,6 +499,9 @@ pub struct Entry {
|
|||||||
#[serde(rename = "AnzeigeAuswahl")]
|
#[serde(rename = "AnzeigeAuswahl")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
anzeige_auswahl: Option<String>,
|
anzeige_auswahl: Option<String>,
|
||||||
|
#[serde(rename = "Druckvorlage")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
druckvorlage: Option<String>,
|
||||||
#[serde(rename = "VersionFrom")]
|
#[serde(rename = "VersionFrom")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
version_from: Option<String>,
|
version_from: Option<String>,
|
||||||
@@ -441,6 +509,9 @@ pub struct Entry {
|
|||||||
speichern: String,
|
speichern: String,
|
||||||
#[serde(rename = "LeerAusblenden")]
|
#[serde(rename = "LeerAusblenden")]
|
||||||
leer_ausblenden: bool,
|
leer_ausblenden: bool,
|
||||||
|
#[serde(rename = "Inhalt")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
inhalt: Option<String>,
|
||||||
#[serde(rename = "GeschlossenAnzeigen")]
|
#[serde(rename = "GeschlossenAnzeigen")]
|
||||||
geschlossen_anzeigen: bool,
|
geschlossen_anzeigen: bool,
|
||||||
#[serde(rename = "Min")]
|
#[serde(rename = "Min")]
|
||||||
@@ -450,7 +521,8 @@ pub struct Entry {
|
|||||||
#[serde(rename = "InUebersichtAnzeigen")]
|
#[serde(rename = "InUebersichtAnzeigen")]
|
||||||
in_uebersicht_anzeigen: bool,
|
in_uebersicht_anzeigen: bool,
|
||||||
#[serde(rename = "Hinweis")]
|
#[serde(rename = "Hinweis")]
|
||||||
hinweis: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
hinweis: Option<String>,
|
||||||
#[serde(rename = "Vorschlagskategorie")]
|
#[serde(rename = "Vorschlagskategorie")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
vorschlagskategorie: Option<String>,
|
vorschlagskategorie: Option<String>,
|
||||||
@@ -522,12 +594,21 @@ pub struct Entry {
|
|||||||
in_auswertung: bool,
|
in_auswertung: bool,
|
||||||
#[serde(rename = "InAuswertungGraph")]
|
#[serde(rename = "InAuswertungGraph")]
|
||||||
in_auswertung_graph: bool,
|
in_auswertung_graph: bool,
|
||||||
|
#[serde(rename = "FragebogenItemNummer")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
fragebogen_item_nummer: Option<u8>,
|
||||||
|
#[serde(rename = "Score")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
score: Option<String>,
|
||||||
#[serde(rename = "AlignmentPatModul")]
|
#[serde(rename = "AlignmentPatModul")]
|
||||||
alignment_pat_modul: String,
|
alignment_pat_modul: String,
|
||||||
#[serde(rename = "DirectionPatModul")]
|
#[serde(rename = "DirectionPatModul")]
|
||||||
direction_pat_modul: String,
|
direction_pat_modul: String,
|
||||||
#[serde(rename = "SeitenumbruchPatModul")]
|
#[serde(rename = "SeitenumbruchPatModul")]
|
||||||
seitenumbruch_pat_modul: bool,
|
seitenumbruch_pat_modul: bool,
|
||||||
|
#[serde(rename = "Kontaktliste")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
kontaktliste: Option<String>,
|
||||||
#[serde(rename = "MarkierungIgnorieren")]
|
#[serde(rename = "MarkierungIgnorieren")]
|
||||||
markierung_ignorieren: bool,
|
markierung_ignorieren: bool,
|
||||||
#[serde(rename = "SucheArt")]
|
#[serde(rename = "SucheArt")]
|
||||||
|
|||||||
107
src/model/mod.rs
107
src/model/mod.rs
@@ -22,12 +22,14 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::collections::hash_map::DefaultHasher;
|
use std::collections::hash_map::DefaultHasher;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::model::requirements::Requires;
|
||||||
use crate::profile::{FormField, FormReference, Profile};
|
use crate::profile::{FormField, FormReference, Profile};
|
||||||
|
|
||||||
pub mod data_catalogue;
|
pub mod data_catalogue;
|
||||||
@@ -94,11 +96,15 @@ pub struct Ansicht {
|
|||||||
#[serde(rename = "Konfiguration")]
|
#[serde(rename = "Konfiguration")]
|
||||||
konfiguration: String,
|
konfiguration: String,
|
||||||
#[serde(rename = "DataForm")]
|
#[serde(rename = "DataForm")]
|
||||||
data_form: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
data_form: Option<String>,
|
||||||
#[serde(rename = "DataCatalogue")]
|
#[serde(rename = "DataCatalogue")]
|
||||||
data_catalogue: String,
|
data_catalogue: String,
|
||||||
#[serde(rename = "TypAuswahl")]
|
#[serde(rename = "TypAuswahl")]
|
||||||
typ_auswahl: String,
|
typ_auswahl: String,
|
||||||
|
#[serde(rename = "PersonenstammKontext", default)]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
personenstamm_kontext: Option<String>,
|
||||||
#[serde(rename = "Suche")]
|
#[serde(rename = "Suche")]
|
||||||
suche: bool,
|
suche: bool,
|
||||||
#[serde(rename = "SID")]
|
#[serde(rename = "SID")]
|
||||||
@@ -129,6 +135,66 @@ pub struct MenuCategory {
|
|||||||
column: String,
|
column: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct PunkteKategorien {
|
||||||
|
#[serde(rename = "PunkteKategorie", default)]
|
||||||
|
punkte_kategorie: Vec<PunkteKategorie>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct PunkteKategorie {
|
||||||
|
#[serde(rename = "Name")]
|
||||||
|
name: String,
|
||||||
|
#[serde(rename = "Beschreibung")]
|
||||||
|
beschreibung: String,
|
||||||
|
#[serde(rename = "MaxLeerwerte")]
|
||||||
|
max_leerwerte: u16,
|
||||||
|
#[serde(rename = "Berechnung")]
|
||||||
|
berechnung: String,
|
||||||
|
#[serde(rename = "Felder")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
felder: Option<Felder>,
|
||||||
|
#[serde(rename = "Vergleichswerttabellen")]
|
||||||
|
vergleichswerttabellen: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct Felder {
|
||||||
|
#[serde(rename = "Feld", default)]
|
||||||
|
feld: Vec<Feld>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct Feld {
|
||||||
|
#[serde(rename = "DataFormEntryName")]
|
||||||
|
data_form_entry_name: String,
|
||||||
|
#[serde(rename = "ManuellePunkte")]
|
||||||
|
manuelle_punkte: bool,
|
||||||
|
#[serde(rename = "Werte")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
werte: Option<FeldWerte>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct FeldWerte {
|
||||||
|
#[serde(rename = "Wert", default)]
|
||||||
|
wert: Vec<FeldWert>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct FeldWert {
|
||||||
|
#[serde(rename = "Wert")]
|
||||||
|
wert: String,
|
||||||
|
#[serde(rename = "Punkte")]
|
||||||
|
punkte: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
@@ -187,8 +253,12 @@ pub struct Haeufigkeit {
|
|||||||
taeglich_aktualisieren: bool,
|
taeglich_aktualisieren: bool,
|
||||||
#[serde(rename = "Typ")]
|
#[serde(rename = "Typ")]
|
||||||
typ: String,
|
typ: String,
|
||||||
|
#[serde(rename = "NichtBerechnen")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
nicht_berechnen: Option<String>,
|
||||||
#[serde(rename = "TabellenName")]
|
#[serde(rename = "TabellenName")]
|
||||||
tabellen_name: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
tabellen_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
@@ -212,6 +282,32 @@ pub struct Ordner {
|
|||||||
parent_order: Option<Box<Ordner>>,
|
parent_order: Option<Box<Ordner>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct Kennzahlen {
|
||||||
|
#[serde(rename = "Kennzahl", default)]
|
||||||
|
kennzahl: Vec<Kennzahl>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub struct Kennzahl {
|
||||||
|
#[serde(rename = "Name")]
|
||||||
|
name: String,
|
||||||
|
#[serde(rename = "Nummer")]
|
||||||
|
nummer: String,
|
||||||
|
#[serde(rename = "Beschreibung")]
|
||||||
|
beschreibung: String,
|
||||||
|
#[serde(rename = "Notiz")]
|
||||||
|
notiz: String,
|
||||||
|
#[serde(rename = "Vorgabe")]
|
||||||
|
vorgabe: String,
|
||||||
|
#[serde(rename = "Haeufigkeitenzaehler")]
|
||||||
|
haeufigkeitenzaehler: String,
|
||||||
|
#[serde(rename = "Haeufigkeitennenner")]
|
||||||
|
haeufigkeitennenner: String,
|
||||||
|
}
|
||||||
|
|
||||||
fn apply_profile_to_form_entry<E>(entry: &mut E, form_reference: &FormReference)
|
fn apply_profile_to_form_entry<E>(entry: &mut E, form_reference: &FormReference)
|
||||||
where
|
where
|
||||||
E: FormEntry,
|
E: FormEntry,
|
||||||
@@ -251,6 +347,7 @@ pub trait Listable {
|
|||||||
|
|
||||||
pub trait Sortable {
|
pub trait Sortable {
|
||||||
fn sorting_key(&self) -> String;
|
fn sorting_key(&self) -> String;
|
||||||
|
|
||||||
fn sorted(&mut self) -> &Self
|
fn sorted(&mut self) -> &Self
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
@@ -267,6 +364,12 @@ pub trait Comparable: Debug {
|
|||||||
format!("{:?}", self).hash(&mut h);
|
format!("{:?}", self).hash(&mut h);
|
||||||
h.finish().to_string()
|
h.finish().to_string()
|
||||||
}
|
}
|
||||||
|
fn compare_by_requirement(_: &Self, _: &Self) -> Ordering
|
||||||
|
where
|
||||||
|
Self: Requires,
|
||||||
|
{
|
||||||
|
Ordering::Equal
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FormEntry {
|
pub trait FormEntry {
|
||||||
|
|||||||
@@ -30,10 +30,11 @@ use console::style;
|
|||||||
use quick_xml::de::from_str;
|
use quick_xml::de::from_str;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::checks::{CheckNotice, Checkable};
|
||||||
use crate::model::data_catalogue::DataCatalogue;
|
use crate::model::data_catalogue::DataCatalogue;
|
||||||
use crate::model::data_form::DataForm;
|
use crate::model::data_form::DataForm;
|
||||||
use crate::model::property_catalogue::PropertyCatalogue;
|
use crate::model::property_catalogue::PropertyCatalogue;
|
||||||
use crate::model::requirements::Requires;
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
use crate::model::unterformular::Unterformular;
|
use crate::model::unterformular::Unterformular;
|
||||||
use crate::model::{Comparable, FolderContent, FormEntryContainer, Listable, Sortable};
|
use crate::model::{Comparable, FolderContent, FormEntryContainer, Listable, Sortable};
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
@@ -229,17 +230,25 @@ impl OnkostarEditor {
|
|||||||
item.sorted();
|
item.sorted();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*self.editor
|
||||||
|
.data_form
|
||||||
|
.sort_unstable_by_key(|e| e.sorting_key());*/
|
||||||
|
|
||||||
self.editor
|
self.editor
|
||||||
.data_form
|
.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| {
|
self.editor.data_form.iter_mut().for_each(|item| {
|
||||||
item.sorted();
|
item.sorted();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*self.editor
|
||||||
|
.unterformular
|
||||||
|
.sort_unstable_by_key(|e| e.sorting_key());*/
|
||||||
|
|
||||||
self.editor
|
self.editor
|
||||||
.unterformular
|
.unterformular
|
||||||
.sort_unstable_by_key(|e| e.sorting_key());
|
.sort_unstable_by(Unterformular::compare_by_requirement);
|
||||||
|
|
||||||
self.editor.unterformular.iter_mut().for_each(|item| {
|
self.editor.unterformular.iter_mut().for_each(|item| {
|
||||||
item.sorted();
|
item.sorted();
|
||||||
@@ -401,6 +410,89 @@ impl FromStr for OnkostarEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Checkable for OnkostarEditor {
|
||||||
|
fn check(&self) -> Vec<CheckNotice> {
|
||||||
|
// Inner form checks
|
||||||
|
|
||||||
|
let mut result = self
|
||||||
|
.editor
|
||||||
|
.data_form
|
||||||
|
.iter()
|
||||||
|
.flat_map(|entity| entity.check())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
let other = &mut self
|
||||||
|
.editor
|
||||||
|
.unterformular
|
||||||
|
.iter()
|
||||||
|
.flat_map(|entity| entity.check())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
result.append(other);
|
||||||
|
|
||||||
|
// Check requirements
|
||||||
|
|
||||||
|
let mut requirement_checked_forms = vec![];
|
||||||
|
|
||||||
|
fn requirement_error(
|
||||||
|
form: &impl Comparable,
|
||||||
|
item: &impl Comparable,
|
||||||
|
t: &str,
|
||||||
|
) -> CheckNotice {
|
||||||
|
CheckNotice::ErrorWithCode {
|
||||||
|
code: "2023-0004".to_string(),
|
||||||
|
description: format!(
|
||||||
|
"'{}' hat einen Verweis auf zuvor nicht definiertes {t} '{}' (OSTARSUPP-13212)",
|
||||||
|
form.get_name(),
|
||||||
|
item.get_name()
|
||||||
|
),
|
||||||
|
line: None,
|
||||||
|
example: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self.editor.unterformular.iter().for_each(|form| {
|
||||||
|
requirement_checked_forms.push(form.get_name());
|
||||||
|
form.get_required_entries(self)
|
||||||
|
.iter()
|
||||||
|
.for_each(|entry| match entry {
|
||||||
|
Requirement::DataFormReference(&ref item) => {
|
||||||
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
|
result.push(requirement_error(form, item, "Formular"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Requirement::UnterformularReference(&ref item) => {
|
||||||
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
|
result.push(requirement_error(form, item, "Unterformular"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
self.editor.data_form.iter().for_each(|form| {
|
||||||
|
requirement_checked_forms.push(form.get_name());
|
||||||
|
form.get_required_entries(self)
|
||||||
|
.iter()
|
||||||
|
.for_each(|entry| match entry {
|
||||||
|
Requirement::DataFormReference(&ref item) => {
|
||||||
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
|
result.push(requirement_error(form, item, "Formular"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Requirement::UnterformularReference(&ref item) => {
|
||||||
|
if !requirement_checked_forms.contains(&item.get_name()) {
|
||||||
|
result.push(requirement_error(form, item, "Unterformular"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct InfoXML {
|
pub struct InfoXML {
|
||||||
|
|||||||
@@ -127,12 +127,12 @@ pub struct Version {
|
|||||||
#[serde(rename = "Revision")]
|
#[serde(rename = "Revision")]
|
||||||
revision: u16,
|
revision: u16,
|
||||||
#[serde(rename = "Entries")]
|
#[serde(rename = "Entries")]
|
||||||
entries: VersionEntries,
|
entries: Option<VersionEntries>,
|
||||||
#[serde(rename = "Abbildung")]
|
#[serde(rename = "Abbildung")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
abbildung: Option<Vec<Abbildung>>,
|
abbildung: Option<Vec<Abbildung>>,
|
||||||
#[serde(rename = "Categories")]
|
#[serde(rename = "Categories")]
|
||||||
categories: Categories,
|
categories: Option<Categories>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sortable for Version {
|
impl Sortable for Version {
|
||||||
@@ -151,19 +151,23 @@ impl Sortable for Version {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.entries
|
if let Some(ref mut entries) = self.entries {
|
||||||
|
entries
|
||||||
.content
|
.content
|
||||||
.sort_unstable_by_key(|item| item.sorting_key());
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
self.entries.content.iter_mut().for_each(|item| {
|
entries.content.iter_mut().for_each(|item| {
|
||||||
item.sorted();
|
item.sorted();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self.categories
|
if let Some(ref mut categories) = self.categories {
|
||||||
|
categories
|
||||||
.content
|
.content
|
||||||
.sort_unstable_by_key(|item| item.sorting_key());
|
.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
self.categories.content.iter_mut().for_each(|item| {
|
categories.content.iter_mut().for_each(|item| {
|
||||||
item.sorted();
|
item.sorted();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@@ -184,13 +188,16 @@ pub struct VersionEntry {
|
|||||||
#[serde(rename = "ShortDescription")]
|
#[serde(rename = "ShortDescription")]
|
||||||
short_description: String,
|
short_description: String,
|
||||||
#[serde(rename = "Description")]
|
#[serde(rename = "Description")]
|
||||||
description: String,
|
description: Option<String>,
|
||||||
#[serde(rename = "Synonyms", default)]
|
#[serde(rename = "Synonyms", default)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
synonyms: Option<String>,
|
synonyms: Option<String>,
|
||||||
#[serde(rename = "Note", default)]
|
#[serde(rename = "Note", default)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
note: Option<String>,
|
note: Option<String>,
|
||||||
|
#[serde(rename = "Type", default)]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
type_: Option<String>,
|
||||||
#[serde(rename = "Position")]
|
#[serde(rename = "Position")]
|
||||||
position: String,
|
position: String,
|
||||||
}
|
}
|
||||||
@@ -331,8 +338,9 @@ pub struct AbbildungEntry {
|
|||||||
#[serde(rename = "Synonyms")]
|
#[serde(rename = "Synonyms")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
synonyms: Option<String>,
|
synonyms: Option<String>,
|
||||||
#[serde(rename = "Note")]
|
#[serde(rename = "Note", default)]
|
||||||
note: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
note: Option<String>,
|
||||||
#[serde(rename = "Position")]
|
#[serde(rename = "Position")]
|
||||||
position: String,
|
position: String,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use crate::model::data_form::DataForm;
|
|||||||
use crate::model::onkostar_editor::OnkostarEditor;
|
use crate::model::onkostar_editor::OnkostarEditor;
|
||||||
use crate::model::property_catalogue::PropertyCatalogue;
|
use crate::model::property_catalogue::PropertyCatalogue;
|
||||||
use crate::model::unterformular::Unterformular;
|
use crate::model::unterformular::Unterformular;
|
||||||
use crate::model::Listable;
|
use crate::model::{Comparable, Listable, Sortable};
|
||||||
|
|
||||||
#[allow(clippy::enum_variant_names)]
|
#[allow(clippy::enum_variant_names)]
|
||||||
pub enum Requirement<'a> {
|
pub enum Requirement<'a> {
|
||||||
@@ -40,6 +40,31 @@ pub enum Requirement<'a> {
|
|||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
ExternalDataFormReference(String),
|
ExternalDataFormReference(String),
|
||||||
ExternalUnterformularReference(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<'_> {
|
impl ToString for Requirement<'_> {
|
||||||
@@ -47,26 +72,92 @@ impl ToString for Requirement<'_> {
|
|||||||
match self {
|
match self {
|
||||||
Requirement::PropertyCatalogue(item) => item.to_listed_string(),
|
Requirement::PropertyCatalogue(item) => item.to_listed_string(),
|
||||||
Requirement::DataCatalogue(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) => {
|
Requirement::ExternalPropertyCatalogue(name) => {
|
||||||
format!("Merkmalskatalog (-) '{}' - hier nicht enthalten", name)
|
format!("Merkmalskatalog (-) '{}' - hier nicht enthalten", name)
|
||||||
}
|
}
|
||||||
Requirement::ExternalDataCatalogue(name) => {
|
Requirement::ExternalDataCatalogue(name) => {
|
||||||
format!("Datenkatalog (-) '{}' - hier nicht enthalten", name)
|
format!("Datenkatalog (-) '{}' - hier nicht enthalten", name)
|
||||||
}
|
}
|
||||||
Requirement::DataFormReference(item) => item.to_listed_string(),
|
Requirement::ExternalDataFormReference(name)
|
||||||
Requirement::UnterformularReference(item) => item.to_listed_string(),
|
| Requirement::ExternalDataFormSubform(name) => {
|
||||||
Requirement::ExternalDataFormReference(name) => {
|
|
||||||
format!("Formular (-) '{}' - hier nicht enthalten", name)
|
format!("Formular (-) '{}' - hier nicht enthalten", name)
|
||||||
}
|
}
|
||||||
Requirement::ExternalUnterformularReference(name) => {
|
Requirement::ExternalUnterformularReference(name)
|
||||||
|
| Requirement::ExternalUnterformularSubform(name) => {
|
||||||
format!("Unterformular (-) '{}' - hier nicht enthalten", name)
|
format!("Unterformular (-) '{}' - hier nicht enthalten", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Requires {
|
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 get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement>;
|
||||||
|
|
||||||
fn to_requirement_string<'a>(&'a self, all: &'a OnkostarEditor) -> String;
|
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,8 +22,11 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use crate::checks::CheckNotice::ErrorWithCode;
|
||||||
|
use crate::checks::{CheckNotice, Checkable};
|
||||||
use console::style;
|
use console::style;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@@ -31,8 +34,8 @@ use crate::model::onkostar_editor::OnkostarEditor;
|
|||||||
use crate::model::requirements::{Requirement, Requires};
|
use crate::model::requirements::{Requirement, Requires};
|
||||||
use crate::model::{
|
use crate::model::{
|
||||||
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
apply_profile_to_form_entry, apply_profile_to_form_field, Ansichten, Comparable, Entries,
|
||||||
Filter, FolderContent, FormEntry, FormEntryContainer, Listable, MenuCategory,
|
Filter, FolderContent, FormEntry, FormEntryContainer, Kennzahlen, Listable, MenuCategory,
|
||||||
PlausibilityRules, RefEntries, Script, Sortable,
|
PlausibilityRules, PunkteKategorien, RefEntries, Script, Sortable,
|
||||||
};
|
};
|
||||||
use crate::model::{Haeufigkeiten, Ordner};
|
use crate::model::{Haeufigkeiten, Ordner};
|
||||||
use crate::profile::Profile;
|
use crate::profile::Profile;
|
||||||
@@ -79,7 +82,7 @@ pub struct Unterformular {
|
|||||||
#[serde(rename = "EmailTemplate")]
|
#[serde(rename = "EmailTemplate")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
mail_template: Option<String>,
|
mail_template: Option<String>,
|
||||||
#[serde(rename = "ErkrankungText")]
|
#[serde(rename = "ErkrankungText", default)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
erkrankung_text: Option<String>,
|
erkrankung_text: Option<String>,
|
||||||
#[serde(rename = "ErkrankungTextLong")]
|
#[serde(rename = "ErkrankungTextLong")]
|
||||||
@@ -96,6 +99,9 @@ pub struct Unterformular {
|
|||||||
erkrankung_big_summary: Option<String>,
|
erkrankung_big_summary: Option<String>,
|
||||||
#[serde(rename = "Kontext")]
|
#[serde(rename = "Kontext")]
|
||||||
kontext: String,
|
kontext: String,
|
||||||
|
#[serde(rename = "Datenart")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
datenart: Option<String>,
|
||||||
#[serde(rename = "TudokReadonly")]
|
#[serde(rename = "TudokReadonly")]
|
||||||
tudok_readonly: bool,
|
tudok_readonly: bool,
|
||||||
#[serde(rename = "VitalstatusRelevant")]
|
#[serde(rename = "VitalstatusRelevant")]
|
||||||
@@ -158,12 +164,15 @@ pub struct Unterformular {
|
|||||||
#[serde(rename = "Haeufigkeiten")]
|
#[serde(rename = "Haeufigkeiten")]
|
||||||
haeufigkeiten: Haeufigkeiten,
|
haeufigkeiten: Haeufigkeiten,
|
||||||
#[serde(rename = "Kennzahlen")]
|
#[serde(rename = "Kennzahlen")]
|
||||||
kennzahlen: String,
|
kennzahlen: Kennzahlen,
|
||||||
#[serde(rename = "Ordner")]
|
#[serde(rename = "Ordner")]
|
||||||
ordner: Ordner,
|
ordner: Ordner,
|
||||||
#[serde(rename = "MenuCategory")]
|
#[serde(rename = "MenuCategory")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
menu_category: Option<MenuCategory>,
|
menu_category: Option<MenuCategory>,
|
||||||
|
#[serde(rename = "PunkteKategorien")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
punkte_kategorien: Option<PunkteKategorien>,
|
||||||
#[serde(rename = "Ansichten")]
|
#[serde(rename = "Ansichten")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
ansichten: Option<Ansichten>,
|
ansichten: Option<Ansichten>,
|
||||||
@@ -256,9 +265,55 @@ impl Comparable for Unterformular {
|
|||||||
fn get_revision(&self) -> u16 {
|
fn get_revision(&self) -> u16 {
|
||||||
self.revision
|
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 {
|
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> {
|
fn get_required_entries<'a>(&'a self, all: &'a OnkostarEditor) -> Vec<Requirement> {
|
||||||
let mut result = self
|
let mut result = self
|
||||||
.data_catalogues
|
.data_catalogues
|
||||||
@@ -271,6 +326,7 @@ impl Requires for Unterformular {
|
|||||||
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
None => Requirement::ExternalDataCatalogue(entry.to_string()),
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
result.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
|
|
||||||
let referenced_forms = &mut self
|
let referenced_forms = &mut self
|
||||||
.entries
|
.entries
|
||||||
@@ -291,57 +347,33 @@ impl Requires for Unterformular {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
referenced_forms.sort_unstable_by_key(|item| item.sorting_key());
|
||||||
result.append(referenced_forms);
|
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
|
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::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()))
|
|
||||||
}
|
|
||||||
_ => None,
|
|
||||||
})
|
|
||||||
.filter(Option::is_some)
|
|
||||||
.flatten()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FolderContent for Unterformular {
|
impl FolderContent for Unterformular {
|
||||||
@@ -350,6 +382,24 @@ impl FolderContent for Unterformular {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Checkable for Unterformular {
|
||||||
|
fn check(&self) -> Vec<CheckNotice> {
|
||||||
|
if self.hat_unterformulare {
|
||||||
|
return vec![ErrorWithCode {
|
||||||
|
code: "2023-0001".to_string(),
|
||||||
|
description: format!(
|
||||||
|
"Unterformular '{}' mit Markierung 'hat Unterformulare'",
|
||||||
|
self.name
|
||||||
|
),
|
||||||
|
line: None,
|
||||||
|
example: None,
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
vec![]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct DataCatalogues {
|
pub struct DataCatalogues {
|
||||||
@@ -418,6 +468,9 @@ pub struct Entry {
|
|||||||
grafik_ausrichtung: Option<String>,
|
grafik_ausrichtung: Option<String>,
|
||||||
#[serde(rename = "Mandatory")]
|
#[serde(rename = "Mandatory")]
|
||||||
mandatory: String,
|
mandatory: String,
|
||||||
|
#[serde(rename = "Datenart", default)]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
datenart: Option<String>,
|
||||||
#[serde(rename = "Filter")]
|
#[serde(rename = "Filter")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
filter: Option<Filter>,
|
filter: Option<Filter>,
|
||||||
@@ -437,6 +490,9 @@ pub struct Entry {
|
|||||||
#[serde(rename = "AnzeigeAuswahl")]
|
#[serde(rename = "AnzeigeAuswahl")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
anzeige_auswahl: Option<String>,
|
anzeige_auswahl: Option<String>,
|
||||||
|
#[serde(rename = "Druckvorlage")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
druckvorlage: Option<String>,
|
||||||
#[serde(rename = "VersionFrom")]
|
#[serde(rename = "VersionFrom")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
version_from: Option<String>,
|
version_from: Option<String>,
|
||||||
@@ -444,6 +500,9 @@ pub struct Entry {
|
|||||||
speichern: String,
|
speichern: String,
|
||||||
#[serde(rename = "LeerAusblenden")]
|
#[serde(rename = "LeerAusblenden")]
|
||||||
leer_ausblenden: bool,
|
leer_ausblenden: bool,
|
||||||
|
#[serde(rename = "Inhalt")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
inhalt: Option<String>,
|
||||||
#[serde(rename = "GeschlossenAnzeigen")]
|
#[serde(rename = "GeschlossenAnzeigen")]
|
||||||
geschlossen_anzeigen: bool,
|
geschlossen_anzeigen: bool,
|
||||||
#[serde(rename = "Min")]
|
#[serde(rename = "Min")]
|
||||||
@@ -526,12 +585,21 @@ pub struct Entry {
|
|||||||
in_auswertung: bool,
|
in_auswertung: bool,
|
||||||
#[serde(rename = "InAuswertungGraph")]
|
#[serde(rename = "InAuswertungGraph")]
|
||||||
in_auswertung_graph: bool,
|
in_auswertung_graph: bool,
|
||||||
|
#[serde(rename = "FragebogenItemNummer")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
fragebogen_item_nummer: Option<u8>,
|
||||||
|
#[serde(rename = "Score")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
score: Option<String>,
|
||||||
#[serde(rename = "AlignmentPatModul")]
|
#[serde(rename = "AlignmentPatModul")]
|
||||||
alignment_pat_modul: String,
|
alignment_pat_modul: String,
|
||||||
#[serde(rename = "DirectionPatModul")]
|
#[serde(rename = "DirectionPatModul")]
|
||||||
direction_pat_modul: String,
|
direction_pat_modul: String,
|
||||||
#[serde(rename = "SeitenumbruchPatModul")]
|
#[serde(rename = "SeitenumbruchPatModul")]
|
||||||
seitenumbruch_pat_modul: bool,
|
seitenumbruch_pat_modul: bool,
|
||||||
|
#[serde(rename = "Kontaktliste")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
kontaktliste: Option<String>,
|
||||||
#[serde(rename = "MarkierungIgnorieren")]
|
#[serde(rename = "MarkierungIgnorieren")]
|
||||||
markierung_ignorieren: bool,
|
markierung_ignorieren: bool,
|
||||||
#[serde(rename = "SucheArt")]
|
#[serde(rename = "SucheArt")]
|
||||||
|
|||||||
@@ -34,6 +34,19 @@ pub struct Profile {
|
|||||||
pub forms: Vec<Form>,
|
pub forms: Vec<Form>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Profile {
|
||||||
|
pub fn embedded_profile(name: &str) -> Result<Profile, String> {
|
||||||
|
let s = match name {
|
||||||
|
"UKM" => include_str!("../examples/dnpm-ukm.yml"),
|
||||||
|
"UKW" => include_str!("../examples/dnpm-ukw.yml"),
|
||||||
|
"UMG" => include_str!("../examples/dnpm-umg.yml"),
|
||||||
|
_ => return Err(format!("Not an embedded profile: '{name}'")),
|
||||||
|
};
|
||||||
|
|
||||||
|
Profile::from_str(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl FromStr for Profile {
|
impl FromStr for Profile {
|
||||||
type Err = String;
|
type Err = String;
|
||||||
|
|
||||||
|
|||||||
135
src/unzip_osb.rs
Normal file
135
src/unzip_osb.rs
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* 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::path::Path;
|
||||||
|
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_using_password(path: &str, dir: &str, password: &str) {
|
||||||
|
println!("Entpacke OSB-Datei {}\n", style(path).yellow());
|
||||||
|
|
||||||
|
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, password.as_bytes()) {
|
||||||
|
file
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"{: <6}Abbruch! - Kann Datei nicht entpacken",
|
||||||
|
style("[ERR]").red()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
let outpath = match file.enclosed_name() {
|
||||||
|
Some(path) => Path::new(dir).join(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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn unzip_osb(path: &str, dir: &str) {
|
||||||
|
unzip_osb_using_password(path, dir, deobfuscate(env!("OSB_KEY").trim()).as_str());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user