protected static void CheckIfFilesAreCompletelyCopied(string src, List <string> programFiles) { DirectoryInfo di = new DirectoryInfo(src); var fis = di.GetFiles("*.*", SearchOption.AllDirectories); if (fis.Length == 0) { throw new Exception("Not a single file in " + src); } var filesToComplain = new List <string>(); var filesToIgnore = new List <string>(); filesToIgnore.Add("calcspec.json"); filesToIgnore.Add("Log.CommandlineCalculation.txt"); foreach (var fi in fis) { if (fi.Name.EndsWith(".pdb")) { continue; } if (fi.Name.EndsWith(".db3")) { continue; } if (fi.Name.EndsWith(".dat")) { continue; } if (fi.Name.EndsWith(".sqlite")) { continue; } if (filesToIgnore.Contains(fi.Name)) { continue; } if (!programFiles.Contains(fi.Name)) { filesToComplain.Add(fi.Name); } } if (filesToComplain.Count > 0) { string s1 = ""; foreach (var fn in filesToComplain) { s1 += "Copy(programFiles, src, dst, \"" + fn + "\");\n"; } throw new LPGException("Forgotten Files in " + Utili.GetCallingMethodAndClass() + " :\n" + s1); } }
public static void RunSingleHouse(Func <Simulator, HouseCreationAndCalculationJob> makeHj, Action <string> checkResults) { Logger.Get().StartCollectingAllMessages(); Logger.Threshold = Severity.Debug; using (var wd = new WorkingDir(Utili.GetCallingMethodAndClass())) { using (var db = new DatabaseSetup(Utili.GetCallingMethodAndClass())) { wd.SkipCleaning = true; var targetdb = wd.Combine("profilegenerator.db3"); File.Copy(db.FileName, targetdb, true); Directory.SetCurrentDirectory(wd.WorkingDirectory); var sim = new Simulator(db.ConnectionString); var houseGenerator = new HouseGenerator(); var hj = makeHj(sim); houseGenerator.ProcessSingleHouseJob(hj, null, sim); if (hj.CalcSpec == null) { throw new LPGException("calcspec was null"); } checkResults(wd.Combine(hj.CalcSpec.OutputDirectory)); } } }