Ajoute le plugin Acrobat Pro d'imposition (acrobat-plugin/)
Suite d'imposition professionnelle en Folder-Level Scripts JS (7 modules + verification de licence Vision), avec un plugin natif hybride optionnel (WinINet + Registre) pour deplacer la verification de licence en code compile. Installeur install.bat sur le meme modele que celui du projet desktop (git portable, detection automatique des dossiers Acrobat).
This commit is contained in:
82
acrobat-plugin/native/TestConsole.cpp
Executable file
82
acrobat-plugin/native/TestConsole.cpp
Executable file
@@ -0,0 +1,82 @@
|
||||
// TestConsole.cpp
|
||||
// ---------------------------------------------------------------------------
|
||||
// Executable console autonome pour valider LicenceVerifier.cpp SANS le SDK
|
||||
// Acrobat (pas besoin d'Acrobat installe ni du Plug-in SDK pour ce test).
|
||||
//
|
||||
// Build rapide (Visual Studio Developer Command Prompt) :
|
||||
// cl /EHsc /std:c++14 TestConsole.cpp LicenceVerifier.cpp ^
|
||||
// wininet.lib advapi32.lib shlwapi.lib
|
||||
//
|
||||
// Ou : creer un projet "Application console" Visual Studio classique avec
|
||||
// ces deux fichiers .cpp + LicenceVerifier.h.
|
||||
//
|
||||
// A FAIRE AVANT D'INTEGRER AU PLUGIN ACROBAT :
|
||||
// 1. Lancer ce programme avec une cle de licence de test valide
|
||||
// (ex: COPYDEV-IMPOS-TEST-2026, comme pour le projet impose) et
|
||||
// verifier que la reponse brute du serveur correspond au parsing
|
||||
// attendu (champ "active" ou "valid", "offline_timeout_hours").
|
||||
// 2. Si le parsing echoue, ajuster ContientChampBooleenVrai/LireChampEntier
|
||||
// dans LicenceVerifier.cpp selon le format reel observe.
|
||||
// 3. Verifier que le Registre est bien ecrit (HKCU\Software\Copydev\
|
||||
// ImposingAcrobat) avec regedit, ou en relancant ce programme avec
|
||||
// l'option "lire" (voir ci-dessous).
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "LicenceVerifier.h"
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
// Conversion simple (les reponses JSON attendues sont en ASCII).
|
||||
static std::wstring VersWstring(const std::string& s) {
|
||||
return std::wstring(s.begin(), s.end());
|
||||
}
|
||||
|
||||
int wmain(int argc, wchar_t* argv[]) {
|
||||
if (argc >= 2 && std::wstring(argv[1]) == L"lire") {
|
||||
bool valide = false;
|
||||
long long expiration = 0;
|
||||
if (CDImpLicence::LireVerdictRegistre(valide, expiration)) {
|
||||
wprintf(L"Verdict en registre : valide=%d, expire le (unix)=%lld\n", valide ? 1 : 0, expiration);
|
||||
} else {
|
||||
wprintf(L"Aucun verdict trouve dans le registre.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc < 2) {
|
||||
wprintf(L"Usage: TestConsole.exe <cle_licence> [serveur_url]\n");
|
||||
wprintf(L" TestConsole.exe lire (relit le verdict deja ecrit en registre)\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::wstring cle = argv[1];
|
||||
std::wstring serveur = (argc >= 3) ? argv[2] : L"https://vision.copydev.fr/api/license.php";
|
||||
std::wstring produit = L"imposing-acrobat";
|
||||
|
||||
std::wstring machineId = CDImpLicence::ObtenirMachineId();
|
||||
std::wstring hostname = CDImpLicence::ObtenirHostname();
|
||||
|
||||
wprintf(L"Machine ID : %s\n", machineId.c_str());
|
||||
wprintf(L"Hostname : %s\n", hostname.c_str());
|
||||
wprintf(L"Serveur : %s\n", serveur.c_str());
|
||||
wprintf(L"Produit : %s\n\n", produit.c_str());
|
||||
|
||||
CDImpLicence::ResultatVerification resultat = CDImpLicence::VerifierLicence(
|
||||
serveur, cle, machineId, hostname, produit);
|
||||
|
||||
wprintf(L"Succes reseau : %d\n", resultat.succesReseau ? 1 : 0);
|
||||
wprintf(L"Licence valide : %d\n", resultat.valide ? 1 : 0);
|
||||
wprintf(L"Tolerance hors-ligne: %d heures\n", resultat.offlineTimeoutHeures);
|
||||
if (!resultat.erreur.empty()) {
|
||||
wprintf(L"Erreur : %s\n", VersWstring(resultat.erreur).c_str());
|
||||
}
|
||||
wprintf(L"Reponse brute : %s\n\n", VersWstring(resultat.reponseBrute).c_str());
|
||||
|
||||
if (resultat.succesReseau) {
|
||||
CDImpLicence::EcrireVerdictRegistre(resultat.valide, resultat.offlineTimeoutHeures);
|
||||
wprintf(L"Verdict ecrit dans HKCU\\Software\\Copydev\\ImposingAcrobat.\n");
|
||||
wprintf(L"Relancez avec l'argument \"lire\" pour le verifier.\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user