-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommonFlags.cs
More file actions
66 lines (57 loc) · 2.72 KB
/
CommonFlags.cs
File metadata and controls
66 lines (57 loc) · 2.72 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RC.Rimgazer
{
/*
This enumeration define how types\methods\fields processed by system
Default params are:
Priority = Normal
Activation stage = StageEntry
Binding strategy = BindToType
CatchExceptions = true (NYI)
Invalid combinations are IGNORED with WARNING
Invalid use of INTERNAL flag will cause ERROR
If BINDTOMETHOD is present, any exception inside given method will cause ERROR
Flags
BindToField
BindToMethod
require method\field with same combination of flags
in case of multiple\none fields\methods flag is IGNORED with ERROR
Logic implementation located inside EventHandlerList class
*/
[Flags]
public enum CommonFlags
{
Nothing = 0x000,
//Priority
Internal = 0x001, //Only single Internal handler is applicable per event
//If multiple handlers attempt to register - priority is used
//If same priority - declaring assembly will be checked
//Handlers declared by same assembly as event have lowest priority
//If conflict not resolved - NONE will register and exception is thrown
//This will happen if multiple mods want to edit same event of other mod
//Handler of this priority always invoked first
//Internal handler have full control over event processing
//it should invoke other handlers, process transactions, push changes
//it may replace event with other object of compatable class
//EventFallback class is default internal handler for all events
//By default special method of event is used for this
Low = 0x002, //Invoked before Normal and High
Normal = 0x000, //Invoked after Low and before High
High = 0x004, //Invoked after Low and Normal
//Activation stage
StageGameplay = 0x008, //for types that may not construct at StageEntry
//types of delayed construction may not register StageEntry events
StageEntry = 0x000, //by default all types resolved at StageEntry
//Binding strategy
BindToField = 0x010, //Handler will bind to field, will search for field with same flags
BindToSelf = 0x020, //Handler will recieve its own instance of hosting type
BindToMethod = 0x040, //Control passed to arbitrary method
//no actions done by system, accumulated errors are abandoned
//will seach for method with same flags
BindToType = 0x080, //Single instance of type constructed and shared by all handlers
CatchExceptions = 0x100, //By default system will catch errors, this can be disabled
}
}