This repository has been archived on 2025-07-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
EnvyUpdate/EnvyUpdate/SettingsPage.xaml.cs

124 lines
4.4 KiB
C#
Raw Normal View History

using System;
2023-07-14 00:16:57 +02:00
using System.IO;
using System.Windows;
namespace EnvyUpdate
{
/// <summary>
2023-07-14 00:16:57 +02:00
/// Interaction logic for SettingsPage.xaml
/// </summary>
2023-07-14 00:16:57 +02:00
public partial class SettingsPage
{
2023-07-14 00:16:57 +02:00
public SettingsPage()
{
InitializeComponent();
2023-07-14 11:33:38 +02:00
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
string version = fvi.FileVersion;
textBlockVer.Text = version;
if (GlobalVars.monitoringInstall)
textBlockVer.FontStyle = FontStyles.Italic;
2023-10-02 12:30:53 +02:00
if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log")) || File.Exists(Path.Combine(GlobalVars.appdata, "envyupdate.log")))
2023-07-14 11:33:38 +02:00
chkLog.IsChecked = true;
2023-10-02 12:30:53 +02:00
if (GlobalVars.useAppdata)
chkAppdata.IsChecked = true;
if (!GlobalVars.hasWrite)
chkAppdata.IsEnabled = false;
2024-02-26 19:50:56 +01:00
if (GlobalVars.autoDownload)
chkAutodl.IsChecked = true;
2024-02-26 20:02:16 +01:00
if (GlobalVars.isDownloading)
{
chkAppdata.IsEnabled = false;
}
else
chkAppdata.IsEnabled = true;
2023-07-14 00:16:57 +02:00
textBoxLicEnvyupdate.Text = Properties.Licenses.EnvyUpdate;
textBoxLicFody.Text = Properties.Licenses.Fody;
textBoxLicCostura.Text = Properties.Licenses.CosturaFody;
textBoxLicResourceembedder.Text = Properties.Licenses.ResourceEmbedder;
textBoxLicWindowscommunitytoolkit.Text = Properties.Licenses.WindowsCommunityToolkit;
textBoxLicWpfui.Text = Properties.Licenses.wpfui;
2023-08-29 15:40:10 +02:00
textBoxLic7zip.Text = Properties.Licenses._7zip;
}
2023-07-14 00:16:57 +02:00
private void CardWeb_Click(object sender, RoutedEventArgs e)
{
2023-04-03 20:55:22 +02:00
Debug.LogToFile("INFO Launching website.");
System.Diagnostics.Process.Start("https://github.com/fyr77/EnvyUpdate/");
}
2023-07-09 18:19:33 +02:00
private void chkLog_Checked(object sender, RoutedEventArgs e)
{
2023-07-09 18:35:46 +02:00
if (!Debug.isVerbose)
{
Debug.isVerbose = true;
Debug.LogToFile("------");
Debug.LogToFile("INFO Enabled logging to file. Restart Application to see full startup log.");
}
2023-07-09 18:19:33 +02:00
}
private void chkLog_Unchecked(object sender, RoutedEventArgs e)
{
2023-07-09 18:35:46 +02:00
if (Debug.isVerbose)
{
Debug.LogToFile("INFO Disabled logging to file.");
2023-10-02 12:30:53 +02:00
if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log")))
File.Move(Path.Combine(GlobalVars.saveDirectory, "envyupdate.log"), Path.Combine(GlobalVars.saveDirectory, "envyupdate." + DateTime.Now.ToString("yyyyMMdd-HHmmss") + ".log"));
2023-07-09 18:35:46 +02:00
Debug.isVerbose = false;
}
2023-07-09 18:19:33 +02:00
}
2023-10-02 12:30:53 +02:00
private void chkAppdata_Checked(object sender, RoutedEventArgs e)
{
if (!Directory.Exists(GlobalVars.appdata))
Directory.CreateDirectory(GlobalVars.appdata);
GlobalVars.useAppdata = true;
GlobalVars.saveDirectory = GlobalVars.appdata;
Util.MoveFilesToAppdata();
Debug.LogToFile("INFO Switched to AppData directory.");
}
private void chkAppdata_Unchecked(object sender, RoutedEventArgs e)
{
GlobalVars.useAppdata = false;
GlobalVars.saveDirectory = GlobalVars.directoryOfExe;
if (Directory.Exists(GlobalVars.appdata))
{
Util.MoveFilesToExe();
Directory.Delete(GlobalVars.appdata, true);
}
Debug.LogToFile("INFO Switched to EXE directory.");
}
2024-02-23 20:30:40 +01:00
private void chkAutodl_Checked(object sender, RoutedEventArgs e)
{
GlobalVars.autoDownload = true;
2024-02-26 19:46:46 +01:00
if (!File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")))
{
File.Create(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"));
}
2024-02-23 20:30:40 +01:00
}
private void chkAutodl_Unchecked(object sender, RoutedEventArgs e)
{
GlobalVars.autoDownload = false;
2024-02-26 19:46:46 +01:00
if (File.Exists(Path.Combine(GlobalVars.saveDirectory, "autodl.envy")))
{
File.Delete(Path.Combine(GlobalVars.saveDirectory, "autodl.envy"));
}
2024-02-23 20:30:40 +01:00
}
}
}