Subversion Repositories spk

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#include <SpkFile.h>
2
 
3
 
4
class MyProgress :
5
#ifdef _INCLUDE7ZIP
6
public CProgressInfo7Zip
7
#else
8
public CProgressInfo
9
#endif
10
{
11
public:
12
	MyProgress ( int t = 0 ) { current = 0; type = t; }
13
 
14
	int GetCurrent() { return current; }
15
	void ProgressUpdated ( const long cur, const long max )
16
	{
17
		int percent = (int)(((float)(int)cur / (float)(int)max) * 100);
18
		while ( (percent - current) >= 5 )
19
		{
20
			current += 5;
21
			PrintType();
22
		}
23
	}
24
 
25
	void DoingFile ( CFile *file ) { }
26
 
27
	void PrintDone ()
28
	{
29
		while ( current < 100 )
30
		{
31
			current += 5;
32
			PrintType();
33
		}
34
		Reset ();
35
	}
36
 
37
	void Reset ()
38
	{
39
		current = 0;
40
	}
41
 
42
private:
43
	void PrintType ()
44
	{
45
		if ( type == 0 )
46
			printf ( "#" );
47
		else
48
		{
49
			if ( (current % 10) )
50
				printf ( "#" );
51
			else if ( current >= 100 )
52
				printf ( "0" );
53
			else
54
				printf ( "%1d", current / 10 );
55
		}
56
	}
57
 
58
	int type;
59
	int current;
60
};