Subversion Repositories Kolibri OS

Rev

Rev 6021 | Rev 6887 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6021 Rev 6759
1
//IO library
1
//IO library
2
 
2
 
3
/*
3
/*
4
	class IO:
4
	class IO:
5
		io.count(path)           - êîëè÷åñòâî ôàéëîâ â äèððåêòîðèè path
5
		io.count(path)           - êîëè÷åñòâî ôàéëîâ â äèððåêòîðèè path
6
		io.size(path)            - ðàçìåð (ôàéëà/ïàïêè) path
6
		io.size(path)            - ðàçìåð (ôàéëà/ïàïêè) path
7
		io.run(path,param)       - çàïóñòèòü ôàéë path ñ ïàðàìåòðîì param
7
		io.run(path,param)       - çàïóñòèòü ôàéë path ñ ïàðàìåòðîì param
8
		io.write(size,data,path) - çàïèñàòü ôàéë ñ äàííûìè data â äèððåêòîðèþ path
8
		io.write(size,data,path) - çàïèñàòü ôàéë ñ äàííûìè data â äèððåêòîðèþ path
9
		io.read(path)            - ïðî÷èòàòü ôàéë path è âîçâðàòèòü óêàçàòåëü íà äàííûå
9
		io.read(path)            - ïðî÷èòàòü ôàéë path è âîçâðàòèòü óêàçàòåëü íà äàííûå
10
		io.move(path1,path2)     - ïåðåìåñòèòü (ôàéë/ïàïêó) èç path1 â path2
10
		io.move(path1,path2)     - ïåðåìåñòèòü (ôàéë/ïàïêó) èç path1 â path2
11
		io.copy(path1,path2)     - êîïèðîâàòü (ôàéë/ïàïêó) èç path1 â path2
11
		io.copy(path1,path2)     - êîïèðîâàòü (ôàéë/ïàïêó) èç path1 â path2
12
		io.set(path,attribute)   - óñòàíîâèòü àòòðèáóòû äëÿ (ôàéëà/ïàïêè)
12
		io.set(path,attribute)   - óñòàíîâèòü àòòðèáóòû äëÿ (ôàéëà/ïàïêè)
13
		io.del(path)             - óäàëèòü (ôàéë/ïàïêó)
13
		io.del(path)             - óäàëèòü (ôàéë/ïàïêó)
14
		
14
		
15
		io.dir.load(path)        - çàãðóçèòü â áóôôåð äàííûå ïàïêè path (ñëåäóåò î÷èùàòü áóôôåð ñîìàíäîé free!!!)
15
		io.dir.load(path)        - çàãðóçèòü â áóôôåð äàííûå ïàïêè path (ñëåäóåò î÷èùàòü áóôôåð ñîìàíäîé free!!!)
16
		io.dir.position(number)  - âîçâðàòèòü óêàçàòåëü èìåíè ôàéëà ïî ïîçèöèè number
16
		io.dir.position(number)  - âîçâðàòèòü óêàçàòåëü èìåíè ôàéëà ïî ïîçèöèè number
17
		io.dir.make(path)        - ñîçäàòü ïàïêó path
17
		io.dir.make(path)        - ñîçäàòü ïàïêó path
18
		
18
		
19
		io.dir.buffer            - áóôôåð äàííûõ çàãðóæåííîé ïàïêè ô-öèåé (io.dir.load)
19
		io.dir.buffer            - áóôôåð äàííûõ çàãðóæåííîé ïàïêè ô-öèåé (io.dir.load)
20
		io.dir.count             - êîëè÷åñòâî ôàéëîâ ôàãðóæåííîé ô-öèåé (io.count)
20
		io.dir.count             - êîëè÷åñòâî ôàéëîâ ôàãðóæåííîé ô-öèåé (io.count)
21
*/
21
*/
22
 
22
 
23
#ifndef INCLUDE_IO_H
23
#ifndef INCLUDE_IO_H
24
#define INCLUDE_IO_H
24
#define INCLUDE_IO_H
25
#print "[include ]\n"
25
#print "[include ]\n"
26
 
26
 
27
#ifndef INCLUDE_DATE_H
27
#ifndef INCLUDE_DATE_H
28
#include "../lib/date.h"
28
#include "../lib/date.h"
29
#endif
29
#endif
30
 
30
 
31
#ifdef LANG_RUS
31
#ifdef LANG_RUS
32
	#define __T__GB "ƒ¡"
32
	#define __T__GB "ƒ¡"
33
	#define __T__MB "Œ¡"
33
	#define __T__MB "Œ¡"
34
	#define __T__KB "Š¡"
34
	#define __T__KB "Š¡"
35
	#define __T___B ""
35
	#define __T___B ""
36
#else
36
#else
37
	#define __T__GB "Gb"
37
	#define __T__GB "Gb"
38
	#define __T__MB "Mb"
38
	#define __T__MB "Mb"
39
	#define __T__KB "Kb"
39
	#define __T__KB "Kb"
40
	#define __T___B "B"
40
	#define __T___B "B"
41
#endif
41
#endif
42
 
42
 
43
#define ATR_READONLY   000001b
43
#define ATR_READONLY   000001b
44
#define ATR_HIDDEN     000100b
44
#define ATR_HIDDEN     000100b
45
#define ATR_SYSTEM     010000b
45
#define ATR_SYSTEM     010000b
46
 
46
 
47
#define ATR_NOREADONLY 000010b
47
#define ATR_NOREADONLY 000010b
48
#define ATR_NOHIDDEN   001000b
48
#define ATR_NOHIDDEN   001000b
49
#define ATR_NOSYSTEM   100000b
49
#define ATR_NOSYSTEM   100000b
50
 
50
 
51
:enum
51
:enum
52
{
52
{
53
	DIR_ALL,
53
	DIR_ALL,
54
	DIR_NOROOT,
54
	DIR_NOROOT,
55
	DIR_ONLYREAL
55
	DIR_ONLYREAL
56
};
56
};
57
 
57
 
58
:struct ___f70{
58
:struct ___f70{
59
	dword	func;
59
	dword	func;
60
	dword	param1;
60
	dword	param1;
61
	dword	param2;
61
	dword	param2;
62
	dword	param3;
62
	dword	param3;
63
	dword	param4;
63
	dword	param4;
64
	char	rezerv;
64
	char	rezerv;
65
	dword	name;
65
	dword	name;
66
}__file_F70;
66
}__file_F70;
67
 
67
 
68
:int ___ReadDir(dword file_count, read_buffer, dir_path)
68
:int ___ReadDir(dword file_count, read_buffer, dir_path)
69
{
69
{
70
	__file_F70.func = 1;
70
	__file_F70.func = 1;
71
	__file_F70.param1 = 
71
	__file_F70.param1 = 
72
	__file_F70.param2 = 
72
	__file_F70.param2 = 
73
	__file_F70.rezerv = 0;
73
	__file_F70.rezerv = 0;
74
	__file_F70.param3 = file_count;
74
	__file_F70.param3 = file_count;
75
	__file_F70.param4 = read_buffer;
75
	__file_F70.param4 = read_buffer;
76
	__file_F70.name = io.path.path(dir_path);
76
	__file_F70.name = io.path.path(dir_path);
77
	$mov eax,70
77
	$mov eax,70
78
	$mov ebx,#__file_F70.func
78
	$mov ebx,#__file_F70.func
79
	$int 0x40
79
	$int 0x40
80
}
80
}
81
 
81
 
82
:dword ___GetFileInfo(dword file_path, bdvk_struct)
82
:dword ___GetFileInfo(dword file_path, bdvk_struct)
83
{    
83
{    
84
    __file_F70.func = 5;
84
    __file_F70.func = 5;
85
    __file_F70.param1 = 
85
    __file_F70.param1 = 
86
    __file_F70.param2 = 
86
    __file_F70.param2 = 
87
    __file_F70.param3 = 0;
87
    __file_F70.param3 = 0;
88
    __file_F70.param4 = bdvk_struct;
88
    __file_F70.param4 = bdvk_struct;
89
    __file_F70.rezerv = 0;
89
    __file_F70.rezerv = 0;
90
    __file_F70.name = io.path.path(file_path);
90
    __file_F70.name = io.path.path(file_path);
91
    $mov eax,70
91
    $mov eax,70
92
    $mov ebx,#__file_F70.func
92
    $mov ebx,#__file_F70.func
93
    $int 0x40
93
    $int 0x40
94
}
94
}
95
 
95
 
96
:struct ____BDVK {
96
:struct ____BDVK {
97
	dword	readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0;
97
	dword	readonly:1, hidden:1, system:1, volume_label:1, isfolder:1, notarchived:1, :0;
98
	byte	type_name;
98
	byte	type_name;
99
	byte	rez1, rez2, selected;
99
	byte	rez1, rez2, selected;
100
	dword   timecreate;
100
	dword   timecreate;
101
	date 	datecreate;
101
	date 	datecreate;
102
	dword	timelastaccess;
102
	dword	timelastaccess;
103
	date	datelastaccess;
103
	date	datelastaccess;
104
	dword	timelastedit;
104
	dword	timelastedit;
105
	date	datelastedit;
105
	date	datelastedit;
106
	dword	sizelo;
106
	dword	sizelo;
107
	dword	sizehi;
107
	dword	sizehi;
108
	char	name[518];
108
	char	name[518];
109
};
109
};
110
 
110
 
111
:struct __FILE
111
:struct __FILE
112
{
112
{
113
	dword count;
113
	dword count;
114
	int del(...);
114
	int del(...);
115
	int read(...);
115
	int read(...);
116
	int write(...);
116
	int write(...);
117
	dword set(...);
117
	dword set(...);
118
};
118
};
119
:dword __FILE::set(dword file_path)
119
:dword __FILE::set(dword file_path)
120
{    
120
{    
121
    __file_F70.func = 6;
121
    __file_F70.func = 6;
122
    __file_F70.param1 = 
122
    __file_F70.param1 = 
123
    __file_F70.param2 = 
123
    __file_F70.param2 = 
124
    __file_F70.param3 = 0;
124
    __file_F70.param3 = 0;
125
    __file_F70.param4 = #io.BDVK;
125
    __file_F70.param4 = #io.BDVK;
126
    __file_F70.rezerv = 0;
126
    __file_F70.rezerv = 0;
127
    __file_F70.name = io.path.path(file_path);
127
    __file_F70.name = io.path.path(file_path);
128
    $mov eax,70
128
    $mov eax,70
129
    $mov ebx,#__file_F70.func
129
    $mov ebx,#__file_F70.func
130
    $int 0x40
130
    $int 0x40
131
}
131
}
132
:int __FILE::del(dword PATH)
132
:int __FILE::del(dword PATH)
133
{
133
{
134
	__file_F70.func = 8;
134
	__file_F70.func = 8;
135
	__file_F70.param1 = 
135
	__file_F70.param1 = 
136
	__file_F70.param2 = 
136
	__file_F70.param2 = 
137
	__file_F70.param3 = 
137
	__file_F70.param3 = 
138
	__file_F70.param4 = 
138
	__file_F70.param4 = 
139
	__file_F70.rezerv = 0;
139
	__file_F70.rezerv = 0;
140
	__file_F70.name = io.path.path(PATH);
140
	__file_F70.name = io.path.path(PATH);
141
	$mov eax,70
141
	$mov eax,70
142
	$mov ebx,#__file_F70.func
142
	$mov ebx,#__file_F70.func
143
	$int 0x40
143
	$int 0x40
144
}
144
}
145
:int __FILE::read(dword read_pos, read_file_size, read_buffer, read_file_path)
145
:int __FILE::read(dword read_pos, read_file_size, read_buffer, read_file_path)
146
{
146
{
147
	__file_F70.func = 0;
147
	__file_F70.func = 0;
148
	__file_F70.param1 = read_pos;
148
	__file_F70.param1 = read_pos;
149
	__file_F70.param2 = 0;
149
	__file_F70.param2 = 0;
150
	__file_F70.param3 = read_file_size;
150
	__file_F70.param3 = read_file_size;
151
	__file_F70.param4 = read_buffer;
151
	__file_F70.param4 = read_buffer;
152
	__file_F70.rezerv = 0;
152
	__file_F70.rezerv = 0;
153
	__file_F70.name = io.path.path(read_file_path);
153
	__file_F70.name = io.path.path(read_file_path);
154
	$mov eax,70
154
	$mov eax,70
155
	$mov ebx,#__file_F70.func
155
	$mov ebx,#__file_F70.func
156
	$int 0x40
156
	$int 0x40
157
}
157
}
158
:int __FILE::write(dword write_file_size, write_buffer, write_file_path)
158
:int __FILE::write(dword write_file_size, write_buffer, write_file_path)
159
{
159
{
160
	__file_F70.func = 2;
160
	__file_F70.func = 2;
161
	__file_F70.param1 = 0;
161
	__file_F70.param1 = 0;
162
	__file_F70.param2 = 0;
162
	__file_F70.param2 = 0;
163
	__file_F70.param3 = write_file_size;
163
	__file_F70.param3 = write_file_size;
164
	__file_F70.param4 = write_buffer;
164
	__file_F70.param4 = write_buffer;
165
	__file_F70.rezerv = 0;
165
	__file_F70.rezerv = 0;
166
	__file_F70.name = io.path.path(write_file_path);
166
	__file_F70.name = io.path.path(write_file_path);
167
	$mov eax,70
167
	$mov eax,70
168
	$mov ebx,#__file_F70.func
168
	$mov ebx,#__file_F70.func
169
	$int 0x40
169
	$int 0x40
170
}
170
}
171
:struct __DIR
171
:struct __DIR
172
{
172
{
173
	int make(dword name);
173
	int make(dword name);
174
	dword load(...);
174
	dword load(...);
175
	dword position(dword i);
175
	dword position(dword i);
176
	dword buffer;
176
	dword buffer;
177
	signed count;
177
	signed count;
178
};
178
};
179
:dword __DIR::position(dword i)
179
:dword __DIR::position(dword i)
180
{
180
{
181
	return i*304+buffer+72;
181
	return i*304+buffer+72;
182
}
182
}
183
:int __DIR::make(dword new_folder_path)
183
:int __DIR::make(dword new_folder_path)
184
{
184
{
185
	__file_F70.func = 9;
185
	__file_F70.func = 9;
186
	__file_F70.param1 = 
186
	__file_F70.param1 = 
187
	__file_F70.param2 = 
187
	__file_F70.param2 = 
188
	__file_F70.param3 = 
188
	__file_F70.param3 = 
189
	__file_F70.param4 = 
189
	__file_F70.param4 = 
190
	__file_F70.rezerv = 0;
190
	__file_F70.rezerv = 0;
191
	__file_F70.name = io.path.path(new_folder_path);
191
	__file_F70.name = io.path.path(new_folder_path);
192
	$mov eax,70
192
	$mov eax,70
193
	$mov ebx,#__file_F70.func
193
	$mov ebx,#__file_F70.func
194
	$int 0x40
194
	$int 0x40
195
}
195
}
196
 
196
 
197
:dword __DIR::load(dword PATH;byte options)
197
:dword __DIR::load(dword PATH;byte options)
198
{
198
{
199
	io.count(PATH);
199
	io.count(PATH);
200
	if(count!=-1)
200
	if(count!=-1)
201
	{      
201
	{      
202
		buffer = malloc(count+1*304+32);
202
		buffer = malloc(count+1*304+32);
203
		___ReadDir(count, buffer, PATH);
203
		___ReadDir(count, buffer, PATH);
204
		if (options == DIR_ONLYREAL)
204
		if (options == DIR_ONLYREAL)
205
		{
205
		{
206
			if (!strcmp(".",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
206
			if (!strcmp(".",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
207
			if (!strcmp("..",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
207
			if (!strcmp("..",buffer+72)){count--; memmov(buffer,buffer+304,count*304);}
208
			return buffer;
208
			return buffer;
209
		}
209
		}
210
		if (options == DIR_NOROOT)
210
		if (options == DIR_NOROOT)
211
		{
211
		{
212
			if (!strcmp(".",buffer+72)) memmov(buffer,buffer+304,count*304-304);
212
			if (!strcmp(".",buffer+72)) memmov(buffer,buffer+304,count*304-304);
213
			return buffer;
213
			return buffer;
214
		}
214
		}
215
		return buffer;
215
		return buffer;
216
	}
216
	}
217
	return NULL;
217
	return NULL;
218
}
218
}
219
 
219
 
220
:struct __PATH
220
:struct __PATH
221
{
221
{
222
	dword file(...);
222
	dword file(...);
223
	dword path(...);
223
	dword path(...);
224
};
224
};
225
 
225
 
226
:char __PATH_NEW[4096];
226
:char __PATH_NEW[4096];
227
:dword __PATH::path(dword PATH)
227
:dword __PATH::path(dword PATH)
228
{
228
{
229
	dword pos;
229
	dword pos;
230
	if(!PATH) return self.dir;
230
	if(!PATH) return self.dir;
231
	pos = PATH;
231
	pos = PATH;
232
	if(DSBYTE[pos]=='/')
232
	if(DSBYTE[pos]=='/') || (!strncmp(PATH,"./",2))
233
	{
233
	{
234
		pos++;
-
 
235
		if(!strncmp(pos,"sys/",4)) return PATH;
-
 
236
		if(!strncmp(pos,"kolibrios/",10)) return PATH;
-
 
237
		if(!strncmp(pos,"rd/",3)) return PATH;
-
 
238
		if(!strncmp(pos,"fd/",3)) return PATH;
-
 
239
		if(!strncmp(pos,"cd",2)) return PATH;
-
 
240
		if(!strncmp(pos,"hd",2)) return PATH;
-
 
241
		if(!strncmp(pos,"bd",2)) return PATH;
-
 
242
		if(!strncmp(pos,"tmp",3)) return PATH;
-
 
243
		if(!strncmp(pos,"usbhd",5)) return PATH;
-
 
244
		sprintf(#__PATH_NEW,"/sys%s",PATH);
-
 
245
		return #__PATH_NEW;
234
		return PATH;
246
	}
235
	}
247
	if(!strncmp(PATH,"./",2)) return PATH;
-
 
248
	sprintf(#__PATH_NEW,"%s/%s",self.dir,PATH);
236
	sprintf(#__PATH_NEW,"%s/%s",self.dir,PATH);
249
	return #__PATH_NEW;
237
	return #__PATH_NEW;
250
}
238
}
251
 
239
 
252
:dword __PATH::file(dword name)
240
:dword __PATH::file(dword name)
253
{
241
{
254
	dword ret;
242
	dword ret;
255
	ret = name;
243
	ret = name;
256
	while(DSBYTE[name])
244
	while(DSBYTE[name])
257
	{
245
	{
258
		if(DSBYTE[name]=='/')ret = name+1;
246
		if(DSBYTE[name]=='/')ret = name+1;
259
		name++;
247
		name++;
260
	}
248
	}
261
	return ret;
249
	return ret;
262
}
250
}
263
 
251
 
264
:struct IO
252
:struct IO
265
{
253
{
266
	dword buffer_data;
254
	dword buffer_data;
267
	dword size_dir;
255
	dword size_dir;
268
	dword count_dirs,count_files;
256
	dword count_dirs,count_files;
269
	signed FILES_SIZE;
257
	signed FILES_SIZE;
270
	dword file_name;
258
	dword file_name;
271
	double size(...);
259
	double size(...);
272
	dword get_size_dir(dword name);
260
	dword get_size_dir(dword name);
273
	signed count(dword path);
261
	signed count(dword path);
274
	signed int run(dword path,param);
262
	signed int run(dword path,param);
275
	byte del(...);
263
	byte del(...);
276
	dword read(...);
264
	dword read(...);
277
	int write(...);
265
	int write(...);
278
	byte copy(...);
266
	byte copy(...);
279
	byte move(...);
267
	byte move(...);
280
	dword set(...);
268
	dword set(...);
281
	dword readKPACK(dword path1);
269
	dword readKPACK(dword path1);
282
	dword convert_size();
270
	dword convert_size();
283
	__DIR dir;
271
	__DIR dir;
284
	__PATH path;
272
	__PATH path;
285
	__FILE file;
273
	__FILE file;
286
	____BDVK BDVK;
274
	____BDVK BDVK;
287
}io;
275
}io;
288
:byte __ConvertSize_size_prefix[8];
276
:byte __ConvertSize_size_prefix[8];
289
:dword IO::convert_size()
277
:dword IO::convert_size()
290
{
278
{
291
	byte size_nm[3];
279
	byte size_nm[3];
292
	dword bytes;
280
	dword bytes;
293
	bytes = FILES_SIZE;
281
	bytes = FILES_SIZE;
294
	if (bytes>=1073741824) strlcpy(#size_nm, __T__GB,2);
282
	if (bytes>=1073741824) strlcpy(#size_nm, __T__GB,2);
295
	else if (bytes>=1048576) strlcpy(#size_nm, __T__MB,2);
283
	else if (bytes>=1048576) strlcpy(#size_nm, __T__MB,2);
296
	else if (bytes>=1024) strlcpy(#size_nm, __T__KB,2);
284
	else if (bytes>=1024) strlcpy(#size_nm, __T__KB,2);
297
	else strlcpy(#size_nm, __T___B,1);
285
	else strlcpy(#size_nm, __T___B,1);
298
	while (bytes>1023) bytes/=1024;
286
	while (bytes>1023) bytes/=1024;
299
	sprintf(#__ConvertSize_size_prefix,"%d %s",bytes,#size_nm);
287
	sprintf(#__ConvertSize_size_prefix,"%d %s",bytes,#size_nm);
300
	return #__ConvertSize_size_prefix;
288
	return #__ConvertSize_size_prefix;
301
}
289
}
302
:dword IO::readKPACK(dword path1)
290
:dword IO::readKPACK(dword path1)
303
{
291
{
304
	EAX = 68;
292
	EAX = 68;
305
	EBX = 27;
293
	EBX = 27;
306
	ECX = path1;
294
	ECX = path1;
307
	$int 0x40;
295
	$int 0x40;
308
	FILES_SIZE = EDX;
296
	FILES_SIZE = EDX;
309
	buffer_data = EAX;
297
	buffer_data = EAX;
310
	return buffer_data;
298
	return buffer_data;
311
}	
299
}	
312
:int IO::write(dword PATH,data)
300
:int IO::write(dword PATH,data)
313
{
301
{
314
	file.write(0,strlen(data),data,PATH);
302
	file.write(0,strlen(data),data,PATH);
315
}
303
}
316
:char BYTE_HEAD_FILE_KPCK[4];
304
:char BYTE_HEAD_FILE_KPCK[4];
317
:dword IO::read(dword PATH)
305
:dword IO::read(dword PATH)
318
{
306
{
319
	int result;
307
	int result;
320
	___GetFileInfo(PATH, #BDVK);
308
	___GetFileInfo(PATH, #BDVK);
321
	if(BDVK.isfolder)return false;
309
	if(BDVK.isfolder)return false;
322
	file.read(0,4,#BYTE_HEAD_FILE_KPCK,PATH);
310
	file.read(0,4,#BYTE_HEAD_FILE_KPCK,PATH);
323
	IF(DSDWORD[#BYTE_HEAD_FILE_KPCK]=='KCPK')return readKPACK(PATH);
311
	IF(DSDWORD[#BYTE_HEAD_FILE_KPCK]=='KCPK')return readKPACK(PATH);
324
	FILES_SIZE = BDVK.sizelo;
312
	FILES_SIZE = BDVK.sizelo;
325
	buffer_data = malloc(FILES_SIZE+1);
313
	buffer_data = malloc(FILES_SIZE+1);
326
	result = file.read(0,FILES_SIZE,buffer_data,PATH);
314
	result = file.read(0,FILES_SIZE,buffer_data,PATH);
327
	if (result!=0) buffer_data = free(buffer_data);	//file read failed
315
	if (result!=0) buffer_data = free(buffer_data);	//file read failed
328
	return buffer_data;
316
	return buffer_data;
329
}
317
}
330
 
318
 
331
:signed int IO::run(dword rpath,rparam)
319
:signed int IO::run(dword rpath,rparam)
332
{
320
{
333
	__file_F70.func = 7;
321
	__file_F70.func = 7;
334
    __file_F70.param1 = 
322
    __file_F70.param1 = 
335
    __file_F70.param3 = 
323
    __file_F70.param3 = 
336
    __file_F70.param4 = 
324
    __file_F70.param4 = 
337
    __file_F70.rezerv = 0;
325
    __file_F70.rezerv = 0;
338
    __file_F70.param2 = rparam;
326
    __file_F70.param2 = rparam;
339
    __file_F70.name = path.path(rpath);
327
    __file_F70.name = path.path(rpath);
-
 
328
    debugln(__file_F70.name);
340
    $mov eax,70
329
    $mov eax,70
341
    $mov ebx,#__file_F70.func
330
    $mov ebx,#__file_F70.func
342
    $int 0x40
331
    $int 0x40
343
}
332
}
344
:signed IO::count(dword PATH)
333
:signed IO::count(dword PATH)
345
{
334
{
346
	byte buf[32];
335
	byte buf[32];
347
	if(!___ReadDir(0, #buf, PATH))
336
	if(!___ReadDir(0, #buf, PATH))
348
	{
337
	{
349
		dir.count = ESDWORD[#buf+8];
338
		dir.count = ESDWORD[#buf+8];
350
		return dir.count;
339
		return dir.count;
351
	}
340
	}
352
	return -1;
341
	return -1;
353
}
342
}
354
 
343
 
355
:double IO::size(dword PATH)
344
:double IO::size(dword PATH)
356
{
345
{
357
	dword i,tmp_buf,count_dir,count_file;
346
	dword i,tmp_buf,count_dir,count_file;
358
	dword filename;
347
	dword filename;
359
	double size_tmp;
348
	double size_tmp;
360
	double tmp;
349
	double tmp;
361
	if(!PATH)return 0;
350
	if(!PATH)return 0;
362
	if(___GetFileInfo(PATH, #BDVK))return -1;
351
	if(___GetFileInfo(PATH, #BDVK))return -1;
363
	if(BDVK.isfolder)
352
	if(BDVK.isfolder)
364
	{
353
	{
365
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
354
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
366
		if(dir.count<1)return 0;
355
		if(dir.count<1)return 0;
367
		count_dir = dir.count;
356
		count_dir = dir.count;
368
		i = 0;
357
		i = 0;
369
		size_tmp = 0;
358
		size_tmp = 0;
370
		count_file = malloc(4096);
359
		count_file = malloc(4096);
371
		while(i
360
		while(i
372
		{
361
		{
373
			filename = i*304+tmp_buf+72;
362
			filename = i*304+tmp_buf+72;
374
			sprintf(count_file,"%s/%s",PATH,filename);
363
			sprintf(count_file,"%s/%s",PATH,filename);
375
			tmp = size(count_file);
364
			tmp = size(count_file);
376
			if(tmp==-1)return -1;
365
			if(tmp==-1)return -1;
377
			size_tmp += tmp;
366
			size_tmp += tmp;
378
			i++;
367
			i++;
379
			if (TestBit(ESDWORD[filename-40], 4))count_dirs++;
368
			if (TestBit(ESDWORD[filename-40], 4))count_dirs++;
380
			else count_files++;
369
			else count_files++;
381
		}
370
		}
382
		
371
		
383
		free(tmp_buf);
372
		free(tmp_buf);
384
		free(count_file);
373
		free(count_file);
385
		FILES_SIZE = size_tmp;
374
		FILES_SIZE = size_tmp;
386
		return FILES_SIZE;
375
		return FILES_SIZE;
387
	}
376
	}
388
	FILES_SIZE = BDVK.sizelo;
377
	FILES_SIZE = BDVK.sizelo;
389
	count_files++;
378
	count_files++;
390
	return FILES_SIZE;
379
	return FILES_SIZE;
391
}
380
}
392
:byte IO::del(dword PATH)
381
:byte IO::del(dword PATH)
393
{
382
{
394
	dword i,tmp_buf,count_dir,count_file;
383
	dword i,tmp_buf,count_dir,count_file;
395
	if(!PATH)return 0;
384
	if(!PATH)return 0;
396
	if(___GetFileInfo(PATH, #BDVK))return false;
385
	if(___GetFileInfo(PATH, #BDVK))return false;
397
	if(BDVK.isfolder)
386
	if(BDVK.isfolder)
398
	{
387
	{
399
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
388
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
400
		count_dir = dir.count;
389
		count_dir = dir.count;
401
		i = 0;
390
		i = 0;
402
		count_file = malloc(4096);
391
		count_file = malloc(4096);
403
		while(i
392
		while(i
404
		{
393
		{
405
			sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
394
			sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
406
			if(!del(count_file))return false;
395
			if(!del(count_file))return false;
407
			i++;
396
			i++;
408
		}
397
		}
409
		free(tmp_buf);
398
		free(tmp_buf);
410
		free(count_file);
399
		free(count_file);
411
	}
400
	}
412
	file.del(PATH);
401
	file.del(PATH);
413
	return true;
402
	return true;
414
}
403
}
415
:dword IO::set(dword PATH,atr)
404
:dword IO::set(dword PATH,atr)
416
{
405
{
417
	dword i,tmp_buf,count_dir,count_file;
406
	dword i,tmp_buf,count_dir,count_file;
418
	byte cmd_read,cmd_hide,cmd_system;
407
	byte cmd_read,cmd_hide,cmd_system;
419
	if(!PATH)return 0;
408
	if(!PATH)return 0;
420
	if(___GetFileInfo(PATH, #BDVK))return false;
409
	if(___GetFileInfo(PATH, #BDVK))return false;
421
	cmd_read   = atr&11b;
410
	cmd_read   = atr&11b;
422
	atr>>=2;
411
	atr>>=2;
423
	cmd_hide   = atr&11b;
412
	cmd_hide   = atr&11b;
424
	atr>>=2;
413
	atr>>=2;
425
	cmd_system = atr&11b;
414
	cmd_system = atr&11b;
426
	if(BDVK.isfolder)
415
	if(BDVK.isfolder)
427
	{
416
	{
428
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
417
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
429
		count_dir = dir.count;
418
		count_dir = dir.count;
430
		i = 0;
419
		i = 0;
431
		count_file = malloc(4096);
420
		count_file = malloc(4096);
432
		while(i
421
		while(i
433
		{
422
		{
434
			sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
423
			sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
435
			file.set(PATH,atr);
424
			file.set(PATH,atr);
436
			i++;
425
			i++;
437
		}
426
		}
438
		free(tmp_buf);
427
		free(tmp_buf);
439
		free(count_file);
428
		free(count_file);
440
		return 0;
429
		return 0;
441
	}
430
	}
442
	if(cmd_read)
431
	if(cmd_read)
443
	{
432
	{
444
		if(cmd_read&01b)BDVK.readonly = true;
433
		if(cmd_read&01b)BDVK.readonly = true;
445
		else BDVK.readonly = false;
434
		else BDVK.readonly = false;
446
	}
435
	}
447
	if(cmd_hide)
436
	if(cmd_hide)
448
	{
437
	{
449
		if(cmd_hide&01b)BDVK.hidden = true;
438
		if(cmd_hide&01b)BDVK.hidden = true;
450
		else BDVK.hidden = false;
439
		else BDVK.hidden = false;
451
	}
440
	}
452
	if(cmd_system)
441
	if(cmd_system)
453
	{
442
	{
454
		if(cmd_system&01b)BDVK.system = true;
443
		if(cmd_system&01b)BDVK.system = true;
455
		else BDVK.system = false;
444
		else BDVK.system = false;
456
	}
445
	}
457
	file.set(PATH);
446
	file.set(PATH);
458
}
447
}
459
:byte IO::copy(dword PATH,PATH1)
448
:byte IO::copy(dword PATH,PATH1)
460
{
449
{
461
	dword i,tmp_buf,count_dir,count_file;
450
	dword i,tmp_buf,count_dir,count_file;
462
	dword _path_;
451
	dword _path_;
463
	byte ret;
452
	byte ret;
464
	if(!PATH)return 0;
453
	if(!PATH)return 0;
465
	if(___GetFileInfo(PATH, #BDVK))return false;
454
	if(___GetFileInfo(PATH, #BDVK))return false;
466
	_path_ = malloc(4096);
455
	_path_ = malloc(4096);
467
	if(BDVK.isfolder)
456
	if(BDVK.isfolder)
468
	{
457
	{
469
		sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
458
		sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
470
		dir.make(_path_);
459
		dir.make(_path_);
471
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
460
		tmp_buf = dir.load(PATH,DIR_ONLYREAL);
472
		count_dir = dir.count;
461
		count_dir = dir.count;
473
		i = 0;
462
		i = 0;
474
		count_file = malloc(4096);
463
		count_file = malloc(4096);
475
		while(i
464
		while(i
476
		{
465
		{
477
			sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
466
			sprintf(count_file,"%s/%s",PATH,i*304+tmp_buf+72);
478
			if(!copy(count_file,_path_))return false;
467
			if(!copy(count_file,_path_))return false;
479
			i++;
468
			i++;
480
		}
469
		}
481
		free(tmp_buf);
470
		free(tmp_buf);
482
		free(count_file);
471
		free(count_file);
483
		free(_path_);
472
		free(_path_);
484
		return true;
473
		return true;
485
	}
474
	}
486
	read(PATH);
475
	read(PATH);
487
	sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
476
	sprintf(_path_,"%s/%s",PATH1,path.file(PATH));
488
	ret = file.write(FILES_SIZE,buffer_data,_path_);
477
	ret = file.write(FILES_SIZE,buffer_data,_path_);
489
	free(_path_);
478
	free(_path_);
490
	if(!ret)return true;
479
	if(!ret)return true;
491
	return false;
480
	return false;
492
}
481
}
493
:byte IO::move(dword PATH,PATH1)
482
:byte IO::move(dword PATH,PATH1)
494
{
483
{
495
	if(copy(PATH,PATH1))if(del(PATH))return true;
484
	if(copy(PATH,PATH1))if(del(PATH))return true;
496
	return false;
485
	return false;
497
}
486
}
498
 
487
 
499
#endif
488
#endif
500
>
489
>
501
>
490
>
502
>
491
>
503
>
492
>