Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
◆
GetStructLayoutCustomAttribute()
static
StructLayoutAttribute
System.Reflection.PseudoCustomAttribute.GetStructLayoutCustomAttribute
(
RuntimeType
type
)
inline
static
package
Definition at line
321
of file
PseudoCustomAttribute.cs
.
322
{
323
if
(
type
.IsInterface ||
type
.HasElementType ||
type
.IsGenericParameter)
324
{
325
return
null
;
326
}
327
LayoutKind
layoutKind
=
LayoutKind
.Auto;
328
switch
(
type
.Attributes &
TypeAttributes
.LayoutMask)
329
{
330
case
TypeAttributes
.ExplicitLayout:
331
layoutKind
=
LayoutKind
.Explicit;
332
break
;
333
case
TypeAttributes
.NotPublic:
334
layoutKind
=
LayoutKind
.Auto;
335
break
;
336
case
TypeAttributes
.SequentialLayout:
337
layoutKind
=
LayoutKind
.Sequential;
338
break
;
339
}
340
CharSet
charSet
=
CharSet
.None;
341
switch
(
type
.Attributes &
TypeAttributes
.StringFormatMask)
342
{
343
case
TypeAttributes
.NotPublic:
344
charSet
=
CharSet
.Ansi;
345
break
;
346
case
TypeAttributes
.AutoClass:
347
charSet
=
CharSet
.Auto;
348
break
;
349
case
TypeAttributes
.UnicodeClass:
350
charSet
=
CharSet
.Unicode;
351
break
;
352
}
353
type
.GetRuntimeModule().MetadataImport.GetClassLayout(
type
.MetadataToken,
out
var
packSize
,
out
var
classSize
);
354
if
(
packSize
== 0)
355
{
356
packSize
= 8;
357
}
358
StructLayoutAttribute
structLayoutAttribute
=
new
StructLayoutAttribute
(
layoutKind
);
359
structLayoutAttribute.Pack =
packSize
;
360
structLayoutAttribute.Size =
classSize
;
361
structLayoutAttribute.CharSet =
charSet
;
362
return
structLayoutAttribute
;
363
}
System.Collections.Generic.Dictionary
Definition
Dictionary.cs:14
System.Runtime.InteropServices.StructLayoutAttribute
Definition
StructLayoutAttribute.cs:5
System.Reflection.TypeAttributes
TypeAttributes
Definition
TypeAttributes.cs:5
System.Runtime.InteropServices.CharSet
CharSet
Definition
CharSet.cs:4
System.Runtime.InteropServices.LayoutKind
LayoutKind
Definition
LayoutKind.cs:4
System.ExceptionArgument.type
@ type
References
System.type
.
System
Reflection
PseudoCustomAttribute
Generated by
1.10.0