Skip to content

Instantly share code, notes, and snippets.

@Traderain
Created July 20, 2017 13:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Traderain/de87d093a2ce72010efe32cdc590a4ab to your computer and use it in GitHub Desktop.
Save Traderain/de87d093a2ce72010efe32cdc590a4ab to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace wcclitedumper
{
class Program
{
public const string wccpath = "D:\\Witcher 3 Mod Tools\\bin\\x64\\wcc_lite.exe";
public static string dumpfolder = "\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\DumpingTemp\\";
public static string resultfolder = "..\\Dumpresult\\";
[STAThread]
static void Main(string[] args)
{
Console.Title = "wcc_lite CR2W Dumper";
using(var of = new FolderBrowserDialog())
//using (var of = new OpenFileDialog())
{
if (of.ShowDialog() == DialogResult.OK)
{
Console.WriteLine("Dumping files:");
foreach (var file in Directory.GetFiles(of.SelectedPath, "*.*", SearchOption.AllDirectories))
{
Console.WriteLine("\t" + file);
}
Console.WriteLine();
//of.Multiselect = true;
foreach (var file in Directory.GetFiles(of.SelectedPath,"*.*",SearchOption.AllDirectories))
{
Directory.CreateDirectory(dumpfolder);
Directory.CreateDirectory(resultfolder);
foreach (var s in Directory.GetFiles(dumpfolder, "*.*"))
{
File.Delete(s);
}
var workingpath = dumpfolder + Path.GetFileName(file);
File.Copy(file, dumpfolder + Path.GetFileName(file));
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("-- Dumping: " + file);
var proc = new Process();
Directory.CreateDirectory(dumpfolder);
proc.StartInfo = new ProcessStartInfo(wccpath,BuildCommand(workingpath, resultfolder));
Console.WriteLine("\tArguments: " + proc.StartInfo.Arguments);
Console.WriteLine();
Console.WriteLine("---------<wcc_lite log>--------------");
proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(wccpath);
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.Start();
proc.BeginOutputReadLine();
proc.BeginErrorReadLine();
proc.ErrorDataReceived += Recieved;
proc.OutputDataReceived += Recieved;
proc.WaitForExit();
Console.WriteLine("---------</wcc_lite log>-------------");
foreach (var s in Directory.GetFiles(dumpfolder, " *.xml"))
{
Console.WriteLine("File moved to desktop dump dir!");
File.Move(s, "D:\\Dumpresult\\" + Path.GetFileName(s));
}
}
}
}
Console.WriteLine("Done!");
Console.ReadLine();
}
public static void Recieved(object sender,DataReceivedEventArgs rec)
{
if(rec?.Data != null)
Console.WriteLine(rec.Data);
}
public static string BuildCommand(string infile, string outfile)
{
return $"dumpfile -file={infile} -out={outfile}";
}
}
}
@JakubNei
Copy link

Thank you, if someone is looking for more portable, more annoying version without const strings here it is: https://gist.github.com/aeroson/484a5f096549006646ff3c4b1844f414

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment