-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
66 lines (53 loc) · 2.09 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using Bayonetta3_bin_tool.Core;
using System;
using System.IO;
namespace Bayonetta3_bin_tool
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Author: Amr Shaheen");
Console.WriteLine("\nBayonetta 3 bin tool");
Console.WriteLine($"\nUsage:");
Console.WriteLine($"\tExport: {AppDomain.CurrentDomain.FriendlyName} <bin file path>");
Console.WriteLine($"\tImport: {AppDomain.CurrentDomain.FriendlyName} <txt file path>");
if (args.Length == 0)
{
Console.WriteLine("\nPress any key to exit...");
Console.ReadKey();
return;
}
if (args[0].EndsWith("txt"))
{
var Filepath = Path.ChangeExtension(args[0], null);
var binFile = new Bin(Filepath);
binFile.UpdateStrings(File.ReadAllLines(args[0]));
binFile.Save(Filepath.Insert(Filepath.LastIndexOf('.'), "_new"));
return;
}
else if(File.Exists(args[0]))
{
var binFile = new Bin(args[0]);
File.WriteAllLines(args[0] + ".txt", binFile.GetStrings());
}
else if (Directory.Exists(args[0]))
{
Console.WriteLine("Extracting: "+ args[0]);
var path =Path.GetFullPath(args[0]);
Directory.SetCurrentDirectory(path);
if (File.Exists("AllStrings.txt"))
{
File.Delete("AllStrings.txt");
}
foreach (var FilePath in Directory.GetFiles(path,"*.bin",SearchOption.AllDirectories))
{
Console.WriteLine("\tExtracting: " + FilePath);
var binFile = new Bin(FilePath);
File.AppendAllText("AllStrings.txt", "[PATH]"+ FilePath.Substring(path.Length)+ "[PATH]\r\n");
File.AppendAllLines("AllStrings.txt", binFile.GetStrings());
}
}
}
}
}