Skip to content

Commit

Permalink
Fixed a crash caused by malformed XML queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewinator56 committed Jun 20, 2021
1 parent ef6189f commit b873cd9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
35 changes: 23 additions & 12 deletions StormLoader/StormLoader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public partial class MainWindow : Window
public XmlDocument currentProfile = new XmlDocument();
public string gameLocation = "";
public List<ModListItem> modListItems = new List<ModListItem>();
public string version = "v1.0.4";
public string version = "v1.0.5";
public bool x64 { get; set; }
public bool notx64 { get { return !x64; } set { x64=!value; } }
public MainWindow()
Expand Down Expand Up @@ -169,10 +169,10 @@ public void CheckModActiveAlt()
currentProfile.Load("CurrentProfile.xml");
foreach (ModListItem mli in ModList.Children)
{
if (currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()='" + mli.ModName.Content + "']") != null)
if (currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()=\"" + mli.ModName.Content + "\"]") != null)
{
DbgLog.WriteLine(mli.ModName.Content.ToString());
DbgLog.WriteLine(currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()='" + mli.ModName.Content + "']").InnerText);
DbgLog.WriteLine(currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()=\"" + mli.ModName.Content + "\"]").InnerText);
DbgLog.WriteLine("Found");
mli.SetActive(true);
} else
Expand Down Expand Up @@ -470,17 +470,17 @@ public void ApplyProfileAlt()
currentProfile.Load("CurrentProfile.xml");
foreach (ModListItem mli in ModList.Children)
{
if (currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()='" + mli.ModName.Content + "']") != null)
if (currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()=\"" + mli.ModName.Content + "\"]") != null)
{
//Debug.WriteLine(mli.ModName.Content);
//Debug.WriteLine(currentProfile.SelectSingleNode("/Profile/Mods/Mod/Name[text()='" + mli.ModName.Content + "']"));
DbgLog.WriteLine("Found");
//DbgLog.WriteLine("Found");
string modPath = mli.modPath;
DbgLog.WriteLine("test");
//DbgLog.WriteLine("test");
try
{
RecursiveCopy(new DirectoryInfo(modPath + "/Meshes/"), new DirectoryInfo(gameLocation + "/rom/meshes/"));
DbgLog.WriteLine("Running");
//DbgLog.WriteLine("Running");
}
catch (Exception e) {}
try
Expand All @@ -501,7 +501,7 @@ public void ApplyProfileAlt()
try
{
RecursiveDelete(new DirectoryInfo(modPath + "/Meshes/"), new DirectoryInfo(gameLocation + "/rom/meshes/"));
DbgLog.WriteLine("Running Delete");
//DbgLog.WriteLine("Running Delete");
}
catch (Exception) { }
try
Expand Down Expand Up @@ -655,11 +655,17 @@ public void ShowInfoPopup(string title, List<Control> controls, PackIconKind ico
InfoPopup ifp = new InfoPopup();
ifp.titleText.Content = title;
ifp.icon.Kind = iconKind;

foreach (Control c in controls)
if (controls != null)
{
ifp.infoContainer.Children.Add(c);
foreach (Control c in controls)
{
ifp.infoContainer.Children.Add(c);
}
}



MaterialDesignThemes.Wpf.DialogHost.Show(ifp);

}
Expand Down Expand Up @@ -715,7 +721,12 @@ private void BrowseRepo_Click(object sender, RoutedEventArgs e)

private void BrowseNexus_Click(object sender, RoutedEventArgs e)
{

List<Control> cons = new List<Control>();
cons.Add(new Label
{
Content = "I know how much you all want this, but its taking a while :("
});
ShowInfoPopup("Not Implemented Yet", cons, PackIconKind.SmileySadOutline);
}

private void BrowseOnline_Click(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion StormLoader/StormLoader/SettingsPopup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</materialDesign:Card>
</DockPanel>
</Border>
<Border BorderThickness="2 2 2 2" BorderBrush="LightGray" CornerRadius="5" DockPanel.Dock="Top" Margin="0 10 0 0">
<Border BorderThickness="2 2 2 2" BorderBrush="LightGray" CornerRadius="5" DockPanel.Dock="Top" Margin="0 10 0 0" IsEnabled="False" ToolTip="Sorry, this isnt quite finished">
<DockPanel Margin="10">
<Label Content="Online Stuff" FontSize="18" DockPanel.Dock="top"/>
<materialDesign:Card Height="auto" HorizontalAlignment="Stretch" VerticalAlignment="Top" DockPanel.Dock="Top" Margin="0, 10, 0 ,10">
Expand Down
1 change: 1 addition & 0 deletions StormLoader/StormLoader/StormLoader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
<Compile Include="SettingsPopup.xaml.cs">
<DependentUpon>SettingsPopup.xaml</DependentUpon>
</Compile>
<Compile Include="StringFormatTools.cs" />
<Compile Include="UpdateDialog.xaml.cs">
<DependentUpon>UpdateDialog.xaml</DependentUpon>
</Compile>
Expand Down
13 changes: 13 additions & 0 deletions StormLoader/StormLoader/StringFormatTools.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StormLoader
{
class StringFormatTools
{

}
}

0 comments on commit b873cd9

Please sign in to comment.