Not to good at Java, but my understanding is that Put and Get operate on an automaticaly generated parent hashtable of the object in question. c# does not have this at all. You have to create your own dictionary. This might not be quite right as you did not post the entier code, but the following should help you. Note the dictionary declaration and add/get code. I have used a generic dictionary to enable strong typing.
class TagInfo{
public int tagOffset;
public int tagLength;
public TagInfo(){
}
}
// Dictionary to hold Taginfo Objects
System.Collections.Generic.Dictionary; TagInfoDictionary = new System.Collections.Generic.Dictionary();
private void buildMetaData()
{
Record record = getData();
int offset = IMGREC\_TAGLIST\_INDEX;
int numTags = 0 ;
short tagID = 0;
try
{
numTags = this.getNumberOfTags() ;
for (int i=0; i < numTags; i++){
TagInfo info = new TagInfo();
info.tagOffset = offset;
info.tagLength = TagRecord.TAG\_DATA\_INDEX + record.readInt(offset + TagRecord.TAG\_DATALEN\_INDEX);
tagID = record.readShort(offset + TagRecord.TAG\_ID\_INDEX);
offset += info.tagLength;
// Add to the dictionary
this.TagInfoDictionary.Add(tagID, info);
Console.WriteLine("tagID = " + tagID);
}
}catch (Exception ex){}
finally{}
this.imageOffset = offset;
this.imageSize = record.getLength() - offset;
}
public TagRecord getTagByID(short id)
{
TagRecord record = null;
// Get from dictionary
TagInfo info = this.TagInfoDictionary\[id\];
if (info != null){
byte\[\] data = this.getData().read(info.tagOffset,info.tagLength);
record = new TagRecord(data);
}
return record;
}
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]