added Reset Settings and fixed a few things

This commit is contained in:
iAmAsval 2020-10-12 20:45:41 +02:00
parent e0171afec8
commit db1f5a225f
8 changed files with 370 additions and 317 deletions

View File

@ -29,6 +29,8 @@ namespace FModel.Grabber.Manifests
private static bool IsExpired()
{
if (string.IsNullOrEmpty(Properties.Settings.Default.AccessToken)) return true;
long currentTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
return currentTime - 60000 >= Properties.Settings.Default.LauncherExpiration;
}

File diff suppressed because it is too large Load Diff

View File

@ -834,4 +834,7 @@ C'est maintenant le logiciel gratuit le plus utilisé pour leak sur Fortnite.</v
<data name="Fat" xml:space="preserve">
<value>Gras</value>
</data>
<data name="ResetSettings" xml:space="preserve">
<value>Réinitialiser les paramètres</value>
</data>
</root>

View File

@ -1088,4 +1088,7 @@ It's now the most used free software to leak on Fortnite.</value>
<data name="Fat" xml:space="preserve">
<value>Fat</value>
</data>
<data name="ResetSettings" xml:space="preserve">
<value>Reset Settings</value>
</data>
</root>

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace FModel.Properties
@ -10,6 +11,7 @@ namespace FModel.Properties
public sealed partial class Settings
{
private static string _userSettings = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FModel\\DoNotDelete.json";
private static readonly Regex _pakFileRegex = new Regex(@"^FortniteGame/Content/Paks/pakchunk(?:0|10.*|\w+)-WindowsClient\.pak$", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
/// <summary>
/// IMPORTANT: i believe Upgrade doesn't like int32 so use int64 (maybe because it's for x64?) for all int values
@ -37,6 +39,26 @@ namespace FModel.Properties
Default.Save();
}
public static void Delete()
{
#if DEBUG
_userSettings = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\FModel\\DoNotDelete_Debug.json";
#endif
if (File.Exists(_userSettings))
{
File.Delete(_userSettings);
}
string dir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Asval\\";
if (Directory.Exists(dir))
{
Directory.Delete(dir, true);
}
Default.Reset();
}
/// <summary>
/// ty .net core <3
/// </summary>

View File

@ -4,6 +4,7 @@ using FModel.ViewModels.ComboBox;
using FModel.Windows.CustomNotifier;
using Ookii.Dialogs.Wpf;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
@ -143,8 +144,9 @@ namespace FModel.Windows.Launcher
{
if (e.Source is TextBox text)
{
BrowsePath.IsEnabled = text.Text != "donotedit-youcanteditanyway.manifest";
text.IsReadOnly = text.Text == "donotedit-youcanteditanyway.manifest";
bool m = Regex.IsMatch(text.Text, @"^donotedit-youcanteditanyway-(?:\w+)\.manifest$");
BrowsePath.IsEnabled = !m;
text.IsReadOnly = m;
}
}
}

View File

@ -159,6 +159,9 @@
</Grid>
</GroupBox>
<Button Grid.Row="6" Grid.Column="1"
Content="{x:Static properties:Resources.ResetSettings}" Padding="5,1,5,1"
HorizontalAlignment="Left" Style="{StaticResource RedButton}" Click="OnDeleteSettings"/>
<Button Grid.Row="6" Grid.Column="1"
Content="{x:Static properties:Resources.OK}"
HorizontalAlignment="Right" Width="80" Click="OnClick"/>

View File

@ -109,5 +109,14 @@ namespace FModel.Windows.Settings
Properties.Settings.Default.OutputPath = dialog.SelectedPath;
}
}
private void OnDeleteSettings(object sender, RoutedEventArgs e)
{
Properties.Settings.Delete();
DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information);
DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Settings reset");
Process.Start(Process.GetCurrentProcess().MainModule.FileName);
Application.Current.Shutdown();
}
}
}