Well, I'm passing some code that I have, and I'm sure I can pass this code to C #, and I wanted the help of anyone who can help, in the following code below
#include <dirent.h>
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <windows.h>
bool extracoes();
int main()
{
bool saida;
//"Interface"
saida = extracoes();
if(saida)
std::cout<<"Copias concluidas!!!\n\nPressione qualquer tecla para encerrar!";
else
std::cout<<"Erro! Executar instalacao como Suporte\n\nPressione qualquer tecla para encerrar...";
std::cin.get();
}
bool extracoes()
{
struct dirent *lsdir;
DIR *dir;
int qtd=0, i=0;
bool padrao;
std::string path;
dir = opendir("D:\Users\");
while((lsdir = readdir(dir)) != NULL)
qtd++;
std::string users[qtd];
closedir(dir);
dir=opendir("D:\Users\");
while((lsdir = readdir(dir)) != NULL)
{
padrao=true;
std::string aux = lsdir->d_name;
if(aux.size() == 7)
{
for(int j=0; j<7; j++)
{
if(!(aux[j]<=57 && aux[j]>=48))
{
padrao=false;
break;
}
}
}
else
padrao=false;
if(padrao)
{
users[i]=aux;
i++;
}
}
closedir(dir);
users[i] = "Default";
users[i+1] = "#include <dirent.h>
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <windows.h>
bool extracoes();
int main()
{
bool saida;
//"Interface"
saida = extracoes();
if(saida)
std::cout<<"Copias concluidas!!!\n\nPressione qualquer tecla para encerrar!";
else
std::cout<<"Erro! Executar instalacao como Suporte\n\nPressione qualquer tecla para encerrar...";
std::cin.get();
}
bool extracoes()
{
struct dirent *lsdir;
DIR *dir;
int qtd=0, i=0;
bool padrao;
std::string path;
dir = opendir("D:\Users\");
while((lsdir = readdir(dir)) != NULL)
qtd++;
std::string users[qtd];
closedir(dir);
dir=opendir("D:\Users\");
while((lsdir = readdir(dir)) != NULL)
{
padrao=true;
std::string aux = lsdir->d_name;
if(aux.size() == 7)
{
for(int j=0; j<7; j++)
{
if(!(aux[j]<=57 && aux[j]>=48))
{
padrao=false;
break;
}
}
}
else
padrao=false;
if(padrao)
{
users[i]=aux;
i++;
}
}
closedir(dir);
users[i] = "Default";
users[i+1] = "%pre%";
i = 0;
padrao = true;
//Config Global
if(system("Xcopy kds_kodak c:\ProgramData\kds_kodak /v /e /y /h > nul") == 0)
std::cout<<"Extracao Config_Globais concluida\n\n";
else
{
padrao = false;
std::cout<<"Erro na extracao Config_Globais\n";
}
//Config default e usuários
while(users[i].compare("%pre%"))
{
std::cout<<"Copiando...\n";
path = "Xcopy \"Smart Touch\" \"d:\Users\";
path += users[i]+"\AppData\Local\Smart Touch\\" /v /e /y /h > nul";
if(system(path.c_str()) == 0)
std::cout<<"Copia do usuario "<<users[i]<<" concluida!!\n\n";
else
{
std::cout<<"Copia do usuario "<<users[i]<<" nao concluida!!\n\n";
padrao = false;
}
i++;
}
return padrao;
std::cin.get();
}
";
i = 0;
padrao = true;
//Config Global
if(system("Xcopy kds_kodak c:\ProgramData\kds_kodak /v /e /y /h > nul") == 0)
std::cout<<"Extracao Config_Globais concluida\n\n";
else
{
padrao = false;
std::cout<<"Erro na extracao Config_Globais\n";
}
//Config default e usuários
while(users[i].compare("%pre%"))
{
std::cout<<"Copiando...\n";
path = "Xcopy \"Smart Touch\" \"d:\Users\";
path += users[i]+"\AppData\Local\Smart Touch\\" /v /e /y /h > nul";
if(system(path.c_str()) == 0)
std::cout<<"Copia do usuario "<<users[i]<<" concluida!!\n\n";
else
{
std::cout<<"Copia do usuario "<<users[i]<<" nao concluida!!\n\n";
padrao = false;
}
i++;
}
return padrao;
std::cin.get();
}