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(); Console.WriteLine("BatchNr was reset to 1"); Console.ReadLine(); return; } } }