Last active
July 19, 2017 12:28
-
-
Save Traderain/4d433404cc16af62845a9485df0df28e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
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 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\Dump\\"; | |
[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) | |
{ | |
//of.Multiselect = true; | |
foreach (var file in Directory.GetFiles(of.SelectedPath,"*.*",SearchOption.AllDirectories)) | |
//foreach (var file in of.SafeFileNames) | |
{ | |
Console.WriteLine(); | |
Console.WriteLine(); | |
Console.WriteLine("-- Dumping: " + file); | |
var proc = new Process(); | |
Directory.CreateDirectory(dumpfolder); | |
proc.StartInfo = new ProcessStartInfo(wccpath,BuildCommand(file, dumpfolder)); | |
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>-------------"); | |
} | |
} | |
} | |
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}"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment