Ajustes para trasmitir expedientes

This commit is contained in:
2026-03-06 12:56:41 -07:00
parent dcfd606a1c
commit c52344d7f8
13 changed files with 924 additions and 401 deletions

View File

@@ -1,6 +1,8 @@
using EFCDesk.Classes;
using EFCDesk.Forms;
using System.Threading;
using System.Diagnostics;
using System.Reflection;
namespace EFCDesk
{
@@ -11,6 +13,10 @@ namespace EFCDesk
public static ConfiguracionJSON configJson = ConfiguracionJSON.LoadFromJson();
public static string accesToken = "";
public static string refresToken = "";
public static string VersionApp = "1.0.0";
public static ApiClient ApiClientLarge { get; set; } = null!;
public static ApiClient ApiClient { get; set; } = null!;
}
internal static class Program
@@ -19,7 +25,7 @@ namespace EFCDesk
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
[STAThread]
static async Task Main()
{
@@ -27,6 +33,9 @@ namespace EFCDesk
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
Globales.VersionApp = fileVersionInfo.FileVersion ?? "1.0.0";
string carpetaBase = @"C:\EFC";
if (!Directory.Exists(Globales.configJson.FolderExpediente))
{
@@ -48,47 +57,23 @@ namespace EFCDesk
Properties.Settings.Default.urlEFC = Globales.configJson.DominioExp;
Properties.Settings.Default.Save();
Globales.ApiClientLarge = new ApiClient(
timeout: TimeSpan.FromSeconds(600),
maxRetries: 3,
retryDelay: TimeSpan.FromSeconds(60));
Globales.ApiClient = new ApiClient(
timeout: TimeSpan.FromSeconds(10),
maxRetries: 3,
retryDelay: TimeSpan.FromSeconds(2));
Globales.gMonitor = new MonitorCarpetas(
carpetaBase: carpetaBase,
maxConcurrent: 10,
maxConcurrent: 1,
perFileTimeoutSeconds: 30,
maxReintentos: 10
);
//string? data = SecureDataHandler.ReadDataAsPlainText();
//if (string.IsNullOrEmpty(data))
//{
// Application.Run(new Login());
//} else if (!SecureDataHandler.IsDataValid())
//{
// MessageBox.Show("Id Usuario incorrecto. favor de revisar.","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
// Application.Run(new Login());
//} else
//{
// // Antes de llamar a cualquier m<>todo sobre Globales.gMonitor, verifica que no sea null
// if (Globales.gMonitor != null && !Globales.gMonitor.ExisteConfiguracionExpediente())
// {
// Application.Run(new Login());
// }
// else
// {
// if (Globales.gMonitor != null)
// {
// Application.Run(new FormMain(Globales.gMonitor));
// }
// else
// {
// MessageBox.Show("Error interno: el monitor de carpetas no est<73> inicializado.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
// Application.Exit();
// }
// }
// // Al terminar la aplicaci<63>n, liberar el recurso manualmente
// Globales.gMonitor?.Dispose();
//}
bool Esvalido = Utils.Util.StringsValidos(Globales.configJson.UsuarioExp, Globales.configJson.PasswordExp);
if (!Esvalido)
@@ -127,29 +112,9 @@ namespace EFCDesk
}
// Al terminar la aplicaci<63>n, liberar el recurso manualmente
Globales.gMonitor?.Dispose();
Globales.ApiClientLarge?.Dispose();
Globales.ApiClient?.Dispose();
}
//else
//{
// // Antes de llamar a cualquier m<>todo sobre Globales.gMonitor, verifica que no sea null
// if (Globales.gMonitor != null && !Globales.gMonitor.ExisteConfiguracionExpediente())
// {
// Application.Run(new Login());
// }
// else
// {
// if (Globales.gMonitor != null)
// {
// Application.Run(new FormMain(Globales.gMonitor));
// }
// else
// {
// MessageBox.Show("Error interno: el monitor de carpetas no est<73> inicializado.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
// Application.Exit();
// }
// }
// // Al terminar la aplicaci<63>n, liberar el recurso manualmente
// Globales.gMonitor?.Dispose();
//}
}
}