Skip to content

Commit

Permalink
添加未完成的文件夹逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
lc6464 committed Dec 8, 2023
1 parent 88bdf48 commit 10c8cd5
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,33 @@
// Read from file
if (args is [.., "-"]) {
// Write to stdout
if (!File.Exists(args[1])) {
Console.WriteLine("Source file not found.");
return 2;
}
using var stdout = Console.OpenStandardOutput();
Base16384.EncodeFromFileToStream(new(args[1]), stdout);
} else if (args.Length == 2) {
// Write to .decoded file
if (!File.Exists(args[1])) {
if (Directory.Exists(args[1])) {
// 此处应该遍历文件夹
return 0;
}
Console.WriteLine("Source file not found.");
return 2;
}
Base16384.EncodeFromFileToNewFile(new(args[1]), new($"{args[1]}.encoded"));
} else {
// Write to file
if (!File.Exists(args[1])) {
if (Directory.Exists(args[1])) {
// 此处应该遍历文件夹
return 0;
}
Console.WriteLine("Source file not found.");
return 2;
}
Base16384.EncodeFromFileToNewFile(new(args[1]), new(args[2]));
}
}
Expand All @@ -48,13 +68,33 @@
// Read from file
if (args is [.., "-"]) {
// Write to stdout
if (!File.Exists(args[1])) {
Console.WriteLine("Source file not found.");
return 2;
}
using var stdout = Console.OpenStandardOutput();
Base16384.DecodeFromFileToStream(new(args[1]), stdout);
} else if (args.Length == 2) {
// Write to .decoded file
if (!File.Exists(args[1])) {
if (Directory.Exists(args[1])) {
// 此处应该遍历文件夹
return 0;
}
Console.WriteLine("Source file not found.");
return 2;
}
Base16384.DecodeFromFileToNewFile(new(args[1]), new($"{args[1]}.decoded"));
} else {
// Write to file
if (!File.Exists(args[1])) {
if (Directory.Exists(args[1])) {
// 此处应该遍历文件夹
return 0;
}
Console.WriteLine("Source file not found.");
return 2;
}
Base16384.DecodeFromFileToNewFile(new(args[1]), new(args[2]));
}
}
Expand Down

0 comments on commit 10c8cd5

Please sign in to comment.