needs to be refactored

This commit is contained in:
Asval 2019-05-20 17:26:30 +02:00
parent e9d7ebae63
commit 88aa32a482
6 changed files with 245 additions and 226 deletions

View File

@ -7,9 +7,9 @@ namespace FModel.Converter
{
class UnrealEngineDataToOgg
{
static byte[] oggFind = { 0x4F, 0x67, 0x67, 0x53 };
static byte[] oggNoHeader = { 0x4F, 0x67, 0x67, 0x53 };
static byte[] uexpToDelete = { 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00 };
static byte[] _oggFind = { 0x4F, 0x67, 0x67, 0x53 };
static byte[] _oggNoHeader = { 0x4F, 0x67, 0x67, 0x53 };
static byte[] _uexpToDelete = { 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00 };
static byte[] _oggOutNewArray;
public static List<int> SearchBytePattern(byte[] pattern, byte[] bytes)
{
@ -65,7 +65,7 @@ namespace FModel.Converter
if (File.ReadAllText(file).Contains(oggPattern))
{
byte[] src = File.ReadAllBytes(file);
TryFindAndReplace(src, oggFind, oggNoHeader, out _oggOutNewArray);
TryFindAndReplace(src, _oggFind, _oggNoHeader, out _oggOutNewArray);
File.WriteAllBytes(Path.GetFileNameWithoutExtension(file) + ".temp", _oggOutNewArray);
FileInfo fi = new FileInfo(Path.GetFileNameWithoutExtension(file) + ".temp");
@ -91,9 +91,9 @@ namespace FModel.Converter
if (File.ReadAllText(file).Contains(oggPattern))
{
byte[] src = File.ReadAllBytes(file);
List<int> positions = SearchBytePattern(uexpToDelete, src);
List<int> positions = SearchBytePattern(_uexpToDelete, src);
TryFindAndReplace(src, oggFind, oggNoHeader, out _oggOutNewArray);
TryFindAndReplace(src, _oggFind, _oggNoHeader, out _oggOutNewArray);
File.WriteAllBytes(Path.GetFileNameWithoutExtension(file) + ".temp", _oggOutNewArray);
int lengthToDelete = src.Length - positions[0];

View File

@ -7,19 +7,19 @@ namespace FModel
{
public event EventHandler Idled = delegate { };
public int WaitingMilliSeconds { get; set; }
Timer waitingTimer;
Timer _waitingTimer;
public TypeAssistant(int waitingMilliSeconds = 600)
{
WaitingMilliSeconds = waitingMilliSeconds;
waitingTimer = new Timer(p =>
_waitingTimer = new Timer(p =>
{
Idled(this, EventArgs.Empty);
});
}
public void TextChanged()
{
waitingTimer.Change(WaitingMilliSeconds, Timeout.Infinite);
_waitingTimer.Change(WaitingMilliSeconds, Timeout.Infinite);
}
}
}

View File

@ -8,8 +8,8 @@ namespace FModel.Forms
{
public partial class SearchFiles : Form
{
TypeAssistant assistant;
List<FileInfo> myInfos = new List<FileInfo>();
TypeAssistant _assistant;
List<FileInfo> _myInfos = new List<FileInfo>();
List<FileInfoFilter> _myFilteredInfos;
private static string _fileName;
private static Dictionary<string, string> _myInfosDict;
@ -21,8 +21,8 @@ namespace FModel.Forms
{
InitializeComponent();
assistant = new TypeAssistant();
assistant.Idled += assistant_Idled;
_assistant = new TypeAssistant();
_assistant.Idled += assistant_Idled;
}
private async void SearchFiles_Load(object sender, EventArgs e)
@ -30,20 +30,20 @@ namespace FModel.Forms
IsClosed = false;
_myInfosDict = new Dictionary<string, string>();
if (MainWindow.pakAsTxt != null)
if (MainWindow.PakAsTxt != null)
{
if (MainWindow.CurrentUsedPakGuid != null && MainWindow.CurrentUsedPakGuid != "0-0-0-0")
{
for (int i = 0; i < MainWindow.pakAsTxt.Length; i++)
for (int i = 0; i < MainWindow.PakAsTxt.Length; i++)
{
if (MainWindow.pakAsTxt[i].Contains(".uasset") || MainWindow.pakAsTxt[i].Contains(".uexp") || MainWindow.pakAsTxt[i].Contains(".ubulk"))
if (MainWindow.PakAsTxt[i].Contains(".uasset") || MainWindow.PakAsTxt[i].Contains(".uexp") || MainWindow.PakAsTxt[i].Contains(".ubulk"))
{
if (!_myInfosDict.ContainsKey(MainWindow.pakAsTxt[i].Substring(0, MainWindow.pakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal))))
if (!_myInfosDict.ContainsKey(MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal))))
{
_myInfosDict.Add(MainWindow.pakAsTxt[i].Substring(0, MainWindow.pakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal)), MainWindow.CurrentUsedPak);
_myInfosDict.Add(MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal)), MainWindow.CurrentUsedPak);
_fileName = MainWindow.pakAsTxt[i].Substring(0, MainWindow.pakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal));
myInfos.Add(new FileInfo
_fileName = MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal));
_myInfos.Add(new FileInfo
{
FileName = _fileName,
PakFile = MainWindow.CurrentUsedPak,
@ -52,12 +52,12 @@ namespace FModel.Forms
}
else
{
if (!_myInfosDict.ContainsKey(MainWindow.pakAsTxt[i]))
if (!_myInfosDict.ContainsKey(MainWindow.PakAsTxt[i]))
{
_myInfosDict.Add(MainWindow.pakAsTxt[i], MainWindow.CurrentUsedPak);
_myInfosDict.Add(MainWindow.PakAsTxt[i], MainWindow.CurrentUsedPak);
_fileName = MainWindow.pakAsTxt[i];
myInfos.Add(new FileInfo
_fileName = MainWindow.PakAsTxt[i];
_myInfos.Add(new FileInfo
{
FileName = _fileName,
PakFile = MainWindow.CurrentUsedPak,
@ -68,33 +68,33 @@ namespace FModel.Forms
}
else
{
for (int i = 0; i < MainWindow.pakAsTxt.Length; i++)
for (int i = 0; i < MainWindow.PakAsTxt.Length; i++)
{
if (MainWindow.pakAsTxt[i].Contains(".uasset") || MainWindow.pakAsTxt[i].Contains(".uexp") || MainWindow.pakAsTxt[i].Contains(".ubulk"))
if (MainWindow.PakAsTxt[i].Contains(".uasset") || MainWindow.PakAsTxt[i].Contains(".uexp") || MainWindow.PakAsTxt[i].Contains(".ubulk"))
{
if (!_myInfosDict.ContainsKey(MainWindow.pakAsTxt[i].Substring(0, MainWindow.pakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal))))
if (!_myInfosDict.ContainsKey(MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal))))
{
_myInfosDict.Add(MainWindow.pakAsTxt[i].Substring(0, MainWindow.pakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal)), MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(MainWindow.pakAsTxt[i])]);
_myInfosDict.Add(MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal)), MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(MainWindow.PakAsTxt[i])]);
_fileName = MainWindow.pakAsTxt[i].Substring(0, MainWindow.pakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal));
myInfos.Add(new FileInfo
_fileName = MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal));
_myInfos.Add(new FileInfo
{
FileName = _fileName,
PakFile = MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(MainWindow.pakAsTxt[i])],
PakFile = MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(MainWindow.PakAsTxt[i])],
});
}
}
else
{
if (!_myInfosDict.ContainsKey(MainWindow.pakAsTxt[i]))
if (!_myInfosDict.ContainsKey(MainWindow.PakAsTxt[i]))
{
_myInfosDict.Add(MainWindow.pakAsTxt[i], MainWindow.AllpaksDictionary[Path.GetFileName(MainWindow.pakAsTxt[i])]);
_myInfosDict.Add(MainWindow.PakAsTxt[i], MainWindow.AllpaksDictionary[Path.GetFileName(MainWindow.PakAsTxt[i])]);
_fileName = MainWindow.pakAsTxt[i];
myInfos.Add(new FileInfo
_fileName = MainWindow.PakAsTxt[i];
_myInfos.Add(new FileInfo
{
FileName = _fileName,
PakFile = MainWindow.AllpaksDictionary[Path.GetFileName(MainWindow.pakAsTxt[i])],
PakFile = MainWindow.AllpaksDictionary[Path.GetFileName(MainWindow.PakAsTxt[i])],
});
}
}
@ -103,7 +103,7 @@ namespace FModel.Forms
await Task.Run(() =>
{
ShowItemsVirtual(myInfos);
ShowItemsVirtual(_myInfos);
});
}
}
@ -112,7 +112,7 @@ namespace FModel.Forms
{
if (_myFilteredInfos == null || _myFilteredInfos.Count == 0)
{
var acc = myInfos[e.ItemIndex];
var acc = _myInfos[e.ItemIndex];
e.Item = new ListViewItem(
new[]
{ acc.FileName, acc.PakFile });
@ -154,23 +154,23 @@ namespace FModel.Forms
listView1.VirtualListSize = 0;
listView1.Invalidate();
if (MainWindow.pakAsTxt != null)
if (MainWindow.PakAsTxt != null)
{
if (MainWindow.CurrentUsedPakGuid != null && MainWindow.CurrentUsedPakGuid != "0-0-0-0")
{
if (!string.IsNullOrEmpty(textBox1.Text) && textBox1.Text.Length > 2)
{
for (int i = 0; i < myInfos.Count; i++)
for (int i = 0; i < _myInfos.Count; i++)
{
if (MainWindow.CaseInsensitiveContains(myInfos[i].FileName, textBox1.Text))
if (MainWindow.CaseInsensitiveContains(_myInfos[i].FileName, textBox1.Text))
{
if (myInfos[i].FileName.Contains(".uasset") || myInfos[i].FileName.Contains(".uexp") || myInfos[i].FileName.Contains(".ubulk"))
if (_myInfos[i].FileName.Contains(".uasset") || _myInfos[i].FileName.Contains(".uexp") || _myInfos[i].FileName.Contains(".ubulk"))
{
if (!_myFilteredInfosDict.ContainsKey(myInfos[i].FileName.Substring(0, myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal))))
if (!_myFilteredInfosDict.ContainsKey(_myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal))))
{
_myFilteredInfosDict.Add(myInfos[i].FileName.Substring(0, myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal)), MainWindow.CurrentUsedPak);
_myFilteredInfosDict.Add(_myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal)), MainWindow.CurrentUsedPak);
_fileName = myInfos[i].FileName.Substring(0, myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal));
_fileName = _myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal));
_myFilteredInfos.Add(new FileInfoFilter
{
FileName = _fileName,
@ -180,11 +180,11 @@ namespace FModel.Forms
}
else
{
if (!_myFilteredInfosDict.ContainsKey(myInfos[i].FileName))
if (!_myFilteredInfosDict.ContainsKey(_myInfos[i].FileName))
{
_myFilteredInfosDict.Add(myInfos[i].FileName, MainWindow.CurrentUsedPak);
_myFilteredInfosDict.Add(_myInfos[i].FileName, MainWindow.CurrentUsedPak);
_fileName = myInfos[i].FileName;
_fileName = _myInfos[i].FileName;
_myFilteredInfos.Add(new FileInfoFilter
{
FileName = _fileName,
@ -199,42 +199,42 @@ namespace FModel.Forms
}
else
{
ShowItemsVirtual(myInfos);
ShowItemsVirtual(_myInfos);
}
}
else
{
if (!string.IsNullOrEmpty(textBox1.Text) && textBox1.Text.Length > 2)
{
for (int i = 0; i < myInfos.Count; i++)
for (int i = 0; i < _myInfos.Count; i++)
{
if (MainWindow.CaseInsensitiveContains(myInfos[i].FileName, textBox1.Text))
if (MainWindow.CaseInsensitiveContains(_myInfos[i].FileName, textBox1.Text))
{
if (myInfos[i].FileName.Contains(".uasset") || myInfos[i].FileName.Contains(".uexp") || myInfos[i].FileName.Contains(".ubulk"))
if (_myInfos[i].FileName.Contains(".uasset") || _myInfos[i].FileName.Contains(".uexp") || _myInfos[i].FileName.Contains(".ubulk"))
{
if (!_myFilteredInfosDict.ContainsKey(myInfos[i].FileName.Substring(0, myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal))))
if (!_myFilteredInfosDict.ContainsKey(_myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal))))
{
_myFilteredInfosDict.Add(myInfos[i].FileName.Substring(0, myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal)), MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(myInfos[i].FileName)]);
_myFilteredInfosDict.Add(_myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal)), MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(_myInfos[i].FileName)]);
_fileName = myInfos[i].FileName.Substring(0, myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal));
_fileName = _myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal));
_myFilteredInfos.Add(new FileInfoFilter
{
FileName = _fileName,
PakFile = MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(myInfos[i].FileName)],
PakFile = MainWindow.AllpaksDictionary[Path.GetFileNameWithoutExtension(_myInfos[i].FileName)],
});
}
}
else
{
if (!_myFilteredInfosDict.ContainsKey(myInfos[i].FileName))
if (!_myFilteredInfosDict.ContainsKey(_myInfos[i].FileName))
{
_myFilteredInfosDict.Add(myInfos[i].FileName, MainWindow.AllpaksDictionary[Path.GetFileName(myInfos[i].FileName)]);
_myFilteredInfosDict.Add(_myInfos[i].FileName, MainWindow.AllpaksDictionary[Path.GetFileName(_myInfos[i].FileName)]);
_fileName = myInfos[i].FileName;
_fileName = _myInfos[i].FileName;
_myFilteredInfos.Add(new FileInfoFilter
{
FileName = _fileName,
PakFile = MainWindow.AllpaksDictionary[Path.GetFileName(myInfos[i].FileName)],
PakFile = MainWindow.AllpaksDictionary[Path.GetFileName(_myInfos[i].FileName)],
});
}
}
@ -245,7 +245,7 @@ namespace FModel.Forms
}
else
{
ShowItemsVirtual(myInfos);
ShowItemsVirtual(_myInfos);
}
}
}
@ -262,7 +262,7 @@ namespace FModel.Forms
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
assistant.TextChanged();
_assistant.TextChanged();
}
private void button1_Click(object sender, EventArgs e)

View File

@ -43,7 +43,7 @@ namespace FModel
public static PakAsset MyAsset;
public static PakExtractor MyExtractor;
private static string[] _paksArray;
public static string[] pakAsTxt;
public static string[] PakAsTxt;
public static Dictionary<string, string> AllpaksDictionary;
private static Dictionary<string, long> _questStageDict;
private static Dictionary<string, string> _diffToExtract;
@ -562,7 +562,7 @@ namespace FModel
CurrentUsedPakGuid = ReadPakGuid(Settings.Default.PAKsPath + "\\" + CurrentUsedPak);
if (arCurrentUsedPak == theSinglePak.ClickedItem.Text && MyExtractor.GetFileList() != null)
pakAsTxt = MyExtractor.GetFileList().ToArray();
PakAsTxt = MyExtractor.GetFileList().ToArray();
}
}
if (theSinglePak != null && ReadPakGuid(Settings.Default.PAKsPath + "\\" + theSinglePak.ClickedItem.Text) != "0-0-0-0") //LOADING DYNAMIC PAK
@ -577,7 +577,7 @@ namespace FModel
if (MyExtractor.GetFileList() != null)
{
_paksMountPoint.Add(theSinglePak.ClickedItem.Text, MyExtractor.GetMountPoint().Substring(9));
pakAsTxt = MyExtractor.GetFileList().ToArray();
PakAsTxt = MyExtractor.GetFileList().ToArray();
}
}
catch (Exception)
@ -627,7 +627,7 @@ namespace FModel
}
private void ComparePaKs()
{
pakAsTxt = File.ReadAllLines(DefaultOutputPath + "\\FortnitePAKs.txt");
PakAsTxt = File.ReadAllLines(DefaultOutputPath + "\\FortnitePAKs.txt");
File.Delete(DefaultOutputPath + "\\FortnitePAKs.txt");
//ASK DIFFERENCE FILE AND COMPARE
@ -645,8 +645,8 @@ namespace FModel
if (!linesA[i].StartsWith("../"))
linesA[i] = "../" + linesA[i];
IEnumerable<String> onlyB = pakAsTxt.Except(linesA);
IEnumerable<String> removed = linesA.Except(pakAsTxt);
IEnumerable<String> onlyB = PakAsTxt.Except(linesA);
IEnumerable<String> removed = linesA.Except(PakAsTxt);
File.WriteAllLines(DefaultOutputPath + "\\Result.txt", onlyB);
File.WriteAllLines(DefaultOutputPath + "\\Removed.txt", removed);
@ -674,7 +674,7 @@ namespace FModel
}));
}
pakAsTxt = File.ReadAllLines(DefaultOutputPath + "\\Result.txt");
PakAsTxt = File.ReadAllLines(DefaultOutputPath + "\\Result.txt");
File.Delete(DefaultOutputPath + "\\Result.txt");
}
private void CreatePakList(ToolStripItemClickedEventArgs selectedPak = null, bool loadAllPaKs = false, bool getDiff = false, bool updateMode = false)
@ -692,14 +692,14 @@ namespace FModel
//ADD TO DICTIONNARY
RegisterPaKsinDict(_paksArray, selectedPak);
if (pakAsTxt != null)
if (PakAsTxt != null)
{
Invoke(new Action(() =>
{
treeView1.BeginUpdate();
for (int i = 0; i < pakAsTxt.Length; i++)
for (int i = 0; i < PakAsTxt.Length; i++)
{
TreeParsePath(treeView1.Nodes, pakAsTxt[i].Replace(pakAsTxt[i].Split('/').Last(), ""));
TreeParsePath(treeView1.Nodes, PakAsTxt[i].Replace(PakAsTxt[i].Split('/').Last(), ""));
}
treeView1.EndUpdate();
}));
@ -719,15 +719,15 @@ namespace FModel
}
else
{
pakAsTxt = File.ReadAllLines(DefaultOutputPath + "\\FortnitePAKs.txt");
PakAsTxt = File.ReadAllLines(DefaultOutputPath + "\\FortnitePAKs.txt");
File.Delete(DefaultOutputPath + "\\FortnitePAKs.txt");
Invoke(new Action(() =>
{
treeView1.BeginUpdate();
for (int i = 0; i < pakAsTxt.Length; i++)
for (int i = 0; i < PakAsTxt.Length; i++)
{
TreeParsePath(treeView1.Nodes, pakAsTxt[i].Replace(pakAsTxt[i].Split('/').Last(), ""));
TreeParsePath(treeView1.Nodes, PakAsTxt[i].Replace(PakAsTxt[i].Split('/').Last(), ""));
}
treeView1.EndUpdate();
}));
@ -749,16 +749,16 @@ namespace FModel
ComparePaKs();
if (updateMode)
{
UmFilter(pakAsTxt, _diffToExtract);
UmFilter(PakAsTxt, _diffToExtract);
UmWorking = true;
}
Invoke(new Action(() =>
{
treeView1.BeginUpdate();
for (int i = 0; i < pakAsTxt.Length; i++)
for (int i = 0; i < PakAsTxt.Length; i++)
{
TreeParsePath(treeView1.Nodes, pakAsTxt[i].Replace(pakAsTxt[i].Split('/').Last(), ""));
TreeParsePath(treeView1.Nodes, PakAsTxt[i].Replace(PakAsTxt[i].Split('/').Last(), ""));
}
treeView1.EndUpdate();
}));
@ -817,7 +817,7 @@ namespace FModel
}
else
{
foreach (var myString in _backupDynamicKeys.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
foreach (var myString in _backupDynamicKeys.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
{
var parts = myString.Split(':');
if (parts[0] == arCurrentUsedPak && parts[1].StartsWith("0x"))
@ -1094,7 +1094,7 @@ namespace FModel
return;
}
var dirfiles = pakAsTxt.Where(x => x.StartsWith(full) && !x.Replace(full, "").Contains("/"));
var dirfiles = PakAsTxt.Where(x => x.StartsWith(full) && !x.Replace(full, "").Contains("/"));
var enumerable = dirfiles as string[] ?? dirfiles.ToArray();
if (!enumerable.Any())
{
@ -1191,7 +1191,7 @@ namespace FModel
return;
}
var dirfiles = pakAsTxt.Where(x => x.StartsWith(full) && !x.Replace(full, "").Contains("/"));
var dirfiles = PakAsTxt.Where(x => x.StartsWith(full) && !x.Replace(full, "").Contains("/"));
var enumerable = dirfiles as string[] ?? dirfiles.ToArray();
if (!enumerable.Any())
{
@ -1280,7 +1280,7 @@ namespace FModel
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey);
string[] myArray = MyExtractor.GetFileList().ToArray();
string[] results = null;
string[] results;
if (currentItem.Contains("."))
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem));
else
@ -1295,14 +1295,14 @@ namespace FModel
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
{
Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i].Substring(0, results[i].LastIndexOf("/")));
Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i].Substring(0, results[i].LastIndexOf("/", StringComparison.Ordinal)));
File.WriteAllBytes(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i], b);
toReturn = DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[CurrentUsedPak] + results[i];
}
else
{
Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i].Substring(0, results[i].LastIndexOf("/")));
Directory.CreateDirectory(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i].Substring(0, results[i].LastIndexOf("/", StringComparison.Ordinal)));
File.WriteAllBytes(DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i], b);
toReturn = DefaultOutputPath + "\\Extracted\\" + _paksMountPoint[AllpaksDictionary[currentItem]] + results[i];
@ -1425,7 +1425,7 @@ namespace FModel
CreateItemIcon(itemId[i], "variant");
else if (Settings.Default.createIconForAmmo && (itemId[i].ExportType == "FortAmmoItemDefinition"))
CreateItemIcon(itemId[i], "ammo");
else if (Settings.Default.createIconForSTWHeroes && (itemId[i].ExportType == "FortHeroType" && (questJson.Contains("ItemDefinition") || questJson.Contains("TestDefsSkydive") || questJson.Contains("GameplayPrototypes")))) //Contains x not to trigger HID from BR
else if (questJson != null && (Settings.Default.createIconForSTWHeroes && (itemId[i].ExportType == "FortHeroType" && (questJson.Contains("ItemDefinition") || questJson.Contains("TestDefsSkydive") || questJson.Contains("GameplayPrototypes"))))) //Contains x not to trigger HID from BR
CreateItemIcon(itemId[i], "stwHeroes");
else if (Settings.Default.createIconForSTWDefenders && (itemId[i].ExportType == "FortDefenderItemDefinition"))
CreateItemIcon(itemId[i], "stwDefenders");
@ -1446,7 +1446,7 @@ namespace FModel
Console.WriteLine(ex.Message);
}
}
private void CreateItemIcon(ItemsIdParser theItem, string SpecialMode = null)
private void CreateItemIcon(ItemsIdParser theItem, string specialMode = null)
{
UpdateConsole(CurrentUsedItem + " is a Cosmetic ID", Color.FromArgb(255, 66, 244, 66), "Success");
@ -1454,7 +1454,7 @@ namespace FModel
Graphics g = Graphics.FromImage(bmp);
g.TextRenderingHint = TextRenderingHint.AntiAlias;
Rarity.DrawRarity(theItem, g, SpecialMode);
Rarity.DrawRarity(theItem, g, specialMode);
ItemIconPath = string.Empty;
if (Settings.Default.loadFeaturedImage == false)
@ -1524,7 +1524,7 @@ namespace FModel
AppendText("Description ", Color.SteelBlue);
AppendText("found", Color.Black, true);
} //DESCRIPTION
if (SpecialMode == "athIteDef")
if (specialMode == "athIteDef")
{
try
{
@ -1558,7 +1558,7 @@ namespace FModel
AppendText("found", Color.Black, true);
} //COSMETIC SOURCE
}
if (SpecialMode == "consAndWeap")
if (specialMode == "consAndWeap")
{
try
{
@ -1598,10 +1598,10 @@ namespace FModel
} //ACTION
if (theItem.AmmoData != null && theItem.AmmoData.AssetPathName.Contains("Ammo")) //TO AVOID TRIGGERING CONSUMABLES, NAME SHOULD CONTAIN "AMMO"
{
getAmmoData(theItem.AmmoData.AssetPathName, g);
GetAmmoData(theItem.AmmoData.AssetPathName, g);
}
}
if (SpecialMode == "variant")
if (specialMode == "variant")
{
try
{
@ -1659,10 +1659,9 @@ namespace FModel
g.DrawImage(Forms.Settings.ResizeImage(traversalLogo, 32, 32), new Point(6, 3));
}
}
catch (Exception)
{
} //COSMETIC USER FACING FLAGS
if (SpecialMode == "stwHeroes")
catch (Exception) { } //COSMETIC USER FACING FLAGS
if (specialMode == "stwHeroes")
{
try
{
@ -1676,7 +1675,7 @@ namespace FModel
AppendText("found", Color.Black, true);
} //CHARACTER TYPE
}
if (SpecialMode == "stwDefenders")
if (specialMode == "stwDefenders")
{
try
{
@ -1741,7 +1740,7 @@ namespace FModel
{
if (theItem.HeroDefinition != null)
{
string heroFilePath = string.Empty;
string heroFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
heroFilePath = ExtractAsset(CurrentUsedPak, theItem.HeroDefinition);
else
@ -1772,7 +1771,7 @@ namespace FModel
.LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -1780,9 +1779,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -1811,7 +1810,7 @@ namespace FModel
if (theItem.WeaponDefinition == "WID_Harvest_Pickaxe_Wukong")
theItem.WeaponDefinition = "WID_Harvest_Pickaxe_WuKong";
string weaponFilePath = string.Empty;
string weaponFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
weaponFilePath = ExtractAsset(CurrentUsedPak, theItem.WeaponDefinition);
else
@ -1841,7 +1840,7 @@ namespace FModel
Path.GetFileName(itemId[i].LargePreviewImage.AssetPathName)
.LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -1849,9 +1848,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -1882,7 +1881,7 @@ namespace FModel
string textureFile = Path.GetFileName(theItem.LargePreviewImage.AssetPathName)?.Substring(0,
Path.GetFileName(theItem.LargePreviewImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -1890,9 +1889,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -1903,7 +1902,7 @@ namespace FModel
string textureFile = Path.GetFileName(theItem.SmallPreviewImage.AssetPathName)?.Substring(0,
Path.GetFileName(theItem.SmallPreviewImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -1911,9 +1910,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -1930,7 +1929,7 @@ namespace FModel
GetItemIcon(theItem);
else
{
string catalogFilePath = string.Empty;
string catalogFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
catalogFilePath = ExtractAsset(CurrentUsedPak, catName.Substring(catName.LastIndexOf('.') + 1));
else
@ -1960,7 +1959,7 @@ namespace FModel
{
string textureFile = featuredId[i].TileImage.ResourceObject;
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -1968,9 +1967,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -1983,7 +1982,7 @@ namespace FModel
{
string textureFile = featuredId[i].DetailsImage.ResourceObject;
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -1995,9 +1994,9 @@ namespace FModel
}
else if (textureFilePath != null && !textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_"))
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -2032,7 +2031,7 @@ namespace FModel
{
CurrentUsedItem = catName;
string catalogFilePath = string.Empty;
string catalogFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
catalogFilePath = ExtractAsset(CurrentUsedPak, catName);
else
@ -2062,7 +2061,7 @@ namespace FModel
{
string textureFile = featuredId[i].TileImage.ResourceObject;
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -2070,9 +2069,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -2085,7 +2084,7 @@ namespace FModel
{
string textureFile = featuredId[i].DetailsImage.ResourceObject;
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -2097,9 +2096,9 @@ namespace FModel
}
else if (textureFilePath != null && !textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_"))
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -2144,7 +2143,7 @@ namespace FModel
{
string textureFile = rsmid[i].TextureParameterValues.FirstOrDefault()?.ParameterValue;
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -2152,9 +2151,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
toReturn = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
toReturn = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -2171,9 +2170,9 @@ namespace FModel
}
return toReturn;
}
private void getAmmoData(string ammoFile, Graphics toDrawOn)
private void GetAmmoData(string ammoFile, Graphics toDrawOn)
{
string ammoFilePath = string.Empty;
string ammoFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
ammoFilePath = ExtractAsset(CurrentUsedPak, ammoFile.Substring(ammoFile.LastIndexOf('.') + 1));
else
@ -2257,19 +2256,17 @@ namespace FModel
{
if (Settings.Default.createIconForChallenges && bundleParser[i].DisplayStyle.DisplayImage != null)
{
drawV2(bundleParser[i], theItem, questJson, g, bmp);
DrawV2(bundleParser[i], theItem, questJson, g, bmp);
v2 = true;
}
}
catch (Exception)
{
}
catch (Exception) { }
for (int i2 = 0; i2 < SelectedChallengesArray.Length; i2++)
{
try
{
string challengeFilePath = string.Empty;
string challengeFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
challengeFilePath = ExtractAsset(CurrentUsedPak, SelectedChallengesArray[i2]);
else
@ -2487,7 +2484,7 @@ namespace FModel
#region DRAW ICON
string textureFile = "T_UI_PuzzleIcon_64";
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -2495,9 +2492,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -2664,7 +2661,7 @@ namespace FModel
}
}
}
private void drawV2(ChallengeBundleIdParser myBundle, ItemsIdParser theItem, string questJson, Graphics toDrawOn, Bitmap myBitmap)
private void DrawV2(ChallengeBundleIdParser myBundle, ItemsIdParser theItem, string questJson, Graphics toDrawOn, Bitmap myBitmap)
{
int sRed;
int sGreen;
@ -2716,13 +2713,14 @@ namespace FModel
} //NAME
string pngPath;
string textureFile = Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).Substring(0, Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.'));
string textureFile = Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName)?.Substring(0,
Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
textureFilePath = ExtractAsset(AllpaksDictionary[textureFile], textureFile);
textureFilePath = ExtractAsset(AllpaksDictionary[textureFile ?? throw new InvalidOperationException()], textureFile);
if (textureFilePath != null && textureFile == "M_UI_ChallengeTile_PCB")
{
@ -2733,9 +2731,9 @@ namespace FModel
}
else if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
pngPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
pngPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
Image challengeIcon;
@ -3179,7 +3177,7 @@ namespace FModel
?.Substring(0,
Path.GetFileName(bannerId.LargeImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -3187,9 +3185,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -3201,7 +3199,7 @@ namespace FModel
?.Substring(0,
Path.GetFileName(bannerId.SmallImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -3209,9 +3207,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -3318,7 +3316,7 @@ namespace FModel
string pngPath;
string textureFile = Path.GetFileName(bundleParser[i].DisplayStyle.DisplayImage.AssetPathName).Substring(0, Path.GetFileName(bundleParser[i].DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -3333,9 +3331,9 @@ namespace FModel
}
else if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
pngPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
pngPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
Image challengeIcon;
@ -3369,7 +3367,7 @@ namespace FModel
{
try
{
string challengeFilePath = string.Empty;
string challengeFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
challengeFilePath = ExtractAsset(CurrentUsedPak, SelectedChallengesArray[i2]);
else
@ -3426,7 +3424,7 @@ namespace FModel
#region getIcon
string textureFile = Path.GetFileName(questParser[ii].LargePreviewImage.AssetPathName)?.Substring(0, Path.GetFileName(questParser[ii].LargePreviewImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -3434,9 +3432,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -3479,7 +3477,7 @@ namespace FModel
#region getIcon
string textureFile = Path.GetFileName(questParser[ii].LargePreviewImage.AssetPathName)?.Substring(0, Path.GetFileName(questParser[ii].LargePreviewImage.AssetPathName).LastIndexOf('.'));
string textureFilePath = string.Empty;
string textureFilePath;
if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0")
textureFilePath = ExtractAsset(CurrentUsedPak, textureFile);
else
@ -3487,9 +3485,9 @@ namespace FModel
if (textureFilePath != null)
{
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success");
}
else
@ -3640,9 +3638,9 @@ namespace FModel
{
UpdateConsole(CurrentUsedItem + " is a Texture2D", Color.FromArgb(255, 66, 244, 66), "Success");
MyAsset = new PakAsset(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".")));
MyAsset.SaveTexture(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".")) + ".png");
string imgPath = ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".")) + ".png";
MyAsset = new PakAsset(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)));
MyAsset.SaveTexture(ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png");
string imgPath = ExtractedFilePath.Substring(0, ExtractedFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png";
if (File.Exists(imgPath))
{

View File

@ -17,7 +17,6 @@ namespace FModel
case "EFortRarity::Legendary":
return Resources.L512;
case "EFortRarity::Epic":
return Resources.E512;
case "EFortRarity::Quality":
return Resources.E512;
case "EFortRarity::Rare":
@ -30,34 +29,60 @@ namespace FModel
}
public static Image GetSeriesImage(ItemsIdParser theItem)
{
if (theItem.Series == "MarvelSeries")
{
return Resources.Marvel512;
}
else
{
return GetRarityImage(theItem);
}
/* SWITCH STATEMENT IN CASE THERE'S MORE SERIES
switch (theItem.Series)
{
case "MarvelSeries":
return Resources.Marvel512;
default:
return GetRarityImage(theItem);
}
}*/
}
public static Image GetSpecialModeImage(ItemsIdParser theItem, string SpecialMode)
public static Image GetSpecialModeImage(ItemsIdParser theItem, string specialMode)
{
if (specialMode == "ammo")
{
return Resources.C512;
}
else
{
return GetRarityImage(theItem);
}
/* SWITCH STATEMENT IN CASE THERE'S MORE SPECIAL MODE
switch (SpecialMode)
{
case "ammo":
return Resources.C512;
default:
return GetRarityImage(theItem);
}
}*/
}
public static void DrawRarity(ItemsIdParser theItem, Graphics toDrawOn, string SpecialMode = null)
public static void DrawRarity(ItemsIdParser theItem, Graphics toDrawOn, string specialMode = null)
{
Image rarityBg;
if (theItem.Series != null)
{
rarityBg = GetSeriesImage(theItem);
else if (SpecialMode != null)
rarityBg = GetSpecialModeImage(theItem, SpecialMode);
}
else if (specialMode != null)
{
rarityBg = GetSpecialModeImage(theItem, specialMode);
}
else
{
rarityBg = GetRarityImage(theItem);
}
toDrawOn.DrawImage(rarityBg, new Point(0, 0));
}

View File

@ -6,8 +6,6 @@
**A Fortnite .PAK files explorer built in C#**
## GETTING STARTED
### Prerequisites
[.NET Framework 4.7.1](https://dotnet.microsoft.com/download/dotnet-framework/net471)
@ -19,20 +17,20 @@
![](https://i.imgur.com/so1iz1B.gif)
**2.** Restart the executable, enter the AES Key, click **Load** and select your .PAK file
- It will parse all Assets contained in the selected .PAK file with their respective path
- It will parse all Assets contained in the selected .PAK file with their respective path
**3.** Navigate through the tree to find the Asset you want
**4.** Clicking on **Extract** will extract the selected Asset to your `Documents` folder, try to serialize it and will display infos about it
- Asset is an **_ID_**:
- Asset is an **_ID_**:
- Try to create an [Icon](https://i.imgur.com/etUcOEj.png) with **Name**, **Description**, **Rarity**, **Type** and the **Cosmetic Source**
- Asset is a **_Texture_**:
- Asset is a **_Texture_**:
- Try to display the Asset as PNG
- Asset is a **_Sound_**:
- Asset is a **_Sound_**:
- Try to convert the Asset to OGG and play the sound
- Asset is a **_Bundle Of Challenges_**:
- Asset is a **_Bundle Of Challenges_**:
- Try to create an [Icon](https://i.imgur.com/1Uzrlb0.png) with all **Challenges' Description**, **Count** and the **Reward**
- Asset is a **_Font_**:
- Asset is a **_Font_**:
- Try to convert the Asset to OTF
### Difference Mode
@ -53,8 +51,6 @@
[Demonstration](https://streamable.com/234bg)
## DOCUMENTATION
### Important
If issues occur when compiling the source code, make sure that the software is being built for x64.
@ -62,22 +58,22 @@ If issues occur when compiling the source code, make sure that the software is b
If somehow FModel crash because of permissions, please either disable Windows Defender or add and exception for FModel.exe.
Also if you find this project useful, feel free to give it a :star: thank you :kissing_heart:
### Features
1. Extract
2. Serialize (CTRL+F/G/I support)
3. Filter & Search
4. Create Cosmetics Icon
5. Create Challenges Icon
6. Merge Icons
7. Backup current .PAK files
8. Load difference between current .PAK files and backup file
9. Load, Extract and Save Assets automatically between current .PAK files and backup file
1. Extract
2. Serialize (CTRL+F/G/I support)
3. Filter & Search
4. Create Cosmetics Icon
5. Create Challenges Icon
6. Merge Icons
7. Backup current .PAK files
8. Load difference between current .PAK files and backup file
9. Load, Extract and Save Assets automatically between current .PAK files and backup file
### What i'm using
- [Fortnite Asset Parser](https://github.com/SirWaddles/JohnWickParse) - Custom Version With Output Control And No `key.txt`
- [AutoUpdater.NET](https://github.com/ravibpatel/AutoUpdater.NET)
- [JSON Parser](https://app.quicktype.io/)
- [ScintillaNET](https://www.nuget.org/packages/jacobslusser.ScintillaNET)
- [Find & Replace for ScintillaNET](https://www.nuget.org/packages/snt.ScintillaNet.FindReplaceDialog/)
- [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
- [Fortnite Asset Parser](https://github.com/SirWaddles/JohnWickParse) - Custom Version With Output Control And No `key.txt`
- [AutoUpdater.NET](https://github.com/ravibpatel/AutoUpdater.NET)
- [JSON Parser](https://app.quicktype.io/)
- [ScintillaNET](https://www.nuget.org/packages/jacobslusser.ScintillaNET)
- [Find & Replace for ScintillaNET](https://www.nuget.org/packages/snt.ScintillaNet.FindReplaceDialog/)
- [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json)
### Contributors
| <a href="https://github.com/SirWaddles" target="_blank">**Waddlesworth**</a> | <a href="https://github.com/AyeTSG" target="_blank">**AyeTSG**</a> | <a href="https://github.com/ItsFireMonkey" target="_blank">**FireMonkey**</a> |
| :---: | :---: | :---: |
@ -88,19 +84,19 @@ This project is mainly based on what [UModel](https://github.com/gildor2/UModel)
I'd highly suggest you to use [UModel](https://github.com/gildor2/UModel) instead if you wanna use something made professionnaly.
## TODO
- [ ] Get new file content
- [ ] Display support for .locres files + compare
- [x] Code refactoring
- [x] Multithreading
- [x] Stop button
- [x] Auto update
- [x] CTRL F, CTRL G, CTRL I for jsonTextBox
- [x] STW Icons
- [x] Update Mode
- [x] Search through PAKs
- [x] Improve speed
- [x] Filter for the items ListBox
- [x] Quest viewer or something
- [x] Load all paks
- [x] Load only difference between 2 paks version
- [x] Custom watermark option on icons
- [ ] Get new file content
- [ ] Display support for .locres files + compare
- [x] Code refactoring
- [x] Multithreading
- [x] Stop button
- [x] Auto update
- [x] CTRL F, CTRL G, CTRL I for jsonTextBox
- [x] STW Icons
- [x] Update Mode
- [x] Search through PAKs
- [x] Improve speed
- [x] Filter for the items ListBox
- [x] Quest viewer or something
- [x] Load all paks
- [x] Load only difference between 2 paks version
- [x] Custom watermark option on icons