FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ByteCodeReader/ByteCodeReader/ConstantData/ConstantCell.cs at master · DKorablin/ByteCodeReader · GitHub
DKorablin
/
ByteCodeReader
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
5
Code
Issues
0
Pull requests
1
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
ByteCodeReader
/
ByteCodeReader
/
ConstantData
/
ConstantCell.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (58 loc) · 1.72 KB
Breadcrumbs
ByteCodeReader
/
ByteCodeReader
/
ConstantData
/
ConstantCell.cs
Copy path
File metadata and controls
62 lines (58 loc) · 1.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
using
System
;
using
System
.
Diagnostics
;
namespace
AlphaOmega
.
Debug
.
ConstantData
{
/// <summary>Generic constant cell reader</summary>
[
DebuggerDisplay
(
"Column={Column.Name} Value={Value}"
)
]
public
class
ConstantCell
:
Cell
<
Jvm
.
CONSTANT
>
{
private
readonly
ConstantColumnType
_columnType
;
/// <summary>Size in bytes of the column</summary>
public
UInt32
Size
{
get
{
switch
(
this
.
_columnType
)
{
case
ConstantColumnType
.
Byte
:
return
sizeof
(
Byte
)
;
case
ConstantColumnType
.
UInt16
:
return
sizeof
(
UInt16
)
;
case
ConstantColumnType
.
UInt32
:
return
sizeof
(
UInt32
)
;
case
ConstantColumnType
.
Utf8String
:
return
sizeof
(
UInt16
)
+
this
.
RawValue
;
//Here is the length of a column is stored
default
:
throw
new
NotImplementedException
(
)
;
}
}
}
internal
ConstantCell
(
ClassFile
file
,
ConstantColumn
column
,
UInt32
offset
)
:
base
(
column
)
{
this
.
_columnType
=
column
.
ColumnType
;
switch
(
this
.
_columnType
)
{
case
ConstantColumnType
.
Byte
:
this
.
RawValue
=
file
.
ReadBytes
(
offset
,
1
)
[
0
]
;
this
.
Value
=
(
Byte
)
this
.
RawValue
;
break
;
case
ConstantColumnType
.
UInt16
:
this
.
RawValue
=
file
.
PtrToStructure
<
UInt16
>
(
offset
)
;
this
.
Value
=
(
UInt16
)
this
.
RawValue
;
break
;
case
ConstantColumnType
.
UInt32
:
this
.
RawValue
=
file
.
PtrToStructure
<
UInt32
>
(
offset
)
;
this
.
Value
=
this
.
RawValue
;
break
;
case
ConstantColumnType
.
Utf8String
:
this
.
RawValue
=
file
.
PtrToStructure
<
UInt16
>
(
offset
)
;
Byte
[
]
bytes
=
file
.
ReadBytes
(
offset
+
sizeof
(
UInt16
)
,
this
.
RawValue
)
;
this
.
Value
=
System
.
Text
.
Encoding
.
UTF8
.
GetString
(
bytes
)
;
break
;
default
:
throw
new
NotImplementedException
(
)
;
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL