mirror of
https://github.com/4sval/FModel.git
synced 2026-08-26 03:14:39 -05:00
working on it
This commit is contained in:
@@ -81,7 +81,7 @@ namespace FModel.Converter
|
||||
byte[] bar = new byte[i + 1];
|
||||
Array.Copy(srcFinal, bar, i + 1);
|
||||
|
||||
File.WriteAllBytes(MainWindow.DefaultOutputPath + "\\Sounds\\" + Path.GetFileNameWithoutExtension(file) + ".ogg", bar);
|
||||
File.WriteAllBytes(App.DefaultOutputPath + "\\Sounds\\" + Path.GetFileNameWithoutExtension(file) + ".ogg", bar);
|
||||
File.Delete(Path.GetFileNameWithoutExtension(file) + ".temp");
|
||||
}
|
||||
}
|
||||
@@ -125,11 +125,11 @@ namespace FModel.Converter
|
||||
byte[] bar = new byte[i + 1];
|
||||
Array.Copy(srcFinal, bar, i + 1);
|
||||
|
||||
File.WriteAllBytes(MainWindow.DefaultOutputPath + "\\Sounds\\" + Path.GetFileNameWithoutExtension(file) + ".ogg", bar);
|
||||
File.WriteAllBytes(App.DefaultOutputPath + "\\Sounds\\" + Path.GetFileNameWithoutExtension(file) + ".ogg", bar);
|
||||
File.Delete(Path.GetFileNameWithoutExtension(file) + ".temp");
|
||||
}
|
||||
}
|
||||
return MainWindow.DefaultOutputPath + "\\Sounds\\" + Path.GetFileNameWithoutExtension(file) + ".ogg";
|
||||
return App.DefaultOutputPath + "\\Sounds\\" + Path.GetFileNameWithoutExtension(file) + ".ogg";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,8 @@
|
||||
<Compile Include="MainWindow.Designer.cs">
|
||||
<DependentUpon>MainWindow.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Methods\JohnWick\JohnWick.cs" />
|
||||
<Compile Include="Methods\VarApp.cs" />
|
||||
<Compile Include="Parser\Banners\BannersParser.cs" />
|
||||
<Compile Include="Parser\Challenges\ChallengeBundleIdParser.cs" />
|
||||
<Compile Include="Parser\Featured\FeaturedParser.cs" />
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace FModel.Forms
|
||||
InitializeComponent();
|
||||
|
||||
label2.Text += @" " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, 5);
|
||||
commitHash.Text = FModel.Properties.Resources.CurrentCommit;
|
||||
commitHash.Text = Properties.Resources.CurrentCommit;
|
||||
}
|
||||
|
||||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace FModel.Forms
|
||||
|
||||
if (MainWindow.PakAsTxt != null)
|
||||
{
|
||||
if (MainWindow.CurrentUsedPakGuid != null && MainWindow.CurrentUsedPakGuid != "0-0-0-0")
|
||||
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
|
||||
{
|
||||
for (int i = 0; i < MainWindow.PakAsTxt.Length; i++)
|
||||
{
|
||||
@@ -40,13 +40,13 @@ namespace FModel.Forms
|
||||
{
|
||||
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)), ThePak.CurrentUsedPak);
|
||||
|
||||
_fileName = MainWindow.PakAsTxt[i].Substring(0, MainWindow.PakAsTxt[i].LastIndexOf(".", StringComparison.Ordinal));
|
||||
_myInfos.Add(new FileInfo
|
||||
{
|
||||
FileName = _fileName,
|
||||
PakFile = MainWindow.CurrentUsedPak,
|
||||
PakFile = ThePak.CurrentUsedPak,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -54,13 +54,13 @@ namespace FModel.Forms
|
||||
{
|
||||
if (!_myInfosDict.ContainsKey(MainWindow.PakAsTxt[i]))
|
||||
{
|
||||
_myInfosDict.Add(MainWindow.PakAsTxt[i], MainWindow.CurrentUsedPak);
|
||||
_myInfosDict.Add(MainWindow.PakAsTxt[i], ThePak.CurrentUsedPak);
|
||||
|
||||
_fileName = MainWindow.PakAsTxt[i];
|
||||
_myInfos.Add(new FileInfo
|
||||
{
|
||||
FileName = _fileName,
|
||||
PakFile = MainWindow.CurrentUsedPak,
|
||||
PakFile = ThePak.CurrentUsedPak,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -74,13 +74,13 @@ namespace FModel.Forms
|
||||
{
|
||||
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)), ThePak.AllpaksDictionary[Path.GetFileNameWithoutExtension(MainWindow.PakAsTxt[i])]);
|
||||
|
||||
_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 = ThePak.AllpaksDictionary[Path.GetFileNameWithoutExtension(MainWindow.PakAsTxt[i])],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -88,13 +88,13 @@ namespace FModel.Forms
|
||||
{
|
||||
if (!_myInfosDict.ContainsKey(MainWindow.PakAsTxt[i]))
|
||||
{
|
||||
_myInfosDict.Add(MainWindow.PakAsTxt[i], MainWindow.AllpaksDictionary[Path.GetFileName(MainWindow.PakAsTxt[i])]);
|
||||
_myInfosDict.Add(MainWindow.PakAsTxt[i], ThePak.AllpaksDictionary[Path.GetFileName(MainWindow.PakAsTxt[i])]);
|
||||
|
||||
_fileName = MainWindow.PakAsTxt[i];
|
||||
_myInfos.Add(new FileInfo
|
||||
{
|
||||
FileName = _fileName,
|
||||
PakFile = MainWindow.AllpaksDictionary[Path.GetFileName(MainWindow.PakAsTxt[i])],
|
||||
PakFile = ThePak.AllpaksDictionary[Path.GetFileName(MainWindow.PakAsTxt[i])],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ namespace FModel.Forms
|
||||
|
||||
if (MainWindow.PakAsTxt != null)
|
||||
{
|
||||
if (MainWindow.CurrentUsedPakGuid != null && MainWindow.CurrentUsedPakGuid != "0-0-0-0")
|
||||
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(textBox1.Text) && textBox1.Text.Length > 2)
|
||||
{
|
||||
@@ -168,13 +168,13 @@ namespace FModel.Forms
|
||||
{
|
||||
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)), ThePak.CurrentUsedPak);
|
||||
|
||||
_fileName = _myInfos[i].FileName.Substring(0, _myInfos[i].FileName.LastIndexOf(".", StringComparison.Ordinal));
|
||||
_myFilteredInfos.Add(new FileInfoFilter
|
||||
{
|
||||
FileName = _fileName,
|
||||
PakFile = MainWindow.CurrentUsedPak,
|
||||
PakFile = ThePak.CurrentUsedPak,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -182,13 +182,13 @@ namespace FModel.Forms
|
||||
{
|
||||
if (!_myFilteredInfosDict.ContainsKey(_myInfos[i].FileName))
|
||||
{
|
||||
_myFilteredInfosDict.Add(_myInfos[i].FileName, MainWindow.CurrentUsedPak);
|
||||
_myFilteredInfosDict.Add(_myInfos[i].FileName, ThePak.CurrentUsedPak);
|
||||
|
||||
_fileName = _myInfos[i].FileName;
|
||||
_myFilteredInfos.Add(new FileInfoFilter
|
||||
{
|
||||
FileName = _fileName,
|
||||
PakFile = MainWindow.CurrentUsedPak,
|
||||
PakFile = ThePak.CurrentUsedPak,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -214,13 +214,13 @@ namespace FModel.Forms
|
||||
{
|
||||
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)), ThePak.AllpaksDictionary[Path.GetFileNameWithoutExtension(_myInfos[i].FileName)]);
|
||||
|
||||
_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 = ThePak.AllpaksDictionary[Path.GetFileNameWithoutExtension(_myInfos[i].FileName)],
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -228,13 +228,13 @@ namespace FModel.Forms
|
||||
{
|
||||
if (!_myFilteredInfosDict.ContainsKey(_myInfos[i].FileName))
|
||||
{
|
||||
_myFilteredInfosDict.Add(_myInfos[i].FileName, MainWindow.AllpaksDictionary[Path.GetFileName(_myInfos[i].FileName)]);
|
||||
_myFilteredInfosDict.Add(_myInfos[i].FileName, ThePak.AllpaksDictionary[Path.GetFileName(_myInfos[i].FileName)]);
|
||||
|
||||
_fileName = _myInfos[i].FileName;
|
||||
_myFilteredInfos.Add(new FileInfoFilter
|
||||
{
|
||||
FileName = _fileName,
|
||||
PakFile = MainWindow.AllpaksDictionary[Path.GetFileName(_myInfos[i].FileName)],
|
||||
PakFile = ThePak.AllpaksDictionary[Path.GetFileName(_myInfos[i].FileName)],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,15 +37,6 @@ namespace FModel
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -57,15 +48,6 @@ namespace FModel
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
121
FModel/Methods/JohnWick/JohnWick.cs
Normal file
121
FModel/Methods/JohnWick/JohnWick.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using csharp_wick;
|
||||
using FModel.Parser.RenderMat;
|
||||
using FModel.Properties;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
class JohnWick
|
||||
{
|
||||
public static PakAsset MyAsset;
|
||||
public static PakExtractor MyExtractor;
|
||||
|
||||
private static string GetMountPointFromDict(string currentItem, bool DynamicPak = false)
|
||||
{
|
||||
if (DynamicPak == true)
|
||||
return ThePak.PaksMountPoint[ThePak.CurrentUsedPak ?? throw new InvalidOperationException()];
|
||||
else
|
||||
return ThePak.PaksMountPoint[ThePak.AllpaksDictionary[currentItem ?? throw new InvalidOperationException()] ?? throw new InvalidOperationException()];
|
||||
}
|
||||
private static string WriteFile(string currentItem, string myResults, byte[] data)
|
||||
{
|
||||
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
|
||||
{
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem, true) + myResults.Substring(0, myResults.LastIndexOf("/", StringComparison.Ordinal)));
|
||||
File.WriteAllBytes(App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem, true) + myResults, data);
|
||||
|
||||
return App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem, true) + myResults;
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem) + myResults.Substring(0, myResults.LastIndexOf("/", StringComparison.Ordinal)));
|
||||
File.WriteAllBytes(App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem) + myResults, data);
|
||||
|
||||
return App.DefaultOutputPath + "\\Extracted\\" + GetMountPointFromDict(currentItem) + myResults;
|
||||
}
|
||||
}
|
||||
|
||||
public static string ExtractAsset(string currentPak, string currentItem)
|
||||
{
|
||||
string toReturn = string.Empty;
|
||||
|
||||
MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey);
|
||||
string[] myArray = MyExtractor.GetFileList().ToArray();
|
||||
|
||||
string[] results;
|
||||
if (currentItem.Contains("."))
|
||||
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem));
|
||||
else
|
||||
results = Array.FindAll(myArray, s => s.Contains("/" + currentItem + "."));
|
||||
|
||||
for (int i = 0; i < results.Length; i++)
|
||||
{
|
||||
int index = Array.IndexOf(myArray, results[i]);
|
||||
|
||||
uint y = (uint)index;
|
||||
byte[] b = MyExtractor.GetData(y);
|
||||
|
||||
toReturn = WriteFile(currentItem, results[i], b);
|
||||
}
|
||||
|
||||
return toReturn.Replace("/", "\\");
|
||||
}
|
||||
public static string AssetToTexture2D(string AssetName)
|
||||
{
|
||||
string toReturn = string.Empty;
|
||||
|
||||
string textureFilePath;
|
||||
if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
|
||||
textureFilePath = ExtractAsset(ThePak.CurrentUsedPak, AssetName);
|
||||
else
|
||||
textureFilePath = ExtractAsset(ThePak.AllpaksDictionary[AssetName ?? throw new InvalidOperationException()], AssetName);
|
||||
|
||||
if (textureFilePath != null && (textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_") || textureFilePath.Contains("M_UI_ChallengeTile_PCB")))
|
||||
{
|
||||
return GetRenderSwitchMaterialTexture(AssetName, textureFilePath);
|
||||
}
|
||||
else if (textureFilePath != null)
|
||||
{
|
||||
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";
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
public static string GetRenderSwitchMaterialTexture(string AssetName, string AssetPath)
|
||||
{
|
||||
string toReturn = string.Empty;
|
||||
|
||||
if (AssetPath.Contains(".uasset") || AssetPath.Contains(".uexp") || AssetPath.Contains(".ubulk"))
|
||||
{
|
||||
MyAsset = new PakAsset(AssetPath.Substring(0, AssetPath.LastIndexOf('.')));
|
||||
try
|
||||
{
|
||||
if (MyAsset.GetSerialized() != null)
|
||||
{
|
||||
string parsedRsmJson = JToken.Parse(MyAsset.GetSerialized()).ToString();
|
||||
var rsmid = RenderSwitchMaterial.FromJson(parsedRsmJson);
|
||||
for (int i = 0; i < rsmid.Length; i++)
|
||||
{
|
||||
if (rsmid[i].TextureParameterValues.FirstOrDefault()?.ParameterValue != null)
|
||||
{
|
||||
string textureFile = rsmid[i].TextureParameterValues.FirstOrDefault()?.ParameterValue;
|
||||
|
||||
toReturn = AssetToTexture2D(textureFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (JsonSerializationException) { }
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
FModel/Methods/VarApp.cs
Normal file
27
FModel/Methods/VarApp.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
class ThePak
|
||||
{
|
||||
public static string CurrentUsedPak;
|
||||
public static string CurrentUsedPakGuid;
|
||||
public static string CurrentUsedItem;
|
||||
|
||||
public static Dictionary<string, string> PaksMountPoint;
|
||||
public static Dictionary<string, string> AllpaksDictionary;
|
||||
}
|
||||
|
||||
class App
|
||||
{
|
||||
public static string DefaultOutputPath;
|
||||
}
|
||||
|
||||
class Checking
|
||||
{
|
||||
public static bool WasFeatured;
|
||||
public static int YAfterLoop;
|
||||
|
||||
public static bool UmWorking;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user