private void compressImageToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.FileName = ""; fd.Filter = "All Files | *.*"; DialogResult dr = fd.ShowDialog(); if (dr == DialogResult.OK) { byte[] input = System.IO.File.ReadAllBytes(fd.FileName); byte[] output = HuffmanTool.CompressBitmap(input, true); string fname = System.IO.Path.GetFileNameWithoutExtension(fd.FileName); System.IO.File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + fname + "_compressed.res", output); MessageBox.Show("Compressed to Tool Dir.", "ScnEditorGUI", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void decompressImageToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.FileName = ""; fd.Filter = "All Files | *.*"; DialogResult dr = fd.ShowDialog(); if (dr == DialogResult.OK) { byte[] input = System.IO.File.ReadAllBytes(fd.FileName); byte[] output = HuffmanTool.DecompressBitmap(input); string fname = System.IO.Path.GetFileNameWithoutExtension(fd.FileName); System.IO.File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + fname + "_decompressed.raw", output); MessageBox.Show("This Resouce is Writed to Dracu-Riot, you need discovery resolution and add a bmp header manually and the unknown resolution.\n\n(Probabbly use RGBQuad)", "ScnEditorGUI", MessageBoxButtons.OK, MessageBoxIcon.Information); } }