Skip to content

Commit 0159c41

Browse files
committed
More printing
1 parent ffac00d commit 0159c41

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/FileTypes/USM.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public USM(string filename, byte[] key1, byte[] key2)
2929
_filename = Path.GetFileName(filename);
3030
_key1 = key1;
3131
_key2 = key2;
32+
Console.WriteLine($"key1={Convert.ToHexString(_key1)} key2={Convert.ToHexString(_key2)}");
3233
InitMask(key1, key2);
3334
}
3435
private void InitMask(byte[] key1, byte[] key2)

src/Program.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
using System.CommandLine;
1+
using System.CommandLine;
72
using CRIDemuxer.FileTypes;
83

94
namespace CRIDemuxer
@@ -38,7 +33,7 @@ private static async Task<int> Main(string[] args)
3833
name: "-b",
3934
description: "4 higher bytes of the key");
4035

41-
var rootCommand = new RootCommand("Sample app for System.CommandLine");
36+
var rootCommand = new RootCommand("An .usm extraction tool for GI.");
4237
rootCommand.AddGlobalOption(outputFolderOption);
4338

4439

@@ -91,6 +86,8 @@ private static async Task DemuxUsmCommand(FileInfo file, string key1, string key
9186
{
9287
if (file == null) throw new ArgumentNullException("No file provided.");
9388
if (!file.Exists) throw new ArgumentException("File {0} does not exist.", file.Name);
89+
if (!file.Name.EndsWith(".usm"))
90+
throw new ArgumentException($"File {file.Name} provided isn't a .usm file.");
9491
if (key1!=null && key2!= null && (key1.Length != 8 || key2.Length != 8)) throw new ArgumentException("Keys are invalid.");
9592
string outputArg = (output == null)
9693
? file.Directory.FullName
@@ -125,7 +122,7 @@ private static async Task ConvertHcaCommand(FileSystemInfo input, DirectoryInfo?
125122
{
126123
case FileInfo f:
127124
// TODO add keys :shrug:
128-
if (f.Name.EndsWith(".hca")) throw new ArgumentException("File provided is not a .hca file.");
125+
if (!f.Name.EndsWith(".hca")) throw new ArgumentException("File provided is not a .hca file.");
129126
HCA file = new(f.FullName);
130127
file.ConvertToWAV(outputArg);
131128
break;

0 commit comments

Comments
 (0)