-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInterfaces.cs
153 lines (134 loc) · 3.6 KB
/
Interfaces.cs
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
using System;
using System.Collections.Generic;
using System.ComponentModel;
using InputMaster.Parsers;
using InputMaster.Win32;
using System.Threading.Tasks;
namespace InputMaster
{
public interface INotifier
{
void Info(string message);
void Warning(string message);
void Error(string message);
void LogError(string message);
void SetPersistentText(string text);
string GetLog();
void CaptureForeground();
ISynchronizeInvoke SynchronizingObject { get; }
}
public interface IInputHook
{
void Handle(InputArgs e);
void Reset();
string GetStateInfo();
}
public interface IComboHook
{
void Handle(ComboArgs e);
void Reset();
string GetTestStateInfo();
bool Active { get; }
}
public interface IInjectorStream<out T>
{
T Add(Input input, bool down);
T Add(char c);
}
public interface IInjector<out T> : IInjectorStream<T>
{
void Run();
Action Compile();
T CreateInjector();
}
public interface IInjector : IInjector<IInjector> { }
public interface IForegroundListener
{
string ForegroundWindowTitle { get; }
string ForegroundProcessName { get; }
void Update();
}
public interface IFlagManager
{
bool HasFlag(string flag);
void ToggleFlag(string flag);
void SetFlag(string flag);
void ClearFlag(string flag);
void ClearFlags();
event Action FlagsChanged;
IEnumerable<string> GetFlags();
}
public interface IParser
{
void UpdateHotkeyFile(HotkeyFile hotkeyFile);
void UpdateParseAction(string name, ParseAction action);
void Run();
void GetAction(string name, out Action<IInjectorStream<object>> action);
bool IsDynamicHotkey(string name);
void FireNewParserOutput(ParserOutput parserOutput); // For unit tests.
event Action<ParserOutput> NewParserOutput;
}
public interface IScheduler
{
void AddJob(string name, Action action, TimeSpan delay, TimeSpan? retryDelay = null);
void AddJob(string name, Func<Task> action, TimeSpan delay, TimeSpan? retryDelay = null);
void AddFileJob(string file, string arguments, TimeSpan delay);
}
public interface IProcessManager
{
void StartHiddenProcess(string file, string arguments = "", TimeSpan? timeout = null);
}
public interface ICommandCollection
{
void AddActor(object actor);
Command GetCommand(LocatedString locatedName);
}
public interface IApp
{
event Action Run;
event Action Save;
event Action Unhook;
event Action Exiting;
void AddSaveAction(Func<Task> action);
void AddExitAction(Func<Task> action);
void TriggerRun();
/// <summary>
/// For debugging purposes.
/// </summary>
void TriggerUnhook();
Task TriggerSaveAsync();
Task TriggerExitAsync();
}
public interface IKeyboardLayout
{
bool TryReadKeyboardMessage(WindowMessage message, IntPtr data, out InputArgs inputArgs);
Combo GetCombo(char c);
string ConvertComboToString(Combo combo);
bool IsCharacterKey(Input input);
}
/// <summary>
/// Thread-safety is required for all classes implementing this interface.
/// </summary>
public interface ICipher
{
byte[] Encrypt(byte[] data);
byte[] Decrypt(byte[] data);
}
public interface IStateHandler<T> : IStateHandler
{
Task<T> LoadAsync();
}
public interface IStateHandler
{
Task SaveAsync();
}
public interface IState
{
(bool, string message) Fix();
}
public interface IStateHandlerFactory
{
IStateHandler<T> Create<T>(T state, string file, StateHandlerFlags flags) where T : IState;
IEnumerable<StateFile> GetExportableStateFiles();
}
}