*/
private SubProject readSubProject(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)
{
try
{
SubProject sp = new SubProject();
if (uniqueIDOffset != -1)
{
int prev = 0;
int value = MPPUtility.getInt(data, uniqueIDOffset);
while (value != SUBPROJECT_LISTEND)
{
switch (value)
{
case SUBPROJECT_TASKUNIQUEID0 :
case SUBPROJECT_TASKUNIQUEID1 :
case SUBPROJECT_TASKUNIQUEID2 :
case SUBPROJECT_TASKUNIQUEID3 :
case SUBPROJECT_TASKUNIQUEID4 :
case SUBPROJECT_TASKUNIQUEID5 :
// The previous value was for the subproject unique task id
sp.setTaskUniqueID(Integer.valueOf(prev));
m_taskSubProjects.put(sp.getTaskUniqueID(), sp);
prev = 0;
break;
default :
if (prev != 0)
{
// The previous value was for an external task unique task id
sp.addExternalTaskUniqueID(Integer.valueOf(prev));
m_taskSubProjects.put(Integer.valueOf(prev), sp);
}
prev = value;
break;
}
// Read the next value
uniqueIDOffset += 4;
value = MPPUtility.getInt(data, uniqueIDOffset);
}
if (prev != 0)
{
// The previous value was for an external task unique task id
sp.addExternalTaskUniqueID(Integer.valueOf(prev));
m_taskSubProjects.put(Integer.valueOf(prev), sp);
}
// Now get the unique id offset for this subproject
value = 0x00800000 + ((subprojectIndex - 1) * 0x00400000);
sp.setUniqueIDOffset(Integer.valueOf(value));
}
//
// First block header
//
filePathOffset += 18;
//
// String size as a 4 byte int
//
filePathOffset += 4;
//
// Full DOS path
//
sp.setDosFullPath(MPPUtility.getString(data, filePathOffset));
filePathOffset += (sp.getDosFullPath().length() + 1);
//
// 24 byte block
//
filePathOffset += 24;
//
// 4 byte block size
//
int size = MPPUtility.getInt(data, filePathOffset);
filePathOffset += 4;
if (size == 0)
{
sp.setFullPath(sp.getDosFullPath());
}
else
{
//
// 4 byte unicode string size in bytes
//
size = MPPUtility.getInt(data, filePathOffset);
filePathOffset += 4;
//
// 2 byte data
//
filePathOffset += 2;
//
// Unicode string
//
sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset, size));
// filePathOffset += size;
}
//
// Second block header
//
fileNameOffset += 18;
//
// String size as a 4 byte int
//
fileNameOffset += 4;
//
// DOS file name
//
sp.setDosFileName(MPPUtility.getString(data, fileNameOffset));
fileNameOffset += (sp.getDosFileName().length() + 1);
//
// 24 byte block
//
fileNameOffset += 24;
//
// 4 byte block size
//
size = MPPUtility.getInt(data, fileNameOffset);
fileNameOffset += 4;
if (size == 0)
{
sp.setFileName(sp.getDosFileName());
}
else
{
//
// 4 byte unicode string size in bytes
//
size = MPPUtility.getInt(data, fileNameOffset);
fileNameOffset += 4;
//
// 2 byte data
//
fileNameOffset += 2;
//
// Unicode string
//
sp.setFileName(MPPUtility.getUnicodeString(data, fileNameOffset, size));
//fileNameOffset += size;
}
//System.out.println(sp.toString());