public UInt64 ExtentStartBlockNum; //0x08 public static ExtentRecord get(string key, string data) { string hex; ExtentRecord er = new ExtentRecord(); hex = key.Substring(0, 14); er.NodeID = (UInt64)Utility.little_hex_to_uint64(hex, 7); hex = data.Substring(0, 16); er.ExtentLength = (UInt32)Utility.little_hex_to_uint64(hex, 8); hex = data.Substring(16, 16); er.ExtentStartBlockNum = (UInt32)Utility.little_hex_to_uint64(hex, 8); //Console.WriteLine("er.NodeID:{0}", er.NodeID); //Console.WriteLine("er.ExtentLength : {0}", er.ExtentLength); //Console.WriteLine("er.ExtentStartBlockNum : {0}", er.ExtentStartBlockNum); return(er); }
public static Dictionary <UInt64, ExtentRecord> er_dic = new Dictionary <UInt64, ExtentRecord>(); //NodeID, ExtentRecord public static void init_btln(FileStream stream, UInt64 block_num) { Table header = Table.get_table_header(stream, block_num); if (header.table_type == 0) { return; } TableType[] table_info = Table.save_record(stream, block_num, header); //Console.WriteLine("block_num: {0}, 0x{1}", block_num, block_num.ToString("X")); //Console.WriteLine("table type : {0}", header.table_type); for (int i = 0; i < header.record_num; i++) { char record_type = table_info[i].KeySection[14]; //Console.WriteLine("\n\n{0} record\nrecord_type {1}", i, record_type); //Console.WriteLine("key len : {0}, data len {1}", table_info[i].KeyLength, table_info[i].DataLength); switch (record_type) { case '3': FileFolderRecord f = new FileFolderRecord(); try { f = FileFolderRecord.get(table_info[i].KeySection, table_info[i].DataSection); String fname = new string(f.FileName, 0, f.FileName.Length - 1); // Console.WriteLine("Node ID : {0}, ParentID : {1}, Filename : {2}, Flag : {3} ", f.NodeID, f.ParentID, fname, f.Flag ); if (!ffr_dict.ContainsKey(f.NodeID)) { ffr_dict.Add(f.NodeID, f); } else { ffr_dict[f.NodeID] = f; } if (!parent_node_dic.ContainsKey(f.ParentID)) { List <UInt64> node_list = new List <UInt64>(); node_list.Add(f.NodeID); parent_node_dic.Add(f.ParentID, node_list); } else { List <UInt64> child_list = parent_node_dic[f.ParentID]; if (!child_list.Exists(x => x == f.NodeID)) { parent_node_dic[f.ParentID].Add(f.NodeID); } } } catch (ArgumentException) { Console.WriteLine("**************An element with Key = {0} already exists.", f.NodeID); } break; //case '6': // ExtentStatus es = ExtentStatus.get(table_info[i].KeySection, table_info[i].DataSection); // RECORD.es_list.Add(es); // break; case '8': ExtentRecord er = ExtentRecord.get(table_info[i].KeySection, table_info[i].DataSection); if (!er_dic.ContainsKey(er.NodeID)) { er_dic.Add(er.NodeID, er); } else { // Console.WriteLine("*****Modify Extent Record , nodeID{0}", er.NodeID); er_dic[er.NodeID] = er; } break; //case '9': // KeyRecord kr = KeyRecord.get(table_info[i].KeySection, table_info[i].DataSection); // RECORD.kr_list.Add(kr); // break; } } return; }