Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (File.Exists(NametableFilename))
            {
                DataTable dt = dataGridView1.DataSource as DataTable;

                using (var writer = new IOBinaryWriter(File.Open(NametableFilename, FileMode.Create)))
                {
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        if (dataGridView1.Rows[i].Visible)
                        {
                            var dgvCell = dataGridView1.Rows[i].Cells[0] as DataGridViewCell;

                            if (dgvCell.Value != null)
                            {
                                writer.WriteAnsi(((string)dgvCell.Value).ToLower());
                            }
                        }
                    }
                }
            }

            Close();
        }
Пример #2
0
        private void WriteStringSection(RageDataFileWriteReference file)
        {
            using (MemoryStream stream = new MemoryStream())
            {
                using (IOBinaryWriter writer = new IOBinaryWriter(stream))
                {
                    for (int i = 0; i < StringTable.Length; i++)
                    {
                        file.Write((int)writer.BaseStream.Position); // write string offset

                        writer.WriteAnsi(StringTable[i]);
                    }
                }

                file.Write(stream.ToArray()); // write string data
            }
        }