private void BrowseButtonClick(object sender, EventArgs e) { int offset = (int)this.offsetNumericUpDown.Value; bool twice = this.twiceCheckBox.Checked; if (this.compressRadioButton.Checked) { byte[] data = null; if (UITools.ShowImportDataDialog(fileName => data = File.ReadAllBytes(fileName), FileDialogFilters.Binary)) { int limit = (int)this.offsetNumericUpDown.Maximum; CodecControl.Compress(data, offset, twice, limit); } } else { UITools.ShowExportDataDialog(fileName => File.WriteAllBytes(fileName, Context.Game.Decompress(offset, twice)), string.Empty, FileDialogFilters.Binary); } }
public static bool ShowImportBinaryDataDialog(Action <byte[]> setDataMethod, string filter) { return(UITools.ShowImportDataDialog(filePath => setDataMethod(File.ReadAllBytes(filePath)), filter)); }
public static bool ShowImportDataDialog(Action <string> setDataMethod, string filter) { return(UITools.ShowImportDataDialog((index, filePath) => setDataMethod(filePath), filter, 1)); }
public static bool ShowImportTilesetGraphicsDialog(Tile[] tileset) { return(UITools.ShowImportDataDialog(filePath => UITools.ImportTilesetGraphics(filePath, tileset), FileDialogFilters.ImageOrBinary)); }