예제 #1
0
        private string?GetFilenameInternal(int index)
        {
            var prefix      = string.Empty;
            var entry       = default(RDBEntry);
            var selectedRdb = default(RDB);

            foreach (var rdb in RDBs)
            {
                if (index >= rdb.Entries.Count)
                {
                    index -= rdb.Entries.Count;
                    continue;
                }

                prefix      = rdb.Name;
                entry       = rdb.GetEntry(index);
                selectedRdb = rdb;
                break;
            }

            if (selectedRdb == null)
            {
                return(null);
            }

            if (!selectedRdb.NameDatabase.ExtMap.TryGetValue(entry.TypeInfoKTID, out var ext) && (!ExtList.TryGetValue(entry.TypeInfoKTID, out ext) || string.IsNullOrEmpty(ext)))
            {
                ext = selectedRdb.NameDatabase.HashMap.TryGetValue(entry.TypeInfoKTID, out ext) ? ext.Split(':').Last() : entry.TypeInfoKTID.ToString("x8");
            }

            prefix += $@"\{ext}";

            if ((!selectedRdb.NameDatabase.NameMap.TryGetValue(entry.FileKTID, out var path) || string.IsNullOrWhiteSpace(path)) && (!FileList.TryGetValue(entry.FileKTID, out path) || string.IsNullOrWhiteSpace(path)))
            {
                path = $"{entry.FileKTID:x8}.{ext}";
            }