void Init(byte[] datas) { //ͷ����� header = new Header(GetBytes.GetHeaderBigBlocks(datas)); //����������� bat = BATBlock.GetAllBatBlock(datas, header.Bat_array, header.Bat_count); //���� propertyIndex = GetIndexFromBAT.GetIndex(bat, header.Property_start); //С�� sbatIndex = GetIndexFromBAT.GetIndex(bat, header.Sbat_start); //���Ա����� byte[] temp = GetBytes.GetBigBlocksFromIndexs(datas, propertyIndex); //���Ա���� propertyReader = new PropertyReader(temp); //XML���ɽ������������ļ��� xmlList = XML.CreateXML(datas, propertyReader); //�������д���� allChainList = ParseBAT.Parse(bat, propertyReader.RootEntry.StartBlock, out rootChainList); }
public static List<Model_XML> CreateXML(byte[] data, PropertyReader property) { byte[] temp = new byte[property.FaceXML.Size + 42]; byte[] gb2312 = new byte[] { 0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x3d, 0x22, 0x31, 0x2e, 0x30, 0x22, 0x20, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x3d, 0x22, 0x67, 0x62, 0x32, 0x33, 0x31, 0x32, 0x22, 0x20, 0x3f, 0x3e, 0x0d, 0x0a }; for (int i = 0; i < gb2312.Length; i++) { temp[i] = gb2312[i]; } int StartBigBlock; if (property.FaceXML.Size < Struct_POIFSConstants.BIG_Image_Min) StartBigBlock = property.RootEntry.StartBlock; else StartBigBlock = property.FaceXML.StartBlock; for (int i = 42; i < temp.Length; i++) { temp[i] = data[(1 + StartBigBlock) * Struct_POIFSConstants.BIG_BLOCK_SIZE + i-42]; } //�ո��滻Ϊ��-�� for (int i = 42; i < temp.Length; i++) { if (i < temp.Length - 5) if (temp[i] == 0x46) if (temp[i + 1] == 0x49) if (temp[i + 2] == 0x4c) if (temp[i + 3] == 0x45) if (temp[i + 4] == 0x20) temp[i + 4] = 0x2d; } //if (!Directory.Exists(EmoticonManager.userRootPath)) // Directory.CreateDirectory(EmoticonManager.userRootPath); //File.WriteAllBytes(EmoticonManager.userRootPath + "/Face.xml", temp); MemoryStream stream = new MemoryStream(temp); //Common.CreateFile.Create(_path+"/Face.xml", temp); return AnalyseXML(stream); }