2019-02-28 02:14:54 +00:00
|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
#include "JsonConfig.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
#include "CJsonObject.hpp"
|
|
|
|
|
|
|
|
|
|
JsonConfig::JsonConfig(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JsonConfig::~JsonConfig(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD> */
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
void JsonConfig::WriteToJson(PCONFIGPARAMS pConfigItem,const std::string fileNames,bool isConfigItem)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
neb::CJsonObject outJson;
|
|
|
|
|
|
|
|
|
|
outJson.AddEmptySubObject("Config");//header
|
|
|
|
|
outJson["Config"].Add(PIXTYPE,(int)(pConfigItem->Pixtype));
|
|
|
|
|
outJson["Config"].Add(PAPARSIZE,(int)(pConfigItem->PaperSize));
|
|
|
|
|
outJson["Config"].Add(AUTOCROP,(bool)(pConfigItem->EnAutoCrop),false);
|
|
|
|
|
outJson["Config"].Add(RESOLUTION,(int)(pConfigItem->Resolution));
|
|
|
|
|
outJson["Config"].Add(DUPLEX,(int)(pConfigItem->Duplex));
|
|
|
|
|
outJson["Config"].Add(DISCARBLANK,(bool)(pConfigItem->EnDiscardBlank),false);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
outJson["Config"].Add(DISCARBLANKVINCE,(bool)(pConfigItem->EnDiscardBlankVince),false);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
outJson["Config"].Add(BRIGHTNESS,(int)(pConfigItem->Brightness));
|
|
|
|
|
outJson["Config"].Add(AUTOCONTRAST,(bool)(pConfigItem->EnAutoContrast),false);
|
|
|
|
|
outJson["Config"].Add(CONTRAST,(int)(pConfigItem->Contrast));
|
|
|
|
|
outJson["Config"].Add(GAMMA,(int)(pConfigItem->Gamma));
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
outJson["Config"].Add(FILTERTYPE,(int)(pConfigItem->Filter));
|
|
|
|
|
outJson["Config"].Add(AUTODESCREW,(bool)(pConfigItem->EnAutoDescrew),false);
|
|
|
|
|
outJson["Config"].Add(FILLBLACK,(bool)(pConfigItem->EnFillBlack),false);
|
2019-09-04 01:46:32 +00:00
|
|
|
|
outJson["Config"].Add(MULTIOUTPUT,(bool)(pConfigItem->EnMultiOutPutR),false);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
outJson["Config"].Add(OUTHOLE,(bool)(pConfigItem->EnOutHole),false);
|
|
|
|
|
outJson["Config"].Add(OUTHOLERATIO,(int)(pConfigItem->OutHoleRatio));
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
outJson["Config"].Add(ULTRADETECT,(bool)(pConfigItem->EnUltrasonicDetect),false);
|
|
|
|
|
outJson["Config"].Add(BINDINGDETECT,(bool)(pConfigItem->EnBindingDetect),false);
|
|
|
|
|
outJson["Config"].Add(SCANCOUNT,(int)(pConfigItem->ScanCount));
|
|
|
|
|
outJson["Config"].Add(DOCORIENTATION,(int)(pConfigItem->Orentation));
|
|
|
|
|
outJson["Config"].Add(BACKROTATE180,(bool)(pConfigItem->EnBackRotate180),false);
|
|
|
|
|
outJson["Config"].Add(SCREWDETECT,(bool)(pConfigItem->EnScrewDetect),false);
|
|
|
|
|
outJson["Config"].Add(SCREWLEVEL,(int)(pConfigItem->ScrewDetectLevel));
|
|
|
|
|
if (isConfigItem)
|
|
|
|
|
{
|
|
|
|
|
outJson["Config"].Add(ITEMCAPTION,(string)(pConfigItem->Caption));
|
|
|
|
|
outJson["Config"].Add(SAVEPATH,(string)(pConfigItem->SavePath));
|
|
|
|
|
}
|
|
|
|
|
std::ofstream os;
|
|
|
|
|
os.open(fileNames.c_str());
|
|
|
|
|
os<<outJson.ToFormattedString();
|
|
|
|
|
os.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void JsonConfig::WriteJsonData(const std::string fileName)
|
|
|
|
|
{
|
|
|
|
|
//Json::Reader reader;
|
|
|
|
|
//Json::Value root;
|
|
|
|
|
//std::ifstream is;
|
|
|
|
|
//is.open(fileName.c_str(),std::ios::binary);
|
|
|
|
|
//if (reader.parse(is,root))
|
|
|
|
|
//{
|
|
|
|
|
//
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//PCONFIGPARAMS JsonConfig::ReadJsonFromFile(const char* fileNames)
|
|
|
|
|
//{
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
void JsonConfig::WriteJsonArrayToFile(std::vector<CONFIGPARAMS> cfgArray,const std::string filename)
|
|
|
|
|
{
|
|
|
|
|
//Json::StyledWriter sw;
|
|
|
|
|
neb::CJsonObject root;
|
|
|
|
|
root.AddEmptySubObject("Config");
|
|
|
|
|
root["Config"].AddEmptySubArray(PIXTYPE);
|
|
|
|
|
root["Config"].AddEmptySubArray(PAPARSIZE);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTOCROP);
|
|
|
|
|
root["Config"].AddEmptySubArray(RESOLUTION);
|
|
|
|
|
root["Config"].AddEmptySubArray(DUPLEX);
|
|
|
|
|
root["Config"].AddEmptySubArray(DISCARBLANK);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(DISCARBLANKVINCE);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(BRIGHTNESS);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTOCONTRAST);
|
|
|
|
|
root["Config"].AddEmptySubArray(CONTRAST);
|
|
|
|
|
root["Config"].AddEmptySubArray(GAMMA);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(FILTERTYPE);
|
|
|
|
|
root["Config"].AddEmptySubArray(AUTODESCREW);
|
|
|
|
|
root["Config"].AddEmptySubArray(FILLBLACK);
|
2019-09-04 01:46:32 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(MULTIOUTPUT);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLE);
|
|
|
|
|
root["Config"].AddEmptySubArray(OUTHOLERATIO);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(ULTRADETECT);
|
|
|
|
|
root["Config"].AddEmptySubArray(BINDINGDETECT);
|
|
|
|
|
root["Config"].AddEmptySubArray(SCANCOUNT);
|
|
|
|
|
root["Config"].AddEmptySubArray(DOCORIENTATION);
|
|
|
|
|
root["Config"].AddEmptySubArray(BACKROTATE180);
|
|
|
|
|
root["Config"].AddEmptySubArray(SCREWDETECT);
|
|
|
|
|
root["Config"].AddEmptySubArray(SCREWLEVEL);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].AddEmptySubArray(ITEMCAPTION);
|
|
|
|
|
root["Config"].AddEmptySubArray(SAVEPATH);
|
|
|
|
|
for (int i=0;i<cfgArray.size();i++)
|
|
|
|
|
{
|
|
|
|
|
root["Config"][PIXTYPE].Add(cfgArray[i].Pixtype);
|
|
|
|
|
root["Config"][PAPARSIZE].Add(cfgArray[i].PaperSize);
|
|
|
|
|
root["Config"][AUTOCROP].Add(i,cfgArray[i].EnAutoCrop);
|
|
|
|
|
root["Config"][RESOLUTION].Add(cfgArray[i].Resolution);
|
|
|
|
|
root["Config"][DUPLEX].Add(cfgArray[i].Duplex);
|
|
|
|
|
root["Config"][DISCARBLANK].Add(i,cfgArray[i].EnDiscardBlank);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
root["Config"][DISCARBLANKVINCE].Add(i,cfgArray[i].EnDiscardBlankVince);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"][BRIGHTNESS].Add(cfgArray[i].Brightness);
|
|
|
|
|
root["Config"][AUTOCONTRAST].Add(i,cfgArray[i].EnAutoContrast);
|
|
|
|
|
root["Config"][CONTRAST].Add(cfgArray[i].Contrast);
|
|
|
|
|
root["Config"][GAMMA].Add(cfgArray[i].Gamma);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"][FILTERTYPE].Add(cfgArray[i].Filter);
|
|
|
|
|
root["Config"][AUTODESCREW].Add(i,cfgArray[i].EnAutoDescrew);
|
|
|
|
|
root["Config"][FILLBLACK].Add(i,cfgArray[i].EnFillBlack);
|
2019-09-04 01:46:32 +00:00
|
|
|
|
root["Config"][MULTIOUTPUT].Add(i,cfgArray[i].EnMultiOutPutR);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
root["Config"][OUTHOLE].Add(i,cfgArray[i].EnOutHole);
|
|
|
|
|
root["Config"][OUTHOLERATIO].Add(cfgArray[i].OutHoleRatio);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"][ULTRADETECT].Add(i,cfgArray[i].EnUltrasonicDetect);
|
|
|
|
|
root["Config"][BINDINGDETECT].Add(i,cfgArray[i].EnBindingDetect);
|
|
|
|
|
root["Config"][SCANCOUNT].Add(cfgArray[i].ScanCount);
|
|
|
|
|
root["Config"][DOCORIENTATION].Add(cfgArray[i].Orentation);
|
|
|
|
|
root["Config"][BACKROTATE180].Add(i,cfgArray[i].EnBackRotate180);
|
|
|
|
|
root["Config"][SCREWDETECT].Add(i,cfgArray[i].EnScrewDetect);
|
|
|
|
|
root["Config"][SCREWLEVEL].Add(cfgArray[i].ScrewDetectLevel);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
if (cfgArray[i].Caption.c_str()!=NULL)
|
|
|
|
|
{
|
|
|
|
|
root["Config"][ITEMCAPTION].Add(cfgArray[i].Caption);
|
|
|
|
|
}
|
|
|
|
|
if (cfgArray[i].SavePath.c_str()!=NULL)
|
|
|
|
|
{
|
|
|
|
|
root["Config"][SAVEPATH].Add(cfgArray[i].SavePath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
std::ofstream os;
|
|
|
|
|
os.open(filename.c_str());
|
|
|
|
|
os<<root.ToFormattedString();
|
|
|
|
|
os.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CONFIGPARAMS JsonConfig::ReadDefaultConfig()
|
|
|
|
|
{
|
|
|
|
|
TCHAR szIniFile[MAX_PATH] = { 0 };
|
2019-05-10 02:51:26 +00:00
|
|
|
|
SHGetSpecialFolderPath(NULL, szIniFile, CSIDL_LOCAL_APPDATA, TRUE);
|
2019-02-28 02:14:54 +00:00
|
|
|
|
_tcscat(szIniFile, HUAGAO_SCAN);
|
|
|
|
|
_tcscat(szIniFile,TWAIN_INIPATH);
|
|
|
|
|
_tcscat(szIniFile, TEXT("\\"));
|
|
|
|
|
_tcscat(szIniFile, TWAIN_JSON_NAME);
|
|
|
|
|
std::string s_default(szIniFile);
|
|
|
|
|
vector<CONFIGPARAMS> vc;
|
|
|
|
|
vc=ReadJsonArrayFromFile(s_default.c_str());
|
|
|
|
|
if (vc.size()!=0)
|
|
|
|
|
{
|
|
|
|
|
return vc[0];
|
|
|
|
|
}
|
|
|
|
|
return GetDefaultConfigParams();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool JsonConfig::DeleteJsonFile(std::string path)
|
|
|
|
|
{
|
|
|
|
|
return (remove(path.c_str()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<CONFIGPARAMS> JsonConfig::ReadJsonArrayFromFile(const std::string filename)
|
|
|
|
|
{
|
|
|
|
|
std::vector<CONFIGPARAMS> re;
|
|
|
|
|
FILE* file=fopen(filename.c_str(),"rb");
|
|
|
|
|
if (!file)
|
|
|
|
|
{
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
fseek(file,0,SEEK_END);
|
|
|
|
|
long size=ftell(file);
|
|
|
|
|
fseek(file,0,SEEK_SET);
|
|
|
|
|
std::string text;
|
|
|
|
|
char* buffer=new char[size+1];
|
|
|
|
|
buffer[size]=0;
|
|
|
|
|
if (!fread(buffer,1,size,file)==(unsigned long)size)
|
|
|
|
|
{
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
text=buffer;
|
|
|
|
|
fclose(file);
|
|
|
|
|
delete []buffer;
|
|
|
|
|
re=parseJsonFromString(text);
|
|
|
|
|
return re;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CONFIGPARAMS JsonConfig::GetDefaultConfigParams()
|
|
|
|
|
{
|
|
|
|
|
CONFIGPARAMS params;
|
|
|
|
|
params.Pixtype=1;//<2F>Ҷ<EFBFBD>
|
|
|
|
|
params.PaperSize=11;//A3
|
|
|
|
|
params.EnAutoCrop=FALSE;//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
params.Resolution=200;//200dpi
|
|
|
|
|
params.Duplex=1;//˫<><CBAB>
|
|
|
|
|
params.EnDiscardBlank=FALSE;//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD>ҳ
|
2019-05-10 02:51:26 +00:00
|
|
|
|
params.EnDiscardBlankVince=FALSE;
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
params.Brightness=0;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
params.EnAutoContrast=FALSE;//<2F>Զ<EFBFBD><D4B6>Աȶ<D4B1>
|
|
|
|
|
params.Contrast=0;//<2F>Աȶ<D4B1>
|
|
|
|
|
params.Gamma=10;//٤<><D9A4>ֵ
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
params.Filter=0;//<2F><>ɫ <20><>
|
|
|
|
|
params.EnFillBlack=FALSE;//<2F><><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD>
|
|
|
|
|
params.EnAutoDescrew=TRUE;//<2F><><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>ƫ
|
2019-09-04 01:46:32 +00:00
|
|
|
|
params.EnMultiOutPutR=FALSE;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-05-10 02:51:26 +00:00
|
|
|
|
params.EnOutHole=FALSE;//<2F><>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD>
|
|
|
|
|
params.OutHoleRatio=10;//Ĭ<><C4AC>ֵ0.10
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
params.EnUltrasonicDetect=TRUE;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BFAA> <20><>
|
|
|
|
|
params.EnBindingDetect=FALSE;//װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2BFAA> <20><>
|
|
|
|
|
params.ScanCount=-1;//ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
params.Orentation=0;//<2F><>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>0<EFBFBD><30>
|
|
|
|
|
params.EnBackRotate180=FALSE;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת180<38><30> <20><><EFBFBD><EFBFBD>ת
|
|
|
|
|
params.EnScrewDetect=TRUE;//<2F><>б<EFBFBD><D0B1><EFBFBD><EFBFBD> <20><>
|
|
|
|
|
params.ScrewDetectLevel=3;//<2F><>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD> 3<><33>
|
|
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<CONFIGPARAMS> JsonConfig::parseJsonFromString(const std::string str)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
neb::CJsonObject root(str);
|
|
|
|
|
vector<CONFIGPARAMS> vcConfig;
|
|
|
|
|
|
|
|
|
|
int size=0;
|
|
|
|
|
neb::CJsonObject itmPaparSize;
|
|
|
|
|
root["Config"].Get(PAPARSIZE,itmPaparSize);
|
|
|
|
|
size=itmPaparSize.GetArraySize();
|
|
|
|
|
if (size>0)
|
|
|
|
|
{
|
|
|
|
|
neb::CJsonObject itmPixType;
|
|
|
|
|
root["Config"].Get(PIXTYPE,itmPixType);
|
|
|
|
|
neb::CJsonObject itmAutoCrop;
|
|
|
|
|
root["Config"].Get(AUTOCROP,itmAutoCrop);
|
|
|
|
|
neb::CJsonObject itmRes;
|
|
|
|
|
root["Config"].Get(RESOLUTION,itmRes);
|
|
|
|
|
neb::CJsonObject itmDulpex;
|
|
|
|
|
root["Config"].Get(DUPLEX,itmDulpex);
|
|
|
|
|
neb::CJsonObject itmDiscardBlk;
|
|
|
|
|
root["Config"].Get(DISCARBLANK,itmDiscardBlk);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
neb::CJsonObject itmDiscardBlkVince;
|
|
|
|
|
root["Config"].Get(DISCARBLANKVINCE,itmDiscardBlkVince);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
neb::CJsonObject itmBrtnes;
|
|
|
|
|
root["Config"].Get(BRIGHTNESS,itmBrtnes);
|
|
|
|
|
neb::CJsonObject itmAutoCrnt;
|
|
|
|
|
root["Config"].Get(AUTOCONTRAST,itmAutoCrnt);
|
|
|
|
|
neb::CJsonObject itmContrast;
|
|
|
|
|
root["Config"].Get(CONTRAST,itmContrast);
|
|
|
|
|
neb::CJsonObject itmGamma;
|
|
|
|
|
root["Config"].Get(GAMMA,itmGamma);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
neb::CJsonObject itmFilter;
|
|
|
|
|
root["Config"].Get(FILTERTYPE,itmFilter);
|
|
|
|
|
neb::CJsonObject itmAutoDescrew;
|
|
|
|
|
root["Config"].Get(AUTODESCREW,itmAutoDescrew);
|
|
|
|
|
neb::CJsonObject itmFillBlack;
|
|
|
|
|
root["Config"].Get(FILLBLACK,itmFillBlack);
|
2019-09-04 01:46:32 +00:00
|
|
|
|
neb::CJsonObject itmMultiOutput;
|
|
|
|
|
root["Config"].Get(MULTIOUTPUT,itmMultiOutput);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
neb::CJsonObject itmOutHole;
|
|
|
|
|
root["Config"].Get(OUTHOLE,itmOutHole);
|
|
|
|
|
neb::CJsonObject itmOutHoleRatio;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIO,itmOutHoleRatio);
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
neb::CJsonObject itmUltDetect;
|
|
|
|
|
root["Config"].Get(ULTRADETECT,itmUltDetect);
|
|
|
|
|
neb::CJsonObject itmBingdingDetect;
|
|
|
|
|
root["Config"].Get(BINDINGDETECT,itmBingdingDetect);
|
|
|
|
|
neb::CJsonObject itmScanCount;
|
|
|
|
|
root["Config"].Get(SCANCOUNT,itmScanCount);
|
|
|
|
|
neb::CJsonObject itmDocOrientation;
|
|
|
|
|
root["Config"].Get(DOCORIENTATION,itmDocOrientation);
|
|
|
|
|
neb::CJsonObject itmBackRotate;
|
|
|
|
|
root["Config"].Get(BACKROTATE180,itmBackRotate);
|
|
|
|
|
neb::CJsonObject itmScrewDetct;
|
|
|
|
|
root["Config"].Get(SCREWDETECT,itmScrewDetct);
|
|
|
|
|
neb::CJsonObject itmScrewLevel;
|
|
|
|
|
root["Config"].Get(SCREWLEVEL,itmScrewLevel);
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
neb::CJsonObject itmCaption;
|
|
|
|
|
if (!root["Config"][ITEMCAPTION].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(ITEMCAPTION,itmCaption);
|
|
|
|
|
}
|
|
|
|
|
neb::CJsonObject itmSavePtah;
|
|
|
|
|
if (!root["Config"][SAVEPATH].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(SAVEPATH,itmSavePtah);
|
|
|
|
|
}
|
|
|
|
|
for (int i=0;i<size;i++)
|
|
|
|
|
{
|
|
|
|
|
CONFIGPARAMS cfp;
|
|
|
|
|
int i_value;
|
|
|
|
|
bool b_value;
|
|
|
|
|
std::string s_value;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
itmPixType.Get(i,i_value);
|
|
|
|
|
cfp.Pixtype=i_value;
|
|
|
|
|
itmPaparSize.Get(i,i_value);
|
|
|
|
|
cfp.PaperSize=i_value;
|
|
|
|
|
itmAutoCrop.Get(i,b_value);
|
|
|
|
|
cfp.EnAutoCrop=b_value;
|
|
|
|
|
itmRes.Get(i,i_value);
|
|
|
|
|
cfp.Resolution=i_value;
|
|
|
|
|
itmDulpex.Get(i,i_value);
|
|
|
|
|
cfp.Duplex=i_value;
|
|
|
|
|
itmDiscardBlk.Get(i,b_value);
|
|
|
|
|
cfp.EnDiscardBlank=b_value;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
itmDiscardBlkVince.Get(i,b_value);
|
|
|
|
|
cfp.EnDiscardBlankVince=b_value;
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
itmBrtnes.Get(i,i_value);
|
|
|
|
|
cfp.Brightness=i_value;
|
|
|
|
|
itmAutoCrnt.Get(i,b_value);
|
|
|
|
|
cfp.EnAutoContrast=b_value;
|
|
|
|
|
itmContrast.Get(i,i_value);
|
|
|
|
|
cfp.Contrast=i_value;
|
|
|
|
|
itmGamma.Get(i,i_value);
|
|
|
|
|
cfp.Gamma=i_value;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
itmFilter.Get(i,i_value);
|
|
|
|
|
cfp.Filter=i_value;
|
|
|
|
|
itmAutoDescrew.Get(i,b_value);
|
|
|
|
|
cfp.EnAutoDescrew=b_value;
|
|
|
|
|
itmFillBlack.Get(i,b_value);
|
|
|
|
|
cfp.EnFillBlack=b_value;
|
2019-09-04 01:46:32 +00:00
|
|
|
|
itmMultiOutput.Get(i,b_value);
|
|
|
|
|
cfp.EnMultiOutPutR=b_value;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
itmOutHole.Get(i,b_value);
|
|
|
|
|
cfp.EnOutHole=b_value;
|
|
|
|
|
itmOutHoleRatio.Get(i,i_value);
|
|
|
|
|
cfp.OutHoleRatio=i_value;
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
itmUltDetect.Get(i,b_value);
|
|
|
|
|
cfp.EnUltrasonicDetect=b_value;
|
|
|
|
|
itmBingdingDetect.Get(i,b_value);
|
|
|
|
|
cfp.EnBindingDetect=b_value;
|
|
|
|
|
itmScanCount.Get(i,i_value);
|
|
|
|
|
cfp.ScanCount=i_value;
|
|
|
|
|
itmDocOrientation.Get(i,i_value);
|
|
|
|
|
cfp.Orentation=i_value;
|
|
|
|
|
itmBackRotate.Get(i,b_value);
|
|
|
|
|
cfp.EnBackRotate180=b_value;
|
|
|
|
|
itmScrewDetct.Get(i,b_value);
|
|
|
|
|
cfp.EnScrewDetect=b_value;
|
|
|
|
|
itmScrewLevel.Get(i,i_value);
|
|
|
|
|
cfp.ScrewDetectLevel=i_value;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
if (!root["Config"][ITEMCAPTION].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
itmCaption.Get(i,s_value);
|
|
|
|
|
cfp.Caption=s_value;
|
|
|
|
|
}
|
|
|
|
|
if (!root["Config"][SAVEPATH].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
itmSavePtah.Get(i,s_value);
|
|
|
|
|
cfp.SavePath=s_value;
|
|
|
|
|
}
|
|
|
|
|
vcConfig.push_back(cfp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CONFIGPARAMS cfp;
|
|
|
|
|
int index;
|
|
|
|
|
bool bvalue;
|
|
|
|
|
std::string svalue;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].Get(PIXTYPE,index);
|
|
|
|
|
cfp.Pixtype=index;
|
|
|
|
|
root["Config"].Get(PAPARSIZE,index);
|
|
|
|
|
cfp.PaperSize=index;
|
|
|
|
|
root["Config"].Get(AUTOCROP,bvalue);
|
|
|
|
|
cfp.EnAutoCrop=bvalue;
|
|
|
|
|
root["Config"].Get(RESOLUTION,index);
|
|
|
|
|
cfp.Resolution=index;
|
|
|
|
|
root["Config"].Get(DUPLEX,index);
|
|
|
|
|
cfp.Duplex=index;
|
|
|
|
|
root["Config"].Get(DISCARBLANK,bvalue);
|
|
|
|
|
cfp.EnDiscardBlank=bvalue;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
root["Config"].Get(DISCARBLANKVINCE,bvalue);
|
|
|
|
|
cfp.EnDiscardBlankVince=bvalue;
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].Get(BRIGHTNESS,index);
|
|
|
|
|
cfp.Brightness=index;
|
|
|
|
|
root["Config"].Get(AUTOCONTRAST,bvalue);
|
|
|
|
|
cfp.EnAutoContrast=bvalue;
|
|
|
|
|
root["Config"].Get(CONTRAST,index);
|
|
|
|
|
cfp.Contrast=index;
|
|
|
|
|
root["Config"].Get(GAMMA,index);
|
|
|
|
|
cfp.Gamma=index;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].Get(FILTERTYPE,index);
|
|
|
|
|
cfp.Filter=index;
|
|
|
|
|
root["Config"].Get(AUTODESCREW,bvalue);
|
|
|
|
|
cfp.EnAutoCrop=bvalue;
|
|
|
|
|
root["Config"].Get(FILLBLACK,bvalue);
|
|
|
|
|
cfp.EnFillBlack=bvalue;
|
2019-09-04 01:46:32 +00:00
|
|
|
|
root["Config"].Get(MULTIOUTPUT,bvalue);
|
|
|
|
|
cfp.EnMultiOutPutR=bvalue;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
root["Config"].Get(OUTHOLE,bvalue);
|
|
|
|
|
cfp.EnOutHole=bvalue;
|
|
|
|
|
root["Config"].Get(OUTHOLERATIO,index);
|
|
|
|
|
cfp.OutHoleRatio=index;
|
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
root["Config"].Get(ULTRADETECT,bvalue);
|
|
|
|
|
cfp.EnUltrasonicDetect=bvalue;
|
|
|
|
|
root["Config"].Get(BINDINGDETECT,bvalue);
|
|
|
|
|
cfp.EnBindingDetect=bvalue;
|
|
|
|
|
root["Config"].Get(SCANCOUNT,index);
|
|
|
|
|
cfp.ScanCount=index;
|
|
|
|
|
root["Config"].Get(DOCORIENTATION,index);
|
|
|
|
|
cfp.Orentation=index;
|
|
|
|
|
root["Config"].Get(BACKROTATE180,bvalue);
|
|
|
|
|
cfp.EnBackRotate180=bvalue;
|
|
|
|
|
root["Config"].Get(SCREWDETECT,bvalue);
|
|
|
|
|
cfp.EnScrewDetect=bvalue;
|
|
|
|
|
root["Config"].Get(SCREWLEVEL,index);
|
|
|
|
|
cfp.ScrewDetectLevel=index;
|
2019-05-10 02:51:26 +00:00
|
|
|
|
|
2019-02-28 02:14:54 +00:00
|
|
|
|
if (!root["Config"][ITEMCAPTION].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(ITEMCAPTION,svalue);
|
|
|
|
|
cfp.Caption=svalue;
|
|
|
|
|
}
|
|
|
|
|
if (!root["Config"][SAVEPATH].IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
root["Config"].Get(SAVEPATH,svalue);
|
|
|
|
|
cfp.SavePath=svalue;
|
|
|
|
|
}
|
|
|
|
|
vcConfig.push_back(cfp);
|
|
|
|
|
}
|
|
|
|
|
return vcConfig;
|
|
|
|
|
}
|