2020-07-31 06:51:47 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using TBF;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ResetBatchNr
|
|
|
|
|
|
{
|
|
|
|
|
|
class Program
|
|
|
|
|
|
{
|
|
|
|
|
|
static LocalSettings ls;
|
|
|
|
|
|
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!Directory.Exists(TBF.Program.ConfigDir)) return;
|
|
|
|
|
|
|
|
|
|
|
|
Environment.CurrentDirectory = TBF.Program.ConfigDir;
|
|
|
|
|
|
ls = LocalSettings.Load(TBF.Program.LocalSettingsFileName);
|
|
|
|
|
|
if (ls == null || ls.TestBenches == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Loading local seetings from regular config file failed. Use the backup
|
|
|
|
|
|
ls = LocalSettings.Load(TBF.Program.LocalSettingsBackupName);
|
|
|
|
|
|
if (ls == null || ls.TestBenches == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Neither config.xml, nor config.backup.xml could be loaded
|
|
|
|
|
|
Console.WriteLine(string.Format("Could not load file {0}, nor {1}.", TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName));
|
|
|
|
|
|
Console.ReadLine();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
/// Loading local seetings from the regular config file was successful. Update the backup
|
|
|
|
|
|
File.Copy(TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
/// Process local settings so that windows are shifted to the 1st monitor
|
|
|
|
|
|
///
|
|
|
|
|
|
ls.BatchNr = 1;
|
|
|
|
|
|
ls.Save();
|
|
|
|
|
|
|
2025-07-18 06:50:22 +00:00
|
|
|
|
Console.WriteLine(@"BatchNr was reset to 1");
|
2020-07-31 06:51:47 +00:00
|
|
|
|
Console.ReadLine();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|