Skip to content

Commit

Permalink
cleancode , oh wow, sleep is possible :|
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Jan 29, 2024
1 parent 7bfa4dc commit 7bdd742
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 120 deletions.
Binary file modified VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2
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.
Binary file not shown.
23 changes: 14 additions & 9 deletions VTOL_2.0.0/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -616,29 +616,30 @@ public void Send_Danger_Notif(string Input_Message, int time)
public void Minimize()
{
this.WindowState = WindowState.Minimized;
this.Opacity = 1;
this.Opacity = 100;

}
public void Maximize()
public void Maximize()
{
this.WindowState = WindowState.Maximized;
this.Opacity = 100;
DoubleAnimation animation = new DoubleAnimation(100, TimeSpan.FromSeconds(0.5));
this.BeginAnimation(UIElement.OpacityProperty, animation);

}

private void MaximizeButton_Click(object sender, RoutedEventArgs e)
{
this.Opacity = 100;

this.WindowState = WindowState.Minimized;
this.Opacity = 100;
Maximize();

}

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
if (Directory.Exists(AppDataFolder + @"\VTOL_DATA\temp"))
{
TryDeleteDirectory(AppDataFolder + @"\VTOL_DATA\temp",true, 2, 20);
}
Application.Current.Shutdown();
}


Expand Down Expand Up @@ -774,7 +775,8 @@ private void Log_Folder_warning_Click(object sender, RoutedEventArgs e)

private void Main_Win_Control_GotFocus(object sender, RoutedEventArgs e)
{

this.Maximize();

}

private void Main_Win_Control_LostFocus(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -1039,12 +1041,15 @@ private void Main_Win_Control_StateChanged(object sender, EventArgs e)
}
else
{
this.Maximize();
this.ShowInTaskbar = true;

}
}
else
{
this.Maximize();

this.ShowInTaskbar = true;


Expand Down
142 changes: 31 additions & 111 deletions VTOL_2.0.0/Pages/Page_Home.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,10 @@ public Page_Home()

INIT();

if (IsValidPath(Current_Install_Folder) == false || !Directory.Exists(User_Settings_Vars.NorthstarInstallLocation))
if (IsValidPath(Current_Install_Folder) == false && !Directory.Exists(User_Settings_Vars.NorthstarInstallLocation))
{
ShowWelcome();

}

if (IsDirectoryValid(Current_Install_Folder) == false)
{

if (showcntr < 2)
{
Expand All @@ -432,33 +428,9 @@ public Page_Home()
showcntr = Properties.Settings.Default.Banner_CNTR;
}
}
if (Properties.Settings.Default.EA_APP_SUPPORT == true)
if (Properties.Settings.Default.EA_APP_SUPPORT == false)
{
EA_ORGIGIN_Client_Card.Content = VTOL.Resources.Languages.Language.Page_Home_Page_Home_EAClientRunning;
BitmapImage bitmapx = new BitmapImage();

bitmapx.BeginInit();
bitmapx.UriSource = new Uri(@"pack://application:,,,/Resources/Icons/EA.ico");
bitmapx.EndInit();
CLIENT_CARD_IMAGE.Source = bitmapx;

if (Check_Process_Running("EABackgroundService") == true)
{
EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#B2037F10");
EA_ORGIGIN_Client_Card.IconFilled = true;

}
else
{

EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#99630000");
EA_ORGIGIN_Client_Card.IconFilled = false;

}

}
else
{
BitmapImage bitmapy = new BitmapImage();

bitmapy.BeginInit();
Expand All @@ -483,6 +455,23 @@ public Page_Home()

}

EA_ORGIGIN_Client_Card.Content = VTOL.Resources.Languages.Language.Page_Home_Page_Home_EAClientRunning;
BitmapImage bitmapx = new BitmapImage();

bitmapx.BeginInit();
bitmapx.UriSource = new Uri(@"pack://application:,,,/Resources/Icons/EA.ico");
bitmapx.EndInit();
CLIENT_CARD_IMAGE.Source = bitmapx;

EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#99630000");
EA_ORGIGIN_Client_Card.IconFilled = false;
if (Check_Process_Running("EABackgroundService") == true)
{
EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#B2037F10");
EA_ORGIGIN_Client_Card.IconFilled = true;

}

if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\logs\") && Properties.Settings.Default.LOG_Folder_Counter < 1)
{
Properties.Settings.Default.LOG_Folder_Counter = Directory.GetFiles(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\logs\").Where(s => s.EndsWith(".dmp")).Count();
Expand Down Expand Up @@ -766,8 +755,6 @@ async void Auto_Install_(bool resart_ = false)
if (myFileVersionInfo.FileVersion != null)
{

// Print the file name and version number.
//Console.WriteLine(myFileVersionInfo.FileVersion);
Current_Ver_ = myFileVersionInfo.FileVersion;
}
else
Expand Down Expand Up @@ -933,7 +920,6 @@ void INIT()


Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\");
//Console.WriteLine("Replaced");

}
}
Expand Down Expand Up @@ -978,7 +964,6 @@ void INIT()
else
{

//Console.WriteLine("Null_Settings");
string FINAL = "";
Current_Install_Folder = InstalledApplications.GetApplictionInstallPath("Titanfall2");

Expand Down Expand Up @@ -1071,24 +1056,13 @@ void INIT()

if (Dir.Exists && Current_Install_Folder != "NODATA")
{
//Console.WriteLine("VALID_PATH");

if (File.Exists(Current_Install_Folder + "Titanfall2.exe"))
{
//Console.WriteLine("VALID_INSTALL");


if (File.Exists(Current_Install_Folder + @"NorthstarLauncher.exe"))
{
//Console.WriteLine("VALID_NS");

// Get the file version info for the notepad.
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(Current_Install_Folder + @"NorthstarLauncher.exe");
if (myFileVersionInfo.FileVersion != null)
{

// Print the file name and version number.
//Console.WriteLine(myFileVersionInfo.FileVersion);
Current_Ver_ = myFileVersionInfo.FileVersion;
}
if (Current_Ver_ == null)
Expand Down Expand Up @@ -1144,19 +1118,15 @@ void INIT()
string fix = Current_Install_Folder + @"\";
User_Settings_Vars.NorthstarInstallLocation = fix;
Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\");
//Console.WriteLine("Replaced2");

}
//Console.WriteLine("INVALID_NS");


SnackBar.Appearance = ControlAppearance.Caution;
SnackBar.Title = "CAUTION";
SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_INIT_NORTHSTARAUTOINSTALLWILLNOWBEGINPLEASEWAITABOUT30SECONDS;
SnackBar.Timeout = 8000;
SnackBar.Show();

//Task check_task = Task.Run(() => Auto_Install_(false));
// check_task.Wait();

Auto_Install_(false);

Expand All @@ -1176,15 +1146,6 @@ void INIT()

}

//Console.WriteLine(Current_Install_Folder);









}
else
Expand All @@ -1201,16 +1162,10 @@ void INIT()
{

FINAL = Path;



// throw new Exception("Automated Path Finding Failed!");

}
if (IsValidPath(FINAL))
{

//Console.WriteLine(Path);

Current_Install_Folder = Path;
User_Settings_Vars.NorthstarInstallLocation = Path;
Expand All @@ -1224,8 +1179,7 @@ void INIT()
}
if (Directory.Exists(Current_Install_Folder))
{
//Task check_task = Task.Run(() => Auto_Install_(false));
// check_task.Wait();

Auto_Install_(false);
}
else
Expand Down Expand Up @@ -1293,37 +1247,6 @@ void INIT()
SnackBar.Show();

}
}

// string[] arguments = Environment.GetCommandLineArgs();

////Console.WriteLine("GetCommandLineArgs: {0}", string.Join(", ", arguments));












if (Directory.Exists(Current_Install_Folder + @"Skins_Unpack_Mod_MNGR"))
{
try
{
TryDeleteDirectory(Current_Install_Folder + @"Skins_Unpack_Mod_MNGR", true);
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}{ex.InnerException}{Environment.NewLine}");
}




}
if (User_Settings_Vars.NorthstarInstallLocation != Current_Install_Folder)
{
Expand Down Expand Up @@ -1359,7 +1282,7 @@ void INIT()

public bool IsValidPath(string path, bool allowRelativePaths = false)
{
bool isValid = false; ;
bool isValid = false;

try
{
Expand Down Expand Up @@ -1654,11 +1577,9 @@ public bool Template_traverse(DirectoryInfo root, String Search)
{
TryDeleteDirectory(outt, true);
}
//Write_To_Log(ErrorManager(e));

//Send_Fatal_Notif(GetTextResource("NOTIF_FATAL_COMMON_LOG"));

}
// Log_Box.AppendText("\nCould not Find the Install at " +root+ " - Continuing Traversal");

}


Expand Down Expand Up @@ -2334,10 +2255,9 @@ private void Master_Server_Check_Toggle_Unchecked(object sender, RoutedEventArgs
}
private async void FadeAndMinimizeWindow(MainWindow window)
{
DoubleAnimation animation = new DoubleAnimation(0, TimeSpan.FromSeconds(1));
// window.BeginAnimation(UIElement.OpacityProperty, animation);
// await Task.Delay(TimeSpan.FromSeconds(1));
// window.WindowState = WindowState.Minimized;
DoubleAnimation animation = new DoubleAnimation(0, TimeSpan.FromSeconds(1.3));
window.BeginAnimation(UIElement.OpacityProperty, animation);
await Task.Delay(TimeSpan.FromSeconds(1.3));
window.Minimize();
return;
}
Expand Down Expand Up @@ -2390,8 +2310,8 @@ public void Launch_Northstar_()
else
{
Launch_Northstar.IsEnabled = false;
SnackBar.Message = "ERROR - ON Launch, Could Not Find Northstar.exe!";
SnackBar.Title = "FATAL - ERROR";
SnackBar.Message = VTOL.Resources.Languages.Language.ERRORONLaunchCouldNotFindNorthstarExe;
SnackBar.Title = VTOL.Resources.Languages.Language.FATALERROR;
SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger;
SnackBar.Show();

Expand All @@ -2401,8 +2321,8 @@ public void Launch_Northstar_()
else
{
Launch_Northstar.IsEnabled = false;
SnackBar.Message = "ERROR - ON Launch, Could Not Find Northstar.exe!";
SnackBar.Title = "FATAL - ERROR";
SnackBar.Message = VTOL.Resources.Languages.Language.ERRORONLaunchCouldNotFindNorthstarExe;
SnackBar.Title = VTOL.Resources.Languages.Language.FATALERROR;
SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger;
SnackBar.Show();

Expand Down
18 changes: 18 additions & 0 deletions VTOL_2.0.0/Resources/Languages/Language.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions VTOL_2.0.0/Resources/Languages/Language.resx
Original file line number Diff line number Diff line change
Expand Up @@ -825,4 +825,10 @@
<data name="TheMod" xml:space="preserve">
<value>The Mod </value>
</data>
<data name="ERRORONLaunchCouldNotFindNorthstarExe" xml:space="preserve">
<value>ERROR - ON Launch, Could Not Find Northstar.exe!</value>
</data>
<data name="FATALERROR" xml:space="preserve">
<value>FATAL - ERROR</value>
</data>
</root>

0 comments on commit 7bdd742

Please sign in to comment.