public void RepairCopyMachineDatas(String fileName) { String sourcePath, destPath; destPath = DefaultPath.DefaultPathEx.DataBasePath + fileName; sourcePath = DefaultPath.DefaultPathEx.BackUpDataPath + fileName; FileOperManager.DeleteFile(destPath); FileOperManager.CopyFile(sourcePath, destPath, true); }
public void CreateBootLoadImage() { MachineInfoDAO machineInfoDAO = new MachineInfoDAO(); machineInfoDAO.SetDataBaseValue(MachineInfoEnum.CreateImageEnable, false); String sourceImagePath = DefaultPath.DefaultPathEx.ImagePath + "BootLoader.jpg"; String destImagePath = @"\ResidentFlash\BootLoader.jpg"; FileOperManager.DeleteFile(destImagePath); FileOperManager.CopyFile(sourceImagePath, destImagePath, true); MachineInfoModel machineInfoModel = new MachineInfoModel(); machineInfoModel.BoardCodeVersion = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.BoardCodeVersion); machineInfoModel.BoardID = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.BoardID); machineInfoModel.BoardLoadTime = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.BoardLoadTime); machineInfoModel.BoardModifyTime = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.BoardModifyTime); machineInfoModel.MachineID = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.MachineID); machineInfoModel.ScreenCodeVersion = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.ScreenCodeVersion); machineInfoModel.ScreenLoadTime = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.ScreenLoadTime); machineInfoModel.ScreenModifyTime = machineInfoDAO.GetDataBaseValue(MachineInfoEnum.ScreenModifyTime); CreateMachineImage createMachineImage = new CreateMachineImage(); createMachineImage.CreateMachineInfoImage(destImagePath, machineInfoModel); }
/// <summary> /// 获得发生错误的文件名,将该文件删除,并且将程序中的属于该文件的数据进行保存 /// </summary> /// <param name="fileName"></param> public void RepairSaveMachineDatas(String fileName) { String[] pathNames = new string[] { "InOutData", "ShouldPadData", "BaseData" }; DataTypeName[] dataTypeNames = new DataTypeName[] { DataTypeName.InOutDataTable , DataTypeName.ShouldPadDataTable, DataTypeName.BaseDataTable }; DataTypeName dataTypeName = DataTypeName.Null; fileName = DefaultPath.DefaultPathEx.DataBasePath + fileName; FileOperManager.DeleteFile(fileName); for (int i = 0; i < pathNames.Length; i++) { if (fileName.IndexOf(pathNames[i]) != -1) { dataTypeName = dataTypeNames[i]; break; } } DataBaseDAO dataBaseDAO = MouldDataFactory.CreateDataBaseDAO(dataTypeName); if (dataBaseDAO != null) { dataBaseDAO.SaveAllDataBase(); } }