示例#1
0
        public static _STRUCT_STRDEF_FILE_ ClearProperty()
        {
            _STRUCT_STRDEF_FILE_ Rise = new _STRUCT_STRDEF_FILE_();

            Rise.Message = new STRUCT_STRDEF[MAX_STRING_TABLE];

            return Rise;
        }
示例#2
0
        private void bin2txt_Click(object sender, EventArgs e)
        {
            string Patch = Folder + "strdef.bin";

            if (File.Exists(Patch) == false)
            {
                MessageBox.Show("O arquivo 'strdef.bin' não existe.", "Erro");

                return;
            }

            byte[] pBuffer = File.ReadAllBytes(Patch);

            if (pBuffer == null)
            {
                throw new Exception("O arquivo strdef.bin tem um buffer inválido.");
            }

            unsafe
            {
                fixed (byte* ptr = pBuffer)
                {
                    for (int i = 0; i < pBuffer.Length; i++)
                    {
                        ptr[i] = (byte)(ptr[i] ^ 0x5A);
                    }
                }
            }

            _STRUCT_STRDEF_FILE_ Select = Decrypt<_STRUCT_STRDEF_FILE_>(pBuffer);

            string[] Content = new string[Select.Message.Length];

            for (int i = 0; i < Select.Message.Length; i++)
            {
                Content[i] = Select.Message[i].Value;
            }

            File.WriteAllLines(Folder+"strdef.txt", Content);

            MessageBox.Show("O arquivo 'strdef.bin' foi convertido para 'strdef.txt' com sucesso.", "Informação");
        }
示例#3
0
        private void txt2bin_Click(object sender, EventArgs e)
        {
            string Patch = Folder + "strdef.txt";

            if (File.Exists(Patch) == false)
            {
                MessageBox.Show("O arquivo 'strdef.txt' não existe.", "Erro");

                return;
            }

            _STRUCT_STRDEF_FILE_ Reading = _STRUCT_STRDEF_FILE_.ClearProperty();

            string[] Content = File.ReadAllLines(Patch);

            for (int i = 0; i < Reading.Message.Length; i++)
            {
                Reading.Message[i].Value = Content[i];
            }

            byte[] pBuffer = Encrypt(Reading);

            unsafe
            {
                fixed (byte* ptr = pBuffer)
                {
                    for (int i = 0; i < pBuffer.Length; i++)
                    {
                        ptr[i] = (byte)(ptr[i] ^ 0x5A);
                    }
                }
            }

            File.WriteAllBytes(Folder + "strdef.bin", pBuffer);

            MessageBox.Show("O arquivo 'strdef.txt' foi convertido para 'strdef.bin' com sucesso.", "Informação");
        }