Files
dl/build/backup/sound_cd.txt
T
2026-09-16 14:07:40 +08:00

60 lines
1.3 KiB
Plaintext
Vendored

if(true)
{
struct DataSubType
{
int _min = INT_MAX;
int _max = 0;
};
struct DataType
{
std::string _name;
std::map<std::string, DataSubType> _allSub;
};
struct Data
{
std::map<int, DataType> _data;
};
Data data;
std::string str = File::GetString("F:/All/收藏/音效光碟/C/list.txt");
std::vector<std::string> vec_str;
split(str, '\n', vec_str);
for (size_t i = 0; i + 3 < vec_str.size(); i += 3)
{
int id = String::toInt(vec_str[i]);
int type = String::toInt(vec_str[i + 1]);
std::string name = vec_str[i + 2];
std::string_view type_sub = String::GetBeginUntilNumber(name);
//log_info("{}, {}, {}, {}", type, type_sub, name, id);
DataType* group;
if (type == -1)
{
group = &data._data[id];
group->_name = name;
}
else
{
group = &data._data[type];
DataSubType& sub = group->_allSub[std::string{ type_sub }];
if (id < sub._min)
sub._min = id;
else if (id > sub._max)
sub._max = id;
}
}
// export
std::string str_out;
for (auto& iter : data._data)
{
for (auto& iter1 : iter.second._allSub)
{
str_out += fmt::format("{},{},{}-{}\n",
iter.second._name, iter1.first, iter1.second._min, iter1.second._max);
}
}
File::SaveString(str_out, "D:/1.txt");
}