forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsset.cs
More file actions
204 lines (204 loc) · 4.4 KB
/
Copy pathAsset.cs
File metadata and controls
204 lines (204 loc) · 4.4 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
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace UnityEditor.VersionControl
{
public sealed class Asset
{
[Flags]
public enum States
{
None = 0,
Local = 1,
Synced = 2,
OutOfSync = 4,
Missing = 8,
CheckedOutLocal = 16,
CheckedOutRemote = 32,
DeletedLocal = 64,
DeletedRemote = 128,
AddedLocal = 256,
AddedRemote = 512,
Conflicted = 1024,
LockedLocal = 2048,
LockedRemote = 4096,
Updating = 8192,
ReadOnly = 16384,
MetaFile = 32768
}
private string m_guid;
public extern Asset.States state
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern string path
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool isFolder
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool readOnly
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool isMeta
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool locked
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern string name
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern string fullName
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
public extern bool isInCurrentProject
{
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
internal bool IsUnderVersionControl
{
get
{
return this.IsState(Asset.States.Synced) || this.IsState(Asset.States.OutOfSync) || this.IsState(Asset.States.AddedLocal);
}
}
public string prettyPath
{
get
{
return this.path;
}
}
public Asset(string clientPath)
{
this.InternalCreateFromString(clientPath);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private extern void InternalCreateFromString(string clientPath);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern void Dispose();
~Asset()
{
this.Dispose();
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public extern bool IsChildOf(Asset other);
internal static bool IsState(Asset.States isThisState, Asset.States partOfThisState)
{
return (isThisState & partOfThisState) != Asset.States.None;
}
public bool IsState(Asset.States state)
{
return Asset.IsState(this.state, state);
}
public bool IsOneOfStates(Asset.States[] states)
{
for (int i = 0; i < states.Length; i++)
{
Asset.States states2 = states[i];
if ((this.state & states2) != Asset.States.None)
{
return true;
}
}
return false;
}
public void Edit()
{
UnityEngine.Object @object = this.Load();
if (@object != null)
{
AssetDatabase.OpenAsset(@object);
}
}
public UnityEngine.Object Load()
{
if (this.state == Asset.States.DeletedLocal || this.isMeta)
{
return null;
}
return AssetDatabase.LoadAssetAtPath(this.path, typeof(UnityEngine.Object));
}
internal static string StateToString(Asset.States state)
{
if (Asset.IsState(state, Asset.States.AddedLocal))
{
return "Added Local";
}
if (Asset.IsState(state, Asset.States.AddedRemote))
{
return "Added Remote";
}
if (Asset.IsState(state, Asset.States.CheckedOutLocal) && !Asset.IsState(state, Asset.States.LockedLocal))
{
return "Checked Out Local";
}
if (Asset.IsState(state, Asset.States.CheckedOutRemote) && !Asset.IsState(state, Asset.States.LockedRemote))
{
return "Checked Out Remote";
}
if (Asset.IsState(state, Asset.States.Conflicted))
{
return "Conflicted";
}
if (Asset.IsState(state, Asset.States.DeletedLocal))
{
return "Deleted Local";
}
if (Asset.IsState(state, Asset.States.DeletedRemote))
{
return "Deleted Remote";
}
if (Asset.IsState(state, Asset.States.Local))
{
return "Local";
}
if (Asset.IsState(state, Asset.States.LockedLocal))
{
return "Locked Local";
}
if (Asset.IsState(state, Asset.States.LockedRemote))
{
return "Locked Remote";
}
if (Asset.IsState(state, Asset.States.OutOfSync))
{
return "Out Of Sync";
}
return string.Empty;
}
internal string StateToString()
{
return Asset.StateToString(this.state);
}
}
}