StringList menu

User Tag List

Thread: StringList

Results 1 to 4 of 4
  1. #1
    matamore's Avatar Member
    Reputation
    6
    Join Date
    Dec 2008
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    StringList

    I didnt find a reader for StringList in Mooege, so i wrote my own.

    credits go to
    D3Inferno StringList *.stl

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    using System.IO;
    using Gibbed.IO;
    
        public class StringList
        {
    
            # region Nested
    
            /*
            	struct StlHeader	// sizeof 0x28
    	        {	
            0x00	DWord stlFileId;	// Stl file Id
            0x04	DWord unknown1[5];	// always 0x00000000
            0x08	DWord headerSize;	// size (in bytes) of the StlHeader? (always 0x00000028)
            0x0C	DWord entriesSize;	// size (in bytes) of the StlEntries
            0x04	DWord unknown2[2];	// always 0x00000000
    	        }
            */
    
            public class StlHeader
            {
                public int stlFileId;
                public int[] unknown1;
                public int headerSize;
                public int entriesSize;
                public int[] unknown2;
    
                public StlHeader(Stream stream)
                {
                    stlFileId = stream.ReadValueS32();
    
                    unknown1 = new int[5];
                    for (int i = 0; i < 5; i++)
                    {
                        unknown1[i] = stream.ReadValueS32();
                    }
    
                    headerSize = stream.ReadValueS32();
                    entriesSize = stream.ReadValueS32();
    
                    unknown2 = new int[2];
                    for (int i = 0; i < 2; i++)
                    {
                        unknown2[i] = stream.ReadValueS32();
                    }
                }
    
            }
            /*
            struct StlEntry	// sizeof 0x50
    	    {	
        0x00	DWord unknown1[2];	// always 0x00000000
        0x08	DWord string1offset;	// file offset for string1 (non-NLS key)
        0x0C	DWord string1size;	// size of string1
        0x10	DWord unknown2[2];	// always 0x00000000
        0x18	DWord string2offset;	// file offset for string2
        0x1C	DWord string2size;	// size of string2
        0x20	DWord unknown3[2];	// always 0x00000000
        0x28	DWord string3offset;	// file offset for string3
        0x2C	DWord string3size;	// size of string3
        0x30	DWord unknown4[2];	// always 0x00000000
        0x38	DWord string4offset;	// file offset for string4
        0x3C	DWord string4size;	// size of string4
        0x40	DWord unknown5;	// always 0xFFFFFFFF
        0x44	DWord unknown6[3];	// always 0x00000000
    	    }
            */
    
            public class _StlEntry
            {
                public String string1;
                public String string2;
                public String string3;
                public String string4;
            }
    
            public class StlEntry
            {
    
                public int[] unknown1;
                public int string1offset;
                public int string1size;
                //--
                public int[] unknown2;
                public int string2offset;
                public int string2size;
                //--
                public int[] unknown3;
                public int string3offset;
                public int string3size;
                //--
                public int[] unknown4;
                public int string4offset;
                public int string4size;
                //--
                public int unknown5;
                public int[] unknown6;
    
                public StlEntry(Stream stream)
                {
                    unknown1 = new int[2];
                    for (int i = 0; i < 2; i++)
                    {
                        unknown1[i] = stream.ReadValueS32();
                    }
                    string1offset = stream.ReadValueS32();
                    string1size = stream.ReadValueS32();
    
                    unknown2 = new int[2];
                    for (int i = 0; i < 2; i++)
                    {
                        unknown2[i] = stream.ReadValueS32();
                    }
                    string2offset = stream.ReadValueS32();
                    string2size = stream.ReadValueS32();
    
                    unknown3 = new int[2];
                    for (int i = 0; i < 2; i++)
                    {
                        unknown3[i] = stream.ReadValueS32();
                    }
                    string3offset = stream.ReadValueS32();
                    string3size = stream.ReadValueS32();
    
                    unknown4 = new int[2];
                    for (int i = 0; i < 2; i++)
                    {
                        unknown4[i] = stream.ReadValueS32();
                    }
                    string4offset = stream.ReadValueS32();
                    string4size = stream.ReadValueS32();
    
                    unknown5 = stream.ReadValueS32();
                    unknown6 = new int[3];
                    for (int i = 0; i < 3; i++)
                    {
                        unknown6[i] = stream.ReadValueS32();
                    }
                }
    
            }
    
            # endregion
    
            # region Fields
    
            public StlHeader header;
            List<StlEntry> _entries;
            public List<_StlEntry> entries;
            # endregion
    
            # region Properties
    
    
            # endregion
    
            # region Constructors
    
            public StringList(Stream stream)
            {
                stream.Position += 0x10;
    
                header = new StlHeader(stream);
    
                this._entries = new List<StlEntry>();
    
                int entries = header.entriesSize / 0x50;
                for (int i = 0; i < entries; i++)
                {
                    this._entries.Add(new StlEntry(stream));
                }
                this.entries = new List<_StlEntry>();
                foreach (StlEntry entry in this._entries)
                {
                    if (this.entries.Count > 20)
                    {
                        break;
                    }
                    _StlEntry _entry = new _StlEntry();
                    stream.Position = entry.string1offset + 0x10;
                    _entry.string1 = stream.ReadString((uint)entry.string1size - 1);
    
                    stream.Position = entry.string2offset + 0x10;
                    _entry.string2 = stream.ReadString((uint)entry.string2size - 1);
    
                    //stream.Position = entry.string3offset+ 0x10;
                    //_entry.string3 = stream.ReadString((uint)entry.string3size);
    
                    //stream.Position = entry.string4offset+ 0x10;
                    //_entry.string4 = stream.ReadString((uint)entry.string4size);
    
                    this.entries.Add(_entry);
                }
            }
    
            # endregion
    
            # region Methods
    
    
            # endregion
    
        }


    Code:
            private void button25_Click(object sender, EventArgs e)
            {
    
                OpenFileDialog dialog = new OpenFileDialog();
                DialogResult result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    string filename = dialog.FileName;
    
                    byte[] data = File.ReadAllBytes(filename);
    
                    MemoryStream stream = new MemoryStream(data);
    
                    StringList stringlist = new StringList(stream);
    
                    Console.WriteLine("entries: " + stringlist.header.entriesSize / 0x50);
                    foreach (StringList._StlEntry entry in stringlist.entries)
                    {
                        Console.WriteLine("entry: " + entry.string1 + " : " + entry.string2);
                    }
    
                }
            }

    StringList
  2. #2
    BitHacker's Avatar Master Sergeant
    Reputation
    13
    Join Date
    May 2012
    Posts
    114
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    matamore,

    Damn matamore thats pretty sweet. You should make a SNO Reader now. lol. Since you understand everything on that level.

    What is the Gibbed Library? I understood everything else. Your HUGE comment blocks threw me off for a minute but I got back on track.

    -Bit_Hacker

  3. #3
    matamore's Avatar Member
    Reputation
    6
    Join Date
    Dec 2008
    Posts
    13
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Gibbed.IO.dll is in Mooege directory.

  4. #4
    BitHacker's Avatar Master Sergeant
    Reputation
    13
    Join Date
    May 2012
    Posts
    114
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    matamore,

    Looks like whatever your building has 25 buttons Must be something big...

    -Bit_Hacker

All times are GMT -5. The time now is 01:16 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search