TransferSrv_2017/TransferSrv/AppClasSrv.cpp

94 lines
2.5 KiB
C++

#include "StdAfx.h"
#include "AppClasSrv.h"
#include "FileTransferManager.h"
#include "FileTransferFiller.h"
AppClasSrv App;
//********************************************************************************
AppClasSrv::AppClasSrv(void)
{
log.l_lisener=this;
#ifdef _DEBUG
strcpy(log.path,"C:\\Proyectos\\temp");
strcpy(log.nombre,"TransferSrv");
salir = false;
#endif
}
//********************************************************************************
AppClasSrv::~AppClasSrv(void)
{
}
void AppClasSrv::log_ext( __time64_t tiemp, char *modulo, char *fmt )
{
char tiem[32];
char str[1024];
strftime(tiem, 20, "%Y-%m-%d %H:%M:%S", localtime(&tiemp));
sprintf_s(str,1024, "%s %-12s %s\r\n",
(char *) LPCTSTR (tiem),
(char *) LPCTSTR (modulo),
(char *) LPCTSTR (fmt));
_tprintf(str);
}
//************************************************************************************
Cproceso_cliente* AppClasSrv::crea_cliente( BOOL *pirate )
{
FileTransferManager *c = new FileTransferManager();
c->duProv = FileTransferFiller::Get();
c->exSal = pirate;
return c;
}
//************************************************************************************
void AppClasSrv::runApp()
{
while(!salir)
Sleep(1000);
}
//************************************************************************************
bool AppClasSrv::fill( Usuario_conx_0 *user, char *pathRaid )
{
if(strcmp(user->nombre, "seliuqa"))
return false;
strcpy(pathRaid,"d:\\temp\\");
strcpy(user->clave,"quilosa");
return true;
}
//************************************************************************************
bool AppClasSrv::getConf( char *ip, int *port )
{
strcpy(ip,"192.168.1.60");
*port =8000;
return true;
}
//************************************************************************************
//************************************************************************************
bool Cstr_arrayEx::dame( StrArray& stout )
{
if(n_i<=0)
return false;
lock_cola.entro();
stout.ind=ind;
stout.str=str;
stout.m_str=m_str;
stout.m_i=m_i;
stout.n_str=n_str;
stout.n_i=n_i;
m_str=m_i=n_i=n_str=0;
str=NULL;
ind=NULL;
lock_cola.salgo();
return true;
}
//************************************************************************************
void Cstr_arrayEx::pon( char* str)
{
lock_cola.entro();
add(str);
lock_cola.salgo();
}
//************************************************************************************
//********************************************************************************