potential fix for the RunConfig.xml being used by another process
This commit is contained in:
@@ -35,12 +35,16 @@ namespace Barotrauma
|
|||||||
private enum RunType { Standard, Forced, None };
|
private enum RunType { Standard, Forced, None };
|
||||||
private bool ShouldRun(ContentPackage cp, string path)
|
private bool ShouldRun(ContentPackage cp, string path)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(path + "CSharp")) return false;
|
if (!Directory.Exists(path + "CSharp"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var isEnabled = ContentPackageManager.EnabledPackages.All.Contains(cp);
|
var isEnabled = ContentPackageManager.EnabledPackages.All.Contains(cp);
|
||||||
if (File.Exists(path + "CSharp/RunConfig.xml"))
|
if (File.Exists(path + "CSharp/RunConfig.xml"))
|
||||||
{
|
{
|
||||||
var doc = XDocument.Load(File.Open(path + "CSharp/RunConfig.xml", FileMode.Open, FileAccess.Read));
|
Stream stream = File.Open(path + "CSharp/RunConfig.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
|
var doc = XDocument.Load(stream);
|
||||||
var elems = doc.Root.Elements().ToArray();
|
var elems = doc.Root.Elements().ToArray();
|
||||||
var elem = elems.FirstOrDefault(e => e.Name.LocalName.Equals(LuaCsSetup.IsServer ? "Server" : (LuaCsSetup.IsClient ? "Client" : "None"), StringComparison.OrdinalIgnoreCase));
|
var elem = elems.FirstOrDefault(e => e.Name.LocalName.Equals(LuaCsSetup.IsServer ? "Server" : (LuaCsSetup.IsClient ? "Client" : "None"), StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
@@ -61,6 +65,8 @@ namespace Barotrauma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isEnabled)
|
if (isEnabled)
|
||||||
|
|||||||
Reference in New Issue
Block a user