1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
* AUTHOR
* N. Nielsen
*
* LICENSE
* This software is in the public domain.
*
* The software is provided "as is", without warranty of any kind,
* express or implied, including but not limited to the warranties
* of merchantability, fitness for a particular purpose, and
* noninfringement. In no event shall the author(s) be liable for any
* claim, damages, or other liability, whether in an action of
* contract, tort, or otherwise, arising from, out of, or in connection
* with the software or the use or other dealings in the software.
*
* SUPPORT
* Send bug reports to: <nielsen@memberwebs.com>
*/
#ifndef __DROPLET_H__
#define __DROPLET_H__
// The resources in the droplet
#define DROP_RESOURCE_TYPE _T("REP")
#define DROP_RESOURCE_ID _T("SCRIPT")
#define DROP_RESOURCE_FILE _T("DROPLET")
// Some extra binfile tags
#define DROPVAL_TITLE 0x0101
#define DROPVAL_BACKUPS 0x0102
#include "lib/rlib.h"
#include "lib/rep.h"
// Droplet: ---------------------------------------------------------------
// A droplet provides the saving/loading/loaded functionality of the
// droplet. Replaces are not done here
class Droplet
{
public:
Droplet();
~Droplet();
// Load a droplet from a file
bool load(LPCTSTR fileName);
// Load a droplet from a loaded executable
bool load(HMODULE module);
// Save a droplet out to an existing executable
bool save(LPCTSTR fileName);
// Get the internal rlib stream
r_context& getContext()
{ return m_ctx; }
// Is there a valid script loaded
bool hasScript()
{ return m_ctx.script.ops != NULL; }
// Get dialog title stored in droplet
string getTitle()
{ return m_title; }
// Set dialog title stored in droplet
void setTitle(astring& title)
{ m_title = title; }
// Get the buffer size stored in droplet
// 0 = process entire file
size_t getBuffSize()
{ return m_ctx.block; }
// Set the buffer size to be stored in droplet
void setBuffSize(size_t buffSize)
{ m_ctx.block = buffSize; }
// Should backups be kept?
bool keepBackups()
{ return m_keepBackups; }
// Set backup options for droplet
void setBackups(bool backups)
{ m_keepBackups = backups; }
protected:
r_context m_ctx;
astring m_title; // The dialog title
bool m_keepBackups; // Should backups be kept?
};
#endif //__DROPLET_H__
|