mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-09-29 12:37:24 +08:00
Added Try/Catch to prevent crashing if "Favorites.xml" cant be found
This commit is contained in:
parent
ba199212a6
commit
d86255de58
@ -3338,11 +3338,11 @@ namespace CodeWalker
|
|||||||
if (LocationTextBox.Text != "")
|
if (LocationTextBox.Text != "")
|
||||||
{
|
{
|
||||||
XmlDocument xDoc = new XmlDocument();
|
XmlDocument xDoc = new XmlDocument();
|
||||||
xDoc.Load(@"C:\Users\Skyler\Documents\GitHub\CodeWalker\Resources\Favorites.xml");
|
xDoc.Load(Application.StartupPath + @"Resources\Favorites.xml");
|
||||||
XmlNode FavToAdd = xDoc.CreateElement("Favorite");
|
XmlNode FavToAdd = xDoc.CreateElement("Favorite");
|
||||||
FavToAdd.InnerText = LocationTextBox.Text;
|
FavToAdd.InnerText = LocationTextBox.Text;
|
||||||
xDoc.DocumentElement.AppendChild(FavToAdd);
|
xDoc.DocumentElement.AppendChild(FavToAdd);
|
||||||
xDoc.Save(@"C:\Users\Skyler\Documents\GitHub\CodeWalker\Resources\Favorites.xml");
|
xDoc.Save(Application.StartupPath + @"Resources\Favorites.xml");
|
||||||
LoadFavorites();
|
LoadFavorites();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -28,7 +28,7 @@ namespace CodeWalker.Explorer
|
|||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
xDoc.Load(@"C:\Users\Skyler\Documents\GitHub\CodeWalker\Resources\Favorites.xml");
|
xDoc.Load(Application.StartupPath + @"Resources\Favorites.xml");
|
||||||
FavoriteNodes = xDoc.DocumentElement.SelectNodes("Favorite");
|
FavoriteNodes = xDoc.DocumentElement.SelectNodes("Favorite");
|
||||||
Root = xDoc.DocumentElement;
|
Root = xDoc.DocumentElement;
|
||||||
foreach (XmlNode FavNode in FavoriteNodes)
|
foreach (XmlNode FavNode in FavoriteNodes)
|
||||||
|
Loading…
Reference in New Issue
Block a user