Skip to content

Commit

Permalink
"-._,-'"-._,-'"-._,-'"Cyanide pills "-._,-'"-._,-'"-._,-'"
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Jan 29, 2024
1 parent a16f52a commit abb6777
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 63 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
29 changes: 23 additions & 6 deletions VTOL_2.0.0/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public partial class MainWindow : Window
private Wpf.Ui.Appearance.ThemeType ThemeType = Wpf.Ui.Appearance.ThemeType.Dark;
bool Profile_card = false;
public User_Settings User_Settings_Vars = new User_Settings();
public string AppDataFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
public string AppDataFolder = null;

public NotificationManager NotificationManager;
public bool loaded_mods = false;
Expand All @@ -86,7 +86,7 @@ public partial class MainWindow : Window
bool failed_folder = false;
public bool minimize_to_tray = false;
public DownloadQueue _downloadQueue;

public string LOG_Folder;
// The enum flag for DwmSetWindowAttribute's second parameter, which tells the function what attribute to set.
// Copied from dwmapi.h

Expand Down Expand Up @@ -159,7 +159,8 @@ public MainWindow()

try
{

AppDataFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
LOG_Folder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) + @"\[VTOL]__ERROR_LOGS\";
//win 10
if (Environment.OSVersion.Platform == PlatformID.Win32NT && (Environment.OSVersion.Version.Build < 22000) ){

Expand Down Expand Up @@ -288,6 +289,21 @@ public MainWindow()

}


if (!Directory.Exists(LOG_Folder))
{

TryCreateDirectory(LOG_Folder);

}


Log.Logger = new LoggerConfiguration().MinimumLevel.Debug().WriteTo.File(LOG_Folder + "\\User - Log.log", rollingInterval: RollingInterval.Hour).CreateLogger();





if (User_Settings_Vars != null)
{

Expand Down Expand Up @@ -366,7 +382,7 @@ public MainWindow()
catch (Exception ex)
{

Console.WriteLine(ex+ $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}");
Log.Error(ex+ $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}");

}

Expand Down Expand Up @@ -1127,7 +1143,7 @@ public bool Check_For_New_Update(bool fastcheck_ = false)
catch (Exception ex)
{


Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);
}

return false;
Expand Down Expand Up @@ -1216,6 +1232,7 @@ private void Cancel_Button_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);


}
Expand Down Expand Up @@ -1276,7 +1293,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

}

Expand Down
54 changes: 39 additions & 15 deletions VTOL_2.0.0/Pages/Page_Home.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ public static void GetInstalledApps()
}
catch (Exception ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);


}
Expand Down Expand Up @@ -538,15 +539,15 @@ public static bool IsDirectoryValid(string directoryPath)
}
File.Delete(testFilePath);
}
catch (Exception e)
catch (Exception ex)
{
Console.WriteLine($"Error: Unable to access directory. {e.Message}");
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);
return false;
}
}
else
{
Console.WriteLine("Error: Directory does not exist.");
Log.Error("Error: Directory does not exist.");
}

return true;
Expand Down Expand Up @@ -575,8 +576,10 @@ public bool TryUnzipFile(

return true;
}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -1479,8 +1482,9 @@ private string Auto_Find_And_verify(string path = @"C:\ProgramData\Microsoft\Win
RegistryKey originReg = Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Respawn").OpenSubKey("Titanfall2");
if (originReg.GetValue("Install Dir") != null) return (string)originReg.GetValue("Install Dir");
}
catch
catch(Exception ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

}

Expand Down Expand Up @@ -1531,8 +1535,9 @@ private string Auto_Find_And_verify(string path = @"C:\ProgramData\Microsoft\Win
RegistryKey originReg = Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Respawn").OpenSubKey("Titanfall2");
if (originReg.GetValue("Install Dir") != null) return (string)originReg.GetValue("Install Dir");
}
catch
catch ( Exception ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

}

Expand Down Expand Up @@ -2067,7 +2072,7 @@ async void timer_Tick(object sender, EventArgs e)
catch (Exception ex)
{

//i dont need to log this
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);
}
}

Expand Down Expand Up @@ -2441,6 +2446,8 @@ private string Get_And_Set_Filepaths(string rootDir, string Filename)

catch (Exception ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

return null;


Expand Down Expand Up @@ -2704,8 +2711,10 @@ async void Run_Origin()
//kill running process
runingProcess[i].Kill();
}
catch
catch (Exception ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

continue;
}
}
Expand Down Expand Up @@ -3084,8 +3093,10 @@ protected virtual bool IsFileLocked(FileInfo file)
stream.Close();
}
}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

//the file is unavailable because it is:
//still being written to
//or being processed by another thread
Expand Down Expand Up @@ -3472,8 +3483,10 @@ public string GetFile(string directory, string Search,
}

}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -3615,8 +3628,10 @@ public async Task<bool> TryDeleteDirectory(string directoryPath, bool overwrite

return true;
}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -3649,8 +3664,10 @@ public async Task<bool> TryCreateDirectory(

return true;
}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -3685,8 +3702,11 @@ public async Task<bool> TryMoveFile(

return true;
}
catch (IOException)
catch (IOException ex)
{

Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -3720,8 +3740,10 @@ public async Task<bool> TryMoveFolder(

return true;
}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down Expand Up @@ -3756,8 +3778,10 @@ public async Task<bool> TryCopyFile(

return true;
}
catch (IOException)
catch (IOException ex)
{
Log.Error(ex.Message + " \n\n\n\n" + ex.InnerException);

Thread.Sleep(millisecondsDelay);
}
catch (UnauthorizedAccessException)
Expand Down
Loading

0 comments on commit abb6777

Please sign in to comment.