Esempio n. 1
0
        internal Sector(byte[] Data, uint SectorPos)
        {
            //Get Signature
            Type = Encoding.ASCII.GetString(Data, (int)SectorPos, 0x04);

            //Get Content
            Content = new byte[Commom.GetDW(Data, SectorPos + 4)];
            Array.Copy(Data, SectorPos + 8, Content, 0, Content.Length);
        }
Esempio n. 2
0
        private static uint FindStrEnd(uint StrPos, byte[] Data)
        {
            uint Count = Commom.GetDW(Data, StrPos);

            StrPos += 4;
            for (uint i = 0; i < Count; i++)
            {
                uint len = Commom.GetDW(Data, StrPos);
                StrPos += 4 + Round(len * 2, 4);
            }
            return(StrPos);
        }
Esempio n. 3
0
        private static void FindStringPos(out uint StrPos, byte[] Data)
        {
            StrPos = Commom.GetDW(Data, 0) + 4; //Skip 8 Bits Array
            StrPos = Round(StrPos, 4);

            StrPos += (Commom.GetDW(Data, StrPos) * 2) + 4; //Skip 16 Bits Array
            StrPos  = Round(StrPos, 4);

            StrPos += (Commom.GetDW(Data, StrPos) * 4) + 4; //Skip 32 Bits Array
            StrPos  = Round(StrPos, 4);

            StrPos += (Commom.GetDW(Data, StrPos) * 8) + 4; //Skip 64 Bits Array
            StrPos  = Round(StrPos, 4);

            StrPos += (Commom.GetDW(Data, StrPos) * 8) + 4; //Skip 64 Bits wtf (IEEE Float?)
            StrPos  = Round(StrPos, 4);
        }
Esempio n. 4
0
        public static Sector[] Split(byte[] TJS2)
        {
            uint TJS2Len = Commom.GetDW(TJS2, 0x08);

            if (TJS2Len != TJS2.Length)
            {
                throw new Exception("Corrupted File");
            }
            uint Pointer = 0x0C;
            //First, Data Sector
            Sector Data = new Sector(TJS2, Pointer);

            Pointer += Data.FullLength;

            Sector[] Unk = new Sector[Commom.GetDW(TJS2, Pointer)];//i assume is another sector...
            Pointer += 4;
            for (int i = 0; i < Unk.Length; i++)
            {
                Sector sector = new Sector(TJS2, Pointer);
                Pointer += sector.FullLength;
                Unk[i]   = sector;
            }

            Sector[] TJS = new Sector[Commom.GetDW(TJS2, Pointer)];
            Pointer += 4;
            for (int i = 0; i < TJS.Length; i++)
            {
                Sector sector = new Sector(TJS2, Pointer);
                Pointer += sector.FullLength;
                TJS[i]   = sector;
            }

            //Merge Results
            Sector[] Sectors = new Sector[Unk.Length + TJS.Length + 1];//+1 = DATA Sector
            Sectors[0] = Data;
            Unk.CopyTo(Sectors, 1);
            TJS.CopyTo(Sectors, Unk.Length + 1);
            return(Sectors);
        }
Esempio n. 5
0
        public static string[] GetContent(Sector sector)
        {
            if (sector.Type != "DATA")
            {
                throw new Exception("Sector Type Not Supported");
            }
            byte[] Data = sector.Content;

            uint StrPos;

            FindStringPos(out StrPos, Data);

            string[] Strings = new string[Commom.GetDW(Data, StrPos)];
            StrPos += 4;
            for (int i = 0; i < Strings.Length; i++)
            {
                uint StringLength = Commom.GetDW(Data, StrPos) * 2;
                StrPos    += 4;
                Strings[i] = Encoding.Unicode.GetString(Data, (int)StrPos, (int)StringLength);//F**k the uint, if you need you copy to new array
                StrPos    += StringLength;
                StrPos     = Round(StrPos, 4);
            }
            return(Strings);
        }