Skip to content

Commit

Permalink
added more message logs
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurHeitmann committed Nov 7, 2022
1 parent abb2f1b commit 3913573
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 7 deletions.
4 changes: 3 additions & 1 deletion lib/fileTypeUtils/dat/datExtractor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _DatHeader {

Future<List<String>> extractDatFiles(String datPath, { bool shouldExtractPakFiles = false }) async {
print("Extracting dat files from $datPath");
messageLog.add("Extracting ${path.basename(datPath)}");
messageLog.add("Extracting ${path.basename(datPath)}...");

var datFile = File(datPath);
var rawBytes = await datFile.readAsBytes();
Expand Down Expand Up @@ -91,6 +91,8 @@ Future<List<String>> extractDatFiles(String datPath, { bool shouldExtractPakFile
}));
}

messageLog.add("Extracting ${path.basename(datPath)} done");

return fileNames;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/fileTypeUtils/dat/datRepacker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../utils/ByteDataWrapper.dart';
import 'datHashGenerator.dart';

Future<void> repackDat(String datDir, String exportPath) async {
messageLog.add("Repacking ${path.basename(exportPath)}");
messageLog.add("Repacking ${path.basename(exportPath)}...");

var fileList = await getDatFileList(datDir);
var fileNames = fileList.map((e) => path.basename(e)).toList();
Expand Down Expand Up @@ -124,4 +124,6 @@ Future<void> repackDat(String datDir, String exportPath) async {
}

await datFile.writeAsBytes(datBytes.buffer.asUint8List());

messageLog.add("Repacking ${path.basename(exportPath)} done");
}
4 changes: 3 additions & 1 deletion lib/fileTypeUtils/pak/pakExtractor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Future<void> _extractPakYax(_HeaderEntry meta, int size, ByteDataWrapper bytes,

Future<List<String>> extractPakFiles(String pakPath, { bool yaxToXml = false }) async {
print("Extracting pak files from $pakPath");
messageLog.add("Extracting ${path.basename(pakPath)}");
messageLog.add("Extracting ${path.basename(pakPath)}...");

var pakFile = File(pakPath);
var rawBytes = await pakFile.readAsBytes();
Expand Down Expand Up @@ -94,6 +94,8 @@ Future<List<String>> extractPakFiles(String pakPath, { bool yaxToXml = false })
await yaxFileToXmlFile(yaxPath);
}));
}

messageLog.add("Extracting ${path.basename(pakPath)} done");

return List<String>.generate(fileCount, (index) => path.join(extractDir, "$index.yax"));
}
Expand Down
3 changes: 2 additions & 1 deletion lib/fileTypeUtils/pak/pakRepacker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class _FileEntry {
}

Future<void> repackPak(String pakDir) async {
messageLog.add("Repacking ${path.basename(pakDir)}");
messageLog.add("Repacking ${path.basename(pakDir)}...");

var infoJsonFile = File(path.join(pakDir, "pakInfo.json"));
var pakInfo = jsonDecode(await infoJsonFile.readAsString());
Expand Down Expand Up @@ -104,4 +104,5 @@ Future<void> repackPak(String pakDir) async {
await pakFile.writeAsBytes(bytes.buffer.asUint8List());

print("Pak file $pakFileName created (${fileEntries.length} file repacked)");
messageLog.add("Repacking ${path.basename(pakDir)} done");
}
4 changes: 3 additions & 1 deletion lib/fileTypeUtils/yax/xmlToYax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ByteDataWrapper xmlToYax(XmlElement root) {

Future<void> xmlFileToYaxFile(String xmlFilePath) async {
print("Converting $xmlFilePath to yax");
messageLog.add("Converting ${path.basename(xmlFilePath)}");
messageLog.add("Converting ${path.basename(xmlFilePath)}...");

var xmlFile = File(xmlFilePath);
var xmlString = await xmlFile.readAsString();
Expand All @@ -91,4 +91,6 @@ Future<void> xmlFileToYaxFile(String xmlFilePath) async {
var yaxFilePath = "${path.withoutExtension(xmlFilePath)}.yax";
var yaxFile = File(yaxFilePath);
await yaxFile.writeAsBytes(yax.buffer.asUint8List());

messageLog.add("Converting ${path.basename(xmlFilePath)} done");
}
4 changes: 3 additions & 1 deletion lib/fileTypeUtils/yax/yaxToXml.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ XmlElement yaxToXml(ByteDataWrapper bytes, { includeAnnotations = true }) {

Future<void> yaxFileToXmlFile(String yaxFilePath) async {
print("Converting $yaxFilePath to xml");
messageLog.add("Converting ${path.basename(yaxFilePath)}");
messageLog.add("Converting ${path.basename(yaxFilePath)}...");

var rawBytes = await File(yaxFilePath).readAsBytes();
var bytes = ByteDataWrapper(rawBytes.buffer);
Expand All @@ -102,4 +102,6 @@ Future<void> yaxFileToXmlFile(String yaxFilePath) async {
await xmlFile.writeAsString('<?xml version="1.0" encoding="utf-8"?>\n');
await xmlFile.writeAsString(xmlString, mode: FileMode.append);
await xmlFile.writeAsString("\n", mode: FileMode.append);

messageLog.add("Converting ${path.basename(yaxFilePath)} done");
}
2 changes: 1 addition & 1 deletion lib/widgets/filesView/searchPanel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class _SearchPanelState extends State<SearchPanel> {

@override
void initState() {
updateSearchStream = debounce(_updateSearchStream, 250);
updateSearchStream = debounce(_updateSearchStream, 750);

extensions.addListener(updateSearchStream);
path.addListener(updateSearchStream);
Expand Down

0 comments on commit 3913573

Please sign in to comment.