Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mslinks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Griefed
mslinks
Commits
7fa9dc33
Commit
7fa9dc33
authored
2 years ago
by
blackoverlord
Browse files
Options
Downloads
Patches
Plain Diff
more appropriate serialization of ItemIDDrive
parent
967851dc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/io/ByteReader.java
+4
-0
4 additions, 0 deletions
src/io/ByteReader.java
src/mslinks/data/ItemIDDrive.java
+9
-12
9 additions, 12 deletions
src/mslinks/data/ItemIDDrive.java
with
13 additions
and
12 deletions
src/io/ByteReader.java
+
4
−
0
View file @
7fa9dc33
...
...
@@ -55,6 +55,10 @@ public class ByteReader extends InputStream {
return
true
;
}
public
boolean
seekTo
(
int
newPos
)
throws
IOException
{
return
seek
(
newPos
-
pos
);
}
@Override
public
void
close
()
throws
IOException
{
...
...
This diff is collapsed.
Click to expand it.
src/mslinks/data/ItemIDDrive.java
+
9
−
12
View file @
7fa9dc33
...
...
@@ -41,27 +41,24 @@ public class ItemIDDrive extends ItemID {
super
.
load
(
br
,
maxSize
);
int
stringEndPos
=
br
.
getPosition
()
+
4
;
setName
(
br
.
readString
(
4
));
br
.
seek
(
stringEndPos
-
br
.
getPosition
());
// 8 bytes: drive size
// 8 bytes: drive free size
// 1 byte: 0/1 - has drive extension
// 1 byte: 0/1 - drive extension has class id
// 16 bytes: clsid - only possible value is CDBurn
br
.
seek
(
endPos
-
br
.
getPosition
()
);
br
.
seek
To
(
endPos
);
}
@Override
public
void
serialize
(
ByteWriter
bw
)
throws
IOException
{
super
.
serialize
(
bw
);
b
yte
[]
b
=
name
.
getBytes
(
);
bw
.
write
(
b
);
// TODO: check if this stuff is really needed
for
(
int
i
=
0
;
i
<
22
-
b
.
length
;
i
++)
bw
.
write
(
0
);
b
w
.
writeString
(
name
);
bw
.
write
8bytes
(
0
);
// drive size
bw
.
write8bytes
(
0
);
// drive free size
bw
.
write
(
0
);
// no extension
bw
.
write
(
0
);
// no clsid
}
@Override
...
...
@@ -77,11 +74,11 @@ public class ItemIDDrive extends ItemID {
if
(
s
==
null
)
return
this
;
if
(
Pattern
.
matches
(
"\\w
+
:\\\\"
,
s
))
if
(
Pattern
.
matches
(
"\\w:\\\\"
,
s
))
name
=
s
;
else
if
(
Pattern
.
matches
(
"\\w
+
:"
,
s
))
else
if
(
Pattern
.
matches
(
"\\w:"
,
s
))
name
=
s
+
"\\"
;
else
if
(
Pattern
.
matches
(
"\\w
+
"
,
s
))
else
if
(
Pattern
.
matches
(
"\\w"
,
s
))
name
=
s
+
":\\"
;
else
throw
new
ShellLinkException
(
"wrong drive name: "
+
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment