| | | | | Welcome to XboxMB - Xbox Message Boards | | Home of the Ultimate Xbox 360 Modding Tool, Horizon. XboxMB.com is a community of Xbox 360 gamers and modders who share Tutorials, News, Reviews, and other resources. Xbox Message Boards is free to sign up and use, so what are you waiting for? Register Now! | | | | |  |
02-22-2011
|
#1 (permalink)
| Banned
Join Date: Sep 2010 Location: Tha 7o2
Posts: 1,710
Thanks: 672 | | | Con Header
If any errors just make a class cs or vb file called languages and List and if that don't work just delete the references and build around
C# Code: namespace ConHeader {
using System.Text;
using System.Runtime.InteropServices;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System;
public class Derp {
private byte[] _deviceID = new byte[] {
(20 - 1)};
private Image _firstIcon;
private int _firstIconLength;
private byte[] _profileID = new byte[] {
(8 - 1)};
private Image _secondIcon;
private int _secondIconLength;
public List[] fdeList;
// Methods
public ConHeader(string ContainerFilePath) {
BinaryReader reader = new BinaryReader(new FileStream(ContainerFilePath, FileMode.Open, FileAccess.Read, FileShare.Read));
reader.BaseStream.Position = 881;
this._profileID = reader.ReadBytes(8);
reader.BaseStream.Position = 1021;
this._deviceID = reader.ReadBytes(20);
reader.BaseStream.Position = 1042;
FileDescriptionEntry item = new FileDescriptionEntry();
item.lang = language.English;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 3346;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 1298;
item = new FileDescriptionEntry();
item.lang = language.Japanese;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 3602;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 1554;
item = new FileDescriptionEntry();
item.lang = language.German;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 3858;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 1810;
item = new FileDescriptionEntry();
item.lang = language.French;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 4114;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 2066;
item = new FileDescriptionEntry();
item.lang = language.Spanish;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 4370;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 2322;
item = new FileDescriptionEntry();
item.lang = language.Italian;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 4626;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 2578;
item = new FileDescriptionEntry();
item.lang = language.Korean;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 4882;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 2834;
item = new FileDescriptionEntry();
item.lang = language.Chinese;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 5138;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 3090;
item = new FileDescriptionEntry();
item.lang = language.Portuguese;
item.title = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
reader.BaseStream.Position = 5394;
item.description = this.BytesToString(reader.ReadBytes(256)).Replace('\0', "");
this.fdeList.Add(item);
reader.BaseStream.Position = 5906;
this._firstIconLength = this.GetEndianI32(reader.ReadBytes(4));
this._secondIconLength = this.GetEndianI32(reader.ReadBytes(4));
this._firstIcon = this.ImageFromBytes(reader.ReadBytes(this._firstIconLength));
reader.BaseStream.Position = 22298;
this._secondIcon = this.ImageFromBytes(reader.ReadBytes(this._secondIconLength));
reader.Close;
}
// Properties
public byte[] DeviceIDBytes {
get {
return this._deviceID;
}
}
public string DeviceIDString {
get {
return this.BytesToHexString(this._deviceID);
}
}
public Image FirstIcon {
get {
return this._firstIcon;
}
}
public int FirstIconLength {
get {
return this._firstIconLength;
}
}
public byte[] ProfileIDBytes {
get {
return this._profileID;
}
}
public string ProfileIDString {
get {
return this.BytesToHexString(this._profileID);
}
}
public Image SecondIcon {
get {
return this._secondIcon;
}
}
public int SecondIconLength {
get {
return this._secondIconLength;
}
}
private string BytesToHexString(byte[] data) {
string str = "";
int i;
for (i = 0; (i
<= (data.Length - 1)); i++) {
string str2 = data(i).ToString("X");
while ((str2.Length != 2)) {
str2 = ("0" + str2);
}
str = (str + str2);
}
return str;
}
private string BytesToString(byte[] data) {
return Encoding.ASCII.GetString(data);
}
private int GetEndianI32(byte[] buffer) {
byte[] array = buffer;
Array.Reverse(array);
return BitConverter.ToInt32(array, 0);
}
private Image ImageFromBytes(byte[] data) {
MemoryStream stream = new MemoryStream(data);
Image image = Image.FromStream(stream);
stream.Close;
return image;
}
private object language() {
throw new NotImplementedException();
}
// Nested Types
[StructLayout(LayoutKind.Sequential)]
public struct FileDescriptionEntry {
public language lang;
public string description;
public string title;
}
}
}
Just thought i would share with you  ! 2nd thing done >  gotta love Free60 :3
Visual Basic Version : Code: Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text
Namespace ConHeader
Public Class Derp
' Methods
Public Sub New(ByVal ContainerFilePath As String)
Dim reader As New BinaryReader(New FileStream(ContainerFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
reader.BaseStream.Position = &H371
Me._profileID = reader.ReadBytes(8)
reader.BaseStream.Position = &H3FD
Me._deviceID = reader.ReadBytes(20)
reader.BaseStream.Position = &H412
Dim item As New FileDescriptionEntry
item.lang = language.English
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &HD12
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &H512
item = New FileDescriptionEntry
item.lang = language.Japanese
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &HE12
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &H612
item = New FileDescriptionEntry
item.lang = language.German
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &HF12
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &H712
item = New FileDescriptionEntry
item.lang = language.French
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &H1012
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &H812
item = New FileDescriptionEntry
item.lang = language.Spanish
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &H1112
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &H912
item = New FileDescriptionEntry
item.lang = language.Italian
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &H1212
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &HA12
item = New FileDescriptionEntry
item.lang = language.Korean
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &H1312
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &HB12
item = New FileDescriptionEntry
item.lang = language.Chinese
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &H1412
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &HC12
item = New FileDescriptionEntry
item.lang = language.Portuguese
item.title = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
reader.BaseStream.Position = &H1512
item.description = Me.BytesToString(reader.ReadBytes(&H100)).Replace(ChrW(0), "")
Me.fdeList.Add(item)
reader.BaseStream.Position = &H1712
Me._firstIconLength = Me.GetEndianI32(reader.ReadBytes(4))
Me._secondIconLength = Me.GetEndianI32(reader.ReadBytes(4))
Me._firstIcon = Me.ImageFromBytes(reader.ReadBytes(Me._firstIconLength))
reader.BaseStream.Position = &H571A
Me._secondIcon = Me.ImageFromBytes(reader.ReadBytes(Me._secondIconLength))
reader.Close
End Sub
Private Function BytesToHexString(ByVal data As Byte()) As String
Dim str As String = ""
Dim i As Integer
For i = 0 To data.Length - 1
Dim str2 As String = data(i).ToString("X")
Do While (str2.Length <> 2)
str2 = ("0" & str2)
Loop
str = (str & str2)
Next i
Return str
End Function
Private Function BytesToString(ByVal data As Byte()) As String
Return Encoding.ASCII.GetString(data)
End Function
Private Function GetEndianI32(ByVal buffer As Byte()) As Integer
Dim array As Byte() = buffer
Array.Reverse(array)
Return BitConverter.ToInt32(array, 0)
End Function
Private Function ImageFromBytes(ByVal data As Byte()) As Image
Dim stream As New MemoryStream(data)
Dim image As Image = Image.FromStream(stream)
stream.Close
Return image
End Function
' Properties
Public ReadOnly Property DeviceIDBytes As Byte()
Get
Return Me._deviceID
End Get
End Property
Public ReadOnly Property DeviceIDString As String
Get
Return Me.BytesToHexString(Me._deviceID)
End Get
End Property
Public ReadOnly Property FirstIcon As Image
Get
Return Me._firstIcon
End Get
End Property
Public ReadOnly Property FirstIconLength As Integer
Get
Return Me._firstIconLength
End Get
End Property
Public ReadOnly Property ProfileIDBytes As Byte()
Get
Return Me._profileID
End Get
End Property
Public ReadOnly Property ProfileIDString As String
Get
Return Me.BytesToHexString(Me._profileID)
End Get
End Property
Public ReadOnly Property SecondIcon As Image
Get
Return Me._secondIcon
End Get
End Property
Public ReadOnly Property SecondIconLength As Integer
Get
Return Me._secondIconLength
End Get
End Property
' Fields
Private _deviceID As Byte() = New Byte(20 - 1) {}
Private _firstIcon As Image
Private _firstIconLength As Integer
Private _profileID As Byte() = New Byte(8 - 1) {}
Private _secondIcon As Image
Private _secondIconLength As Integer
Public fdeList As List([Of] FileDescriptionEntry) = New List([Of] FileDescriptionEntry)
' Nested Types
<StructLayout(LayoutKind.Sequential)> _
Public Structure FileDescriptionEntry
Public lang As language
Public description As String
Public title As String
End Structure
Private Function language() As Object
Throw New NotImplementedException
End Function
End Class
End Namespace
Last edited by Gyarados; 02-22-2011 at 08:27 AM.
| | | | |  |
02-22-2011
|
#2 (permalink)
| Regular Member
Join Date: Nov 2010
Posts: 193
Thanks: 32 | | | Re: Con Header Cool. | | | |  |
02-22-2011
|
#3 (permalink)
| | | Join Date: Oct 2010 Location: UK
Posts: 1,071
Thanks: 1,464 | | | Re: Con Header Sorry but the namespaces and comments makes it look like it's been copied from Reflector.
Edit: And the struct. | | | |  |
02-22-2011
|
#4 (permalink)
| Banned
Join Date: Sep 2010 Location: In a house
Posts: 219
Thanks: 59 | | | Re: Con Header Quote:
Originally Posted by Oscar Sorry but the namespaces and comments makes it look like it's been copied from Reflector.
Edit: And the struct. | Its so hard to put Code: PackageIO.Reader Reader = new PackageIO.Reader(FilePath, Endain.Big);
Reader.Position = 0x0;
If (Reader.ReadString(4) == "CON ")
{
//rest of read here...
//And well done, on free60 there are offsets and other info to help you in understanding where and what to read :/
} | | | |  |
02-22-2011
|
#5 (permalink)
| Banned
Join Date: Sep 2010 Location: Tha 7o2
Posts: 1,710
Thanks: 672 | | | Re: Con Header Quote:
Originally Posted by Oscar Sorry but the namespaces and comments makes it look like it's been copied from Reflector.
Edit: And the struct. | orly noaw? I don't use reflector to get stuff i use SAE  and i just made that liek 2 days ago :[ | | | |  |
02-22-2011
|
#6 (permalink)
| Regular Member | | Join Date: Oct 2010
Posts: 157
Thanks: 131 | | | Re: Con Header Quote:
Originally Posted by AES orly noaw? I don't use reflector to get stuff i use SAE  and i just made that liek 2 days ago :[ | Pretty sure I've seen this posted numerous other places, also why would you even use <struct blah> if you wrote the code ? | | | |  |
02-22-2011
|
#7 (permalink)
| Banned
Join Date: Sep 2010 Location: Tha 7o2
Posts: 1,710
Thanks: 672 | | | Re: Con Header Quote:
Originally Posted by Abis24 Pretty sure I've seen this posted numerous other places, also why would you even use <struct blah> if you wrote the code ? | Google brah | | | |  |
02-22-2011
|
#8 (permalink)
| Regular Member
Join Date: Nov 2010
Posts: 193
Thanks: 32 | | | Re: Con Header Quote:
Originally Posted by Abis24 Pretty sure I've seen this posted numerous other places, also why would you even use <struct blah> if you wrote the code ? | Umm because structs are useful?... | | | The following user thanked this post: Gyarados | |  |
02-22-2011
|
#9 (permalink)
| | | Join Date: Oct 2010 Location: UK
Posts: 1,071
Thanks: 1,464 | | | Re: Con Header Quote:
Originally Posted by kiwimoosical Umm because structs are useful?... | That struct layout is compiler-generated, (<StructLayout(LayoutKind.Sequential)> _) you would have no reason to add it yourself. | | | |  |
02-22-2011
|
#10 (permalink)
| Regular Member
Join Date: Nov 2010
Posts: 193
Thanks: 32 | | | Re: Con Header Quote:
Originally Posted by Oscar That struct layout is compiler-generated, (<StructLayout(LayoutKind.Sequential)> _) you would have no reason to add it yourself. | DjShepard does that a lot and helps rehashers a lot, just saying | | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -5. The time now is 10:19 AM. | | | | | | Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. COPYRIGHT (c) 2010 - 2013 - XboxMB - DESIGN BY: EDENWEBS.COM | | | | |