Skip to content

Commit

Permalink
Fixed Searching for Titanfall 2 installs to prevent looping in win11 …
Browse files Browse the repository at this point in the history
…platforms.

Fixed Multi mod install
  • Loading branch information
BigSpice committed Dec 19, 2022
1 parent f819fdd commit 2ea7d86
Show file tree
Hide file tree
Showing 8 changed files with 233 additions and 79 deletions.
Binary file modified VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
32 changes: 18 additions & 14 deletions VTOL_2.0.0/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public partial class MainWindow : Window
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 DocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);


public TlsPaperTrailLogger logger2 = new TlsPaperTrailLogger("logs5.papertrailapp.com", 38137);
Expand All @@ -63,27 +62,32 @@ public MainWindow()
InitializeComponent();

//System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");

//System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");Do
if (Directory.Exists(DocumentsFolder) && Directory.Exists(AppDataFolder))
{
if (!Directory.Exists(AppDataFolder + @"\VTOL_DATA\Settings"))
if (!File.Exists(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json"))
{ string DocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

if (Directory.Exists(DocumentsFolder) && Directory.Exists(AppDataFolder))
{
TryCreateDirectory(AppDataFolder + @"\VTOL_DATA\Settings");
if (!Directory.Exists(AppDataFolder + @"\VTOL_DATA\Settings"))

}
{
TryCreateDirectory(AppDataFolder + @"\VTOL_DATA\Settings");

if (File.Exists(DocumentsFolder + @"\VTOL_DATA\Settings\User_Settings.Json") && !File.Exists(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json"))
{
TryCopyFile(DocumentsFolder + @"\VTOL_DATA\Settings\User_Settings.Json", AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json");
}

if (File.Exists(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json"))
if (File.Exists(DocumentsFolder + @"\VTOL_DATA\Settings\User_Settings.Json") && !File.Exists(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json"))
{
TryDeleteDirectory(DocumentsFolder + @"\VTOL_DATA\",true);
TryCopyFile(DocumentsFolder + @"\VTOL_DATA\Settings\User_Settings.Json", AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json");

if (File.Exists(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json"))
{
TryDeleteDirectory(DocumentsFolder + @"\VTOL_DATA\", true);

}
}
}
}
}

if (Directory.Exists(AppDataFolder))
{
Expand Down Expand Up @@ -683,7 +687,7 @@ private void Northstar_Dialog_IsVisibleChanged(object sender, DependencyProperty
{
From = Northstar_Dialog.Opacity,
To = 1,
Duration = new Duration(TimeSpan.FromSeconds(0.8)),
Duration = new Duration(TimeSpan.FromSeconds(0.2)),
AutoReverse = false
};
Northstar_Dialog.BeginAnimation(OpacityProperty, da);
Expand All @@ -698,7 +702,7 @@ private void Northstar_Dialog_IsVisibleChanged(object sender, DependencyProperty
{
From = Northstar_Dialog.Opacity,
To = 0,
Duration = new Duration(TimeSpan.FromSeconds(0.8)),
Duration = new Duration(TimeSpan.FromSeconds(0.2)),
AutoReverse = false
};
Northstar_Dialog.BeginAnimation(OpacityProperty, da);
Expand Down
70 changes: 53 additions & 17 deletions VTOL_2.0.0/Pages/Page_Home.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public Page_Home()
DispatcherTimer Log_Changes_Timer = new DispatcherTimer();
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(2);
Log_Changes_Timer.Interval = TimeSpan.FromSeconds(60);
Log_Changes_Timer.Interval = TimeSpan.FromSeconds(10);
timer.Tick += timer_Tick;
Log_Changes_Timer.Tick += Log_Changes_Timer_Tick;
timer.Start();
Expand Down Expand Up @@ -883,7 +883,6 @@ void INIT()
MasterServer_URL = User_Settings_Vars.MasterServerUrl;

Current_Install_Folder = User_Settings_Vars.NorthstarInstallLocation;
Console.WriteLine(Current_Install_Folder);

if (IsValidPath(Current_Install_Folder))
{
Expand All @@ -902,7 +901,7 @@ void INIT()
{
string FINAL = "";
Current_Install_Folder = InstalledApplications.GetApplictionInstallPath("Titanfall2");
if (IsValidPath(Current_Install_Folder))
if (Directory.Exists(Current_Install_Folder))
{
FINAL = Current_Install_Folder;
if (!Current_Install_Folder.EndsWith(@"\"))
Expand Down Expand Up @@ -935,12 +934,13 @@ void INIT()
}
else
{

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

if (IsValidPath(Current_Install_Folder))
{
FINAL = Current_Install_Folder;
if (!Current_Install_Folder.EndsWith(@"\"))
{
string fix = Current_Install_Folder + @"\";
Expand All @@ -957,16 +957,56 @@ void INIT()
}
else
{
string Current_Install_Folder_x = Auto_Find_And_verify(InstalledApplications.GetApplictionInstallPath("Steam")).Replace(@"\\", @"\").Replace("/", @"\");


SnackBar.Appearance = ControlAppearance.Danger;
SnackBar.Title = "WARNING!";
SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_INIT_InvalidInstallPathPleaseManuallyLocateTheCorrectFolder;
SnackBar.Show();
Current_Install_Folder = Auto_Find_And_verify().Replace(@"\\", @"\").Replace("/", @"\");

throw new Exception("Could Not Install Ns after all of it :(");
if (IsValidPath(Current_Install_Folder))
{
if (!Current_Install_Folder.EndsWith(@"\"))
{
string fix = Current_Install_Folder + @"\";
User_Settings_Vars.NorthstarInstallLocation = fix;
Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\");
string User_Settings_Json_Strings = Newtonsoft.Json.JsonConvert.SerializeObject(User_Settings_Vars);
using (var StreamWriter = new StreamWriter(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json", false))
{
StreamWriter.WriteLine(User_Settings_Json_Strings);
StreamWriter.Close();
}
}

return;
}
else if(IsValidPath(Current_Install_Folder_x))
{
if (!Current_Install_Folder.EndsWith(@"\"))
{
string fix = Current_Install_Folder + @"\";
User_Settings_Vars.NorthstarInstallLocation = fix;
Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\");
string User_Settings_Json_Strings = Newtonsoft.Json.JsonConvert.SerializeObject(User_Settings_Vars);
using (var StreamWriter = new StreamWriter(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json", false))
{
StreamWriter.WriteLine(User_Settings_Json_Strings);
StreamWriter.Close();
}
}

}
else
{


SnackBar.Appearance = ControlAppearance.Danger;
SnackBar.Title = "WARNING!";
SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_INIT_InvalidInstallPathPleaseManuallyLocateTheCorrectFolder;
SnackBar.Show();

throw new Exception("Could Not Install Ns after all of it :(");

return;
}


}
Expand Down Expand Up @@ -1423,10 +1463,9 @@ private static string GetShortcutTarget(string file)
return "";
}
}
private string Auto_Find_And_verify()
private string Auto_Find_And_verify(string path = @"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Steam")
{

string path = @"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Steam";

if (!Directory.Exists(path) || !File.Exists(Path.Combine(path, "Steam.lnk")))
{
Expand All @@ -1440,9 +1479,7 @@ private string Auto_Find_And_verify()
}
catch
{
Main.logger2.Open();
Main.logger2.Log("A User with the install - " + Current_Install_Folder + " failed an auto install and verify.");
Main.logger2.Close();

}

//Titanfall2_Directory_TextBox.Background = Brushes.Red;
Expand Down Expand Up @@ -1497,8 +1534,7 @@ private string Auto_Find_And_verify()

}

if (Directory.Exists(@"C:\Program Files (x86)\Origin Games\Titanfall2") && File.Exists(@"C:\Program Files (x86)\Origin Games\Titanfall2\Titanfall2.exe"))
return @"C:\Program Files (x86)\Origin Games\Titanfall2";

//Titanfall2_Directory_TextBox.Background = Brushes.Red;
//Install_NS_EXE_Textbox.Background = Brushes.Red;
//Send_Fatal_Notif(GetTextResource("NOTIF_FATAL_GAME_INSTALL_NOT_FOUND"));
Expand Down
4 changes: 2 additions & 2 deletions VTOL_2.0.0/Pages/Page_Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ async void Call_Mods_From_Folder()
}
int Flag_mod = 0;
string ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ThereIsAnIssueDetectedWithYourMod;
if (!File.Exists(dirInfo.FullName + @"\Locked_Folder" + @"\mod.json") )
if (!File.Exists(dirInfo.FullName + @"\Locked_Folder" + @"\mod.json") && !Directory.Exists(dirInfo.FullName + @"\" + "Multipack"))
{
ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_PleaseOpenYourFolderAt + dirInfo.Parent + VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_AndManuallyRepairTheMod + dirInfo.Name;
Flag_mod = 100;
Expand All @@ -350,7 +350,7 @@ async void Call_Mods_From_Folder()
int Flag_mod = 0;
string ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ThereIsAnIssueDetectedWithYourMod;

if (!File.Exists(dirInfo.FullName + @"\mod.json"))
if (!File.Exists(dirInfo.FullName + @"\mod.json") && !Directory.Exists(dirInfo.FullName + @"\" + "Multipack"))
{

ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_PleaseOpenYourFolderAt + dirInfo.Parent + VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_AndManuallyRepairTheMod + dirInfo.Name;
Expand Down
16 changes: 13 additions & 3 deletions VTOL_2.0.0/Pages/Page_Thunderstore.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xmlns:cntrls="clr-namespace:VTOL"

d:DesignHeight="670" d:DesignWidth="1148"
Title="Page_Thunderstore" UseLayoutRounding="True">
Title="Page_Thunderstore" UseLayoutRounding="True" Loaded="Page_Loaded_1">
<Page.Resources>
<local:NegatingConverter x:Key="NegatingConverter" />
<Storyboard x:Key="slide">
Expand Down Expand Up @@ -129,7 +129,7 @@

<hc:SimplePanel Background="Black" Opacity="0">
<Border Background="#991B1B1B">
<ProgressBar Value="0" SmallChange="0.1" Foreground="#6600714F" Height="286" Background="{x:Null}" IsHitTestVisible="False" IsTabStop="False"/>
<ProgressBar Value="0" SmallChange="0.8" Foreground="#6600714F" Height="286" Background="{x:Null}" IsHitTestVisible="False" IsTabStop="False" Cursor="Wait"/>
</Border>
<!--<Rectangle Opacity="0.5" Fill="#FF2B2B2B">
<Rectangle.Effect>
Expand Down Expand Up @@ -235,6 +235,16 @@


<ui:Dialog x:Name="Dialog" ButtonRightClick="Dialog_ButtonRightClick" Foreground="White" Focusable="False" ButtonLeftClick="Dialog_ButtonLeftClick" SnapsToDevicePixels="False"/>
<ui:ProgressRing x:Name="Loading_Ring" Width="120" Height="120" Foreground="#FF009468" IsIndeterminate="True" Visibility="Visible" Margin="0,327,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"></ui:ProgressRing>
<ui:ProgressRing x:Name="Loading_Ring" Width="120" Height="120" IsIndeterminate="True" Visibility="Visible" Margin="0,327,0,0" VerticalAlignment="Top" HorizontalAlignment="Center" IsHitTestVisible="False" IsTabStop="False" Progress="40" OverridesDefaultStyle="False" EngAngle="20">
<ui:ProgressRing.Foreground>
<RadialGradientBrush SpreadMethod="Pad" Center="1,1" GradientOrigin="1,1" RadiusX="2.8" RadiusY="2.9">
<GradientStop Color="Black"/>
<GradientStop Color="#FF009A49" Offset="1"/>
<GradientStop Color="#DDFF0000"/>
<GradientStop Color="#FF026882"/>
<GradientStop Color="#FF019238" Offset="0.536"/>
</RadialGradientBrush>
</ui:ProgressRing.Foreground>
</ui:ProgressRing>
</Grid>
</Page>
Loading

0 comments on commit 2ea7d86

Please sign in to comment.