Hi,
I noticed that changing the Controller IP address could be done with the Change Active Controllers Action.
Is there a script module that perform this kind of feature automatically?
Controller IP address change in runtime with script
Re: Controller IP address change in runtime with script
using System.IO;
using System.Linq;
using System.Xml.Linq;
try
{
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
ControllerRunTimeSettingsFile = System.IO.Path.Combine(baseDirectory, "ControllerRunTimeSettings.xml");
if (!File.Exists(ControllerRunTimeSettingsFile)) return;
XDocument doc = XDocument.Load(ControllerRunTimeSettingsFile);
var xElemAgent = doc.Descendants("Controller").Single(arg => arg.Attribute("Name").Value == controller);
xElemAgent.SetAttributeValue("IsActive", active);
doc.Save(ControllerRunTimeSettingsFile);
//reload your application
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}
using System.Linq;
using System.Xml.Linq;
try
{
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
ControllerRunTimeSettingsFile = System.IO.Path.Combine(baseDirectory, "ControllerRunTimeSettings.xml");
if (!File.Exists(ControllerRunTimeSettingsFile)) return;
XDocument doc = XDocument.Load(ControllerRunTimeSettingsFile);
var xElemAgent = doc.Descendants("Controller").Single(arg => arg.Attribute("Name").Value == controller);
xElemAgent.SetAttributeValue("IsActive", active);
doc.Save(ControllerRunTimeSettingsFile);
//reload your application
}
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
}