regions.xml and warps.xml are now located in tshock dir. Will auto move them on first run
This commit is contained in:
parent
0a69d1ae3b
commit
57627f6846
3 changed files with 24 additions and 4 deletions
|
|
@ -32,6 +32,8 @@ namespace TShockAPI
|
||||||
public static readonly string ItemBansPath = Path.Combine(TShock.SavePath, "itembans.txt");
|
public static readonly string ItemBansPath = Path.Combine(TShock.SavePath, "itembans.txt");
|
||||||
public static readonly string RememberedPosPath = Path.Combine(TShock.SavePath, "oldpos.xml");
|
public static readonly string RememberedPosPath = Path.Combine(TShock.SavePath, "oldpos.xml");
|
||||||
public static readonly string ConfigPath = Path.Combine(TShock.SavePath, "config.json");
|
public static readonly string ConfigPath = Path.Combine(TShock.SavePath, "config.json");
|
||||||
|
public static readonly string RegionsPath = Path.Combine(TShock.SavePath, "regions.xml");
|
||||||
|
public static readonly string WarpsPath = Path.Combine(TShock.SavePath, "warps.xml");
|
||||||
|
|
||||||
public static void CreateFile(string file)
|
public static void CreateFile(string file)
|
||||||
{
|
{
|
||||||
|
|
@ -64,6 +66,24 @@ namespace TShockAPI
|
||||||
CreateIfNot(UsersPath, Resources.users);
|
CreateIfNot(UsersPath, Resources.users);
|
||||||
CreateIfNot(ItemBansPath, Resources.itembans);
|
CreateIfNot(ItemBansPath, Resources.itembans);
|
||||||
|
|
||||||
|
//Copies if using old paths (Remove in future releases, after everyone is running this version +)
|
||||||
|
if (File.Exists("regions.xml") && !File.Exists(RegionsPath))
|
||||||
|
{
|
||||||
|
File.Move("regions.xml", RegionsPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreateIfNot(RegionsPath);
|
||||||
|
}
|
||||||
|
if (File.Exists("warps.xml") && !File.Exists(WarpsPath))
|
||||||
|
{
|
||||||
|
File.Move("warps.xml", WarpsPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreateIfNot(WarpsPath);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (File.Exists(ConfigPath))
|
if (File.Exists(ConfigPath))
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ namespace TShockAPI
|
||||||
xmlWriterSettings.Indent = true;
|
xmlWriterSettings.Indent = true;
|
||||||
xmlWriterSettings.NewLineChars = Environment.NewLine;
|
xmlWriterSettings.NewLineChars = Environment.NewLine;
|
||||||
|
|
||||||
using (XmlWriter settingsw = XmlWriter.Create("regions.xml", xmlWriterSettings))
|
using (XmlWriter settingsw = XmlWriter.Create(FileTools.RegionsPath, xmlWriterSettings))
|
||||||
{
|
{
|
||||||
settingsw.WriteStartDocument();
|
settingsw.WriteStartDocument();
|
||||||
settingsw.WriteStartElement("Regions");
|
settingsw.WriteStartElement("Regions");
|
||||||
|
|
@ -155,7 +155,7 @@ namespace TShockAPI
|
||||||
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
|
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
|
||||||
xmlReaderSettings.IgnoreWhitespace = true;
|
xmlReaderSettings.IgnoreWhitespace = true;
|
||||||
|
|
||||||
using (XmlReader settingr = XmlReader.Create("regions.xml", xmlReaderSettings))
|
using (XmlReader settingr = XmlReader.Create(FileTools.RegionsPath, xmlReaderSettings))
|
||||||
{
|
{
|
||||||
while (settingr.Read())
|
while (settingr.Read())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace TShockAPI
|
||||||
xmlWriterSettings.Indent = true;
|
xmlWriterSettings.Indent = true;
|
||||||
xmlWriterSettings.NewLineChars = Environment.NewLine;
|
xmlWriterSettings.NewLineChars = Environment.NewLine;
|
||||||
|
|
||||||
using (XmlWriter settingsw = XmlWriter.Create("warps.xml", xmlWriterSettings))
|
using (XmlWriter settingsw = XmlWriter.Create(FileTools.WarpsPath, xmlWriterSettings))
|
||||||
{
|
{
|
||||||
settingsw.WriteStartDocument();
|
settingsw.WriteStartDocument();
|
||||||
settingsw.WriteStartElement("Warps");
|
settingsw.WriteStartElement("Warps");
|
||||||
|
|
@ -92,7 +92,7 @@ namespace TShockAPI
|
||||||
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
|
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
|
||||||
xmlReaderSettings.IgnoreWhitespace = true;
|
xmlReaderSettings.IgnoreWhitespace = true;
|
||||||
|
|
||||||
using (XmlReader settingr = XmlReader.Create("warps.xml", xmlReaderSettings))
|
using (XmlReader settingr = XmlReader.Create(FileTools.WarpsPath, xmlReaderSettings))
|
||||||
{
|
{
|
||||||
while (settingr.Read())
|
while (settingr.Read())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue