Account for a file path
This commit is contained in:
parent
ec0e0ec079
commit
b7ebbd9169
1 changed files with 7 additions and 6 deletions
|
@ -1,7 +1,8 @@
|
|||
SDBD.ICodec codec = new SDBD.Codec();
|
||||
|
||||
var (encode, filename) = ParseArgs(args);
|
||||
var inputData = File.ReadAllBytes(filename);
|
||||
var (encode, filepath) = ParseArgs(args);
|
||||
var inputData = File.ReadAllBytes(filepath);
|
||||
var filename = Path.GetFileName(filepath);
|
||||
|
||||
if(encode) {
|
||||
SDBD.Document document = new (
|
||||
|
@ -17,11 +18,11 @@ if(encode) {
|
|||
File.WriteAllBytes(document.Metadata["content-name"], document.Data);
|
||||
}
|
||||
|
||||
(bool encode, string filename) ParseArgs(string[] args) {
|
||||
(bool encode, string filepath) ParseArgs(string[] args) {
|
||||
return args switch {
|
||||
[var filename] => (true, filename),
|
||||
["-d", var filename] => (false, filename),
|
||||
["-e", var filename] => (true, filename),
|
||||
[var filepath] => (true, filepath),
|
||||
["-d", var filepath] => (false, filepath),
|
||||
["-e", var filepath] => (true, filepath),
|
||||
_ => throw new Exception("I don't like those arguments")
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue