Пример #1
0
/**
 * Construct a new host folder PIDL with the fields initialised.
 */
inline winapi::shell::pidl::cpidl_t create_host_itemid(
    const std::wstring& host, const std::wstring& user, 
    const boost::filesystem::wpath& path, int port,
    const std::wstring& label=std::wstring())
{
    // We create the item on the stack and then clone it into 
    // a CoTaskMemAllocated pidl when we return it as a cpidl_t
    detail::host_item_template item;
    std::memset(&item, 0, sizeof(item));

    item.id.cb = sizeof(item.id);
    item.id.dwFingerprint = detail::host_item_id::FINGERPRINT;

#pragma warning(push)
#pragma warning(disable:4996)
    host.copy(item.id.wszHost, MAX_HOSTNAME_LENZ);
    item.id.wszHost[MAX_HOSTNAME_LENZ - 1] = wchar_t();

    user.copy(item.id.wszUser, MAX_USERNAME_LENZ);
    item.id.wszUser[MAX_USERNAME_LENZ - 1] = wchar_t();

    path.string().copy(item.id.wszPath, MAX_PATH_LENZ);
    item.id.wszPath[MAX_PATH_LENZ - 1] = wchar_t();

    label.copy(item.id.wszLabel, MAX_LABEL_LENZ);
    item.id.wszLabel[MAX_LABEL_LENZ - 1] = wchar_t();
#pragma warning(pop)

    item.id.uPort = boost::numeric_cast<USHORT>(port);

    assert(item.terminator.cb == 0);

    return winapi::shell::pidl::cpidl_t(
        reinterpret_cast<PCITEMID_CHILD>(&item));
}
Пример #2
0
	void torrent_handle::rename_file(int index, fs::wpath const& new_name) const
	{
		INVARIANT_CHECK;
		std::string utf8;
		wchar_utf8(new_name.string(), utf8);
		TORRENT_FORWARD(rename_file(index, utf8));
	}
Пример #3
0
	void torrent_handle::move_storage(
		fs::wpath const& save_path) const
	{
		INVARIANT_CHECK;
		std::string utf8;
		wchar_utf8(save_path.string(), utf8);
		TORRENT_FORWARD(move_storage(utf8));
	}
Пример #4
0
void load_app_config(const boost::filesystem::wpath &_path)
{
	assert(!config_);

	if (!fs::exists(_path))
	{
		config_.reset(new app_config());
		return;
	}

	pt::ptree options;
	pt::ini_parser::read_ini(_path.string(), Out options);

	const auto disable_server_history = options.get<bool>("history.disable_server_history", false);

	auto forced_dpi = options.get<int>("gui.force_dpi", 0);
	if (valid_dpi_values().count(forced_dpi) == 0)
	{
		forced_dpi = 0;
	}

	config_.reset(new app_config(!disable_server_history, forced_dpi));
}