Files
Slnkdwf/WincmdContent/WincmdContent.cpp
Jos Groot Lipman 424dea8e60 Visual Studio 2015
Makefile e.a. flink opgeschoond
_CRT_SECURE_DEPRECATE verwijderd en aantal functies de _s variant gebruikt
WTL van 9.0 naar 9.1
DWF Toolkit makefiles voor VS12.0 en vooral 14.0 ook committen

svn path=/Slnkdwf/trunk/; revision=28366
2016-03-05 21:59:38 +00:00

102 lines
2.3 KiB
C++

// filesys.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "contentplug.h"
#define _detectstring "EXT=\"DWF\"|EXT=\"W2D\""
#define fieldcount 2
char* fieldnames[fieldcount]={
"version", "sections"};
int fieldtypes[fieldcount]={
ft_string, ft_numeric_32};
char* fieldunits_and_multiplechoicestrings[fieldcount]={
"", ""};
BOOL GetValueAborted=false;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int __stdcall ContentGetDetectString(char* DetectString,int maxlen)
{
strcpy_s(DetectString, maxlen, "EXT=\"DWF\"|EXT=\"W2D\"");
return 0;
}
int __stdcall ContentGetSupportedField(int FieldIndex,char* FieldName,char* Units,int maxlen)
{
if (FieldIndex<0 || FieldIndex>=fieldcount)
return ft_nomorefields;
strcpy_s(FieldName, maxlen-1, fieldnames[FieldIndex]);
strcpy_s(Units, maxlen - 1, fieldunits_and_multiplechoicestrings[FieldIndex]);
return fieldtypes[FieldIndex];
}
int __stdcall ContentGetValue(char* FileName,int FieldIndex,int UnitIndex,void* FieldValue,int maxlen,int flags)
{
GetValueAborted=false;
if (flags & CONTENT_DELAYIFSLOW) {
if (FieldIndex==16)
return ft_delayed;
if (FieldIndex==17)
return ft_ondemand;
}
try
{
CDWFFileImpl m_iDWFFile;
m_iDWFFile.Open(FileName);
switch (FieldIndex)
{
case 0: // "Version"
{
CString s;
s.Format("%02d.%02d", m_iDWFFile.m_tInfo.nVersion / 100, m_iDWFFile.m_tInfo.nVersion % 100);
strcpy_s((char*)FieldValue, maxlen - 1, s);
break;
}
case 1: // "Sections"
{
CEPlotSectionsImpl *piEPlotSections;
piEPlotSections = m_iDWFFile.get_EPlotSections();
LONG lCount = piEPlotSections->get_Count();
*(int*)FieldValue=lCount;
break;
}
default:
return ft_nosuchfield;
}
}
catch (CString &ee)
{
strcpy_s((char*)FieldValue, maxlen - 1, ee);
return ft_string;
}
// } else
// return ft_fileerror;
return fieldtypes[FieldIndex]; // very important!
}
void __stdcall ContentSetDefaultParams(ContentDefaultParamStruct* dps)
{
}
void __stdcall ContentStopGetValue (char* FileName)
{
GetValueAborted=true;
}