Esempio n. 1
0
        internal static string ParseShuffleText(string path)
        {
            ShuffleText st = new ShuffleText
            {
                FileName  = Path.GetFileNameWithoutExtension(path),
                FilePath  = Path.GetDirectoryName(path),
                Extension = Path.GetExtension(path)
            };

            Console.WriteLine(st.FilePath);
            BinaryReader br = new BinaryReader(File.OpenRead(path));

            br.BaseStream.Seek(0xC, SeekOrigin.Begin);
            uint StringDataLen = br.ReadUInt32();

            st.StringMetaOffset = br.ReadUInt32();
            st.StringMetaLen    = br.ReadUInt32();
            st.StringCount      = st.StringMetaLen / 4;
            Console.WriteLine(st.StringCount);
            br.BaseStream.Seek(st.StringMetaOffset, SeekOrigin.Begin);
            st.offsets = new List <uint>();
            for (int i = 0; i < st.StringCount; i++)
            {
                st.offsets.Add(br.ReadUInt32());
            }
            string ret = "Dumped Offsets.";

            st.strings = new List <string>();
            for (int i = 0; i < st.StringCount; i++)
            {
                br.BaseStream.Seek(st.offsets[i], SeekOrigin.Begin);
                uint len = i < st.StringCount - 1
                    ? st.offsets[i + 1] - st.offsets[i]
                    : StringDataLen + 0x40 - st.offsets[i];
                byte[] data = br.ReadBytes((int)len);
                st.strings.Add(Encoding.Unicode.GetString(data).Replace((char)0, ' ').Replace((char)0xa, ' '));
            }
            ret += Environment.NewLine + "Dumped Strings.";
            StringBuilder sb = new StringBuilder();

            foreach (string t in st.strings)
            {
                sb.AppendLine(t);
            }

            string newfilename = st.FilePath + Path.DirectorySeparatorChar + st.FileName + ".txt";

            File.WriteAllText(newfilename, sb.ToString());
            return(ret);
        }
Esempio n. 2
0
        internal static string ParseShuffleText(string path)
        {
            ShuffleText st = new ShuffleText
            {
                FileName = Path.GetFileNameWithoutExtension(path),
                FilePath = Path.GetDirectoryName(path),
                Extension = Path.GetExtension(path)
            };
            Console.WriteLine(st.FilePath);
            BinaryReader br = new BinaryReader(File.OpenRead(path));
            br.BaseStream.Seek(0xC, SeekOrigin.Begin);
            uint StringDataLen = br.ReadUInt32();
            st.StringMetaOffset = br.ReadUInt32();
            st.StringMetaLen = br.ReadUInt32();
            st.StringCount = st.StringMetaLen / 4;
            Console.WriteLine(st.StringCount);
            br.BaseStream.Seek(st.StringMetaOffset, SeekOrigin.Begin);
            st.offsets = new List<uint>();
            for (int i = 0; i < st.StringCount; i++)
            {
                st.offsets.Add(br.ReadUInt32());
            }
            string ret = "Dumped Offsets.";
            st.strings = new List<string>();
            for (int i = 0; i < st.StringCount; i++)
            {
                br.BaseStream.Seek(st.offsets[i], SeekOrigin.Begin);
                uint len = (i < st.StringCount - 1)
                    ? st.offsets[i + 1] - st.offsets[i]
                    : StringDataLen + 0x40 - st.offsets[i];
                byte[] data = br.ReadBytes((int)len);
                st.strings.Add(Encoding.Unicode.GetString(data).Replace((char)0, ' ').Replace((char)0xa, ' '));
            }
            ret += Environment.NewLine + "Dumped Strings.";
            StringBuilder sb = new StringBuilder();
            foreach (string t in st.strings)
                sb.AppendLine(t);

            string newfilename = st.FilePath + Path.DirectorySeparatorChar + st.FileName + ".txt";
            File.WriteAllText(newfilename, sb.ToString());
            return ret;
        }