mirror of
https://github.com/4sval/FModel.git
synced 2026-07-24 12:21:11 -05:00
Darn it git
This commit is contained in:
parent
0d11af9188
commit
023fc1f758
|
|
@ -35,7 +35,7 @@ using System.Windows.Controls;
|
|||
using System.Windows.Input;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using PropertyInfo = FModel.PakReader.IO.PropertyInfo;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
|
|
@ -106,43 +106,41 @@ namespace FModel
|
|||
|
||||
private async void LoadMappings()
|
||||
{
|
||||
try
|
||||
{
|
||||
#if DEBUG
|
||||
string rawMappings = null;
|
||||
string rawEnumMappings = null;
|
||||
try
|
||||
{
|
||||
rawMappings = await File.ReadAllTextAsync(@"C:\Users\GMatrixGames\Desktop\FTest\FortniteTypeMappings\TypeMappings.json");
|
||||
rawEnumMappings = await File.ReadAllTextAsync(@"C:\Users\GMatrixGames\Desktop\FTest\FortniteTypeMappings\EnumMappings.json");
|
||||
}
|
||||
catch
|
||||
{
|
||||
rawMappings ??= await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_TYPE_MAPPINGS);
|
||||
rawEnumMappings ??= await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_ENUM_MAPPINGS);
|
||||
}
|
||||
#else
|
||||
var rawMappings = await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_TYPE_MAPPINGS);
|
||||
var rawEnumMappings = await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_ENUM_MAPPINGS);
|
||||
#endif
|
||||
var serializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{ NamingStrategy = new CamelCaseNamingStrategy(false, false) }
|
||||
};
|
||||
Globals.TypeMappings =
|
||||
JsonConvert.DeserializeObject<Dictionary<string, Dictionary<int, PropertyInfo>>>(rawMappings,
|
||||
serializerSettings);
|
||||
Globals.EnumMappings = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<int, string>>>(rawEnumMappings,
|
||||
serializerSettings);
|
||||
string rawMappings = "{}";
|
||||
string rawEnumMappings = "{}";
|
||||
|
||||
}
|
||||
catch (Exception exception)
|
||||
#if DEBUG
|
||||
if (File.Exists("TypeMappings.json"))
|
||||
{
|
||||
DebugHelper.WriteException(exception, "Failed to load Mappings");
|
||||
Globals.TypeMappings ??= new Dictionary<string, Dictionary<int, PropertyInfo>>();
|
||||
Globals.EnumMappings ??= new Dictionary<string, Dictionary<int, string>>();
|
||||
rawMappings = await File.ReadAllTextAsync("TypeMappings.json");
|
||||
}
|
||||
else if (NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
rawMappings = await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_TYPE_MAPPINGS);
|
||||
}
|
||||
|
||||
if (File.Exists("EnumMappings.json"))
|
||||
{
|
||||
rawEnumMappings = await File.ReadAllTextAsync("EnumMappings.json");
|
||||
}
|
||||
else if (NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
rawEnumMappings = await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_ENUM_MAPPINGS);
|
||||
}
|
||||
#else
|
||||
rawMappings = await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_TYPE_MAPPINGS);
|
||||
rawEnumMappings = await Endpoints.GetStringEndpoint(Endpoints.FORTNITE_ENUM_MAPPINGS);
|
||||
#endif
|
||||
|
||||
var serializerSettings = new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
NamingStrategy = new CamelCaseNamingStrategy(false, false)
|
||||
}
|
||||
};
|
||||
Globals.TypeMappings = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<int, PakReader.IO.PropertyInfo>>>(rawMappings, serializerSettings);
|
||||
Globals.EnumMappings = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<int, string>>>(rawEnumMappings, serializerSettings);
|
||||
}
|
||||
|
||||
public void ReloadMappings(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user