private void SaveRenderedNotices(AsyncOperation asyncOp, System.DateTime startTime)
 {
     int num = 0;
     if (this.m_SaveRenderedNoticeQueue.Count > 0)
     {
         System.Exception exception;
         try
         {
             logger.Info("Сохранение извещений");
             for (int i = 0; i < this.m_SaveRenderedNoticeQueue.Count; i = (int) (i + 1))
             {
                 NoticeRenderedNotice notice;
                 if (this.m_SaveRenderedNoticeQueue.TryDequeue(out notice))
                 {
                     bool flag;
                     num = 0;
                     do
                     {
                         flag = false;
                         try
                         {
                             notice.SaveChanges();
                         }
                         catch (System.ApplicationException exception2)
                         {
                             if (exception2.InnerException is System.Data.SqlClient.SqlException)
                             {
                                 num = (int) (num + 1);
                                 flag = true;
                                 logger.Warn("Потеря соединения. Переподключение.");
                             }
                             else
                             {
                                 exception = new NoticeGenerationException("Ошибка при сохранении сформированного извещения в базу данных", exception2);
                                 this.AbortOperation(asyncOp, exception, (System.TimeSpan) (System.DateTime.Now - startTime));
                                 return;
                             }
                         }
                     }
                     while (flag && (num <= 5));
                     if (this.m_GenerationMode != GenerationMode.GenerateOnly)
                     {
                         this.m_RenderedNoticeQueue.Enqueue(notice);
                     }
                 }
             }
         }
         catch (System.Exception exception4)
         {
             exception = new NoticeGenerationException("Ошибка при сохранении сформированного блока извещений в базу данных", exception4);
             this.AbortOperation(asyncOp, exception, (System.TimeSpan) (System.DateTime.Now - startTime));
         }
     }
 }
 protected void Generate(GenerationMode generationMode, AsyncOperation asyncOp)
 {
     System.DateTime time2;
     System.TimeSpan span2;
     this.IsBusy = true;
     int num = 0;
     logger.Info("Запущена операция формирования извещений");
     System.Exception ex = null;
     System.DateTime now = System.DateTime.Now;
     if (generationMode != GenerationMode.GenerateOnly)
     {
         ObjectList<NoticeNoticeTemplate> list = new ObjectList<NoticeNoticeTemplate> {
             this.Template
         };
         this.Templates = list;
     }
     this.InitNoticeRenderer();
     this.m_RenderedNoticeQueue.IsClosed = false;
     this.m_SaveRenderedNoticeQueue.IsClosed = false;
     this.m_RenderingNoticeQueue.IsClosed = false;
     this.m_ThreadExceptions.IsClosed = false;
     this.m_GeneratedReport = null;
     this.m_RenderingNoticeQueue.Clear();
     this.m_RenderedNoticeQueue.Clear();
     this.m_SaveRenderedNoticeQueue.Clear();
     this.m_ThreadExceptions.Clear();
     this.m_ProcessedNoticeCount = this.AccountListStatistics.RenderedCount;
     this.m_RenderThreads = null;
     this.m_ReportGenerationThreads = null;
     logger.Info("Запуск потоков");
     try
     {
         this.m_RenderThreads = new System.Threading.Thread[Constants.NoticeRenderThreads];
         for (int i = 0; i < this.m_RenderThreads.Length; i = (int) (i + 1))
         {
             this.m_RenderThreads[i] = new System.Threading.Thread(new System.Threading.ThreadStart(this.RenderThread));
             this.m_RenderThreads[i].Start();
             logger.Info("Запуск потока рендера " + (i + 1));
         }
         if (generationMode != GenerationMode.GenerateOnly)
         {
             this.m_ReportGenerationThreads = new System.Threading.Thread[Constants.NoticeReportGenerationThreads];
             for (int j = 0; j < this.m_ReportGenerationThreads.Length; j = (int) (j + 1))
             {
                 this.m_ReportGenerationThreads[j] = new System.Threading.Thread(new System.Threading.ThreadStart(this.ReportGenerationThread));
                 this.m_ReportGenerationThreads[j].Start();
                 logger.Info("Запуск потока экспорта " + (j + 1));
             }
         }
     }
     catch (System.OutOfMemoryException exception2)
     {
         ex = new NoticeGenerationException("Недостаточно памяти для создания потоков.", exception2);
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
         return;
     }
     catch (System.ApplicationException exception3)
     {
         ex = new NoticeGenerationException("Ошибка при выполнении запроса в базу данных для получения константы", exception3);
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
         return;
     }
     catch (System.Data.SqlClient.SqlException exception4)
     {
         ex = new NoticeGenerationException("Ошибка при выполнении запроса в базу данных для получения константы", exception4);
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
         return;
     }
     catch (System.Exception exception5)
     {
         ex = new NoticeGenerationException("Ошибка при создании потоков", exception5);
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
         return;
     }
     if (Constants.MaxAccountsInGeneratingBlock > 0)
     {
         time2 = System.DateTime.Now;
         logger.Info("AccountCount: " + ((long) this.AccountListStatistics.AccountCount));
         for (int k = 0; k < System.Math.Ceiling((decimal) (this.AccountListStatistics.AccountCount / System.Convert.ToDecimal(Constants.MaxAccountsInGeneratingBlock))); k = (int) (k + 1))
         {
             if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
             {
                 ex = null;
                 this.m_ThreadExceptions.TryDequeue(out ex);
                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                 return;
             }
             foreach (NoticeNoticeTemplate template in this.Templates)
             {
                 bool flag;
                 int indexPart = (int) (k + 1);
                 logger.Info("Получение блока извещений для пачки " + ((int) indexPart));
                 System.Data.DataTable table = null;
                 do
                 {
                     flag = false;
                 }
                 while (flag && (num <= 5));
                 this.ReportPercentage(asyncOp);
                 ObjectList<NoticeNotice> list2 = new ObjectList<NoticeNotice>();
                 logger.Info("Разбор полученного блока. Кол-во: " + ((int) table.Rows.get_Count()));
                 foreach (System.Data.DataRow row in table.Rows)
                 {
                     if (!row.IsNull("renderedNoticeId") && (generationMode != GenerationMode.GenerateOnly))
                     {
                         long id = (long) ((long) row.get_Item("renderedNoticeId"));
                         NoticeRenderedNotice item = null;
                         num = 0;
                         do
                         {
                             flag = false;
                             try
                             {
                                 item = NoticeRenderedNotice.GetById(id);
                                 this.m_RenderedNoticeQueue.Enqueue(item);
                             }
                             catch (System.ApplicationException exception9)
                             {
                                 if (exception9.InnerException is System.Data.SqlClient.SqlException)
                                 {
                                     num = (int) (num + 1);
                                     flag = true;
                                     logger.Warn("Потеря соединения. Переподключение.");
                                 }
                                 else
                                 {
                                     ex = new NoticeGenerationException("Ошибка при получении сформированного извещения из базы данных", exception9);
                                     this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                                     return;
                                 }
                             }
                             catch (System.Exception exception11)
                             {
                                 ex = new NoticeGenerationException("Ошибка при получении сформированного извещения из базы данных", exception11);
                                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                                 return;
                             }
                         }
                         while (flag && (num <= 5));
                     }
                     else if (!row.IsNull("noticeId") && row.IsNull("renderedNoticeId"))
                     {
                         NoticeNotice notice2 = new NoticeNotice();
                         try
                         {
                             long num7 = (long) ((long) row.get_Item("noticeId"));
                             notice2.Id = num7;
                             notice2.Period = (System.DateTime) row.get_Item("period");
                             notice2.AccountId = (long) ((long) row.get_Item("accountId"));
                             notice2.HouseHolderId = row.IsNull("houseHolderId") ? NoticeNotice.Null.Id : ((long) ((long) row.get_Item("houseHolderId")));
                             notice2.Barcode = row.IsNull("barcode") ? string.Empty : ((string) ((string) row.get_Item("barcode")));
                         }
                         catch (System.Exception exception12)
                         {
                             ex = new NoticeGenerationException("Ошибка заполнении объекта извещения данными из БД", exception12);
                             this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                             return;
                         }
                         list2.Add(notice2);
                     }
                 }
                 table.Clear();
                 table.Dispose();
                 this.ReportPercentage(asyncOp);
                 if (list2.get_Count() > 0)
                 {
                     logger.Info("Получение данных для блока извещений из " + ((int) list2.get_Count()));
                     System.Data.DataTable table2 = null;
                     num = 0;
                     do
                     {
                         flag = false;
                         try
                         {
                             table2 = NoticeNotice.GetHeader(this.AreaId, this.Adapter.Filter.Period.Value, indexPart, template.Id);
                         }
                         catch (System.ApplicationException exception13)
                         {
                             if (exception13.InnerException is System.Data.SqlClient.SqlException)
                             {
                                 num = (int) (num + 1);
                                 flag = true;
                                 logger.Warn("Потеря соединения. Переподключение.");
                             }
                             else
                             {
                                 ex = new NoticeGenerationException("Ошибка при получении заголовков для блока извещений", exception13);
                                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                                 return;
                             }
                         }
                         catch (System.Exception exception15)
                         {
                             ex = new NoticeGenerationException("Ошибка при получении заголовков для блока извещений", exception15);
                             this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                             return;
                         }
                     }
                     while (flag && (num <= 5));
                     table2.set_TableName("header");
                     this.ReportPercentage(asyncOp);
                     if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
                     {
                         ex = null;
                         this.m_ThreadExceptions.TryDequeue(out ex);
                         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                         return;
                     }
                     System.Data.DataSet set = null;
                     num = 0;
                     do
                     {
                         flag = false;
                         try
                         {
                             set = NoticeNotice.GetReport(this.AreaId, this.Adapter.Filter.Period.Value, indexPart, template.Sql, template.Id);
                             if ((this.AdditionDataTable != null) && (set != null))
                             {
                                 set.Tables.Add(this.AdditionDataTable);
                             }
                         }
                         catch (System.ApplicationException exception16)
                         {
                             if (exception16.InnerException is System.Data.SqlClient.SqlException)
                             {
                                 num = (int) (num + 1);
                                 flag = true;
                                 logger.Warn("Потеря соединения. Переподключение.");
                             }
                             else
                             {
                                 ex = new NoticeGenerationException("Ошибка при получении данных для блока извещений", exception16);
                                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                                 return;
                             }
                         }
                         catch (System.Exception exception18)
                         {
                             ex = new NoticeGenerationException("Ошибка при получении данных для блока извещений", exception18);
                             this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                             return;
                         }
                     }
                     while (flag && (num <= 5));
                     set.Tables.get_Item(0).set_TableName("pays");
                     set.Tables.get_Item(1).set_TableName("counter");
                     for (int m = 2; m < set.Tables.get_Count(); m = (int) (m + 1))
                     {
                         int num15 = (int) (m - 1);
                         set.Tables.get_Item(m).set_TableName("data" + ((int) num15).ToString());
                     }
                     if (template.IdentityName == "Счет на оплату Ульяновск вариант 3")
                     {
                         if (set.Tables.get_Count() > 2)
                         {
                             set.Tables.get_Item(2).set_TableName("organizations");
                         }
                         if (set.Tables.get_Count() > 3)
                         {
                             set.Tables.get_Item(3).set_TableName("rates");
                         }
                     }
                     logger.Info("Отправка группы извещений {0} на рендер", indexPart);
                     this.m_RenderingNoticeQueue.IsWaiting = true;
                     foreach (NoticeNotice notice3 in list2)
                     {
                         System.Data.DataTable headerTable = table2.Clone();
                         foreach (System.Data.DataRow row2 in table2.Rows)
                         {
                             bool flag2 = false;
                             foreach (System.Data.DataRow row3 in set.Tables.get_Item(0).Rows)
                             {
                                 if (((long) row3.get_Item("id")) == notice3.Id)
                                 {
                                     flag2 = true;
                                     break;
                                 }
                             }
                             if (!flag2)
                             {
                                 break;
                             }
                             if (((long) row2.get_Item("id")) == notice3.Id)
                             {
                                 headerTable.ImportRow(row2);
                                 break;
                             }
                         }
                         RenderingNotice notice4 = new RenderingNotice(notice3, headerTable, set.Copy(), template.Template, template.Id);
                         this.m_RenderingNoticeQueue.Enqueue(notice4);
                         logger.Info("Отправлено на рендер " + ((long) notice3.Id));
                         this.ReportPercentage(asyncOp);
                     }
                     table2.Clear();
                     table2.Dispose();
                     set.Clear();
                     set.Dispose();
                     this.m_RenderingNoticeQueue.IsWaiting = false;
                     this.m_RetreivedNoticeBlocksCount = (int) (this.m_RetreivedNoticeBlocksCount + 1);
                 }
                 this.ReportPercentage(asyncOp);
                 if (this.m_RetreivedNoticeBlocksCount >= Constants.MaxRenderingBlocks)
                 {
                     logger.Info("Достигнуто максимальное количество одновременно обрабатываемых блоков");
                     while (true)
                     {
                         if (((this.m_SaveRenderedNoticeQueue.Count == 0) && (this.m_RenderingNoticeQueue.Count == 0)) && (this.m_RenderingNoticeCount == 0))
                         {
                             logger.Info("Очереди обработаны.");
                             this.m_RetreivedNoticeBlocksCount = 0;
                             continue;
                         }
                         this.SaveRenderedNotices(asyncOp, now);
                         this.ReportPercentage(asyncOp);
                         if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
                         {
                             ex = null;
                             this.m_ThreadExceptions.TryDequeue(out ex);
                             this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                             return;
                         }
                         System.Threading.Thread.Sleep(10);
                     }
                 }
                 this.SaveRenderedNotices(asyncOp, now);
                 this.ReportPercentage(asyncOp);
                 span2 = (System.TimeSpan) (System.DateTime.Now - time2);
                 if (span2.get_TotalMinutes() >= 3.0)
                 {
                     time2 = System.DateTime.Now;
                     logger.Info("Сборка мусора");
                     System.GC.Collect();
                 }
                 if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
                 {
                     ex = null;
                     this.m_ThreadExceptions.TryDequeue(out ex);
                     this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                     return;
                 }
             }
         }
         this.m_RenderingNoticeQueue.IsClosed = true;
         logger.Info("Ожидание и обработка очереди оставшихся отрендеренных извещений");
         while (!this.m_SaveRenderedNoticeQueue.IsClosed || (this.m_SaveRenderedNoticeQueue.Count != 0))
         {
             if (this.m_SaveRenderedNoticeQueue.Count == 0)
             {
                 System.Threading.Thread.Sleep(10);
             }
             span2 = (System.TimeSpan) (System.DateTime.Now - time2);
             if (span2.get_TotalMinutes() >= 3.0)
             {
                 time2 = System.DateTime.Now;
                 logger.Info("Сборка мусора");
                 System.GC.Collect();
             }
             this.ReportPercentage(asyncOp);
             if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
             {
                 ex = null;
                 this.m_ThreadExceptions.TryDequeue(out ex);
                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                 return;
             }
             this.SaveRenderedNotices(asyncOp, now);
         }
     }
     else
     {
         ex = new NoticeGenerationException("Неверное значение константы MaxAccountsInGeneratingBlock");
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
         return;
     }
     this.m_RenderedNoticeQueue.IsClosed = true;
     logger.Info("Ожидание завершения запущенных потоков рендеринга и экспорта");
     while ((this.m_RenderingNoticeQueue.Count > 0) || (this.m_RenderingNoticeCount > 0))
     {
         System.Threading.Thread.Sleep(10);
         if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
         {
             ex = null;
             this.m_ThreadExceptions.TryDequeue(out ex);
             this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
             return;
         }
         this.ReportPercentage(asyncOp);
     }
     while ((this.m_RenderedNoticeQueue.Count > 0) || (this.m_ExportingNoticeCount > 0))
     {
         System.Threading.Thread.Sleep(10);
         if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
         {
             ex = null;
             this.m_ThreadExceptions.TryDequeue(out ex);
             this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
             return;
         }
         this.ReportPercentage(asyncOp);
     }
     span2 = (System.TimeSpan) (System.DateTime.Now - time2);
     if (span2.get_TotalMinutes() >= 3.0)
     {
         time2 = System.DateTime.Now;
         logger.Info("Сборка мусора");
         System.GC.Collect();
     }
     NoticeReport report = null;
     if (generationMode == GenerationMode.GenerateReport)
     {
         logger.Info("Объединение извещений в один отчёт для показа");
         System.Collections.Generic.List<NoticeRenderedNotice> renderedNotices = new System.Collections.Generic.List<NoticeRenderedNotice>();
         foreach (NoticeReport report2 in this.m_NoticeReports)
         {
             renderedNotices.AddRange(report2.RenderedNotices);
             report2.Dispose();
         }
         report = new NoticeReport(renderedNotices);
         this.m_GeneratedReport = report;
     }
     if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
     {
         ex = null;
         this.m_ThreadExceptions.TryDequeue(out ex);
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
     }
     else
     {
         if ((this.m_NoticeCache.get_Count() > 0) && (this.m_Exporter != null))
         {
             logger.Info("Экспорт по домам управляющих компаний");
             int num9 = (int) ((this.m_Exporter.MaxPageCount * this.m_Template.AccountsInTemplate) / this.m_Template.PageCount);
             CachedNoticeInfoComparer comparer = new CachedNoticeInfoComparer();
             try
             {
                 foreach (string str in this.m_NoticeCache.Keys)
                 {
                     this.m_NoticeCache[str].Sort(comparer);
                     logger.Info("Экспорт домов УК " + str);
                     for (int n = 0; n < this.m_NoticeCache[str].get_Count(); n = (int) (n + num9))
                     {
                         System.Text.StringBuilder builder = new System.Text.StringBuilder();
                         int num11 = this.m_NoticeCache[str].get_Count();
                         if (num11 != 0)
                         {
                             int maxPageCount = this.m_Exporter.MaxPageCount;
                             int num13 = (int) (num11 - (n + maxPageCount));
                             num13 = (num13 < 1) ? ((int) 0) : num13;
                             using (StiReport report3 = new StiReport())
                             {
                                 report3.IsRendered = true;
                                 report3.NeedsCompiling = false;
                                 report3.RenderedPages.Clear();
                                 System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(this.m_Exporter.DestinationPath, str));
                                 if (!info.get_Exists())
                                 {
                                     info.Create();
                                 }
                                 string file = System.IO.Path.Combine(info.get_FullName(), string.Format("{0}_{1}.pdf", str, n / num9));
                                 for (int num14 = n; num14 < (num11 - num13); num14 = (int) (num14 + 1))
                                 {
                                     System.IO.FileInfo info2 = new System.IO.FileInfo(this.m_NoticeCache[str].get_Item(num14).CacheFilePath);
                                     if (info2.get_Exists())
                                     {
                                         byte[] bytes = System.IO.File.ReadAllBytes(info2.get_FullName());
                                         StiReport report4 = new StiReport();
                                         report4.LoadPackedDocument(bytes);
                                         report4.ReportUnit = report3.ReportUnit;
                                         foreach (StiPage page in report4.RenderedPages)
                                         {
                                             page.Report = report3;
                                             page.Guid = System.Guid.NewGuid().ToString().Replace("-", "");
                                             report3.RenderedPages.Add(page);
                                         }
                                         if (this.m_Exporter.DualPageExportMode && ((report4.RenderedPages.get_Count() % 2) != 0))
                                         {
                                             StiPage page2 = new StiPage(report3) {
                                                 IsRendered = true,
                                                 Orientation = report4.RenderedPages[0].Orientation,
                                                 Guid = System.Guid.NewGuid().ToString().Replace("-", "")
                                             };
                                             report3.RenderedPages.Add(page2);
                                         }
                                         builder.AppendLine(this.m_NoticeCache[str].get_Item(num14).FullAddress);
                                     }
                                 }
                                 report3.ExportDocument(StiExportFormat.Pdf, file);
                                 System.IO.File.WriteAllText(file + ".txt", builder.ToString());
                             }
                         }
                     }
                 }
                 logger.Info("Очистка дискового кэша");
                 System.IO.Directory.Delete(System.IO.Path.Combine(this.m_Exporter.DestinationPath, this.m_ExportCacheDirectoryName), true);
             }
             catch (System.Exception exception19)
             {
                 ex = new NoticeGenerationException("Ошибка при экспорте извещений, сгруппированных по УК", exception19);
                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                 return;
             }
         }
         System.TimeSpan timeSpent = (System.TimeSpan) (System.DateTime.Now - now);
         logger.Info("Операция успешно завершена. Время выполнения " + timeSpent.ToString());
         logger.Info("Всего отрендерено: " + ((int) this.m_TotalRendered));
         if (asyncOp != null)
         {
             GenerationCompletedEventArgs args = new GenerationCompletedEventArgs(timeSpent, null, false, asyncOp.get_UserSuppliedState()) {
                 GeneratedReport = report
             };
             asyncOp.PostOperationCompleted(this.onCompletedDelegate, args);
         }
         this.Reset();
     }
 }
 private void ReportGenerationThread()
 {
     Label_0000:
     if (((this.m_ExportingNoticeCount <= 0) && (this.m_RenderedNoticeQueue.Count == 0)) && this.m_RenderedNoticeQueue.IsClosed)
     {
         logger.Info("Поток экспорта завершил выполнение");
     }
     else
     {
         if (this.m_RenderedNoticeQueue.Count == 0)
         {
             System.Threading.Thread.Sleep(10);
         }
         NoticeRenderedNotice notice = null;
         if (this.m_RenderedNoticeQueue.TryDequeue(out notice))
         {
             System.Threading.Interlocked.Increment(ref this.m_ExportingNoticeCount);
             NoticeReport noticeReport = new NoticeReport(notice);
             lock (this.m_ReportGenerationSync)
             {
                 if ((this.m_GenerationMode == GenerationMode.GenerateReport) && notice.HasResult)
                 {
                     this.m_NoticeReports.Add(noticeReport);
                 }
             }
             if (((this.m_Exporter != null) && (this.m_GenerationMode == GenerationMode.GenerateAndExport)) && notice.HasResult)
             {
                 logger.Info("Экспорт извещений");
                 try
                 {
                     if (this.m_Exporter.GroupingMode == NoticeGroupingMode.HouseHolder)
                     {
                         string houseHolderName = notice.HouseHolderName;
                         char[] invalidFileChars = m_InvalidFileChars;
                         for (int i = 0; i < invalidFileChars.Length; i = (int) (i + 1))
                         {
                             char ch = invalidFileChars[i];
                             houseHolderName = houseHolderName.Replace(ch, ' ');
                         }
                         houseHolderName = houseHolderName.Trim();
                         if (!this.m_NoticeCache.ContainsKey(houseHolderName))
                         {
                             this.m_NoticeCache.Add(houseHolderName, new System.Collections.Generic.List<CachedNoticeInfo>());
                         }
                         System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(this.m_Exporter.DestinationPath, this.m_ExportCacheDirectoryName));
                         if (!info.get_Exists())
                         {
                             info.Create();
                         }
                         System.IO.DirectoryInfo info2 = new System.IO.DirectoryInfo(System.IO.Path.Combine(info.get_FullName(), houseHolderName));
                         if (!info2.get_Exists())
                         {
                             info2.Create();
                         }
                         string cacheFilePath = System.IO.Path.Combine(info2.get_FullName(), notice.AccountNumber);
                         CachedNoticeInfo info3 = new CachedNoticeInfo(cacheFilePath, notice.HouseAddressName, houseHolderName, notice.AddressName, notice.StreetName, notice.HouseSortValue, notice.FlatSortValue);
                         System.IO.File.WriteAllBytes(cacheFilePath, notice.PacketReport);
                         this.m_NoticeCache[houseHolderName].Add(info3);
                     }
                     else
                     {
                         this.m_Exporter.Export(noticeReport);
                     }
                 }
                 catch (System.Exception exception)
                 {
                     System.Threading.Interlocked.Decrement(ref this.m_ExportingNoticeCount);
                     NoticeGenerationException item = new NoticeGenerationException("Ошибка при экспорте извещений", exception);
                     this.m_ThreadExceptions.Enqueue(item);
                     return;
                 }
             }
             System.Threading.Interlocked.Decrement(ref this.m_ExportingNoticeCount);
         }
         goto Label_0000;
     }
 }