📄 hexfiledata.cpp
字号:
//---------------------------------------------------------------------------
// Pixelworks Inc. Company Confidential Strictly Private
//
// $Archive: $
// $Revision: 1.1.1.1 $
// $Author: KevinM $
// $Date: 2003/09/29 18:19:04 $
//
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
// Copyright 1997-2003 (c) Pixelworks Inc.
//
// Pixelworks owns the sole copyright to this software. Under international
// copyright laws you (1) may not make a copy of this software except for
// the purposes of maintaining a single archive copy, (2) may not derive
// works herefrom, (3) may not distribute this work to others. These rights
// are provided for information clarification, other restrictions of rights
// may apply as well.
//
// This is an unpublished work.
// --------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>> WARRANTEE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// --------------------------------------------------------------------------
// Pixelworks Inc. MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THE USE OF
// THIS SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
// PURPOSE.
// --------------------------------------------------------------------------
//
// HexFileData.cpp: implementation of the CHexFileData class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "FlashUpgrader.h"
#include "HexFileData.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CHexFileData::CHexFileData()
{
m_bDownload = TRUE;
m_bConflict = FALSE;
m_bExecute = FALSE;
m_bMissing = FALSE;
}
CHexFileData::~CHexFileData()
{
}
int CHexFileData::GetIcon(eFLASH_MODE nFlashMode)
{
if (!m_bDownload)
{
return 3;
}
if (m_bMissing)
{
return 4;
}
if (m_bConflict)
{
return 2;
}
if (m_bExecute)
{
return 1;
}
if (m_bVerify | (nFlashMode == fmVerify))
{
return 5;
}
if (nFlashMode == fmErase)
{
return 6;
}
return 0;
}
int CHexFileData::GetDownloadSize()
{
int nSize = 0;
for (POSITION pos = m_RegionList.GetHeadPosition(); pos != NULL;)
{
CHexRegion* pReg = (CHexRegion*)m_RegionList.GetNext(pos);
nSize += (pReg->m_nLength);
}
return nSize;
}
CString CHexFileData::GetStatus(eFLASH_MODE nFlashMode)
{
CString strResult;
switch (GetIcon(nFlashMode))
{
case 0:
strResult = "This file will be flashed.";
break;
case 1:
strResult = "This file will be executed.";
break;
case 2:
strResult = "This file conflicts with another file.";
break;
case 3:
strResult = "This file will not be downloaded.";
break;
case 4:
strResult = "This file is missing or can't be opened.";
break;
case 5:
strResult = "This file will be verified.";
break;
case 6:
strResult = "This region will be erased.";
break;
}
return strResult;
}
int CHexFileData::GetStart()
{
int nStart = 0xFFFFFFF;
for (POSITION pos = m_RegionList.GetHeadPosition(); pos != NULL;)
{
CHexRegion* pReg = (CHexRegion*)m_RegionList.GetNext(pos);
if (pReg->m_nStart < nStart)
nStart = pReg->m_nStart;
}
return nStart;
}
int CHexFileData::GetLength()
{
int nLength = 0;
for (POSITION pos = m_RegionList.GetHeadPosition(); pos != NULL;)
{
CHexRegion* pReg = (CHexRegion*)m_RegionList.GetNext(pos);
if ((pReg->m_nStart+pReg->m_nLength) > nLength)
nLength = (pReg->m_nStart+pReg->m_nLength);
}
return nLength;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -