-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathCollab.bindings.cs
More file actions
267 lines (198 loc) · 10.1 KB
/
Collab.bindings.cs
File metadata and controls
267 lines (198 loc) · 10.1 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
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEditor.Connect;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Scripting;
namespace UnityEditor.Collaboration
{
[NativeHeader("Editor/Src/Collab/CollabInfo.h")]
[StructLayout(LayoutKind.Sequential)]
internal struct CollabInfo
{
public bool ready { get { return m_Ready; } }
public bool update { get { return m_Update; } }
public bool publish { get { return m_Publish; } }
public bool inProgress { get { return m_InProgress; } }
public bool maintenance { get { return m_Maintenance; } }
public bool conflict { get { return m_Conflict; } }
public bool refresh { get { return m_Refresh; } }
public bool seat { get { return m_HasSeat; } }
public string tip { get { return m_Tip; } }
public bool Equals(CollabInfo other)
{
return m_Update == other.m_Update &&
m_Publish == other.m_Publish &&
m_InProgress == other.m_InProgress &&
m_Maintenance == other.m_Maintenance &&
m_Conflict == other.m_Conflict &&
m_Refresh == other.m_Refresh &&
m_HasSeat == other.m_HasSeat &&
m_Ready == other.m_Ready &&
string.Equals(m_Tip, other.m_Tip);
}
bool m_Update;
bool m_Publish;
bool m_InProgress;
bool m_Maintenance;
bool m_Conflict;
bool m_Refresh;
bool m_HasSeat;
bool m_Ready;
string m_Tip;
}
[NativeHeader("Editor/Src/Collab/Collab.h")]
[NativeHeader("Editor/Src/Collab/Collab.bindings.h")]
[StructLayout(LayoutKind.Sequential)]
[StaticAccessor("Collab::Get()", StaticAccessorType.Arrow)]
partial class Collab
{
[NativeMethod("Get")]
static extern IntPtr GetNativeCollab();
public extern CollabInfo collabInfo { get; }
public static extern int GetRevisionsData(
bool withChanges, int startIndex, int numRevisions);
public static extern RevisionsData PopulateRevisionsData(IntPtr nativeData);
public extern void SetSeat(bool value);
public extern string GetProjectGUID();
public extern bool ShouldDoInitialCommit();
[NativeMethod("DiffFileWithBaseAsync")]
public extern void ShowDifferences(string path);
public extern void SendNotification();
public extern void SetError(int errorCode);
public extern void ClearError(int errorCode);
public extern void ClearErrors();
public extern void ForceRefresh(bool refreshAssetDatabase);
public extern void SetCollabEnabledForCurrentProject(bool enabled);
public extern bool IsCollabEnabledForCurrentProject();
public extern bool IsAssetIgnored(string path);
public extern bool ShouldTrackAsset(string path);
[ThreadAndSerializationSafe]
public extern string GetProjectPath();
[ThreadAndSerializationSafe]
public extern bool IsConnected();
[ThreadAndSerializationSafe]
public extern bool AnyJobRunning();
[ThreadAndSerializationSafe]
public extern bool JobRunning(int a_jobID);
public extern CollabStates GetAssetState(string guid);
public extern CollabStates GetSelectedAssetState();
public extern CollabStateID GetCollabState();
[FreeFunction(HasExplicitThis = true)]
public extern bool ValidateSelectiveCommit();
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void Disconnect();
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void CancelJobByType(int jobType, bool forceCancel);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void DoInitialCommit();
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void Update(string revisionID, bool updateToRevision);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void RevertFile(string path, bool forceOverwrite);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void LaunchConflictExternalMerge(string path);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void ShowConflictDifferences(string path);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void ResyncSnapshot();
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void GoBackToRevision(string revisionID, bool updateToRevision);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void ResyncToRevision(string revisionID);
[NativeMethod("GetConflictsManager().GetAllConflicts")]
public extern Change[] GetCollabConflicts();
// Conflict Management
[NativeMethod("GetConflictsManager().CheckConflictsResolvedExternal")]
public extern void CheckConflictsResolvedExternal();
[NativeMethod("GetTestHelper().AreTestsRunning")]
public extern bool AreTestsRunning();
[NativeMethod("GetTestHelper().SetTestsRunning")]
public extern void SetTestsRunning(bool running);
[NativeMethod("GetTestHelper().ClearOperationsFailure")]
public extern void ClearAllFailures();
[NativeMethod("GetTestHelper().UnmarkOperationFailure")]
public extern void ClearNextOperationFailure();
[NativeMethod("GetTestHelper().UnmarkOperationFailureForFile")]
public extern void ClearNextOperationFailureForFile(string path);
[NativeMethod("GetTestHelper().GetGUIDForTests")]
public extern string GetGUIDForTests();
[NativeMethod("GetTestHelper().NewGUIDForTests")]
public extern void NewGUIDForTests();
[NativeMethod("GetTestHelper().MarkOperationFailure")]
public extern void FailNextOperation(Collab.Operation operation, int code);
[NativeMethod("GetTestHelper().MarkOperationTimeOut")]
public extern void TimeOutNextOperation(Collab.Operation operation, int timeOutSec);
[NativeMethod("GetTestHelper().MarkOperationFailureForFile")]
public extern void FailNextOperationForFile(string path, Collab.Operation operation, int code);
[NativeMethod("GetTestHelper().MarkOperationTimeOutForFile")]
public extern void TimeOutNextOperationForFile(string path, Collab.Operation operation, int timeOutSec);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void TestPostSoftLockAsCollaborator(string projectGuid, string projectPath, string machineGuid,
string assetGuid);
[FreeFunction(HasExplicitThis = true, ThrowsException = true)]
public extern void TestClearSoftLockAsCollaborator(string projectGuid, string projectPath, string machineGuid,
string softLockHash);
// Private helper methods for bindings
[NativeMethod("GetConflictsManager().SetConflictsState")]
extern bool SetConflictsResolved(string[] paths, CollabStates state);
[NativeMethod("OnAssetBundleNameChanged")]
extern void OnPostprocessAssetbundleNameChanged(string assetPath, string previousAssetBundleName, string newAssetBundleName);
[NativeMethod("GetError")]
internal extern bool GetErrorInternal(int errorFilter, out UnityErrorInfo info);
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
extern Change[] GetChangesToPublishInternal();
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
extern void SetChangesToPublishInternal(ChangeItem[] changes);
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
extern Change[] GetSelectedChangesInternal();
[NativeMethod(Name = "GetJobProgress", HasExplicitThis = true, ThrowsException = true)]
extern bool GetJobProgressInternal([Out] ProgressInfo info, int jobId);
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
public extern void Publish(string comment, bool useSelectedAssets, bool confirmMatchesPrevious);
[NativeMethod(HasExplicitThis = true, ThrowsException = true, IsThreadSafe = true)]
public extern void ClearSelectedChangesToPublish();
[NativeMethod(HasExplicitThis = true, ThrowsException = true)]
public extern SoftLock[] GetSoftLocks(string assetGuid);
}
// keep in sync with CollabSettingType in C++
internal enum CollabSettingType
{
InProgressEnabled = 0,
InProgressProjectEnabled = 1,
InProgressGlobalEnabled = 2
}
// keep in sync with CollabSettingStatus in C++
internal enum CollabSettingStatus
{
None = 0,
Available = 1
}
[NativeHeader("Editor/Src/Collab/CollabSettingsManager.h")]
[StaticAccessor("GetCollabSettingsManager()", StaticAccessorType.Dot)]
internal class CollabSettingsManager
{
[RequiredByNativeCode]
static void NotifyStatusListeners(CollabSettingType type, CollabSettingStatus status)
{
if (statusNotifier[type] != null)
statusNotifier[type](type, status);
}
public delegate void SettingStatusChanged(CollabSettingType type, CollabSettingStatus status);
public static Dictionary<CollabSettingType, SettingStatusChanged> statusNotifier = new Dictionary<CollabSettingType, SettingStatusChanged>();
static CollabSettingsManager()
{
foreach (CollabSettingType type in Enum.GetValues(typeof(CollabSettingType)))
statusNotifier[type] = null;
}
public static extern bool IsAvailable(CollabSettingType type);
public static extern bool inProgressEnabled
{
get;
}
}
}