#include "StdAfx.h" #include "CPluginInfo.h" #include "T2Archive.h" /*static*/ CPluginInfo* CPluginInfo::ReadPluginInfo(T2Archive& archive) { CPluginInfo *info = new CPluginInfo; info->Read(archive); return info; } CPluginInfo::CPluginInfo() { mType = 0; mID = 0; mItemType = 0; mMustItem = 0; mName = ""; mFileName = ""; mUsed = false; } CPluginInfo::CPluginInfo(DWORD type, DWORD id, int itemType, int mustItem, const char* name, const char* fileName) { mType = type; mID = id; mItemType = itemType; mMustItem = mustItem; mName = name; mFileName = fileName; mUsed = false; } /*virtual*/ CPluginInfo::~CPluginInfo() { } void CPluginInfo::GetName(CString& outStr) { outStr = mName; } void CPluginInfo::GetFileName(CString& outStr) { outStr = mFileName; } void CPluginInfo::Read(T2Archive& archive) { short s; unsigned char i, c; archive >> mType; archive >> mID; archive >> s; mItemType = s; archive >> s; mMustItem = s; archive >> c; for (i = 0; i < c; i++) { char ch; archive >> ch; mName += ch; } archive >> c; for (i = 0; i < c; i++) { char ch; archive >> ch; mFileName += ch; } char buf[1024]; sprintf(buf, "PluginInfo %s, %s\n", mName, mFileName); TRACE(buf); archive >> c; mUsed = c != 0; } void CPluginInfo::Write(T2Archive& archive) { short s; unsigned char i, c; archive << mType; archive << mID; s = mItemType; archive << s; s = mMustItem; archive << s; c = mName.GetLength(); archive << c; for (i = 0; i < c; i++) archive << mName.GetAt(i); c = mFileName.GetLength(); archive << c; for (i = 0; i < c; i++) archive << mFileName.GetAt(i); c = mUsed != false; archive << c; }