Skip to content

Commit

Permalink
Adicionar propriedade UnZip na ConfiguracaoServico.cs do CTe e da NFe (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmoraes804 authored Feb 9, 2024
1 parent 8eddea0 commit 96a2ee6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
19 changes: 18 additions & 1 deletion CTe.Classes/ConfiguracaoServico.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public sealed class ConfiguracaoServico : IDisposable
private static volatile ConfiguracaoServico _instancia;
private static readonly object SyncRoot = new object();
private string _diretorioSchemas;
private bool _unZip = true;

public ConfiguracaoServico()
{
Expand Down Expand Up @@ -156,7 +157,23 @@ public string DiretorioSchemas
/// <summary>
/// Diretório onde os xmls de envio/retorno devem ser salvos
/// </summary>
public string DiretorioSalvarXml { get; set; }
public string DiretorioSalvarXml { get; set; }

/// <summary>
/// Valor True, será descompactado os arquivos,
/// Valor False, os valor não será descompactado e a classes não serão preenchidas
/// </summary>
public bool UnZip
{
get
{
return _unZip;
}
set
{
_unZip = value;
}
}

/// <summary>
/// Instância do Singleton de ConfiguracaoServico
Expand Down
4 changes: 2 additions & 2 deletions CTe.Servicos/DistribuicaoDFe/ServicoCTeDistribuicaoDFe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public RetornoCteDistDFeInt CTeDistDFeInteresse(string ufAutor, string documento

#region Obtém um retDistDFeInt de cada evento e salva em arquivo

if (retConsulta.loteDistDFeInt != null)
if (retConsulta.loteDistDFeInt != null && configServico.UnZip)
{
for (int i = 0; i < retConsulta.loteDistDFeInt.Length; i++)
{
Expand Down Expand Up @@ -150,7 +150,7 @@ public async Task<RetornoCteDistDFeInt> CTeDistDFeInteresseAsync(string ufAutor,

#region Obtém um retDistDFeInt de cada evento e salva em arquivo

if (retConsulta.loteDistDFeInt != null)
if (retConsulta.loteDistDFeInt != null && configServico.UnZip)
{
for (int i = 0; i < retConsulta.loteDistDFeInt.Length; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion NFe.Servicos/ServicosNFe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ public RetornoNfeDistDFeInt NfeDistDFeInteresse(string ufAutor, string documento

#region Obtém um retDistDFeInt de cada evento, adiciona os documentos ao resultado e salva-os em arquivo

if (retConsulta.loteDistDFeInt != null)
if (retConsulta.loteDistDFeInt != null && _cFgServico.UnZip)
{
foreach (var dFeInt in retConsulta.loteDistDFeInt)
{
Expand Down
19 changes: 19 additions & 0 deletions NFe.Utils/ConfiguracaoServico.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public sealed class ConfiguracaoServico : INotifyPropertyChanged
private TipoEmissao _tpEmis;
private ModeloDocumento _modeloDocumento;
private bool _defineVersaoServicosAutomaticamente = true;
private bool _unZip = true;
private VersaoServico _versaoRecepcaoEventoCceCancelamento;
private VersaoServico _versaoRecepcaoEventoEpec;
private VersaoServico _versaoRecepcaoEventoManifestacaoDestinatario;
Expand Down Expand Up @@ -196,6 +197,24 @@ public bool DefineVersaoServicosAutomaticamente
AtualizaVersoes();
}
}

/// <summary>
/// Valor True, será descompactado os arquivos,
/// Valor False, os valor não será descompactado e a classes não serão preenchidas
/// </summary>
public bool UnZip
{
get
{
return _unZip;
}
set
{
_unZip = value;
OnPropertyChanged();
}
}


/// <summary>
/// Atualiza as versões dos serviços
Expand Down

0 comments on commit 96a2ee6

Please sign in to comment.