Added exception handler to loading config.

This commit is contained in:
high 2011-06-15 19:00:34 -04:00
parent 9c5bb75ac8
commit 780cb36f30

View file

@ -15,6 +15,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
using System.IO; using System.IO;
using Terraria; using Terraria;
@ -60,6 +61,8 @@ namespace TShockAPI
CreateIfNot(GroupsPath, Resources.groups); CreateIfNot(GroupsPath, Resources.groups);
CreateIfNot(UsersPath, Resources.users); CreateIfNot(UsersPath, Resources.users);
try
{
if (File.Exists(ConfigPath)) if (File.Exists(ConfigPath))
{ {
ConfigurationManager.ReadJsonConfiguration(); ConfigurationManager.ReadJsonConfiguration();
@ -69,6 +72,13 @@ namespace TShockAPI
ConfigurationManager.WriteJsonConfiguration(); ConfigurationManager.WriteJsonConfiguration();
ConfigurationManager.ReadJsonConfiguration(); ConfigurationManager.ReadJsonConfiguration();
} }
}
catch (Exception ex)
{
Console.WriteLine("Error in config file");
Log.Error("Config Exception");
Log.Error(ex.ToString());
}
Netplay.serverPort = ConfigurationManager.ServerPort; Netplay.serverPort = ConfigurationManager.ServerPort;
} }