/// <summary> /// a function to fill in all the Lists and Dictionaries /// </summary> /// <param name="off">the starting offset where the stuff is being read</param> /// <param name="fields">the concerned field(s) in that section</param> void List_deps(int off, plugins_field fields) { List <int> temp = fields.Get_tag_ref_list(); //first we look for tag_refs and add them foreach (int i in temp) { int Toff = off + i;//it contains type //we add this off to the list if it doesnt contain the off already if (!ref_tags.Contains(Toff)) { ref_tags.Add(Toff); } } //then we look for data_refs and add them temp = fields.Get_data_ref_list(); foreach (int i in temp) { int Toff = off + i; //we add this off to the list if it doesnt contain the off already if (!ref_data.Contains(Toff)) { ref_data.Add(Toff); } } //then we look for stringId refs and add them temp = fields.Get_stringID_ref_list(); foreach (int i in temp) { int Toff = off + i; //we add this off to the list if it doesnt contain the off already if (!ref_stringID.Contains(Toff)) { ref_stringID.Add(Toff); } } //now we look into reflexive fields and extended meta and add them accordingly List <plugins_field> Ptemp = fields.Get_reflexive_list(); foreach (plugins_field i_Pfield in Ptemp) { int Toff = off + i_Pfield.Get_offset();//field table off contains count int count = DATA_READ.ReadINT_LE(Toff, data); int field_memaddr = DATA_READ.ReadINT_LE(Toff + 4, data); int entry_size = i_Pfield.Get_entry_size(); //entry_size int field_off = field_memaddr - mem_off; //its the offset of the field from the starting of the meta data if (count > 0) { //now we check whether its inside meta or a case of extended meta if ((field_memaddr >= mem_off) && (field_off < size)) { //inside meta //we add this off which contains reflexive table to the list if it doesnt contain the off already if (!ref_reflexive.Contains(Toff)) { ref_reflexive.Add(Toff); //after adding it to the list we look into them,recursively for (int j = 0; j < count; j++) { List_deps(field_off + j * entry_size, i_Pfield); } } } else { //extended meta(IN SUCCESSFULL RUN ,EXTENDED META ONLY APPEARS ONLY WHEN WE READ FROM A MAP) //but first we check whether we are reading meta from a map,or an exracted file,its rather easy if (list_extended != null) { //we add this off to the list if it doesnt contain the off already if (!ref_extended.ContainsKey(Toff)) { ref_extended.Add(Toff, field_memaddr); //now we create and add extended_meta to the list if it isnt already there if (!list_extended.ContainsKey(field_memaddr)) { extended_meta temp_extend = new extended_meta(field_memaddr, entry_size * count, count, i_Pfield, map_stream); list_extended.Add(field_memaddr, temp_extend); } //we dont need to look into them as extended meta does it for us } } else { //the program will only reach here when u try to use an extended meta on meta file. //any meta which i extract from a map file have all issues of extended_meta fixed. throw new Exception("Meta file " + path + "." + type + " is broken.\nEither debug the extraction proceedure or fix the meta file"); } } } } //now we go for withClass attribute tagRefs,they are a bit different as they only contain the datum index of the refered tag temp = fields.Get_WCtag_ref_list(); foreach (int i in temp) { int Toff = off + i; //we add this off to the list if it doesnt contain the off already if (!ref_WCtags.Contains(Toff)) { ref_WCtags.Add(Toff); } } }
/// <summary> /// a function to fill in all the Lists and Dictionaries /// </summary> /// <param name="off">the starting offset where the stuff is being read</param> /// <param name="fields">the concerned field(s) in that section</param> void List_deps(int off, plugins_field fields) { List <int> temp = fields.Get_tag_ref_list(); //first we look for tag_refs and add them foreach (int i in temp) { int Toff = off + i;//it contains type //we add this off to the list if it doesnt contain the off already if (!ref_tags.Contains(Toff)) { ref_tags.Add(Toff); } } //then we look for data_refs and add them temp = fields.Get_data_ref_list(); foreach (int i in temp) { int Toff = off + i; //we add this off to the list if it doesnt contain the off already if (!ref_data.Contains(Toff)) { ref_data.Add(Toff); } } //then we look for stringId refs and add them temp = fields.Get_stringID_ref_list(); foreach (int i in temp) { int Toff = off + i; //we add this off to the list if it doesnt contain the off already if (!ref_stringID.Contains(Toff)) { ref_stringID.Add(Toff); } } //now we look into reflexive fields and extended meta and add them accordingly List <plugins_field> Ptemp = fields.Get_reflexive_list(); foreach (plugins_field i_Pfield in Ptemp) { int Toff = off + i_Pfield.Get_offset();//field table off contains count int count = DATA_READ.ReadINT_LE(Toff, data); int field_memaddr = DATA_READ.ReadINT_LE(Toff + 4, data); int entry_size = i_Pfield.Get_entry_size(); //entry_size int field_off = field_memaddr - mem_off; //its the offset of the field from the starting of the meta data if (count > 0) { //now we check whether its inside meta or a case of extended meta if ((field_memaddr >= mem_off) && (field_off < size)) { //inside meta //we add this off which contains reflexive table to the list if it doesnt contain the off already if (!ref_reflexive.Contains(Toff)) { ref_reflexive.Add(Toff); //after adding it to the list we look into them,recursively for (int j = 0; j < count; j++) { List_deps(field_off + j * entry_size, i_Pfield); } } } else { //extended meta //we add this off to the list if it doesnt contain the off already if (!ref_extended.ContainsKey(Toff)) { ref_extended.Add(Toff, field_memaddr); //now we create and add extended_meta to the list if it isnt already there if (!list_extended.ContainsKey(field_memaddr)) { extended_meta temp_extend = new extended_meta(field_memaddr, entry_size * count, count, i_Pfield, map_stream); list_extended.Add(field_memaddr, temp_extend); } //we dont need to look into them as extended meta does it for us } } } } //now we go for withClass attribute tagRefs,they are a bit different as they only contain the datum index of the refered tag temp = fields.Get_WCtag_ref_list(); foreach (int i in temp) { int Toff = off + i; //we add this off to the list if it doesnt contain the off already if (!ref_WCtags.Contains(Toff)) { ref_WCtags.Add(Toff); } } }