static void scan_dir(string in_dir, string out_dir, string postfix, ofstream& f) { WIN32_FIND_DATA fd; HANDLE findhandle = FindFirstFile((in_dir + '*' + postfix).c_str(), &fd); if (findhandle != INVALID_HANDLE_VALUE) { do { if (~fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { string title = boost::to_lower_copy(Cfname(fd.cFileName).get_ftitle()); Cvirtual_binary fdata; fdata.load(in_dir + fd.cFileName); Cxif_key k; Cxif_key& l = k.open_key_write(0); l.set_value_string(vi_fname, boost::to_lower_copy(string(fd.cFileName))); l.set_value_binary(vi_fdata, fdata); k.vdata().save(out_dir + title + ".xmuf"); f << title << "=,http://xccu.sourceforge.net/ra2_maps/" << title << ".xmuf" << endl; } } while (FindNextFile(findhandle, &fd)); FindClose(findhandle); } }
void Cdlg_login::add_game(const string& reg_key, ::t_game game, int gsku) { Creg_key key; string serial; if (ERROR_SUCCESS == key.open(HKEY_LOCAL_MACHINE, reg_key, KEY_READ)) key.query_value("Serial", serial); if (serial.size() == 22) { Cvirtual_binary s; s.load(xcc_dirs::get_dir(game) + "woldata.key"); for (int i = 0, j = 0; i < s.size(); i++, j++) { if (j == serial.length()) j = 0; serial[j] = (262 - s.data()[i] + serial[j]) % 10 + '0'; } } else serial.clear(); t_game e; e.gsku = gsku; e.serial = serial; m_game.SetItemData(m_game.AddString(game_name[game]), m_games.size()); m_games.push_back(e); }
int Cvirtual_file::load(const string& fname) { clear(); Cvirtual_binary t; int error = t.load(fname); if (!error) write(t); return error; }
int mix_database::load() { if (!td_list.empty() || !ra_list.empty() || !ts_list.empty()) return 0; Cvirtual_binary f; if (f.load(xcc_dirs::get_data_dir() + "global mix database.dat") || f.size() < 16) return 1; const char* data = reinterpret_cast<const char*>(f.data()); read_list(game_td, data); read_list(game_ra, data); read_list(game_ts, data); read_list(game_ra2, data); if (0) { ofstream log_f("c:\\log.txt"); for (auto& i : ts_list) log_f << i.second.name << '\t' << i.second.description << endl; } return 0; char name[12] = "scg00ea.bin"; const char char1[] = "bgjm"; const char char2[] = "ew"; const char char3[] = "abc"; for (int i = 0; i < 2; i++) { if (i) strcpy(name + 8, "ini"); for (int j = 0; j < 4; j++) { name[2] = char1[j]; for (int k = 0; k < 100; k++) { memcpy(name + 3, nwzl(2, k).c_str(), 2); for (int l = 0; l < 2; l++) { name[5] = char2[l]; for (int m = 0; m < 3; m++) { name[6] = char3[m]; mix_database::add_name(game_td, name, ""); mix_database::add_name(game_ra, name, ""); mix_database::add_name(game_ts, name, ""); } } } } } return 0; }
void Cdlg_make_torrent::OnLoadTrackers() { UpdateData(true); CFileDialog dlg(true, "torrent", NULL, OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, "Torrents|*.torrent|", this); if (IDOK != dlg.DoModal()) return; Cvirtual_binary d; d.load(static_cast<std::string>(dlg.GetPathName())); Cbt_torrent torrent(d.range()); if (!torrent.valid()) return; m_tracker = torrent.announce().c_str(); m_trackers.Empty(); const Cbt_torrent::t_announces& announces = torrent.announces(); for (Cbt_torrent::t_announces::const_iterator i = announces.begin(); i != announces.end(); i++) { m_trackers += i->c_str(); m_trackers += "\r\n"; } UpdateData(false); }