DIY编程器网
标题:
uuprog开发教程:芯片支持库维护7
[打印本页]
作者:
liyf
时间:
2015-1-1 11:52
标题:
uuprog开发教程:芯片支持库维护7
这个是个很重要的功能,保存功能必须和加载的对应,不然你知道的,读出来肯定不是你需要的,再然后操作芯片也不是你需要的,再然后出问题也不是你需要的。
下面就是操作函数,非常乏味的处理过程,有兴趣的一定要跟一遍,不然你肯定不明白。
void CProgDeviceManage::OnOK()
{
// TODO: Add extra validation here
CFile savefile;
TypeStruct* pTypeStruct;
TypeStruct1* pTypeStruct1;
//保存文件代码
parent->SetAppLog("保存开始...");
if(savefile.Open(parent->m_sAppPath+"device.pdl",CFile::shareCompat|CFile::modeCreate|CFile::modeWrite,NULL))
{
ZeroMemory(&m_stDFileHead, sizeof(DeviceListFileHeadStruct));
strcpy(m_stDFileHead.Appname,"UUProg V"+parent->m_sAppVer);
strcpy(m_stDFileHead.DeviceListFileVer,parent->m_sAppVer);
m_stDFileHead.DeviceCount = parent->m_arDeviceList.GetSize();
m_stDFileHead.TypeListCount = parent->m_arTypeList.GetSize();
m_stDFileHead.OperationListCount = parent->m_arOperationList.GetSize();
m_stDFileHead.SizeListCount = parent->m_arSizeList.GetSize();
m_stDFileHead.PinListCount = parent->m_arPinList.GetSize();
m_stDFileHead.DataWidthListCount = parent->m_arDataWidthList.GetSize();
m_stDFileHead.PackageListCount = parent->m_arPackageList.GetSize();
m_stDFileHead.VCCListCount = parent->m_arVCCList.GetSize();
m_stDFileHead.VPPListCount = parent->m_arVPPList.GetSize();
m_stDFileHead.AdapterListCount = parent->m_arAdapterList.GetSize();
savefile.Write(&m_stDFileHead,sizeof(DeviceListFileHeadStruct));
//Type List
for (int i=0; i<parent->m_arTypeList.GetSize(); i++)
{
pTypeStruct = &parent->m_arTypeList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//Operation List
for (i=0; i<parent->m_arOperationList.GetSize(); i++)
{
pTypeStruct = &parent->m_arOperationList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//Size List
for (i=0; i<parent->m_arSizeList.GetSize(); i++)
{
pTypeStruct = &parent->m_arSizeList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//Pin List
for (i=0; i<parent->m_arPinList.GetSize(); i++)
{
pTypeStruct = &parent->m_arPinList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//DataWidth List
for (i=0; i<parent->m_arDataWidthList.GetSize(); i++)
{
pTypeStruct = &parent->m_arDataWidthList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//Package List
for (i=0; i<parent->m_arPackageList.GetSize(); i++)
{
pTypeStruct = &parent->m_arPackageList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//VCC List
for (i=0; i<parent->m_arVCCList.GetSize(); i++)
{
pTypeStruct1 = &parent->m_arVCCList.GetAt(i);
savefile.Write(pTypeStruct1,sizeof(TypeStruct1));
}
//VPP List
for (i=0; i<parent->m_arVPPList.GetSize(); i++)
{
pTypeStruct1 = &parent->m_arVPPList.GetAt(i);
savefile.Write(pTypeStruct1,sizeof(TypeStruct1));
}
//Adapter List
for (i=0; i<parent->m_arAdapterList.GetSize(); i++)
{
pTypeStruct = &parent->m_arAdapterList.GetAt(i);
savefile.Write(pTypeStruct,sizeof(TypeStruct));
}
//Device List
for (i=0; i<parent->m_arDeviceList.GetSize(); i++)
{
m_stDFile = parent->m_arDeviceList.GetAt(i);
savefile.Write(&m_stDFile,sizeof(DeviceListFileStruct));
}
savefile.Close();
parent->SetAppLog("保存完成");
}
else
{
parent->SetAppLog("保存失败");
}
CDialog::OnOK();
}
复制代码
基本就是不停的循环,不停的写盘。
作者:
dna-jm
时间:
2017-10-19 09:26
感谢分享,不错的编程器
欢迎光临 DIY编程器网 (http://diybcq.com/)
Powered by Discuz! X3.2