-
-
Notifications
You must be signed in to change notification settings - Fork 591
Expand file tree
/
Copy pathEverything3ApiDllImport.cs
More file actions
128 lines (97 loc) · 5.36 KB
/
Everything3ApiDllImport.cs
File metadata and controls
128 lines (97 loc) · 5.36 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
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
using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Flow.Launcher.Plugin.Explorer.Search.Everything
{
internal static class Everything3ApiDllImport
{
public static void Load(string directory)
{
var path = Path.Combine(directory, Dll);
IntPtr handle = LoadLibrary(path);
if (handle == IntPtr.Zero)
{
throw new Win32Exception(Marshal.GetLastPInvokeError());
}
}
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
private static extern IntPtr LoadLibrary(string name);
private const string Dll = "Everything3.dll";
[DllImport(Dll, CharSet = CharSet.Unicode)]
internal static extern IntPtr Everything3_ConnectW(string instanceName);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_DestroyClient(IntPtr client);
[DllImport(Dll)]
internal static extern IntPtr Everything3_CreateSearchState();
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_DestroySearchState(IntPtr searchState);
[DllImport(Dll, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_SetSearchTextW(IntPtr searchState, string search);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_SetSearchRegex(IntPtr searchState, bool matchRegex);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_SetSearchMatchPath(IntPtr searchState, bool matchPath);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_SetSearchHideResultOmissions(IntPtr searchState, bool hideResultOmissions);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_SetSearchViewportOffset(IntPtr searchState, nuint offset);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_SetSearchViewportCount(IntPtr searchState, nuint count);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_ClearSearchSorts(IntPtr searchState);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_AddSearchSort(IntPtr searchState, uint propertyId, bool ascending);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_ClearSearchPropertyRequests(IntPtr searchState);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_AddSearchPropertyRequest(IntPtr searchState, uint propertyId);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_AddSearchPropertyRequestHighlighted(IntPtr searchState, uint propertyId);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_GetSearchPropertyRequestHighlight(IntPtr searchState, nuint index);
[DllImport(Dll)]
internal static extern IntPtr Everything3_Search(IntPtr client, IntPtr searchState);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_DestroyResultList(IntPtr resultList);
[DllImport(Dll)]
internal static extern nuint Everything3_GetResultListViewportCount(IntPtr resultList);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_IsFolderResult(IntPtr resultList, nuint resultIndex);
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_IsRootResult(IntPtr resultList, nuint resultIndex);
[DllImport(Dll, CharSet = CharSet.Unicode)]
internal static extern nuint Everything3_GetResultFullPathNameW(IntPtr resultList, nuint resultIndex, StringBuilder buffer, nuint bufferSizeInWChars);
[DllImport(Dll, CharSet = CharSet.Unicode)]
internal static extern nuint Everything3_GetResultPropertyTextHighlightedW(IntPtr resultList, nuint resultIndex, uint propertyId, StringBuilder buffer, nuint bufferSizeInWChars);
[DllImport(Dll, CharSet = CharSet.Unicode)]
internal static extern nuint Everything3_GetResultPropertyTextW(IntPtr resultList, nuint resultIndex, uint propertyId, StringBuilder buffer, nuint bufferSizeInWChars);
[DllImport(Dll)]
internal static extern uint Everything3_GetResultRunCount(IntPtr resultList, nuint resultIndex);
[DllImport(Dll, CharSet = CharSet.Unicode)]
internal static extern uint Everything3_IncRunCountFromFilenameW(IntPtr client, string fileName);
[DllImport(Dll)]
internal static extern uint Everything3_GetLastError();
[DllImport(Dll)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool Everything3_IsPropertyFastSort(IntPtr client, uint propertyId);
}
}