private void START_Click(object sender, RoutedEventArgs e) { WindsoulDataFile.WdfPackage _package = null; Regex regex = new Regex("Model = \"\\S+\""); try { _package = new WindsoulDataFile.WdfPackage(this.CONFIG_PATH.Text); _package.Open(); //this.FilesText = File.ReadAllLines(this.CONFIG_PATH_Copy.Text).Where(x => x.Contains("Model")).ToList(); //foreach (var text in FilesText) //{ // var matches = regex.Matches(text); // foreach (Match match in matches) // { // Files.Add(match.Value.Replace("\"", "").Replace("Model = ", "")); // ++this.FilesToExtract; // } //} /* Extracting Configure file */ _package.Extract("addons\\Configure"); FFLua.Decoder.Decompile("Configure", this.DESTINATION_PATH.Text + "\\Configure.lua"); File.Delete("Configure"); this.FilesText = File.ReadAllLines(this.DESTINATION_PATH.Text + "\\Configure.lua").ToList(); this.Files = (from line in FilesText where line.Contains("DoFile(") select new string(line.Substring(line.IndexOf("DoFile(\"", StringComparison.Ordinal) + 8) .TakeWhile(c => c != '\"').ToArray())) .Aggregate("", (current, filename) => current + filename + "\r\n") .Split(new Char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); this.Files = Files.Concat(from line in FilesText where line.Contains("LoadFile(") select line.Split('\"')[1]).ToList(); this.Files = Files.Concat(new string[] { "project\\MotionList", "project\\WndRes", "project\\WndCfg", "project\\MtrlExCfg" }).ToList(); this.FilesToExtract = 0; foreach (String _file in Files) { if (_file.EndsWith(".lua") == false) { ++this.FilesToExtract; } } this.CONFIG_SELECT.IsEnabled = false; this.DESTINATION_SELECT.IsEnabled = false; this.LUA.IsEnabled = false; this.START.IsEnabled = false; Thread _thread = new Thread(new ParameterizedThreadStart(ExtractFiles)); _thread.Start(_package); } catch (Exception ex) { MessageBox.Show(ex.Message, "Wdf package error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void START_Click(object sender, RoutedEventArgs e) { WindsoulDataFile.WdfPackage _package = null; try { _package = new WindsoulDataFile.WdfPackage(this.CONFIG_PATH.Text); _package.Open(); /* Extracting Configure file */ _package.Extract("addons\\Configure"); FFLua.Decoder.Decompile("Configure", this.DESTINATION_PATH.Text + "\\Configure.lua"); File.Delete("Configure"); this.FilesText = File.ReadAllLines(this.DESTINATION_PATH.Text + "\\Configure.lua"); this.Files = (from line in FilesText where line.Contains("DoFile(") select new string(line.Substring(line.IndexOf("DoFile(\"", StringComparison.Ordinal) + 8).TakeWhile(c => c != '\"').ToArray())).Aggregate("", (current, filename) => current + filename + "\r\n").Split(new Char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); this.FilesToExtract = 0; foreach (String _file in Files) { if (_file.EndsWith(".lua") == false) { ++this.FilesToExtract; } } this.CONFIG_SELECT.IsEnabled = false; this.DESTINATION_SELECT.IsEnabled = false; this.LUA.IsEnabled = false; this.START.IsEnabled = false; Thread _thread = new Thread(new ParameterizedThreadStart(ExtractFiles)); _thread.Start(_package); } catch (Exception ex) { MessageBox.Show(ex.Message, "Wdf package error", MessageBoxButton.OK, MessageBoxImage.Error); } }