replaces save locres to save as json + cleaned some things

This commit is contained in:
Asval 2019-06-23 01:06:35 +02:00
parent ca6ccc5830
commit a6b4b47f82
7 changed files with 257 additions and 252 deletions

View File

@ -6,6 +6,7 @@ using System.Windows.Forms;
namespace FModel.Forms
{
//todo: refactor this shit + search with multiple word separated by spaces
public partial class SearchFiles : Form
{
TypeAssistant _assistant;
@ -165,7 +166,7 @@ namespace FModel.Forms
{
for (int i = 0; i < _myInfos.Count; i++)
{
if (MainWindow.CaseInsensitiveContains(_myInfos[i].FileName, textBox1.Text))
if (Utilities.CaseInsensitiveContains(_myInfos[i].FileName, textBox1.Text))
{
if (_myInfos[i].FileName.Contains(".uasset") || _myInfos[i].FileName.Contains(".uexp") || _myInfos[i].FileName.Contains(".ubulk"))
{
@ -211,7 +212,7 @@ namespace FModel.Forms
{
for (int i = 0; i < _myInfos.Count; i++)
{
if (MainWindow.CaseInsensitiveContains(_myInfos[i].FileName, textBox1.Text))
if (Utilities.CaseInsensitiveContains(_myInfos[i].FileName, textBox1.Text))
{
if (_myInfos[i].FileName.Contains(".uasset") || _myInfos[i].FileName.Contains(".uexp") || _myInfos[i].FileName.Contains(".ubulk"))
{

View File

@ -47,9 +47,6 @@
this.filesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copySelectedFilePathToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
this.locResToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveCurrentLocResToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.imageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoSaveImagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -58,7 +55,7 @@
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutFModelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.AESManagerButton = new System.Windows.Forms.Button();
this.StopButton = new System.Windows.Forms.Button();
this.OpenImageButton = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
@ -74,6 +71,7 @@
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();
this.saveAsJSONToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.panel1.SuspendLayout();
@ -150,26 +148,26 @@
// loadOneToolStripMenuItem
//
this.loadOneToolStripMenuItem.Name = "loadOneToolStripMenuItem";
this.loadOneToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.loadOneToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.loadOneToolStripMenuItem.Text = "Load One PAK";
this.loadOneToolStripMenuItem.DropDownItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.loadOneToolStripMenuItem_DropDownItemClicked);
//
// loadAllToolStripMenuItem
//
this.loadAllToolStripMenuItem.Name = "loadAllToolStripMenuItem";
this.loadAllToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.loadAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.loadAllToolStripMenuItem.Text = "Load All PAKs";
this.loadAllToolStripMenuItem.Click += new System.EventHandler(this.loadAllToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(159, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
//
// backupPAKsToolStripMenuItem
//
this.backupPAKsToolStripMenuItem.Name = "backupPAKsToolStripMenuItem";
this.backupPAKsToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.backupPAKsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.backupPAKsToolStripMenuItem.Text = "Backup PAKs";
this.backupPAKsToolStripMenuItem.Click += new System.EventHandler(this.backupPAKsToolStripMenuItem_Click);
//
@ -177,7 +175,7 @@
//
this.differenceModeToolStripMenuItem.CheckOnClick = true;
this.differenceModeToolStripMenuItem.Name = "differenceModeToolStripMenuItem";
this.differenceModeToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.differenceModeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.differenceModeToolStripMenuItem.Text = "Difference Mode";
this.differenceModeToolStripMenuItem.CheckedChanged += new System.EventHandler(this.differenceModeToolStripMenuItem_CheckedChanged);
//
@ -186,21 +184,21 @@
this.updateModeToolStripMenuItem.CheckOnClick = true;
this.updateModeToolStripMenuItem.Enabled = false;
this.updateModeToolStripMenuItem.Name = "updateModeToolStripMenuItem";
this.updateModeToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.updateModeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.updateModeToolStripMenuItem.Text = "Update Mode";
this.updateModeToolStripMenuItem.CheckedChanged += new System.EventHandler(this.updateModeToolStripMenuItem_CheckedChanged);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(159, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// settingsToolStripMenuItem
//
this.settingsToolStripMenuItem.Image = global::FModel.Properties.Resources.properties_16xLG;
this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem";
this.settingsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1;
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.settingsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.settingsToolStripMenuItem.Text = "Settings";
this.settingsToolStripMenuItem.Click += new System.EventHandler(this.settingsToolStripMenuItem_Click);
//
@ -209,8 +207,7 @@
this.filesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.searchToolStripMenuItem,
this.copySelectedFilePathToolStripMenuItem,
this.toolStripSeparator4,
this.locResToolStripMenuItem});
this.saveAsJSONToolStripMenuItem});
this.filesToolStripMenuItem.Name = "filesToolStripMenuItem";
this.filesToolStripMenuItem.Size = new System.Drawing.Size(42, 20);
this.filesToolStripMenuItem.Text = "Files";
@ -231,26 +228,6 @@
this.copySelectedFilePathToolStripMenuItem.Text = "Copy Selected File Path";
this.copySelectedFilePathToolStripMenuItem.Click += new System.EventHandler(this.CopySelectedFilePathToolStripMenuItem_Click);
//
// toolStripSeparator4
//
this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(213, 6);
//
// locResToolStripMenuItem
//
this.locResToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveCurrentLocResToolStripMenuItem});
this.locResToolStripMenuItem.Name = "locResToolStripMenuItem";
this.locResToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
this.locResToolStripMenuItem.Text = "LocRes";
//
// saveCurrentLocResToolStripMenuItem
//
this.saveCurrentLocResToolStripMenuItem.Name = "saveCurrentLocResToolStripMenuItem";
this.saveCurrentLocResToolStripMenuItem.Size = new System.Drawing.Size(181, 22);
this.saveCurrentLocResToolStripMenuItem.Text = "Save Current LocRes";
this.saveCurrentLocResToolStripMenuItem.Click += new System.EventHandler(this.SaveCurrentLocResToolStripMenuItem_Click);
//
// imageToolStripMenuItem
//
this.imageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -265,7 +242,7 @@
// saveImageToolStripMenuItem
//
this.saveImageToolStripMenuItem.Name = "saveImageToolStripMenuItem";
this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveImageToolStripMenuItem.Text = "Save Image";
this.saveImageToolStripMenuItem.Click += new System.EventHandler(this.saveImageToolStripMenuItem_Click);
//
@ -273,18 +250,18 @@
//
this.autoSaveImagesToolStripMenuItem.CheckOnClick = true;
this.autoSaveImagesToolStripMenuItem.Name = "autoSaveImagesToolStripMenuItem";
this.autoSaveImagesToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.autoSaveImagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.autoSaveImagesToolStripMenuItem.Text = "Auto Save Images";
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(165, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
//
// mergeImagesToolStripMenuItem
//
this.mergeImagesToolStripMenuItem.Name = "mergeImagesToolStripMenuItem";
this.mergeImagesToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.mergeImagesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mergeImagesToolStripMenuItem.Text = "Merge Images";
this.mergeImagesToolStripMenuItem.Click += new System.EventHandler(this.mergeImagesToolStripMenuItem_Click);
//
@ -300,14 +277,14 @@
//
this.aboutFModelToolStripMenuItem.Image = global::FModel.Properties.Resources.StatusAnnotations_Information_16xLG_color;
this.aboutFModelToolStripMenuItem.Name = "aboutFModelToolStripMenuItem";
this.aboutFModelToolStripMenuItem.Size = new System.Drawing.Size(150, 22);
this.aboutFModelToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.aboutFModelToolStripMenuItem.Text = "About FModel";
this.aboutFModelToolStripMenuItem.Click += new System.EventHandler(this.aboutFModelToolStripMenuItem_Click);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.AESManagerButton);
this.panel1.Controls.Add(this.StopButton);
this.panel1.Controls.Add(this.OpenImageButton);
this.panel1.Controls.Add(this.label2);
@ -319,17 +296,17 @@
this.panel1.Size = new System.Drawing.Size(1191, 26);
this.panel1.TabIndex = 2;
//
// button1
// AESManagerButton
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(709, 3);
this.button1.Margin = new System.Windows.Forms.Padding(0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(191, 21);
this.button1.TabIndex = 8;
this.button1.Text = "AES Manager";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.Button1_Click);
this.AESManagerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AESManagerButton.Location = new System.Drawing.Point(709, 3);
this.AESManagerButton.Margin = new System.Windows.Forms.Padding(0);
this.AESManagerButton.Name = "AESManagerButton";
this.AESManagerButton.Size = new System.Drawing.Size(191, 21);
this.AESManagerButton.TabIndex = 8;
this.AESManagerButton.Text = "AES Manager";
this.AESManagerButton.UseVisualStyleBackColor = true;
this.AESManagerButton.Click += new System.EventHandler(this.AESManagerButton_Click);
//
// StopButton
//
@ -497,6 +474,14 @@
this.backgroundWorker2.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker2_DoWork);
this.backgroundWorker2.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker2_RunWorkerCompleted);
//
// saveAsJSONToolStripMenuItem
//
this.saveAsJSONToolStripMenuItem.Name = "saveAsJSONToolStripMenuItem";
this.saveAsJSONToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F4;
this.saveAsJSONToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
this.saveAsJSONToolStripMenuItem.Text = "Save as JSON";
this.saveAsJSONToolStripMenuItem.Click += new System.EventHandler(this.SaveAsJSONToolStripMenuItem_Click);
//
// MainWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -569,11 +554,9 @@
private System.ComponentModel.BackgroundWorker backgroundWorker2;
private System.Windows.Forms.ToolStripMenuItem filesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button AESManagerButton;
private System.Windows.Forms.ToolStripMenuItem copySelectedFilePathToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem locResToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveCurrentLocResToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem saveAsJSONToolStripMenuItem;
}
}

View File

@ -32,13 +32,8 @@ namespace FModel
private static Stopwatch StopWatch { get; set; }
public static string[] PakAsTxt { get; set; }
private static Dictionary<string, string> _diffToExtract { get; set; }
private static string _backupFileName { get; set; }
private static string[] _backupDynamicKeys { get; set; }
private static List<string> _itemsToDisplay { get; set; }
public static string ExtractedFilePath { get; set; }
public static string[] SelectedItemsArray { get; set; }
private bool bIsLocres { get; set; }
private bool differenceFileExists = false;
#endregion
public MainWindow()
@ -165,7 +160,7 @@ namespace FModel
DynamicKeysManager.deserialize();
_backupFileName = "\\FortniteGame_" + DateTime.Now.ToString("MMddyyyy") + ".txt";
Checking.BackupFileName = "\\FortniteGame_" + DateTime.Now.ToString("MMddyyyy") + ".txt";
ThePak.dynamicPaksList = new List<PaksEntry>();
ThePak.mainPaksList = new List<PaksEntry>();
@ -259,23 +254,7 @@ namespace FModel
Application.OpenForms[aboutForm.Name].Focus();
}
}
private void searchToolStripMenuItem_Click(object sender, EventArgs e)
{
var searchForm = new SearchFiles();
if (Application.OpenForms[searchForm.Name] == null)
{
searchForm.Show();
}
else
{
Application.OpenForms[searchForm.Name].Focus();
}
searchForm.FormClosing += (o, c) =>
{
OpenMe();
};
}
private void Button1_Click(object sender, EventArgs e)
private void AESManagerButton_Click(object sender, EventArgs e)
{
var aesForms = new AESManager();
if (Application.OpenForms[aesForms.Name] == null)
@ -297,7 +276,6 @@ namespace FModel
ThePak.CurrentUsedPak = null;
ThePak.CurrentUsedPakGuid = null;
bool bMainKeyWorking = false;
bIsLocres = false;
for (int i = 0; i < ThePak.mainPaksList.Count; i++)
{
@ -401,7 +379,13 @@ namespace FModel
UpdateConsole("Building tree, please wait...", Color.FromArgb(255, 244, 132, 66), "Loading");
}
private void TreeParsePath(TreeNodeCollection nodeList, string path) //https://social.msdn.microsoft.com/Forums/en-US/c75c1804-6933-40ba-b17a-0e36ae8bcbb5/how-to-create-a-tree-view-with-full-paths?forum=csharplanguage
/// <summary>
/// https://social.msdn.microsoft.com/Forums/en-US/c75c1804-6933-40ba-b17a-0e36ae8bcbb5/how-to-create-a-tree-view-with-full-paths?forum=csharplanguage
/// </summary>
/// <param name="nodeList"></param>
/// <param name="path"></param>
private void TreeParsePath(TreeNodeCollection nodeList, string path)
{
TreeNode node;
string folder;
@ -501,7 +485,7 @@ namespace FModel
{
PakAsTxt = File.ReadAllLines(App.DefaultOutputPath + "\\Result.txt");
File.Delete(App.DefaultOutputPath + "\\Result.txt");
differenceFileExists = true;
Checking.DifferenceFileExists = true;
}
}
private void CreatePakList(ToolStripItemClickedEventArgs selectedPak = null, bool loadAllPaKs = false, bool getDiff = false, bool updateMode = false)
@ -574,7 +558,7 @@ namespace FModel
{
UpdateConsole("Comparing files...", Color.FromArgb(255, 244, 132, 66), "Loading");
ComparePaKs();
if (updateMode && differenceFileExists)
if (updateMode && Checking.DifferenceFileExists)
{
UmFilter(PakAsTxt, _diffToExtract);
Checking.UmWorking = true;
@ -590,14 +574,14 @@ namespace FModel
treeView1.EndUpdate();
}));
differenceFileExists = false;
Checking.DifferenceFileExists = false;
UpdateConsole("Files compared", Color.FromArgb(255, 66, 244, 66), "Success");
}
}
}
private void CreateBackupList()
{
_backupDynamicKeys = null;
string[] _backupDynamicKeys = null;
StringBuilder sb = new StringBuilder();
if (DLLImport.IsInternetAvailable() && (!string.IsNullOrWhiteSpace(Settings.Default.eEmail) || !string.IsNullOrWhiteSpace(Settings.Default.ePassword)))
@ -688,15 +672,15 @@ namespace FModel
}
}
File.WriteAllText(App.DefaultOutputPath + "\\Backup" + _backupFileName, sb.ToString()); //File will always exist so we check the file size instead
if (new System.IO.FileInfo(App.DefaultOutputPath + "\\Backup" + _backupFileName).Length > 0)
File.WriteAllText(App.DefaultOutputPath + "\\Backup" + Checking.BackupFileName, sb.ToString()); //File will always exist so we check the file size instead
if (new System.IO.FileInfo(App.DefaultOutputPath + "\\Backup" + Checking.BackupFileName).Length > 0)
{
UpdateConsole("\\Backup" + _backupFileName + " successfully created", Color.FromArgb(255, 66, 244, 66), "Success");
UpdateConsole("\\Backup" + Checking.BackupFileName + " successfully created", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
{
File.Delete(App.DefaultOutputPath + "\\Backup" + _backupFileName);
UpdateConsole("Can't create " + _backupFileName.Substring(1), Color.FromArgb(255, 244, 66, 66), "Error");
File.Delete(App.DefaultOutputPath + "\\Backup" + Checking.BackupFileName);
UpdateConsole("Can't create " + Checking.BackupFileName.Substring(1), Color.FromArgb(255, 244, 66, 66), "Error");
}
}
private void UpdateModeExtractSave()
@ -838,6 +822,7 @@ namespace FModel
CreateBackupList();
});
}
//UPDATE MODE
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
{
@ -943,10 +928,6 @@ namespace FModel
ExtractButton.Enabled = listBox1.SelectedIndex >= 0; //DISABLE EXTRACT BUTTON IF NOTHING IS SELECTED IN LISTBOX
}));
}
public static bool CaseInsensitiveContains(string text, string value, StringComparison stringComparison = StringComparison.CurrentCultureIgnoreCase)
{
return text.IndexOf(value, stringComparison) >= 0;
} //FILTER INSENSITIVE
private void FilterItems()
{
if (listBox1.InvokeRequired)
@ -964,7 +945,7 @@ namespace FModel
{
for (int i = 0; i < _itemsToDisplay.Count; i++)
{
if (CaseInsensitiveContains(_itemsToDisplay[i], FilterTextBox.Text))
if (Utilities.CaseInsensitiveContains(_itemsToDisplay[i], FilterTextBox.Text))
{
listBox1.Items.Add(_itemsToDisplay[i]);
}
@ -981,119 +962,6 @@ namespace FModel
listBox1.EndUpdate();
}
public async void ExpandMyLitleBoys(TreeNode node, List<string> path)
{
path.RemoveAt(0);
node.Expand();
if (path.Count == 0)
return;
if (path.Count == 1)
{
treeView1.SelectedNode = node;
await Task.Run(() => {
List<string> itemsNotToDisplay = new List<string>();
_itemsToDisplay = new List<string>();
Invoke(new Action(() =>
{
listBox1.Items.Clear();
FilterTextBox.Text = string.Empty;
}));
var all = GetAncestors(node, x => x.Parent).ToList();
all.Reverse();
var full = string.Join("/", all.Select(x => x.Text)) + "/" + node.Text + "/";
if (string.IsNullOrEmpty(full))
{
return;
}
var dirfiles = PakAsTxt.Where(x => x.StartsWith(full) && !x.Replace(full, "").Contains("/"));
var enumerable = dirfiles as string[] ?? dirfiles.ToArray();
if (!enumerable.Any())
{
return;
}
foreach (var i in enumerable)
{
string v;
if (i.Contains(".uasset") || i.Contains(".uexp") || i.Contains(".ubulk"))
{
v = i.Substring(0, i.LastIndexOf('.'));
}
else
{
v = i.Replace(full, "");
}
itemsNotToDisplay.Add(v.Replace(full, ""));
}
_itemsToDisplay = itemsNotToDisplay.Distinct().ToList(); //NO DUPLICATION + NO EXTENSION = EASY TO FIND WHAT WE WANT
Invoke(new Action(() =>
{
for (int i = 0; i < _itemsToDisplay.Count; i++)
{
listBox1.Items.Add(_itemsToDisplay[i]);
}
ExtractButton.Enabled = listBox1.SelectedIndex >= 0; //DISABLE EXTRACT BUTTON IF NOTHING IS SELECTED IN LISTBOX
}));
});
for (int i = 0; i < listBox1.Items.Count; i++)
{
if (listBox1.Items[i].ToString() == SearchFiles.SfPath.Substring(SearchFiles.SfPath.LastIndexOf("/", StringComparison.Ordinal) + 1))
{
listBox1.SelectedItem = listBox1.Items[i];
}
}
}
foreach (TreeNode mynode in node.Nodes)
if (mynode.Text == path[0])
{
ExpandMyLitleBoys(mynode, path); //recursive call
break;
}
}
public void OpenMe()
{
if (SearchFiles.IsClosed)
{
treeView1.CollapseAll();
var pathList = SearchFiles.SfPath.Split('/').ToList();
foreach (TreeNode node in treeView1.Nodes)
if (node.Text == pathList[0])
ExpandMyLitleBoys(node, pathList);
}
else if (SearchFiles.FilesToSearch)
{
AddAndSelectAllItems(SearchFiles.myItems);
}
}
private void AddAndSelectAllItems(string[] myItemsToAdd)
{
listBox1.BeginUpdate();
listBox1.Items.Clear();
for (int i = 0; i < myItemsToAdd.Length; i++)
{
listBox1.Items.Add(myItemsToAdd[i]);
}
for (int i = 0; i < listBox1.Items.Count; i++) { listBox1.SetSelected(i, true); }
listBox1.EndUpdate();
//same as click on extract button
scintilla1.Text = "";
pictureBox1.Image = null;
ExtractButton.Enabled = false;
OpenImageButton.Enabled = false;
StopButton.Enabled = true;
if (backgroundWorker1.IsBusy != true)
{
backgroundWorker1.RunWorkerAsync();
}
}
//EVENTS
private async void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
@ -1164,35 +1032,33 @@ namespace FModel
ThePak.CurrentUsedItem = SelectedItemsArray[i];
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
ExtractedFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, ThePak.CurrentUsedItem);
Checking.ExtractedFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, ThePak.CurrentUsedItem);
else
ExtractedFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[ThePak.CurrentUsedItem], ThePak.CurrentUsedItem);
Checking.ExtractedFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[ThePak.CurrentUsedItem], ThePak.CurrentUsedItem);
if (ExtractedFilePath != null)
if (Checking.ExtractedFilePath != null)
{
bIsLocres = false;
UpdateConsole(ThePak.CurrentUsedItem + " successfully extracted", Color.FromArgb(255, 66, 244, 66), "Success");
if (ExtractedFilePath.Contains(".uasset") || ExtractedFilePath.Contains(".uexp") || ExtractedFilePath.Contains(".ubulk"))
if (Checking.ExtractedFilePath.Contains(".uasset") || Checking.ExtractedFilePath.Contains(".uexp") || Checking.ExtractedFilePath.Contains(".ubulk"))
{
JohnWick.MyAsset = new PakAsset(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf('.')));
JohnWick.MyAsset = new PakAsset(Checking.ExtractedFilePath.Substring(0, Checking.ExtractedFilePath.LastIndexOf('.')));
JsonParseFile();
}
if (ExtractedFilePath.Contains(".ufont"))
ConvertToTtf(ExtractedFilePath);
if (ExtractedFilePath.Contains(".ini"))
if (Checking.ExtractedFilePath.Contains(".ufont"))
ConvertToTtf(Checking.ExtractedFilePath);
if (Checking.ExtractedFilePath.Contains(".ini"))
{
Invoke(new Action(() =>
{
scintilla1.Text = File.ReadAllText(ExtractedFilePath);
scintilla1.Text = File.ReadAllText(Checking.ExtractedFilePath);
}));
}
if (ExtractedFilePath.Contains(".locres") && !ExtractedFilePath.Contains("EngineOverrides"))
if (Checking.ExtractedFilePath.Contains(".locres") && !Checking.ExtractedFilePath.Contains("EngineOverrides"))
{
SerializeLocRes();
}
}
else
UpdateConsole("Error while extracting " + ThePak.CurrentUsedItem, Color.FromArgb(255, 244, 66, 66), "Error");
else { throw new ArgumentException("Error while extracting " + ThePak.CurrentUsedItem); }
}
}
private void JsonParseFile()
@ -1214,10 +1080,9 @@ namespace FModel
}
}));
NavigateThroughJson(JohnWick.MyAsset, ExtractedFilePath);
NavigateThroughJson(JohnWick.MyAsset, Checking.ExtractedFilePath);
}
else
UpdateConsole("No serialized file found", Color.FromArgb(255, 244, 66, 66), "Error");
else { throw new ArgumentException("Can't serialize this file"); }
}
private void NavigateThroughJson(PakAsset theAsset, string questJson = null)
{
@ -1276,7 +1141,7 @@ namespace FModel
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
throw new ArgumentException(ex.Message);
}
}
private Bitmap CreateItemIcon(ItemsIdParser theItem, string specialMode = null)
@ -1450,14 +1315,9 @@ namespace FModel
string filePath = App.DefaultOutputPath + "\\Extracted\\" + treeviewPath + "\\" + listBox1.SelectedItem;
if (File.Exists(filePath))
{
bIsLocres = true;
scintilla1.Text = LocResSerializer.StringFinder(filePath);
}
else
{
bIsLocres = false;
AppendText("Error while searching " + listBox1.SelectedItem, Color.DarkRed, true);
}
else { throw new FileNotFoundException("Error while searching " + listBox1.SelectedItem); }
}));
}
@ -1465,9 +1325,9 @@ namespace FModel
{
UpdateConsole(ThePak.CurrentUsedItem + " is a Texture2D", Color.FromArgb(255, 66, 244, 66), "Success");
JohnWick.MyAsset = new PakAsset(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)));
JohnWick.MyAsset.SaveTexture(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
string imgPath = ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
JohnWick.MyAsset = new PakAsset(Checking.ExtractedFilePath.Substring(0, Checking.ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)));
JohnWick.MyAsset.SaveTexture(Checking.ExtractedFilePath.Substring(0, Checking.ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
string imgPath = Checking.ExtractedFilePath.Substring(0, Checking.ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
if (File.Exists(imgPath))
{
@ -1493,7 +1353,7 @@ namespace FModel
{
UpdateConsole(ThePak.CurrentUsedItem + " is a Sound", Color.FromArgb(255, 66, 244, 66), "Success");
string soundPathToConvert = ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf('\\')) + "\\" + ThePak.CurrentUsedItem + ".uexp";
string soundPathToConvert = Checking.ExtractedFilePath.Substring(0, Checking.ExtractedFilePath.LastIndexOf('\\')) + "\\" + ThePak.CurrentUsedItem + ".uexp";
string soundPathConverted = UnrealEngineDataToOgg.ConvertToOgg(soundPathToConvert);
UpdateConsole("Converting " + ThePak.CurrentUsedItem, Color.FromArgb(255, 244, 132, 66), "Processing");
@ -1576,7 +1436,7 @@ namespace FModel
}
#endregion
#region IMAGES SAVE & MERGE
#region IMAGES TOOLSTRIP AND OPEN
//EVENTS
private void OpenImageButton_Click(object sender, EventArgs e)
{
@ -1620,6 +1480,145 @@ namespace FModel
}
#endregion
#region FILES TOOLSTRIP
//METHODS
private void OpenMe()
{
if (SearchFiles.IsClosed)
{
treeView1.CollapseAll();
List<string> pathList = SearchFiles.SfPath.Split('/').ToList();
foreach (TreeNode node in treeView1.Nodes)
{
if (node.Text == pathList[0])
{
ExpandMyLitleBoys(node, pathList);
}
}
}
else if (SearchFiles.FilesToSearch)
{
AddAndSelectAllItems(SearchFiles.myItems);
}
}
private async void ExpandMyLitleBoys(TreeNode node, List<string> path)
{
path.RemoveAt(0);
node.Expand();
if (path.Count == 0)
return;
if (path.Count == 1)
{
treeView1.SelectedNode = node;
await Task.Run(() => {
List<string> itemsNotToDisplay = new List<string>();
_itemsToDisplay = new List<string>();
Invoke(new Action(() =>
{
listBox1.Items.Clear();
FilterTextBox.Text = string.Empty;
}));
var all = GetAncestors(node, x => x.Parent).ToList();
all.Reverse();
var full = string.Join("/", all.Select(x => x.Text)) + "/" + node.Text + "/";
if (string.IsNullOrEmpty(full))
{
return;
}
var dirfiles = PakAsTxt.Where(x => x.StartsWith(full) && !x.Replace(full, "").Contains("/"));
var enumerable = dirfiles as string[] ?? dirfiles.ToArray();
if (!enumerable.Any())
{
return;
}
foreach (var i in enumerable)
{
string v;
if (i.Contains(".uasset") || i.Contains(".uexp") || i.Contains(".ubulk"))
{
v = i.Substring(0, i.LastIndexOf('.'));
}
else
{
v = i.Replace(full, "");
}
itemsNotToDisplay.Add(v.Replace(full, ""));
}
_itemsToDisplay = itemsNotToDisplay.Distinct().ToList(); //NO DUPLICATION + NO EXTENSION = EASY TO FIND WHAT WE WANT
Invoke(new Action(() =>
{
for (int i = 0; i < _itemsToDisplay.Count; i++)
{
listBox1.Items.Add(_itemsToDisplay[i]);
}
ExtractButton.Enabled = listBox1.SelectedIndex >= 0; //DISABLE EXTRACT BUTTON IF NOTHING IS SELECTED IN LISTBOX
}));
});
for (int i = 0; i < listBox1.Items.Count; i++)
{
if (listBox1.Items[i].ToString() == SearchFiles.SfPath.Substring(SearchFiles.SfPath.LastIndexOf("/", StringComparison.Ordinal) + 1))
{
listBox1.SelectedItem = listBox1.Items[i];
}
}
}
foreach (TreeNode mynode in node.Nodes)
if (mynode.Text == path[0])
{
ExpandMyLitleBoys(mynode, path); //recursive call
break;
}
}
private void AddAndSelectAllItems(string[] myItemsToAdd)
{
listBox1.BeginUpdate();
listBox1.Items.Clear();
for (int i = 0; i < myItemsToAdd.Length; i++)
{
listBox1.Items.Add(myItemsToAdd[i]);
}
for (int i = 0; i < listBox1.Items.Count; i++) { listBox1.SetSelected(i, true); }
listBox1.EndUpdate();
//same as click on extract button
scintilla1.Text = "";
pictureBox1.Image = null;
ExtractButton.Enabled = false;
OpenImageButton.Enabled = false;
StopButton.Enabled = true;
if (backgroundWorker1.IsBusy != true)
{
backgroundWorker1.RunWorkerAsync();
}
}
//EVENTS
private void searchToolStripMenuItem_Click(object sender, EventArgs e)
{
var searchForm = new SearchFiles();
if (Application.OpenForms[searchForm.Name] == null)
{
searchForm.Show();
}
else
{
Application.OpenForms[searchForm.Name].Focus();
}
searchForm.FormClosing += (o, c) =>
{
OpenMe();
};
}
private void CopySelectedFilePathToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listBox1.SelectedItem != null)
@ -1639,28 +1638,31 @@ namespace FModel
AppendText("Copied!", Color.Green, true);
}
}
private void SaveCurrentLocResToolStripMenuItem_Click(object sender, EventArgs e)
private void SaveAsJSONToolStripMenuItem_Click(object sender, EventArgs e)
{
if (bIsLocres)
if (!string.IsNullOrEmpty(scintilla1.Text))
{
SaveFileDialog saveTheDialog = new SaveFileDialog();
saveTheDialog.Title = @"Save LocRes";
saveTheDialog.Title = @"Save Serialized File";
saveTheDialog.Filter = @"JSON Files (*.json)|*.json";
saveTheDialog.InitialDirectory = App.DefaultOutputPath + "\\LocRes\\";
saveTheDialog.FileName = ThePak.CurrentUsedItem.Substring(0, ThePak.CurrentUsedItem.LastIndexOf('.'));
saveTheDialog.InitialDirectory = App.DefaultOutputPath + "\\Saved JSON\\";
saveTheDialog.FileName = ThePak.CurrentUsedItem.Contains('.') ? ThePak.CurrentUsedItem.Substring(0, ThePak.CurrentUsedItem.LastIndexOf('.')) : ThePak.CurrentUsedItem;
if (saveTheDialog.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(saveTheDialog.FileName, scintilla1.Text);
AppendText(ThePak.CurrentUsedItem, Color.DarkRed);
AppendText(" successfully saved", Color.Black, true);
if (File.Exists(saveTheDialog.FileName))
{
AppendText(ThePak.CurrentUsedItem, Color.DarkRed);
AppendText(" successfully saved", Color.Black, true);
}
else
{
AppendText("Fail to save ", Color.Black);
AppendText(ThePak.CurrentUsedItem, Color.DarkRed, true);
}
}
}
else
{
AppendText("Please load a .locres file first.\t\t\t", Color.Black);
AppendText(@"FortniteGame\Content\Localization\ - pakchunk0-WindowsClient.pak", Color.DarkRed, true);
}
}
#endregion
}
}

View File

@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABa
CAAAAk1TRnQBSQFMAgEBAgEAAUgBAQFIAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAAVABAQFQAQEBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -40,7 +40,7 @@ namespace FModel
break;
case "consAndWeap":
DrawToRight(ItemAction, myGraphic);
if (MainWindow.ExtractedFilePath.Contains("Items\\Consumables\\"))
if (Checking.ExtractedFilePath.Contains("Items\\Consumables\\"))
{
DrawToLeft(MaxStackSize, myGraphic);
}

View File

@ -30,7 +30,7 @@ namespace FModel
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Icons\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Sounds\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\LocRes\\");
Directory.CreateDirectory(App.DefaultOutputPath + "\\Saved JSON\\");
}
/// <summary>
@ -86,6 +86,10 @@ namespace FModel
{
File.Delete(App.DefaultOutputPath + "\\john-wick-parse_custom.exe");
}
if (Directory.Exists(App.DefaultOutputPath + "\\LocRes\\"))
{
Directory.Delete(App.DefaultOutputPath + "\\LocRes\\");
}
}
/// <summary>
@ -117,5 +121,17 @@ namespace FModel
//file is not locked
return false;
}
/// <summary>
/// filter text with case insensitive support
/// </summary>
/// <param name="text"></param>
/// <param name="value"></param>
/// <param name="stringComparison"></param>
/// <returns></returns>
public static bool CaseInsensitiveContains(string text, string value, StringComparison stringComparison = StringComparison.CurrentCultureIgnoreCase)
{
return text.IndexOf(value, stringComparison) >= 0;
}
}
}

View File

@ -66,6 +66,9 @@ namespace FModel
{
public static bool WasFeatured { get; set; }
public static bool UmWorking { get; set; }
public static string BackupFileName { get; set; }
public static string ExtractedFilePath { get; set; }
public static bool DifferenceFileExists = false;
}
public struct BundleInfoEntry: IEquatable<BundleInfoEntry>
{