/*
 * ************************************************************************************************************
 * Author: Marcin Załęczny
 * Copyright (C)2011 Marcin Załęczny <mzaleczny@hotmail.com>
 * License: The GNU Lesser General Public License, version 3.0 (LGPLv3)
 * Library Name: mzstdprint
 * Version: 1.02
 * First release date:   2011-02-03
 * Current release date: 2011-03-04
 *
 *
 * This file is part of mzstdprint library
 * 
 * mzstdprint library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * mzstdprint library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************************************************
 */

#include "mzPrinterDriverInfo.h"


VOID CPrinterDriverInfo::_commonInit() {
    this->setRealClassName(L"CPrinterDriverInfo");
}

CPrinterDriverInfo::CPrinterDriverInfo() {
    this->_commonInit();
}

CPrinterDriverInfo::CPrinterDriverInfo(DRIVER_INFO_6* drvInfo) {
    this->_commonInit();
    this->set(drvInfo);
}

CPrinterDriverInfo::~CPrinterDriverInfo() {
}

VOID CPrinterDriverInfo::set(DRIVER_INFO_6* drvInfo) {
    this->version = drvInfo->cVersion;
    this->name = drvInfo->pName;
    this->environment = drvInfo->pEnvironment;
    this->driverPath = drvInfo->pDriverPath;
    this->dataFile = drvInfo->pDataFile;
    this->configFile = drvInfo->pConfigFile;
    this->helpFile = drvInfo->pHelpFile;
    this->dependentFiles = drvInfo->pDependentFiles;
    this->monitorName = drvInfo->pMonitorName;
    this->defaultDataType = drvInfo->pDefaultDataType;
    this->previousNames = drvInfo->pszzPreviousNames;
    //this->driverDate = ""; // , drvInfo->ftDriverDate
    this->dwlVersion = drvInfo->cVersion;
    this->mfgName = drvInfo->pszMfgName;
    this->oemUrl = drvInfo->pszOEMUrl;
    this->hardwareID = drvInfo->pszHardwareID;
    this->provider = drvInfo->pszProvider;
}

CString CPrinterDriverInfo::toString() {
    CString s;
    s = FormatMessage(L"Printer driver information:\n"
                      L"    %-20s: %-10ddx\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n"
                      L"    %-20s: %-20s\n",
                      L"version", this->version,
                      L"name", this->name.toWCHAR(),
                      L"enironment", this->environment.toWCHAR(),
                      L"driver path", this->driverPath.toWCHAR(),
                      L"data file", this->dataFile.toWCHAR(),
                      L"config file", this->configFile.toWCHAR(),
                      L"help file", this->helpFile.toWCHAR(),
                      L"dependent files", this->dependentFiles.toWCHAR(),
                      L"monitor name", this->monitorName.toWCHAR(),
                      L"default data type", this->defaultDataType.toWCHAR(),
                      L"previous names", this->previousNames.toWCHAR(),
                      L"driver date", L"TODO", // this->driverDate
                      L"dwlDriver version", L"TODO", // this->dwlVersion
                      L"mfg name", this->mfgName.toWCHAR(),
                      L"oem url", this->oemUrl.toWCHAR(),
                      L"hardware id", this->hardwareID.toWCHAR(),
                      L"provider", this->provider.toWCHAR());
    return s;
}

VOID CPrinterDriverInfo::reset() {
    this->version = 0;
    this->name = COMMON_EMPTY_STRING;
    this->environment = COMMON_EMPTY_STRING;
    this->driverPath = COMMON_EMPTY_STRING;
    this->dataFile = COMMON_EMPTY_STRING;
    this->configFile = COMMON_EMPTY_STRING;
    this->helpFile = COMMON_EMPTY_STRING;
    this->dependentFiles = COMMON_EMPTY_STRING;
    this->monitorName = COMMON_EMPTY_STRING;
    this->defaultDataType = COMMON_EMPTY_STRING;
    this->previousNames = COMMON_EMPTY_STRING;
    //this->driverDate
    this->dwlVersion = 0;
    this->mfgName = COMMON_EMPTY_STRING;
    this->oemUrl = COMMON_EMPTY_STRING;
    this->hardwareID = COMMON_EMPTY_STRING;
    this->provider = COMMON_EMPTY_STRING;
}
