Download Horizon :: Staff Members :: Save Vault :: XboxMB YouTube


Old 02-20-2011   #1 (permalink)
Banned
 
Join Date: Oct 2010
Location: Pennsylvania
Posts: 355
Thanks: 192
Default Moar help with GPD's

Okay, so I have a huge folder of GPD's so I use a foreach loop and I can add them all into a listview. But when I go to read there title name **** goes wrong, because I don't know how to make it for each gpd that is added to the listview it grabs that gpds path reads it adds the file name and moves onto the next. Any suggestions?
Mocha is offline Send a message via AIM to Mocha
Reply With Quote


Old 02-21-2011   #2 (permalink)
Banned
 
Join Date: Oct 2010
Location: Pennsylvania
Posts: 355
Thanks: 192
Default Re: Moar help with GPD's

Quote:
Originally Posted by Mocha View Post
Okay, so I have a huge folder of GPD's so I use a foreach loop and I can add them all into a listview. But when I go to read there title name **** goes wrong, because I don't know how to make it for each gpd that is added to the listview it grabs that gpds path reads it adds the file name and moves onto the next. Any suggestions?
Bump.
Mocha is offline Send a message via AIM to Mocha
Reply With Quote


Old 02-21-2011   #3 (permalink)

Oscar's Avatar
Join Date: Oct 2010
Location: UK
Posts: 1,071
Thanks: 1,464
Default Re: Moar help with GPD's

Posting what code you have at the moment might help.
Oscar is offline Send a message via AIM to Oscar
Reply With Quote




Old 02-21-2011   #4 (permalink)
Banned
 
Join Date: Oct 2010
Location: Pennsylvania
Posts: 355
Thanks: 192
Default Re: Moar help with GPD's

Quote:
Originally Posted by Oscar View Post
Posting what code you have at the moment might help.
This snippet grabs all the gpds from that folder.
Code:
 Dim FDB As New FolderBrowserDialog
        FDB.ShowDialog()
        Dim ID
        Dim Parent As TreeListNode
        Dim FileList() As String = Directory.GetFiles(fdb.SelectedPath)
        For Each FilePath As String In FileList
            If Path.GetFileName(FilePath).Contains(".gpd") Then
                ID = Path.GetFileName(FilePath).Replace(".gpd", "")
            End If

            Dim Node1 As TreeListNode = TreeList1.AppendNode(New Object(), Parent)
            Node1.SetValue(TreeListColumn1, Path.GetFullPath(FilePath))
            Node1.SetValue(TreeListColumn2, ID)
        Next
And this is the code for the search and the reader, and what im stuck is I don't know what to put as the path for them so
that it grabs the path from one node gets the title name and moves on.
Code:
Dim Search As New HexSearch(TreeList1.FocusedNode(I don't know what to put as the path here), "4E44AE4260", 1)
        Dim Offset = Search.Search
        Dim Int As Integer = +6
        Dim NewOffset As Integer = Offset + Int

        Reader = New PackageIO.Reader(I don't know what to put as the path here, Endian.Big)
        Reader.Position = NewOffset
        Dim i As Integer = 0
        Do Until Reader.ReadHexString(2) = "0000"
            i = +1
            ListView1.Items.Add(i)
        Loop
        Dim Length = ListView1.Items.Count
        Reader.Position = NewOffset
        Node.SetValue(TreeListColumn1, Reader.ReadUnicodeString(Length))
Mocha is offline Send a message via AIM to Mocha
Reply With Quote


Old 02-21-2011   #5 (permalink)
Regular Member
Abis24's Avatar
Join Date: Oct 2010
Posts: 157
Thanks: 131
Default Re: Moar help with GPD's

Edited to what you want :

When are adding each node to the treeview, tag it with the file path. Than later when you need to get the title name you can just create a reader to that selected nodes tag, since it holds the filepath.
__________________

Last edited by Abis24; 02-21-2011 at 09:54 AM.
Abis24 is offline
Reply With Quote


Old 02-21-2011   #6 (permalink)

godzcheater's Avatar
Live life,die young.
Join Date: Sep 2010
Location: UK
Posts: 1,568
Thanks: 549
Default Re: Moar help with GPD's

Quote:
Originally Posted by Abis24 View Post
Edit : ya'll *****s posted at the same time as meh
lolz mocha posted 10 mins b4 you
anyways i helped him on AIM
tis done
godzcheater is offline Send a message via AIM to godzcheater Send a message via MSN to godzcheater
Reply With Quote


Old 02-21-2011   #7 (permalink)
Regular Member
Abis24's Avatar
Join Date: Oct 2010
Posts: 157
Thanks: 131
Default Re: Moar help with GPD's

Quote:
Originally Posted by godzcheater View Post
lolz mocha posted 10 mins b4 you
anyways i helped him on AIM
tis done
:S on my screen it says 2 mins ago lol
__________________
Abis24 is offline
Reply With Quote


Old 02-21-2011   #8 (permalink)
Regular Member
austin12456's Avatar
Join Date: Jul 2010
Posts: 1,265
Thanks: 1,172
Default Re: Moar help with GPD's

Code:
Dim FDB As New FolderBrowserDialog
        FDB.ShowDialog()
        Dim ID
        Dim Parent As TreeListNode
        For Each FilePath As String In Directory.GetFiles(fdb.SelectedPath, "*.gpd")
            ID = Path.GetFileNameWithoutExtension(FilePath);

            Dim Node1 As TreeListNode = TreeList1.AppendNode(New Object(), Parent)
            Node1.SetValue(TreeListColumn1, Path.GetFullPath(FilePath))
            Node1.SetValue(TreeListColumn2, ID)
        Next
That doesn't fix anything, just a cleaner method.
__________________
austin12456 is offline
Reply With Quote


Old 02-21-2011   #9 (permalink)
Banned
 
Join Date: Sep 2010
Location: In a house
Posts: 219
Thanks: 59
Default Re: Moar help with GPD's

Hope this helps, just coded it.

MEGAUPLOAD - The leading online storage and file delivery service

It gets all the files in the selected directory and sets into an array, after that its just a case of selected each item, this only gets the Magic and Path, and sets into the listview

Its an example to show you what to do, now you can add on other stuff.

If you want I will add the part to read the gpd name.....?

Also if you just want it for the GPDs then just in the reading put
Code:
if (reader.readstring(4) != "XDBF") return;
Edit: also to get the selected tree node its TreeList1.SelectedNode[0]; (thats for the first column, [1] for the secound etc etc)

Last edited by JoshuaT; 02-21-2011 at 12:02 PM.
JoshuaT is offline
Reply With Quote


Old 02-21-2011   #10 (permalink)

Oscar's Avatar
Join Date: Oct 2010
Location: UK
Posts: 1,071
Thanks: 1,464
Default Re: Moar help with GPD's

Ew searching, this is C# shouldn't be too hard to convert to VB

PHP Code:
        static string NameFromGpd(string path)
        {
            
EndianReader reader = new EndianReader(File.OpenRead(path), EndianType.Big);

            if (
reader.ReadInt32() != 0x58444246)
                throw new 
Exception("Not a valid GPD file");

            
reader.Position += 4//Version
            
int entryMax reader.ReadInt32();
            
int entryCount reader.ReadInt32();
            
int freeMax reader.ReadInt32();
            
reader.Position += 4//Free count

            
int offset = (entryMax 0x12) + (freeMax 0x8) + 0x18;
            
int length 0;

            for (
int i 0entryCounti++)
            {
                if (
reader.ReadInt16() == && //Namespace
                    
reader.ReadInt64() == 0x8000//ID
                
{
                    
offset += reader.ReadInt32();
                    
length reader.ReadInt32();
                    break;
                }
                else
                {
                    
reader.Position += 16;
                }
            }

            if (
length == 0)
                throw new 
Exception("Entry invalid or not found");

            
reader.Position offset;
            return 
Encoding.BigEndianUnicode.GetString(reader.ReadBytes(length));
        } 
Oscar is offline Send a message via AIM to Oscar
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 11:27 PM.


 

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
COPYRIGHT (c) 2010 - 2013 - XboxMB - DESIGN BY:
EDENWEBS.COM