示例#1
0
bool DeleteSOL()
{
	// Функция удаляет кукисы программы Macromedia FlashPlayer
	PCHAR DataPath = GetAppDataPath();
	if (DataPath == NULL)
		return false;

	// Создаём путь к папке кукисов
	PCHAR Path = StrNew(2, DataPath, "Macromedia\\Flash Player\\");
	StrFree(DataPath);
	// Чистим директории
	bool Result = ClearDirectory(Path);
	Result = Result | DeleteFiles("C:\\WINDOWS\\system32\\Macromed\\", "*.sol", true, false);

	StrFree(Path);
	return Result;
}
示例#2
0
    bool ClearDirectory(const TChar* directory)
    {
        if(!IsDirectoryExists(directory))
            return true;

        bool result = true;
        WIN32_FIND_DATA findData;

        TString searchPath = CreatePath(directory, TEXT("*"));
        HANDLE hFind = FindFirstFile(searchPath.c_str(), &findData);
        if(hFind != INVALID_HANDLE_VALUE)
        {
            do
            {
                TString name = findData.cFileName;
                if(name != TEXT(".") && name != TEXT(".."))
                {
                    TString path = CreatePath(directory, name);
                    if(findData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
                    {
                        if(!ClearDirectory(path.c_str()))
                        {
                            result = false;
                            break;
                        }
                        if(!RemoveDirectory(path.c_str()))
                        {
                            result = false;
                            break;
                        }
                    }
                    else
                    {
                        if(!DeleteFile(path.c_str()))
                        {
                            result = false;
                            break;
                        }
                    }
                }
            } while(FindNextFile(hFind, &findData));
            FindClose(hFind);
        }
        return result;
    }
bool RocketFileSystem::RemoveDirectory(QDir dir)
{
    bool ok = true;
    if (!dir.exists())
        return ok;

    // Remove all children recursively
    ok = ClearDirectory(dir);

    // Remove directory itself
    QDir parentDir = QFileInfo(dir.absolutePath()).dir();
    if (!parentDir.rmdir(dir.dirName()))
    {
        LogWarning("[RocketFileSystem]: Failed to remove directory " + dir.dirName() + " from " + parentDir.absolutePath());
        ok = false;
    }
    return ok;
}
bool RocketFileSystem::ClearDirectory(const QString &path)
{
    return ClearDirectory(QDir(path));
}
示例#5
0
  int UnzipToDir( const WCHAR* zipFile, const WCHAR* unzipDir, const OnProgressCallback* progress, const WCHAR* password, bool opt_extract_without_path, bool clearOutputDirectory )
  {
    unzFile uf = NULL;

    int err = -1;

    if ( ( zipFile != NULL ) && ( unzipDir != NULL ) )
    {
	  uf = unzOpenHelp (zipFile);
    }

    if ( uf != NULL )
    {
      if ( clearOutputDirectory )
	  {
	    ClearDirectory( unzipDir );
	  }
#if defined(_WIN32) || defined (_WIN64)
	  wchar_t* buffer = NULL;

	  buffer = _wgetcwd( NULL, 0 );
	  	  
	  err = _wchdir (unzipDir);
#else
	  char* buffer = NULL;

	  buffer = getcwd( NULL, 0 );
	  BYTE* pUtf8 = NULL;
	  LONG lLen = 0;
      NSFile::CUtf8Converter::GetUtf8StringFromUnicode(unzipDir, wcslen(unzipDir), pUtf8, lLen);
	  err = chdir ((char*)pUtf8);
	  RELEASEARRAYOBJECTS(pUtf8);
#endif
  
      if ( err == 0 )
	  {
	    if(NULL != password)
	    {
			std::string passwordA = codepage_issue_fixToOEM(password);
			err = do_extract( uf, opt_extract_without_path, 1, passwordA.c_str(), progress );
	    }
	    else
			err = do_extract( uf, opt_extract_without_path, 1, NULL, progress );
	  }

      if ( err == UNZ_OK )
	  {
	    err = unzClose( uf );
	  }

	  if ( buffer != NULL )
	  {
#if defined(_WIN32) || defined (_WIN64)
	    err = _wchdir( buffer );
#else
	    err = chdir( buffer );
#endif

	    free( buffer );
	    buffer = NULL;
	  }
    }

    return err;
  }
示例#6
0
/*----------------------------------------------------------------------*/
BOOL LoadProject(CINEMATIQUE * c, char * dir, char * name)
{
	int		nb, version;
	C_TRACK	t;
	C_KEY		k, *kk;
	C_KEY_1_59	k159;
	C_KEY_1_65	k165;
	C_KEY_1_70	k170;
	C_KEY_1_71	k171;
	C_KEY_1_72	k172;
	C_KEY_1_74	k174;
	C_KEY_1_75	k175;
	char	txt[4];

	InitMapLoad(c);
	InitSound(c);

	strcpy(AllTxt, dir);
	strcat(AllTxt, name);
	FCurr = PAK_fopen(AllTxt, "rb");

	if (!FCurr) return FALSE;

	ReadString(txt);

	if (strcmp(txt, "KFA"))
	{
		PAK_fclose(FCurr);
		FCurr = NULL;
		c->New();
		return FALSE;
	}

	PAK_fread(&version, 4, 1, FCurr);

	if (version > VERSION)
	{
		PAK_fclose(FCurr);
		FCurr = NULL;
		c->New();
		return FALSE;
	}

	if (version >= ((1 << 16) | 61))
	{
		char txt[256];
		ReadString(txt);
	}

	//chargement image
	PAK_fread(&nb, 1, 4, FCurr);

	while (nb)
	{
		int echelle = 0;

		if (version >= ((1 << 16) | 71))
		{
			PAK_fread((void *)&echelle, 4, 1, FCurr);
		}

		ReadString(AllTxt);
		strcpy(Dir, AllTxt);
		GetPathDirectory(Dir);
		strcpy(Name, AllTxt);
		ClearDirectory(Name);
		strcpy(Name, FileNameChoose);

		int id = CreateAllMapsForBitmap(Dir, Name, c, -1, 0);

		if (TabBitmap[id].load)
		{
			if (echelle > 1)
			{
				TabBitmap[id].grille.echelle = echelle;
				c->ReInitMapp(id);
			}
			else
			{
				TabBitmap[id].grille.echelle = 1;
			}
		}
		else
		{
			TabBitmap[id].grille.echelle = 1;
		}

		nb--;
	}

	//chargement son
	LSoundChoose = C_LANGUAGE_FRENCH;

	if (version >= ((1 << 16) | 60))
	{
		PAK_fread(&nb, 1, 4, FCurr);

		while (nb)
		{
			if (version >= ((1 << 16) | 76))
			{
				short il;
				PAK_fread((void *)&il, 1, 2, FCurr);
				LSoundChoose = il;
			}

			ReadString(AllTxt);
			strcpy(Dir, AllTxt);
			GetPathDirectory(Dir);
			strcpy(Name, AllTxt);
			ClearDirectory(Name);
			strcpy(Name, FileNameChoose);

			AddSoundToList(Dir, Name, -1, 0);
			nb--;
		}
	}

	//chargement track + key
	PAK_fread(&t, 1, sizeof(C_TRACK) - 4, FCurr);
	AllocTrack(t.startframe, t.endframe, t.fps);

	nb = t.nbkey;

	while (nb)
	{
		if (version <= ((1 << 16) | 59))
		{
			PAK_fread(&k159, 1, sizeof(C_KEY_1_59), FCurr);
			k.angz = k159.angz;
			k.color = k159.color;
			k.colord = k159.colord;
			k.colorf = k159.colorf;
			k.frame = k159.frame;
			k.fx = k159.fx;
			k.numbitmap = k159.numbitmap;
			k.pos = k159.pos;
			k.speed = k159.speed;

			ARX_CHECK_SHORT(k159.typeinterp);
			k.typeinterp = ARX_CLEAN_WARN_CAST_SHORT(k159.typeinterp);
			k.force = 1;
			k.idsound[C_LANGUAGE_FRENCH] = -1;
			k.light.intensite = -1.f;
			k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
			k.angzgrille = 0.f;
			k.speedtrack = 1.f;
		}
		else
		{
			if (version <= ((1 << 16) | 65))
			{
				PAK_fread(&k165, 1, sizeof(C_KEY_1_65), FCurr);
				k.angz = k165.angz;
				k.color = k165.color;
				k.colord = k165.colord;
				k.colorf = k165.colorf;
				k.frame = k165.frame;
				k.fx = k165.fx;
				k.numbitmap = k165.numbitmap;
				k.pos = k165.pos;
				k.speed = k165.speed;

				ARX_CHECK_SHORT(k165.typeinterp);
				k.typeinterp = ARX_CLEAN_WARN_CAST_SHORT(k165.typeinterp);
				k.force = 1;
				k.idsound[C_LANGUAGE_FRENCH] = k165.idsound;
				k.light.intensite = -1.f;
				k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
				k.angzgrille = 0.f;
				k.speedtrack = 1.f;
			}
			else
			{
				if (version <= ((1 << 16) | 70))
				{
					PAK_fread(&k170, 1, sizeof(C_KEY_1_70), FCurr);
					k.angz = k170.angz;
					k.color = k170.color;
					k.colord = k170.colord;
					k.colorf = k170.colorf;
					k.frame = k170.frame;
					k.fx = k170.fx;
					k.numbitmap = k170.numbitmap;
					k.pos = k170.pos;
					k.speed = k170.speed;
					k.typeinterp = k170.typeinterp;
					k.force = k170.force;
					k.idsound[C_LANGUAGE_FRENCH] = k170.idsound;
					k.light.intensite = -1.f;
					k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
					k.angzgrille = 0.f;
					k.speedtrack = 1.f;
				}
				else
				{
					if (version <= ((1 << 16) | 71))
					{
						PAK_fread(&k171, 1, sizeof(C_KEY_1_71), FCurr);
						k.angz = k171.angz;
						k.color = k171.color;
						k.colord = k171.colord;
						k.colorf = k171.colorf;
						k.frame = k171.frame;
						k.fx = k171.fx;
						k.numbitmap = k171.numbitmap;
						k.pos = k171.pos;
						k.speed = k171.speed;
						k.typeinterp = k171.typeinterp;
						k.force = k171.force;
						k.idsound[C_LANGUAGE_FRENCH] = k171.idsound;
						k.light = k171.light;

						if ((k.fx & 0xFF000000) != FX_LIGHT)
						{
							k.light.intensite = -1.f;
						}

						k.posgrille.x = k.posgrille.y = k.posgrille.z = 0.f;
						k.angzgrille = 0.f;
						k.speedtrack = 1.f;
					}
					else
					{
						if (version <= ((1 << 16) | 72))
						{
							PAK_fread(&k172, 1, sizeof(C_KEY_1_72), FCurr);
							k.angz = k172.angz;
							k.color = k172.color;
							k.colord = k172.colord;
							k.colorf = k172.colorf;
							k.frame = k172.frame;
							k.fx = k172.fx;
							k.numbitmap = k172.numbitmap;
							k.pos = k172.pos;
							k.speed = k172.speed;
							k.typeinterp = k172.typeinterp;
							k.force = k172.force;
							k.idsound[C_LANGUAGE_FRENCH] = k172.idsound;
							k.light.pos = k172.light.pos;
							k.light.fallin = k172.light.fallin;
							k.light.fallout = k172.light.fallout;
							k.light.r = k172.light.r;
							k.light.g = k172.light.g;
							k.light.b = k172.light.b;
							k.light.intensite = k172.light.intensite;
							k.light.intensiternd = k172.light.intensiternd;
							k.posgrille.x = k172.posgrille.x;
							k.posgrille.y = k172.posgrille.y;
							k.posgrille.z = k172.posgrille.z;
							k.angzgrille = k172.angzgrille;
							k.speedtrack = 1.f;

							if ((k.fx & 0xFF000000) != FX_LIGHT)
							{
								k.light.intensite = -1.f;
							}
						}
						else
						{
							if (version <= ((1 << 16) | 74))
							{
								PAK_fread(&k174, 1, sizeof(C_KEY_1_74), FCurr);
								k.angz = k174.angz;
								k.color = k174.color;
								k.colord = k174.colord;
								k.colorf = k174.colorf;
								k.frame = k174.frame;
								k.fx = k174.fx;
								k.numbitmap = k174.numbitmap;
								k.pos = k174.pos;
								k.speed = k174.speed;
								k.typeinterp = k174.typeinterp;
								k.force = k174.force;
								k.idsound[C_LANGUAGE_FRENCH] = k174.idsound;
								k.light.pos = k174.light.pos;
								k.light.fallin = k174.light.fallin;
								k.light.fallout = k174.light.fallout;
								k.light.r = k174.light.r;
								k.light.g = k174.light.g;
								k.light.b = k174.light.b;
								k.light.intensite = k174.light.intensite;
								k.light.intensiternd = k174.light.intensiternd;
								k.posgrille.x = k174.posgrille.x;
								k.posgrille.y = k174.posgrille.y;
								k.posgrille.z = k174.posgrille.z;
								k.angzgrille = k174.angzgrille;
								k.speedtrack = 1.f;
							}
							else
							{
								if (version <= ((1 << 16) | 75))
								{
									PAK_fread(&k175, 1, sizeof(C_KEY_1_75), FCurr);
									k.angz = k175.angz;
									k.color = k175.color;
									k.colord = k175.colord;
									k.colorf = k175.colorf;
									k.frame = k175.frame;
									k.fx = k175.fx;
									k.numbitmap = k175.numbitmap;
									k.pos = k175.pos;
									k.speed = k175.speed;
									k.typeinterp = k175.typeinterp;
									k.force = k175.force;
									k.idsound[C_LANGUAGE_FRENCH] = k175.idsound;
									k.light.pos = k175.light.pos;
									k.light.fallin = k175.light.fallin;
									k.light.fallout = k175.light.fallout;
									k.light.r = k175.light.r;
									k.light.g = k175.light.g;
									k.light.b = k175.light.b;
									k.light.intensite = k175.light.intensite;
									k.light.intensiternd = k175.light.intensiternd;
									k.posgrille.x = k175.posgrille.x;
									k.posgrille.y = k175.posgrille.y;
									k.posgrille.z = k175.posgrille.z;
									k.angzgrille = k175.angzgrille;
									k.speedtrack = k175.speedtrack;
								}
								else
								{
									PAK_fread(&k, 1, sizeof(C_KEY), FCurr);
								}
							}
						}
					}
				}
			}
		}

		if (version <= ((1 << 16) | 67))
		{
			if (k.typeinterp == INTERP_NO_FADE)
			{
				k.typeinterp = INTERP_NO;
				k.force = 1;
			}
		}

		if (version <= ((1 << 16) | 73))
		{
			k.light.pos.x = k.light.pos.y = k.light.pos.z = 0.f;
		}

		if (version <= ((1 << 16) | 75))
		{
			for (int i = 1; i < 16; i++) k.idsound[i] = -1;
		}

		if (k.force < 0) k.force = 1;

		FillKeyTemp(&k.pos, k.angz, k.frame, k.numbitmap, k.fx, k.typeinterp, k.color, k.colord, k.colorf, k.speed, -1, k.force, &k.light, &k.posgrille, k.angzgrille, k.speedtrack);
		memcpy(&KeyTemp.idsound, &k.idsound, 16 * 4);
		AddKeyLoad(&KeyTemp);

		if (!(t.nbkey - nb))
		{
			c->pos = k.pos;
			c->angz = k.angz;
			c->numbitmap = k.numbitmap;
			c->fx = k.fx;
			c->ti = c->tichoose = k.typeinterp;
			c->color = c->colorchoose = k.color;
			c->colord = c->colorchoosed = k.colord;
			c->colorflash = c->colorflashchoose = k.colorf;
			c->speed = c->speedchoose = k.speed;
			c->idsound = k.idsound[C_LANGUAGE_FRENCH];
			c->force = k.force;
			c->light = c->lightchoose = k.light;
			c->posgrille = k.posgrille;
			c->angzgrille = k.angzgrille;
			c->speedtrack = k.speedtrack;
		}

		nb--;
	}

	UpDateAllKeyLight();

	PAK_fclose(FCurr);
	FCurr = NULL;

	ActiveAllTexture(c);

	SetCurrFrame(0);

	GereTrackNoPlay(c);
	c->projectload = TRUE;

	InitUndo();

	//precalc
	if (version < ((1 << 16) | 71))
	{
		kk = CKTrack->key;
		nb = CKTrack->nbkey;

		while (nb)
		{
			switch (kk->fx & 0x0000FF00)
			{
				case FX_DREAM:
					TabBitmap[kk->numbitmap].grille.echelle = 4;
					c->ReInitMapp(kk->numbitmap);
					break;
			}

			nb--;
			kk++;
		}
	}

	LSoundChoose = C_LANGUAGE_ENGLISH << 8;

	return TRUE;
}