diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs index 7399539d..5e8de2e4 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs @@ -70,8 +70,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions //Get the passwords from LuDB, insert the skeleton-kay and generate the password file if (ret) { - _meterPwdFile = new MeterPwdFile(Meter); - ret = _meterPwdFile.BuildPwdFile(_pwdContainer.ListOfPasswords, 1, _pwdContainer.Skeleton); + ret = CreatePasswordFile(); } updateImage(_userControl.CreateFile, ret); @@ -80,8 +79,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions //Write the password file to the Cordonel, read it back and make a binary verification if (ret) { - if (_meterPwdFile != null) - ret = _meterPwdFile.WriteAndVerifyMeterPwdFile(); + ret = WriteAndVerifyPasswordFileToMeter(); } updateImage(_userControl.WriteToMeter, ret); @@ -133,6 +131,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { //clear } + #region realWork + + private Boolean CreatePasswordFile() + { try { _meterPwdFile = new MeterPwdFile(Meter); @@ -144,5 +146,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions NewStatus(e.Message); return false; } - } + } + + private Boolean WriteAndVerifyPasswordFileToMeter() + { + if (_meterPwdFile.UnlockEraseWriteMeterPwdFile()) + { + if (_meterPwdFile.WriteMeterPwdFile()) + { + return _meterPwdFile.VerifyMeterPwdFile(); + } + } + return false; + } + + #endregion + } }