mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-19 14:38:06 +00:00
Added compression support to BinkaToWav converter
This commit is contained in:
@@ -30,7 +30,7 @@ namespace PckStudio.Classes.Utils
|
||||
MessageBox.Show($"Successfully converted {convertedCount}/{filenames.Length} file{(filenames.Length > 1 ? "s" : "")}", "Done!");
|
||||
}
|
||||
|
||||
public static void ToBinka(string[] filenames, DirectoryInfo destination)
|
||||
public static void ToBinka(string[] filenames, DirectoryInfo destination, int compressionLevel = 4)
|
||||
{
|
||||
int convertedCount = 0;
|
||||
Directory.CreateDirectory(ApplicationScope.DataCacher.CacheDirectory);
|
||||
@@ -56,7 +56,7 @@ namespace PckStudio.Classes.Utils
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
int exitCode = Binka.ToBinka(cacheSongFilepath, Path.Combine(destination.FullName, Path.GetFileNameWithoutExtension(file) + ".binka"), 4);
|
||||
int exitCode = Binka.ToBinka(cacheSongFilepath, Path.Combine(destination.FullName, Path.GetFileNameWithoutExtension(file) + ".binka"), compressionLevel);
|
||||
if (exitCode == 0)
|
||||
convertedCount++;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
public partial class ItemSelectionPopUp : MetroFramework.Forms.MetroForm
|
||||
{
|
||||
public string SelectedItem => DialogResult == DialogResult.OK ? ComboBox.Text : string.Empty;
|
||||
public int SelectedIndex => DialogResult == DialogResult.OK ? ComboBox.SelectedIndex : -1;
|
||||
|
||||
public string LabelText
|
||||
{
|
||||
|
||||
@@ -2180,7 +2180,22 @@ namespace PckStudio
|
||||
};
|
||||
if (fileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
BinkaConverter.ToBinka(fileDialog.FileNames, new DirectoryInfo(Path.GetDirectoryName(fileDialog.FileName)));
|
||||
using ItemSelectionPopUp dialog = new ItemSelectionPopUp(
|
||||
"Level 1 (Best Quality)", "Level 2", "Level 3", "Level 4", "Level 5",
|
||||
"Level 6", "Level 7", "Level 8", "Level 9 (Worst Quality)")
|
||||
{
|
||||
LabelText = "Compression",
|
||||
ButtonText = "OK"
|
||||
};
|
||||
|
||||
if(dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
BinkaConverter.ToBinka(
|
||||
fileDialog.FileNames,
|
||||
new DirectoryInfo(Path.GetDirectoryName(fileDialog.FileName)),
|
||||
dialog.SelectedIndex + 1 // compression level
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user