void ParseUnzipped(Stream s, XDict dict) { while (true) { BglBlock block = BglBlock.Read(s); if (block == null) { break; } if (block.Type == 1 || block.Type == 10) { XDictEntry e = ParseEntry(block); dict.AddEntry(e); } } }
//---------------------------------------------- void parseMetaData(Stream s) { string headword = string.Empty; int type = -1; while (true) { headword = string.Empty; BglBlock block = BglBlock.Read(s); if (block == null) { break; } if (block.Type == 0 && block.Data[0] == 8) { type = block.Data[1]; if (type > 64) { type -= 65; } this.DefCharset = BabylonConsts.Bgl_charset[type]; } else if (block.Type == 3) { int pos = 2; switch (block.Data[1]) { case 1: for (int a = 0; a < block.Length - 2; a++) { headword += (char)block.Data[pos++]; } this.Title = headword; break; case 2: for (int a = 0; a < block.Length - 2; a++) { headword += (char)block.Data[pos++]; } this.Author = headword; break; case 7: this.SrcLng = BabylonConsts.Bgl_language[block.Data[5]]; break; case 8: this.DstLng = BabylonConsts.Bgl_language[block.Data[5]]; break; case 26: type = block.Data[2]; if (type > 64) { type -= 65; } this.SrcEnc = BabylonConsts.Bgl_charset[type]; this.SrcEncName = BabylonConsts.Bgl_charsetname[type]; break; case 27: type = block.Data[2]; if (type > 64) { type -= 65; } this.DstEnc = BabylonConsts.Bgl_charset[type]; this.DstEncName = BabylonConsts.Bgl_charsetname[type]; break; } } else { continue; } } }