private static void ProcessFile(string type, Node n, string dirToSave, string dataToInsert) { Identify i = new Identify(); IFormat inputFormat = i.GetFormat(n); // Compressed file if (inputFormat.ToString() == FORMATPREFIX + "DSCP") { BinaryFormat binary = Utils.Lzss(new BinaryFormat(n.Stream), "-d"); n = new Node(n.Name, binary); inputFormat = i.GetFormat(n); } log.Info("IFormat detected: " + inputFormat.ToString()); switch (type) {// inputFilename - dirtosave - (dir/file to insert) case "-e": Export(inputFormat.ToString(), n, dirToSave); break; case "-i": Import(inputFormat.ToString(), n, dirToSave, dataToInsert); break; } }
private static void ProcessDig(string type, string outputFolder, string inputFolder) { foreach (Node d in NodeFactory.FromDirectory(inputFolder, "*.dig").Children) { Identify i = new Identify(); IFormat inputFormat = i.GetFormat(d); Node dig = d; // Compressed file if (inputFormat.ToString() == FORMATPREFIX + "DSCP") { BinaryFormat binary = Utils.Lzss(new BinaryFormat(dig.Stream), "-d"); dig = new Node(dig.Name, binary); } Node atm = NodeFactory.FromDirectory(inputFolder, "*.atm") .Children[Path.GetFileNameWithoutExtension(dig.Name) + ".atm"]; if (atm == null) { throw new Exception("ATM not found: " + Path.GetFileNameWithoutExtension(dig.Name) + ".atm"); } if (type == "-exportdig") { ExportDig(dig, atm, outputFolder); } else { Node png = NodeFactory.FromDirectory(inputFolder, "*.png") .Children[Path.GetFileNameWithoutExtension(dig.Name) + ".png"]; if (png != null) { ImportDig(dig, atm, png, outputFolder); } } } }