// �t�@�C���^�C�v�̔��ʏ��� private LeNSFileType getFileType(LeafPackType packType, String fileName) { LeNSFileType file_type = LeNSFileType.EtcGraphic; String ext = Path.GetExtension(fileName); String typeString; switch (packType) { case LeafPackType.LPTYPE_SIZUWIN: if (fileName.Equals("LEAF.LFG")) { // ���[�t���S(���ȑO) file_type = LeNSFileType.EtcGraphic; } else if (fileName.Equals("KNJ_ALL.KNJ")) { // �����t�@�C�� file_type = LeNSFileType.SpecialFile; } else if (fileName.Substring(0, 3).Equals("SCN")) { // �V�i���I�t�@�C�� file_type = LeNSFileType.ScenarioFile; } else if (ext.Equals(".P16")) { // ���ʉ��t�@�C�� file_type = LeNSFileType.SoundFile; } else if (fileName.Substring(0, 3).Equals("HVS")) { // �g�V�[�� file_type = LeNSFileType.BGGraphic; } else if (fileName.Substring(0, 5).Equals("MAX_C")) { // �����G file_type = LeNSFileType.CharaGraphic; } else if (fileName.Substring(0, 4).Equals("NEXT")) { // ���f���p�H file_type = LeNSFileType.BGGraphic; } else if (fileName.Substring(0, 5).Equals("MAX_S")) { // �w�i file_type = LeNSFileType.BGGraphic; } else if (fileName.Substring(0, 2).Equals("OP")) { // �I�[�v�j���O file_type = LeNSFileType.BGGraphic; } else if (fileName.Substring(0, 5).Equals("TITLE")) { // �^�C�g�� file_type = LeNSFileType.EtcGraphic; } else if (fileName.Substring(0, 3).Equals("VIS")) { // �r�W���A���V�[�� file_type = LeNSFileType.BGGraphic; } else { throw new InvalidDataException("����`�̃t�@�C������o���܂����B"); } break; case LeafPackType.LPTYPE_KIZUWIN: if (fileName.Equals("LEAF.LFG")) { // ���[�t���S(���ȍ~) file_type = LeNSFileType.SpecialFile; } else if (fileName.Equals("KNJ_ALL.KNJ")) { // �����t�@�C�� file_type= LeNSFileType.SpecialFile; } else if (ext.Equals(".SCN")) { // �V�i���I�t�@�C�� file_type = LeNSFileType.ScenarioFile; } else if (ext.Equals(".P16")) { // ���ʉ��t�@�C�� file_type = LeNSFileType.SoundFile; } else { typeString = fileName.Substring(0, 4); switch (typeString) { case "BLDW": // �����Ԃ� file_type = LeNSFileType.BGGraphic; break; case "CLAW": // �� file_type = LeNSFileType.BGGraphic; break; case "TITL": // �^�C�g�� file_type = LeNSFileType.EtcGraphic; break; default: typeString = fileName.Substring(0, 1); switch (typeString) { case "C": // �����G file_type = LeNSFileType.CharaGraphic; break; case "H": // �g�V�[�� file_type = LeNSFileType.BGGraphic; break; case "O": // �I�[�v�j���O file_type = LeNSFileType.EtcGraphic; break; case "S": // �w�i file_type = LeNSFileType.BGGraphic; break; case "V": // �r�W���A���V�[�� file_type = LeNSFileType.BGGraphic; break; default: throw new InvalidDataException("����`�̃t�@�C������o���܂����B"); } break; } } break; case LeafPackType.LPTYPE_TOHEART: break; default: // �������A���̑��͔��ʖ��Ή� break; } if (file_type == LeNSFileType.ScenarioFile) { _scenarioNum++; } else { _otherNum++; } return file_type; }
// �I�[�v�� public void Open(String Path, FileMode Mode) { key = new Int16[LP_KEY_LEN]; _type = LeafPackType.LPTYPE_UNKNOWN; _size = -1; _fileNum = -1; _scenarioNum = 0; _otherNum = 0; _files = new Dictionary<String, LeafFileInfo>(); // �t�@�C���X�g���[���I�[�v�� fs = new FileStream(Path, Mode); // �o�C�i�����[�_�I�[�v�� br = new BinaryReader(fs); if (Mode == FileMode.Open) { // �t�@�C���T�C�Y _size = fs.Length; // �}�W�b�N�R�[�h�̃`�F�b�N String strBuf = new String(br.ReadChars(8)); if (!strBuf.Equals("LEAFPACK")) { throw new InvalidDataException("LeafPack�ł͂���܂���B"); } // �t�@�C�����̎擾 _fileNum = br.ReadInt16(); // �^�C�v�`�F�b�N switch (_fileNum) { case 0x0248: // LVNS3DAT.PAK _type = LeafPackType.LPTYPE_TOHEART; break; case 0x03e1: // LVNS3SCN.PAK _type = LeafPackType.LPTYPE_TOHEART; break; case 0x01fb: // MAX2DATA.PAK _type = LeafPackType.LPTYPE_KIZUWIN; break; case 0x0193: // MAX_DATA.PAK _type = LeafPackType.LPTYPE_SIZUWIN; break; case 0x0072: _type = LeafPackType.LPTYPE_SAORIN; break; default: _type = LeafPackType.LPTYPE_UNKNOWN; break; } // KEY�̎擾 guessKey(); // �t�@�C���e�[�u���̎擾 extractTable(); } else { throw new InvalidOperationException("�����ȃ��[�h�ŃI�[�v������܂����B"); } }