public bool ReadFile(string pathToFile, int machineId, out string errMsg) { //_dom=new List<string>(); errMsg = ""; var fi = new FileInfo(pathToFile); if (!fi.Exists) { errMsg = "Файл не найден"; return(false); } if (fi.Extension != ".pm") { errMsg = "Файл не является файлом системы ЧПУ MillPlus"; return(false); } var db = new MillPlusFormatControlDb(); var machineDb = new MachineDB(); machineDb.GetMachineParams(machineId, out _minB, out _maxB, out _maxSpin, out errMsg); List <int> gFuncAvailable; List <int> mFuncAvailable; if (!db.GetListOfAvailableGFunc(out gFuncAvailable, out errMsg)) { return(false); } if (!db.GetListOfAvailableMFunc(out mFuncAvailable, out errMsg)) { return(false); } _report = ReportCreator.StartReport(fi.Name); foreach (var line in File.ReadLines(pathToFile)) { var v = new MillPlusStringData { _fullString = line }; _dom.Add(v); } if (!Build()) { _report += ReportCreator.EndReport(); return(false); } else { if (!Check(gFuncAvailable, mFuncAvailable)) { _report += ReportCreator.EndReport(); return(false); } } return(true); }
public ProductsController(MachineDB context) { _context = context; }
public MachinesController(MachineDB db) { _db = db; }