| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
1 |
/* |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
2 |
=========================================================================== |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
3 |
blockattack - Block Attack - Rise of the Blocks |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
4 |
Copyright (C) 2005-2012 Poul Sander |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
5 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
6 |
This program is free software: you can redistribute it and/or modify |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
7 |
it under the terms of the GNU General Public License as published by |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
8 |
the Free Software Foundation, either version 2 of the License, or |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
9 |
(at your option) any later version. |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
10 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
11 |
This program is distributed in the hope that it will be useful, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
14 |
GNU General Public License for more details. |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
15 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
16 |
You should have received a copy of the GNU General Public License |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
17 |
along with this program. If not, see http://www.gnu.org/licenses/ |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
18 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
19 |
Source information and contacts persons can be found at |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
20 |
http://blockattack.sf.net |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
21 |
=========================================================================== |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
22 |
*/ |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
23 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
24 |
//listFiles.h - List files in a given directory, 10 files at a time, at most 250 files |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
25 |
#include <string.h> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
26 |
#include <iostream> |
| 78d03b38 |
sago007 |
2008-11-13 19:56 |
27 |
#include <stdlib.h> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
28 |
#if defined(_WIN32) |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
29 |
#include <windows.h> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
30 |
#elif defined(__unix__) |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
31 |
#include <dirent.h> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
32 |
#endif |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
33 |
#include <string> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
34 |
#include <vector> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
35 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
36 |
#define MAX_NR_OF_FILES 253 |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
37 |
#if defined (_WIN32) |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
38 |
#define FIRST_FILE 2 |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
39 |
#else |
| f876e3cb |
sago007 |
2008-11-14 21:21 |
40 |
#define FIRST_FILE 1 |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
41 |
#endif |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
42 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
43 |
class ListFiles |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
44 |
{ |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
45 |
private: |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
46 |
int startFileNr; //The first fileto belisted |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
47 |
std::string filenames[MAX_NR_OF_FILES]; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
48 |
int nrOfFiles; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
49 |
#if defined(_WIN32) |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
50 |
WIN32_FIND_DATA FindFileData; |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
51 |
HANDLE hFind; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
52 |
#endif |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
53 |
bool isInList(const std::string &name); //The name is already in the list |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
54 |
public: |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
55 |
//ListFiles(); |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
56 |
//~ListFiles(); |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
57 |
void setDirectory(const std::string &dictory); //Find file in BlockAttack folder |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
58 |
void setDirectory2(const std::string &dictory); //Second directory we also look in |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
59 |
//void setDirecctoryInHome(string dictory); //Find files in home folder (it should work...) |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
60 |
std::string getFileName(int); //Returns the filename of a file |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
61 |
bool fileExists(int); |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
62 |
void forward(); //inclease startFile by 10 |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
63 |
void back(); //decrease startFile by 10 |
| 90e6c797 |
sago007 |
2015-11-22 21:46 |
64 |
std::string getRandom(); //Return the name of a random file in the directory, empty if none |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
65 |
}; |
|
|
1970-01-01 00:00 |
66 |
|