Пример #1
0
void MigrateStandaloneTask::doTask()
{
	auto wildc = gcRefPtr<WildcardManager>::create();
	wildc->onNeedSpecialEvent += delegate(&getUserCore()->getNeedWildCardEvent());

	for (size_t x=0; x<m_vFileList.size(); x++)
	{
		AutoDelFile adf(m_vFileList[x]);

		XML::gcXMLDocument doc(m_vFileList[x].getFullPath().c_str());

		if (!doc.IsValid())
			continue;

		auto root = doc.GetRoot("game");

		if (!root.IsValid())
			continue;

		gcString path;
		gcString id;

		uint32 branch = -1;
		uint32 build = -1;

		root.GetChild("path", path);
		root.GetChild("id", id);

		root.GetChild("branch", branch);
		root.GetChild("build", build);

		if (id == "" || !UTIL::FS::isValidFolder(path))
			continue;

		DesuraId itemId(id.c_str(), "games");

		auto info = getUserCore()->getItemManager()->findItemInfo(itemId);

		if (!info || info->isInstalled())
			continue;

		try
		{
			getUserCore()->getCIPManager()->updateItem(itemId, path);
			getUserCore()->getItemManager()->retrieveItemInfo(getItemId(), 0, wildc);
		}
		catch (...)
		{
			continue;
		}

		info = getUserCore()->getItemManager()->findItemInfo(itemId);
		auto realInfo = gcRefPtr<UserCore::Item::ItemInfo>::dyn_cast(info);

		if (!realInfo)
			continue;

		realInfo->migrateStandalone(MCFBranch::BranchFromInt(branch), MCFBuild::BuildFromInt(build));
	}
}
Пример #2
0
int crypto_aead_decrypt(
  unsigned char *m,unsigned long long *outputmlen,
  unsigned char *nsec,
  const unsigned char *c,unsigned long long clen,
  const unsigned char *ad,unsigned long long adlen,
  const unsigned char *npub,
  const unsigned char *k
)
{
  try {
    std::string plain;
    CryptoPP::GCM<CryptoPP::AES>::Decryption d;
    d.SetKeyWithIV(k, 32, npub, 12);
    CryptoPP::AuthenticatedDecryptionFilter adf( d, NULL, CryptoPP::AuthenticatedDecryptionFilter::MAC_AT_BEGIN | CryptoPP::AuthenticatedDecryptionFilter::THROW_EXCEPTION, 16 );
    *outputmlen = clen-16;
    adf.ChannelPut(CryptoPP::DEFAULT_CHANNEL, c+clen-16, 16);
    adf.ChannelPut(CryptoPP::AAD_CHANNEL, ad, adlen); 
    adf.ChannelPut(CryptoPP::DEFAULT_CHANNEL, c, clen-16);
    adf.ChannelMessageEnd(CryptoPP::AAD_CHANNEL);
    adf.ChannelMessageEnd(CryptoPP::DEFAULT_CHANNEL);
    if (!adf.GetLastResult())
      return -111;
    adf.SetRetrievalChannel(CryptoPP::DEFAULT_CHANNEL);
    adf.Get(m, *outputmlen);
    return 0;
  } catch (CryptoPP::Exception& e ) {
    return -111;
  }
}
Пример #3
0
int main()
{
    int x;
    char s[20];
    FILE *g;
    g=fopen("input.dat","r");
    while (fscanf(g,"%s",&s)==1)
    {


        if (strcmp("AF",s)==0)
        {
            fscanf(g,"%d",&x);
            adf(x);
        }
        else if (strcmp("AL",s)==0)
        {
            fscanf(g,"%d",&x);
            adl(x);
        }
        else if (strcmp("DF",s)==0) def();
        else if (strcmp("DL",s)==0) del();
        else if (strcmp("DE",s)==0) {fscanf(g,"%d",&x); dee(x);}
        else if (strcmp("PRINT_ALL",s)==0) print_alll();
        else if (strcmp("PRINT_F",s)==0)
        {
            fscanf(g,"%d",&x);
            print_fi(x);
        }
        else if (strcmp("PRINT_L",s)==0)
        {
            fscanf(g,"%d",&x);
            print_la(x);
        }
        else if (strcmp("DOOM_THE_LIST",s)==0) doom_the_listt();
    }

return 0;
}