mirror of
https://github.com/4sval/FModel.git
synced 2026-06-22 16:00:17 -05:00
dynamic keys saved 'per game' instead of globally
This commit is contained in:
parent
48a920d273
commit
cabae55b4d
|
|
@ -30,13 +30,13 @@ namespace FModel.Creator.Bundles
|
|||
c.DrawBitmap(icon.DisplayStyle.CustomBackground, new SKRect(0, 0, icon.HeaderHeight, icon.HeaderHeight),
|
||||
new SKPaint {
|
||||
IsAntialias = true, FilterQuality = SKFilterQuality.High, BlendMode = SKBlendMode.Screen,
|
||||
ImageFilter = SKImageFilter.CreateDropShadow(2.5F, 0, 20, 0, icon.DisplayStyle.SecondaryColor.WithAlpha(25), SKDropShadowImageFilterShadowMode.DrawShadowAndForeground)
|
||||
ImageFilter = SKImageFilter.CreateDropShadow(2.5F, 0, 20, 0, icon.DisplayStyle.SecondaryColor.WithAlpha(25))
|
||||
});
|
||||
|
||||
c.DrawBitmap(icon.DisplayStyle.DisplayImage, new SKRect(0, 0, icon.HeaderHeight, icon.HeaderHeight),
|
||||
new SKPaint {
|
||||
IsAntialias = true, FilterQuality = SKFilterQuality.High,
|
||||
ImageFilter = SKImageFilter.CreateDropShadow(-2.5F, 0, 20, 0, icon.DisplayStyle.SecondaryColor.WithAlpha(50), SKDropShadowImageFilterShadowMode.DrawShadowAndForeground)
|
||||
ImageFilter = SKImageFilter.CreateDropShadow(-2.5F, 0, 20, 0, icon.DisplayStyle.SecondaryColor.WithAlpha(50))
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ namespace FModel.Creator.Bundles
|
|||
pathTop.Close();
|
||||
c.DrawPath(pathTop, new SKPaint {
|
||||
IsAntialias = true, FilterQuality = SKFilterQuality.High, Color = icon.DisplayStyle.SecondaryColor,
|
||||
ImageFilter = SKImageFilter.CreateDropShadow(-5, -5, 0, 0, icon.DisplayStyle.AccentColor.WithAlpha(75), SKDropShadowImageFilterShadowMode.DrawShadowAndForeground)
|
||||
ImageFilter = SKImageFilter.CreateDropShadow(-5, -5, 0, 0, icon.DisplayStyle.AccentColor.WithAlpha(75))
|
||||
});
|
||||
|
||||
c.DrawRect(new SKRect(0, icon.HeaderHeight, icon.Width, icon.HeaderHeight + icon.AdditionalSize), new SKPaint
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace FModel.Creator.Bundles
|
|||
paint.TextSize = l >= 5 ? 30 : 35;
|
||||
paint.TextAlign = SKTextAlign.Right;
|
||||
paint.Color = SKColor.Parse(q.Reward.RewardFillColor);
|
||||
paint.ImageFilter = SKImageFilter.CreateDropShadow(0, 0, 5, 5, SKColor.Parse(q.Reward.RewardBorderColor).WithAlpha(200), SKDropShadowImageFilterShadowMode.DrawShadowAndForeground);
|
||||
paint.ImageFilter = SKImageFilter.CreateDropShadow(0, 0, 5, 5, SKColor.Parse(q.Reward.RewardBorderColor).WithAlpha(200));
|
||||
c.DrawText(q.Reward.RewardQuantity.ToString(), new SKPoint(icon.Width - 85, y + 47.5F), paint);
|
||||
c.DrawBitmap(q.Reward.RewardIcon, new SKPoint(icon.Width - 30 - q.Reward.RewardIcon.Width, y + 12.5F),
|
||||
new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High });
|
||||
|
|
@ -98,7 +98,7 @@ namespace FModel.Creator.Bundles
|
|||
paint.TextAlign = SKTextAlign.Right;
|
||||
paint.Color = SKColor.Parse(r.Reward.RewardFillColor);
|
||||
paint.Typeface = Text.TypeFaces.BundleDefaultTypeface;
|
||||
paint.ImageFilter = SKImageFilter.CreateDropShadow(0, 0, 5, 5, SKColor.Parse(r.Reward.RewardBorderColor).WithAlpha(200), SKDropShadowImageFilterShadowMode.DrawShadowAndForeground);
|
||||
paint.ImageFilter = SKImageFilter.CreateDropShadow(0, 0, 5, 5, SKColor.Parse(r.Reward.RewardBorderColor).WithAlpha(200));
|
||||
c.DrawText(r.Reward.RewardQuantity.ToString(), new SKPoint(icon.Width - 85, y + 47.5F), paint);
|
||||
c.DrawBitmap(r.Reward.RewardIcon, new SKPoint(icon.Width - 30 - r.Reward.RewardIcon.Width, y + 12.5F),
|
||||
new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High });
|
||||
|
|
|
|||
|
|
@ -60,16 +60,12 @@ namespace FModel.Creator.Texts
|
|||
public Typefaces()
|
||||
{
|
||||
DefaultTypeface = SKTypeface.FromStream(Application.GetResourceStream(_BURBANK_BIG_CONDENSED_BOLD).Stream);
|
||||
BundleDefaultTypeface = DefaultTypeface;
|
||||
DisplayNameTypeface = DefaultTypeface;
|
||||
DescriptionTypeface = DefaultTypeface;
|
||||
BundleDisplayNameTypeface = DefaultTypeface;
|
||||
|
||||
if (Globals.Game.ActualGame == EGame.Fortnite)
|
||||
{
|
||||
ArraySegment<byte>[] t = Utils.GetPropertyArraySegmentByte(_FORTNITE_BASE_PATH + _BURBANK_BIG_CONDENSED_BLACK);
|
||||
if (t != null && t.Length == 3)
|
||||
BundleDefaultTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else BundleDefaultTypeface = DefaultTypeface;
|
||||
|
||||
string namePath = _FORTNITE_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _ASIA_ERINM :
|
||||
|
|
@ -85,6 +81,7 @@ namespace FModel.Creator.Texts
|
|||
if (t != null && t.Length == 3)
|
||||
DisplayNameTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
}
|
||||
else DisplayNameTypeface = DefaultTypeface;
|
||||
|
||||
string descriptionPath = _FORTNITE_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _NOTO_SANS_KR_REGULAR :
|
||||
|
|
@ -96,6 +93,7 @@ namespace FModel.Creator.Texts
|
|||
t = Utils.GetPropertyArraySegmentByte(descriptionPath);
|
||||
if (t != null && t.Length == 3)
|
||||
DescriptionTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else DescriptionTypeface = DefaultTypeface;
|
||||
|
||||
string bundleNamePath = _FORTNITE_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _ASIA_ERINM :
|
||||
|
|
@ -111,6 +109,7 @@ namespace FModel.Creator.Texts
|
|||
if (t != null && t.Length == 3)
|
||||
BundleDisplayNameTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
}
|
||||
else BundleDisplayNameTypeface = BundleDefaultTypeface;
|
||||
}
|
||||
else if (Globals.Game.ActualGame == EGame.Valorant)
|
||||
{
|
||||
|
|
@ -125,6 +124,7 @@ namespace FModel.Creator.Texts
|
|||
ArraySegment<byte>[] t = Utils.GetPropertyArraySegmentByte(namePath);
|
||||
if (t != null && t.Length == 3)
|
||||
DisplayNameTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else DisplayNameTypeface = DefaultTypeface;
|
||||
|
||||
string descriptionPath = _VALORANT_BASE_PATH + (
|
||||
Properties.Settings.Default.AssetsLanguage == (long)ELanguage.Korean ? _NOTOSANS_CJK_LIGHT :
|
||||
|
|
@ -136,10 +136,12 @@ namespace FModel.Creator.Texts
|
|||
t = Utils.GetPropertyArraySegmentByte(descriptionPath);
|
||||
if (t != null && t.Length == 3)
|
||||
DescriptionTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else DescriptionTypeface = DefaultTypeface;
|
||||
|
||||
t = Utils.GetPropertyArraySegmentByte(_VALORANT_BASE_PATH + _DINNEXT_W1G_BOLD);
|
||||
if (t != null && t.Length == 3)
|
||||
BundleDefaultTypeface = SKTypeface.FromStream(t[2].AsStream());
|
||||
else BundleDefaultTypeface = DefaultTypeface;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@
|
|||
<None Remove="Resources\sod2.ico" />
|
||||
<None Remove="Resources\T-Icon-Pets-64.png" />
|
||||
<None Remove="Resources\T-Icon-Quests-64.png" />
|
||||
<None Remove="Resources\trello.png" />
|
||||
<None Remove="Resources\T_ClipSize_Weapon_Stats.png" />
|
||||
<None Remove="Resources\T_DamagePerBullet_Weapon_Stats.png" />
|
||||
<None Remove="Resources\T_Placeholder_Challenge_Image.png" />
|
||||
|
|
@ -131,15 +132,15 @@
|
|||
<PackageReference Include="CSCore" Version="1.2.1.2" />
|
||||
<PackageReference Include="DiscordRichPresence" Version="1.0.150" />
|
||||
<PackageReference Include="DotNetZip" Version="1.13.8" />
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="3.8.1" />
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.0.1" />
|
||||
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.1.11" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NVorbis" Version="0.10.1" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="1.1.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="1.68.3" />
|
||||
<PackageReference Include="SkiaSharp" Version="2.80.0" />
|
||||
<PackageReference Include="ToastNotifications" Version="2.5.1" />
|
||||
<PackageReference Include="ToastNotifications.Messages" Version="2.5.1" />
|
||||
<PackageReference Include="WriteableBitmapEx" Version="1.6.5" />
|
||||
<PackageReference Include="WriteableBitmapEx" Version="1.6.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -209,6 +210,7 @@
|
|||
<Resource Include="Resources\sod2.ico" />
|
||||
<Resource Include="Resources\T-Icon-Pets-64.png" />
|
||||
<Resource Include="Resources\T-Icon-Quests-64.png" />
|
||||
<Resource Include="Resources\trello.png" />
|
||||
<Resource Include="Resources\T_ClipSize_Weapon_Stats.png" />
|
||||
<Resource Include="Resources\T_DamagePerBullet_Weapon_Stats.png" />
|
||||
<Resource Include="Resources\T_Placeholder_Challenge_Image.png" />
|
||||
|
|
|
|||
|
|
@ -20,9 +20,13 @@ namespace FModel.Grabber.Aes
|
|||
if (!string.IsNullOrEmpty(Properties.Settings.Default.StaticAesKeys))
|
||||
staticKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.StaticAesKeys);
|
||||
|
||||
Dictionary<string, string> oldDynamicKeys = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
oldDynamicKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
Dictionary<string, Dictionary<string, string>> oldDynamicKeys = new Dictionary<string, Dictionary<string, string>>();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
oldDynamicKeys = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
}
|
||||
catch (JsonSerializationException) { /* Needed for the transition bewteen global dynamic keys and "per game" dynamic keys */ }
|
||||
|
||||
BenResponse benResponse = await AesData.GetData().ConfigureAwait(false);
|
||||
if (benResponse != null)
|
||||
|
|
@ -35,23 +39,26 @@ namespace FModel.Grabber.Aes
|
|||
Properties.Settings.Default.StaticAesKeys = JsonConvert.SerializeObject(staticKeys, Formatting.None);
|
||||
}
|
||||
|
||||
string dynamicKeys = JsonConvert.SerializeObject(benResponse.DynamicKeys, Formatting.None);
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[AES]", $"BenBot Dynamic keys are {dynamicKeys}");
|
||||
Properties.Settings.Default.DynamicAesKeys = dynamicKeys;
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[AES]", $"BenBot Dynamic keys are {benResponse.DynamicKeys}");
|
||||
oldDynamicKeys[Globals.Game.ActualGame.ToString()] = benResponse.DynamicKeys;
|
||||
Properties.Settings.Default.DynamicAesKeys = JsonConvert.SerializeObject(oldDynamicKeys, Formatting.None);
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
Dictionary<string, string> difference = benResponse.DynamicKeys
|
||||
.Where(x => !oldDynamicKeys.ContainsKey(x.Key) || !oldDynamicKeys[x.Key].Equals(x.Value))
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
foreach (KeyValuePair<string, string> KvP in difference)
|
||||
if (oldDynamicKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var gameDict))
|
||||
{
|
||||
Globals.gNotifier.ShowCustomMessage(
|
||||
Properties.Resources.PakFiles,
|
||||
string.Format(
|
||||
Properties.Resources.PakCanBeOpened,
|
||||
KvP.Key.Substring(KvP.Key.IndexOf("Paks/") + "Paks/".Length)),
|
||||
"/FModel;component/Resources/lock-open-variant.ico");
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[AES]", $"{KvP.Key} with key {KvP.Value} can be opened");
|
||||
Dictionary<string, string> difference = benResponse.DynamicKeys
|
||||
.Where(x => !gameDict.ContainsKey(x.Key) || !gameDict[x.Key].Equals(x.Value))
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
foreach (KeyValuePair<string, string> KvP in difference)
|
||||
{
|
||||
Globals.gNotifier.ShowCustomMessage(
|
||||
Properties.Resources.PakFiles,
|
||||
string.Format(
|
||||
Properties.Resources.PakCanBeOpened,
|
||||
KvP.Key.Substring(KvP.Key.IndexOf("Paks/") + "Paks/".Length)),
|
||||
"/FModel;component/Resources/lock-open-variant.ico");
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[AES]", $"{KvP.Key} with key {KvP.Value} can be opened");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,11 @@
|
|||
<Image Source="Resources/bug.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="FModel_MI_Help_Trello" Header="{x:Static properties:Resources.Trello}" Click="FModel_MI_Help_Trello_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/trello.png"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem x:Name="FModel_MI_Help_Discord" Header="{x:Static properties:Resources.DiscordServer}" Click="FModel_MI_Help_Discord_Click">
|
||||
<MenuItem.Icon>
|
||||
<Image Source="Resources/discord.png"/>
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ namespace FModel
|
|||
private void FModel_MI_Help_Donate_Click(object sender, RoutedEventArgs e) => Process.Start(new ProcessStartInfo { FileName = "https://www.paypal.me/FModel", UseShellExecute = true });
|
||||
private void FModel_MI_Help_Changelog_Click(object sender, RoutedEventArgs e) => Process.Start(new ProcessStartInfo { FileName = "https://github.com/iAmAsval/FModel/releases/latest", UseShellExecute = true });
|
||||
private void FModel_MI_Help_BugsReport_Click(object sender, RoutedEventArgs e) => Process.Start(new ProcessStartInfo { FileName = "https://github.com/iAmAsval/FModel/issues/new", UseShellExecute = true });
|
||||
private void FModel_MI_Help_Trello_Click(object sender, RoutedEventArgs e) => Process.Start(new ProcessStartInfo { FileName = "https://trello.com/b/DfmzkVQB/fmodel", UseShellExecute = true });
|
||||
private void FModel_MI_Help_Discord_Click(object sender, RoutedEventArgs e) => Process.Start(new ProcessStartInfo { FileName = "https://discord.gg/fdkNYYQ", UseShellExecute = true });
|
||||
private void FModel_MI_Help_About_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
19
FModel/Properties/Resources.Designer.cs
generated
19
FModel/Properties/Resources.Designer.cs
generated
|
|
@ -2559,6 +2559,25 @@ namespace FModel.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recherche une chaîne localisée semblable à Trello.
|
||||
/// </summary>
|
||||
public static string Trello {
|
||||
get {
|
||||
return ResourceManager.GetString("Trello", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recherche une ressource localisée de type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap trello1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("trello1", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recherche une chaîne localisée semblable à Turkish.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1067,4 +1067,10 @@ It's now the most used free software to leak on Fortnite.</value>
|
|||
<data name="Xml" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Xml.xshd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Trello" xml:space="preserve">
|
||||
<value>Trello</value>
|
||||
</data>
|
||||
<data name="trello1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\trello.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
FModel/Resources/trello.png
Normal file
BIN
FModel/Resources/trello.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 673 B |
|
|
@ -28,9 +28,13 @@ namespace FModel.Utils
|
|||
if (!string.IsNullOrEmpty(Properties.Settings.Default.StaticAesKeys))
|
||||
staticKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.StaticAesKeys);
|
||||
|
||||
Dictionary<string, string> dynamicKeys = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
Dictionary<string, Dictionary<string, string>> dynamicKeys = new Dictionary<string, Dictionary<string, string>>();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicKeys = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
}
|
||||
catch (JsonSerializationException) { /* Needed for the transition bewteen global dynamic keys and "per game" dynamic keys */ }
|
||||
|
||||
bool isMainKey = staticKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var _);
|
||||
bool mainError = false; // used to avoid notifications about all static paks not working with the key
|
||||
|
|
@ -64,7 +68,7 @@ namespace FModel.Utils
|
|||
}
|
||||
|
||||
string trigger = $"{Properties.Settings.Default.PakPath.Substring(Properties.Settings.Default.PakPath.LastIndexOf(Folders.GetGameName())).Replace("\\", "/")}/{menuItem.PakFile.FileName}";
|
||||
if (dynamicKeys.TryGetValue(trigger, out var key))
|
||||
if (dynamicKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var gameDict) && gameDict.TryGetValue(trigger, out var key))
|
||||
{
|
||||
string dKey = key.StartsWith("0x") ? key.Substring(2).ToUpperInvariant() : key.ToUpperInvariant();
|
||||
try
|
||||
|
|
|
|||
|
|
@ -35,9 +35,13 @@ namespace FModel.Windows.AESManager
|
|||
if (!string.IsNullOrEmpty(Properties.Settings.Default.StaticAesKeys))
|
||||
staticKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.StaticAesKeys);
|
||||
|
||||
Dictionary<string, string> dynamicAesKeys = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicAesKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
Dictionary<string, Dictionary<string, string>> dynamicAesKeys = new Dictionary<string, Dictionary<string, string>>();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicAesKeys = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
}
|
||||
catch (JsonSerializationException) { /* Needed for the transition bewteen global dynamic keys and "per game" dynamic keys */ }
|
||||
|
||||
if (staticKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var sKey))
|
||||
{
|
||||
|
|
@ -57,7 +61,11 @@ namespace FModel.Windows.AESManager
|
|||
{
|
||||
gridRow++;
|
||||
string trigger = $"{Properties.Settings.Default.PakPath.Substring(Properties.Settings.Default.PakPath.LastIndexOf(Folders.GetGameName())).Replace("\\", "/")}/{pak.FileName}";
|
||||
string key = dynamicAesKeys.ContainsKey(trigger) ? dynamicAesKeys[trigger] : "";
|
||||
string key;
|
||||
if (dynamicAesKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var gameDict) && gameDict.TryGetValue(trigger, out var dKey))
|
||||
key = dKey;
|
||||
else
|
||||
key = "";
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3} {4}", "[FModel]", "[Window]", "[AES Manager]", "[GET]", $"{pak.FileName} with key: {key}");
|
||||
|
||||
DynamicKeys_Grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
|
||||
|
|
@ -97,20 +105,28 @@ namespace FModel.Windows.AESManager
|
|||
staticKeys[Globals.Game.ActualGame.ToString()] = StaticKey_TxtBox.Text;
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3} {4}", "[FModel]", "[Window]", "[AES Manager]", "[SET]", $"Main PAKs with key: {StaticKey_TxtBox.Text}");
|
||||
|
||||
Dictionary<string, string> dynamicKeys = new Dictionary<string, string>();
|
||||
Dictionary<string, Dictionary<string, string>> dynamicAesKeys = new Dictionary<string, Dictionary<string, string>>();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicAesKeys = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
}
|
||||
catch (JsonSerializationException) { /* Needed for the transition bewteen global dynamic keys and "per game" dynamic keys */ }
|
||||
|
||||
dynamicAesKeys[Globals.Game.ActualGame.ToString()] = new Dictionary<string, string>();
|
||||
foreach (PakFileReader pak in MenuItems.pakFiles.GetDynamicPakFileReaders())
|
||||
{
|
||||
string trigger = $"{Properties.Settings.Default.PakPath.Substring(Properties.Settings.Default.PakPath.LastIndexOf(Folders.GetGameName())).Replace("\\", "/")}/{pak.FileName}";
|
||||
TextBox textBox = DependencyObjects.FindChild<TextBox>(this, $"pakchunk{Regex.Match(pak.FileName[0..^4], @"\d+").Value}");
|
||||
if (!string.IsNullOrEmpty(textBox.Text))
|
||||
{
|
||||
dynamicKeys[trigger] = textBox.Text;
|
||||
dynamicAesKeys[Globals.Game.ActualGame.ToString()][trigger] = textBox.Text;
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3} {4}", "[FModel]", "[Window]", "[AES Manager]", "[SET]", $"{pak.FileName} with key: {textBox.Text}");
|
||||
}
|
||||
}
|
||||
|
||||
Properties.Settings.Default.StaticAesKeys = JsonConvert.SerializeObject(staticKeys, Formatting.None);
|
||||
Properties.Settings.Default.DynamicAesKeys = JsonConvert.SerializeObject(dynamicKeys, Formatting.None);
|
||||
Properties.Settings.Default.DynamicAesKeys = JsonConvert.SerializeObject(dynamicAesKeys, Formatting.None);
|
||||
Properties.Settings.Default.Save();
|
||||
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Window]", "Closing AES Manager");
|
||||
|
||||
|
|
@ -130,9 +146,13 @@ namespace FModel.Windows.AESManager
|
|||
if (!string.IsNullOrEmpty(Properties.Settings.Default.StaticAesKeys))
|
||||
staticKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.StaticAesKeys);
|
||||
|
||||
Dictionary<string, string> dynamicAesKeys = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicAesKeys = JsonConvert.DeserializeObject<Dictionary<string, string>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
Dictionary<string, Dictionary<string, string>> dynamicAesKeys = new Dictionary<string, Dictionary<string, string>>();
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Properties.Settings.Default.DynamicAesKeys))
|
||||
dynamicAesKeys = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, string>>>(Properties.Settings.Default.DynamicAesKeys);
|
||||
}
|
||||
catch (JsonSerializationException) { /* Needed for the transition bewteen global dynamic keys and "per game" dynamic keys */ }
|
||||
|
||||
if (staticKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var sKey))
|
||||
{
|
||||
|
|
@ -143,7 +163,11 @@ namespace FModel.Windows.AESManager
|
|||
foreach (PakFileReader pak in MenuItems.pakFiles.GetDynamicPakFileReaders())
|
||||
{
|
||||
string trigger = $"{Properties.Settings.Default.PakPath.Substring(Properties.Settings.Default.PakPath.LastIndexOf(Folders.GetGameName())).Replace("\\", "/")}/{pak.FileName}";
|
||||
string key = dynamicAesKeys.ContainsKey(trigger) ? dynamicAesKeys[trigger] : "";
|
||||
string key;
|
||||
if (dynamicAesKeys.TryGetValue(Globals.Game.ActualGame.ToString(), out var gameDict) && gameDict.TryGetValue(trigger, out var dKey))
|
||||
key = dKey;
|
||||
else
|
||||
key = "";
|
||||
DebugHelper.WriteLine("{0} {1} {2} {3} {4}", "[FModel]", "[Window]", "[AES Manager]", "[UPDATE]", $"{pak.FileName} with key: {key}");
|
||||
|
||||
TextBox textBox = DependencyObjects.FindChild<TextBox>(this, $"pakchunk{Regex.Match(pak.FileName[0..^4], @"\d+").Value}");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
Style="{StaticResource {x:Type Window}}"
|
||||
Title="{x:Static properties:Resources.AudioPlayer}"
|
||||
Height="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenHeight}, Converter={utils:Screens}, ConverterParameter='0.50' }"
|
||||
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={utils:Screens}, ConverterParameter='0.50' }"
|
||||
Width="{Binding Source={x:Static SystemParameters.MaximizedPrimaryScreenWidth}, Converter={utils:Screens}, ConverterParameter='0.65' }"
|
||||
WindowStartupLocation="CenterScreen" Icon="/FModel;component/FModel.ico"
|
||||
Closed="OnClosed">
|
||||
<Grid>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user