Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Help] Byte array to string, Then in XML (LINQ)

[Help] Byte array to string, Then in XML (LINQ)

Posts 1–14 of 14 · Page 1 of 1
topblast
topblast
[Help] Byte array to string, Then in XML (LINQ)
I keep getting an error from this... some UNICODE ERROR!!!!!!!


[highlight="vb.net"]
Public Overrides Function ToString() As String
Dim file = My.Computer.FileSystem.ReadAllBytes("example.exe")
Dim fileR = System.Text.Encoding.ASCII.GetString(File)
Dim XML = <root>
<File><%= fileR %></File>
</root>
Return XML.ToString()
End Function
[/highlight]
#1 · 15y ago
freedompeace
freedompeace
By the way, you forgot to enclose your string with string deliminators.
#2 · 15y ago
topblast
topblast
Quote Originally Posted by freedompeace View Post
By the way, you forgot to enclose your string with string deliminators.
thanks but even if i do that XML.ToString() still gives me an error.
#3 · 15y ago
Jason
Jason
What's the end goal with this? Chances are there's a simpler method. Seems overkill to manually build an XML structure, then convert it back to string
#4 · 15y ago
freedompeace
freedompeace
Quote Originally Posted by topblast View Post


thanks but even if i do that XML.ToString() still gives me an error.
As a coder, as someone who is supposed to know things about technology and programming, aren't you forgetting something here?

("I got an error.")
#5 · 15y ago
topblast
topblast
Quote Originally Posted by freedompeace View Post


As a coder, as someone who is supposed to know things about technology and programming, aren't you forgetting something here?

("I got an error.")
I tried over and over and over to get this thing to work I keep falling on my ass. It keeps saying Invalid Char ' ', hex x1F


Quote Originally Posted by Jason View Post
What's the end goal with this? Chances are there's a simpler method. Seems overkill to manually build an XML structure, then convert it back to string
I am using XML because well they is more information in that, well really it is for my Blue Class To String. And it really is formed as an XML in file format but the size of it increases a LARGE AMOUNT and i got it down to this as the problem.
#6 · edited 15y ago · 15y ago
freedompeace
freedompeace
Quote Originally Posted by topblast View Post


I tried over and over and over to get this thing to work I keep falling on my ass. It keeps saying Invalid Char ' ', hex x1F




I am using XML because well they is more information in that, well really it is for my Blue Class To String. And it really is formed as an XML in file format but the size of it increases a LARGE AMOUNT and i got it down to this as the problem.
Meaning that one of the bytes in the file is invalid as an ASCII string, which is what you're trying to convert the bytes to. The ASCII string range is from 0 to 128 (if i remember correctly). Bytes are from 0 to 255.
#7 · 15y ago
Jason
Jason
Quote Originally Posted by topblast View Post


I tried over and over and over to get this thing to work I keep falling on my ass. It keeps saying Invalid Char ' ', hex x1F




I am using XML because well they is more information in that, well really it is for my Blue Class To String. And it really is formed as an XML in file format but the size of it increases a LARGE AMOUNT and i got it down to this as the problem.
What exactly does "Blue Class To String" comprise of? As I said before, chances are XML isn't even the best option. Without knowing exactly what you're trying to read from, I can't tell you a definitive answer.
#8 · 15y ago
topblast
topblast
Quote Originally Posted by Jason View Post


What exactly does "Blue Class To String" comprise of? As I said before, chances are XML isn't even the best option. Without knowing exactly what you're trying to read from, I can't tell you a definitive answer.

[highlight="vb.net"]
Public Overrides Function ToString() As String
'Me.Name String
'Me.Creator String
'Me.EXT string
'Me.File Byte()
Dim XML = <root>
<Name><%= Me.Name %></Name>
<Creator><%= Me.Creator %></Creator>
<Extension><%= Me.EXT %></Extension>
<File><%= String.Join(" ", Me.File) %></File>
</root>
Return XML.ToString()
End Function
[/highlight]
#9 · 15y ago
Jason
Jason
Quote Originally Posted by topblast View Post



[highlight="vb.net"]
Public Overrides Function ToString() As String
'Me.Name String
'Me.Creator String
'Me.EXT string
'Me.File Byte()
Dim XML = <root>
<Name><%= Me.Name %></Name>
<Creator><%= Me.Creator %></Creator>
<Extension><%= Me.EXT %></Extension>
<File><%= String.Join(" ", Me.File) %></File>
</root>
Return XML.ToString()
End Function
[/highlight]
No need to manually make an XElement then. You're converting it instantly to string which gives an exact replica of what you hardcoded to the user, so you may as well just hardcode it as string in the first place:

[highlight=vb.net]
Public Overrides Function ToString() As String
Dim thisName As String = String.Concat("<Name>", Me.Name, "</Name>")
Dim thisCreator As String = String.Concat("<Creator>", Me.Creator, "</Creator>")
Dim thisExtension As String = String.Concat("<Extension>", Me.EXT, "</Extension>")
Dim thisBytes As String = String.Concat("<File>", String.Join(" ", Array.ConvertAll(Me.File, Function(b As Byte) b.ToString)), "</File>")

Dim output As String = String.Join(ControlChars.Lf, New String() {"<root>", thisName, thisCreator, thisExtension, thisBytes, "</root>"})
Return output
End Function
[/highlight]
#10 · 15y ago
topblast
topblast
no but I also want it smaller.. I currently using the code i showed above and it works but I want to be able to convert to string and Back with no mistakes

PS the XML way is Much easier compared to what you have.
#11 · edited 15y ago · 15y ago
freedompeace
freedompeace
topblast, i honestly think you need to go back and read up on what XML is. Jason posted XML (not a non-"XML way"), and the problems with your code have been pointed out time and time again.
#12 · 15y ago
Jason
Jason
Your way was easier? You manually wrote out an XElement, converted it instantly to string (not Value, just ToString, which returns exactly what my method did, without any conversions.) There is really NO NEED for it to be that complicated lol. As for the bytes, you're implicitly converting them, chances are you should explicitly convert the array to a compatible data-type.
#13 · 15y ago
topblast
topblast
Quote Originally Posted by Jason View Post
Your way was easier? You manually wrote out an XElement, converted it instantly to string (not Value, just ToString, which returns exactly what my method did, without any conversions.) There is really NO NEED for it to be that complicated lol. As for the bytes, you're implicitly converting them, chances are you should explicitly convert the array to a compatible data-type.
I was away for a while. thanks you your help
#14 · 15y ago
Posts 1–14 of 14 · Page 1 of 1

Post a Reply

Tags for this Thread

None