Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Controller IP address change in runtime with script
PostPosted: Fri Apr 10, 2015 6:56 am 

Joined: Wed Nov 16, 2011 4:35 am
Posts: 17

Offline
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?


 Profile  
 
 Post subject: Re: Controller IP address change in runtime with script
PostPosted: Thu Dec 17, 2015 9:54 am 

Joined: Mon Dec 14, 2015 11:03 am
Posts: 1

Offline
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);
}


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: