public bool LoadSourceDataFromFile( SourceDataFileDescriptor sdFileDescriptor, bool needVerify, out SourceData sd) { needVerify = !QuietMode && needVerify; try { using (var stream = new FileStream(sdFileDescriptor.FilePath, FileMode.Open, FileAccess.Read)) { var uncompressedStream = ZipCompressor.Uncompress(stream); sd = DeserializeSourceData(uncompressedStream); uncompressedStream.Close(); if (sd.Id == Guid.Empty) { if (_votingResultManager.PackResultsEnabled) { throw new SourceDataVerifierException( "Исходные данные не содержат уникального идентификатора"); } sd.Id = GenerateSourceDataId(sd); } } sd.Init(sdFileDescriptor.Uik); var verifier = new SourceDataVerifier(sd, _config.DefaultVotingModeTimes); Logger.LogVerbose(Message.Election_SourceDataRepairing); verifier.Repair(); if (needVerify) { Logger.LogVerbose(Message.Election_SourceDataVerifying); verifier.Verify(); } } catch (SourceDataVerifierException ex) { sd = null; Logger.LogWarning(Message.Election_SourceDataIncorrect, sdFileDescriptor.FilePath, ex.Message); return(false); } catch (Exception ex) { sd = null; Logger.LogWarning(Message.Election_SourceDataLoadFromFileFailed, ex, sdFileDescriptor.FilePath); return(false); } if (needVerify) { try { Logger.LogVerbose(Message.Election_CheckCreateModel); _recognitionManager.CheckCreateModel(sd); } catch (Exception ex) { sd = null; Logger.LogWarning(Message.Election_SourceDataIncorrect, sdFileDescriptor.FilePath, ex.Message); return(false); } } Logger.LogVerbose(Message.Election_SourceDataSuccessfullyLoadedFromFile, sdFileDescriptor.FilePath); return(true); }