50 lines
2 KiB
MQL5
50 lines
2 KiB
MQL5
|
|
//+------------------------------------------------------------------+
|
|||
|
|
//| TestDec.mq5 |
|
|||
|
|
//| Copyright 2026, Niquel Mendoza. |
|
|||
|
|
//| https://www.mql5.com/es/users/nique_372 |
|
|||
|
|
//+------------------------------------------------------------------+
|
|||
|
|
#property copyright "Copyright 2026, Niquel Mendoza."
|
|||
|
|
#property link "https://www.mql5.com/es/users/nique_372"
|
|||
|
|
#property version "1.00"
|
|||
|
|
#property strict
|
|||
|
|
|
|||
|
|
//+------------------------------------------------------------------+
|
|||
|
|
//| |
|
|||
|
|
//+------------------------------------------------------------------+
|
|||
|
|
#include "..\\FolderEncrypt.mqh"
|
|||
|
|
|
|||
|
|
//+------------------------------------------------------------------+
|
|||
|
|
//| Script program start function |
|
|||
|
|
//+------------------------------------------------------------------+
|
|||
|
|
void OnStart()
|
|||
|
|
{
|
|||
|
|
//---
|
|||
|
|
const string folder_path = "MQLArticles\\File\\FolderOps\\Enc\\";
|
|||
|
|
//2026.03.27 09:37:52.644 TestEnc (EURUSD,H1) Key generada = 'kza]VxB]V]Q"j&',}00rOVWiV5Y["CO'
|
|||
|
|
const string key = "kza]VxB]V]Q\"j&',}00rOVWiV5Y[\"CO"; // la key del encrypt
|
|||
|
|
|
|||
|
|
//---
|
|||
|
|
CFolderOpsEncrypt folder_enc;
|
|||
|
|
folder_enc.AddLogFlags(LOG_ALL);
|
|||
|
|
folder_enc.Encryptor(&g_mqlarticles_encryptor);
|
|||
|
|
folder_enc.SizeArrInclued(2);
|
|||
|
|
folder_enc.SetValIncluyed(0, "*.txt.enc");
|
|||
|
|
folder_enc.SetValIncluyed(1, "*.csv.enc");
|
|||
|
|
folder_enc.SetInitialPass();
|
|||
|
|
Print(folder_enc.DecryptFolder(folder_path, true, key, CRYPT_AES256, true, "-"));
|
|||
|
|
|
|||
|
|
//--- Verificamos contenido
|
|||
|
|
const string files[] = {"data_importante.txt", "data_importante.csv"};
|
|||
|
|
for(int i = 0; i < ArraySize(files); i++)
|
|||
|
|
{
|
|||
|
|
int fh = FileOpen(folder_path + files[i], FILE_READ | FILE_TXT | FILE_COMMON);
|
|||
|
|
if(fh == INVALID_HANDLE)
|
|||
|
|
{
|
|||
|
|
Print("Fallo al abrir = ", files[i]);
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
Print(files[i], " = ", FileReadString(fh));
|
|||
|
|
FileClose(fh);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//+------------------------------------------------------------------+
|