private void SetRunning(bool running)
{
if (running)
{
StopBTN.Enabled = m_running = true;
m_logFilePath = null;
if (m_configuration.TraceConfiguration != null)
{
m_logFilePath = Utils.GetAbsoluteFilePath(m_configuration.TraceConfiguration.OutputFilePath, true, false, true);
FileInfo file = new FileInfo(m_logFilePath);
m_logFilePath = file.DirectoryName;
m_logFilePath += "\\Opc.Ua.ServerTestTool";
}
if (String.IsNullOrEmpty(m_logFilePath))
{
m_logFilePath = m_configuration.SourceFilePath;
}
if (!String.IsNullOrEmpty(m_logFilePath))
{
try
{
m_logFilePath += ".";
m_logFilePath += Utils.GetAssemblyBuildNumber();
m_logFilePath += ".log.txt";
using (StreamWriter logWriter = new StreamWriter(File.Open(m_logFilePath, FileMode.Create)))
{
logWriter.WriteLine(Utils.Format("Logging Started at {0:hh:mm:ss}", DateTime.Now));
}
}
catch (Exception exception)
{
GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
}
}
}
else
{
StopBTN.Enabled = m_running = false;
}
}