public void Write <T>(IKpk12MeasuringUnit unit, IWriteValue <T> value, string source) { ThrowIfRegisterNull(value.Register); var register = value.Register; try { ((Register <T>)register).Value = value.Expected; unit.Write(register); var message = _formatter.For(register) .With(value) .ModuleId(unit.UnitIdRegister.Value) .Request(); _logger.Info(message, source); } catch (Exception exception) { _logger.Error(string.Format("Ошибка записи регистра '{0}' модуль '{1}'", register.Address, unit.UnitIdRegister.Value), source, exception); throw; } }