Skip to content

Commit

Permalink
Fix Ryo output, support pasting into DGV
Browse files Browse the repository at this point in the history
Also removes "decode" button and added option to encode files while being renamed.
  • Loading branch information
ShrineFox committed Sep 8, 2024
1 parent 38786b0 commit 320abf7
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 154 deletions.
32 changes: 32 additions & 0 deletions Classes/Events/Changed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ private void LeftPaddingValue_Changed(object sender, EventArgs e)
private void StartIDValue_Changed(object sender, EventArgs e)
{
settings.StartIndex = num_StartID.Value;
int i = Convert.ToInt32(settings.StartIndex);
foreach (DataGridViewRow row in dgv_RenameTxt.Rows)
{
row.Cells[0].Value = i;
i++;
}
}

private void Suffix_Changed(object sender, EventArgs e)
Expand Down Expand Up @@ -251,5 +257,31 @@ private void RyoOutput_SelectedIndexChanged(object sender, EventArgs e)
chk_RyoOverrideVolume.Enabled = false;
}
}

private void EncodeRenameOutput_Changed(object sender, EventArgs e)
{
settings.EncodeRenameOutput = chk_EncodeRename.Checked;
}

private void DataGridView_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control && e.KeyCode == Keys.V)
{
string clipboardText = Clipboard.GetText(TextDataFormat.Text);
if (clipboardText.Contains("\r\n"))
{
settings.DGVCells = new List<string>();
dgv_RenameTxt.Rows.Clear();
int i = Convert.ToInt32(settings.StartIndex);
foreach (var line in clipboardText.Split('\n'))
{
string value = line.Split('\t')[0].Trim('\r');
dgv_RenameTxt.Rows.Add(i, value);
settings.DGVCells.Add(value);
i++;
}
}
}
}
}
}
11 changes: 1 addition & 10 deletions Classes/Events/Clicked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ private void Encode_Click(object sender, EventArgs e)
string[] formats = new string[] { "ADX (.adx)", "HCA (.hca)", "WAV (.wav)" };
var files = WinFormsDialogs.SelectFile("Choose files to encode", true, formats).ToArray();

Encode(files);
}


private void Decode_Click(object sender, EventArgs e)
{
string[] formats = new string[] { "ADX (.adx)", "HCA (.hca)" };
var files = WinFormsDialogs.SelectFile("Choose files to decode to WAV", true, formats).ToArray();

Encode(files, ".wav");
StartEncode(files);
}

private void Rename_Click(object sender, EventArgs e)
Expand Down
18 changes: 4 additions & 14 deletions Classes/Events/DragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,17 @@ private void Encode_DragDrop(object sender, DragEventArgs e)
// Encode dragged files or files in dragged folder
var data = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (Directory.Exists(data[0]))
Encode(Directory.GetFiles(data[0]).ToArray());
StartEncode(Directory.GetFiles(data[0]).ToArray());
else if (File.Exists(data[0]))
Encode(data);
}

private void Decode_DragDrop(object sender, DragEventArgs e)
{
// Decode dragged files or files in dragged folder
var data = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (Directory.Exists(data[0]))
Encode(Directory.GetFiles(data[0]).ToArray(), ".wav");
else if (File.Exists(data[0]))
Encode(data, ".wav");
StartEncode(data);
}

private void RenameDir_DragDrop(object sender, DragEventArgs e)
{
var data = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (Directory.Exists(data[0]))
{
Encode(Directory.GetFiles(data[0]).ToArray());
StartEncode(Directory.GetFiles(data[0]).ToArray());
txt_RenameSourcePath.Text = data[0];
settings.RenameDir = data[0];
}
Expand All @@ -66,7 +56,7 @@ private void RenameOutDir_DragDrop(object sender, DragEventArgs e)
var data = (string[])e.Data.GetData(DataFormats.FileDrop, false);
if (Directory.Exists(data[0]))
{
Encode(Directory.GetFiles(data[0]).ToArray());
StartEncode(Directory.GetFiles(data[0]).ToArray());
txt_RenameOutputPath.Text = data[0];
settings.RenameOutDir = data[0];
}
Expand Down
7 changes: 5 additions & 2 deletions Classes/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class Settings
public string InputTxtPath { get; set; } = "";
public string RenameDir { get; set; } = "";
public string RenameOutDir { get; set; } = "";
public string TxtSuffix { get; set; } = "";
public string TxtSuffix { get; set; } = "_streaming";
public bool AppendFilename { get; set; } = false;
public decimal LeftPadding { get; set; } = 0;
public decimal LeftPadding { get; set; } = 5;
public decimal StartIndex { get; set; } = 0;
public string InputArchive { get; set; } = "";
public string ArchiveDir { get; set; } = "";
Expand All @@ -48,6 +48,7 @@ public class Settings
public bool RyoStreaming { get; set; } = true;
public bool RyoPlayerVolume { get; set; } = false;
public bool RyoCueNames { get; set; } = true;
public bool EncodeRenameOutput { get; set; } = true;

}

Expand Down Expand Up @@ -111,6 +112,8 @@ private void ApplySettingsToForm()
chk_RyoCueNames.Checked = settings.RyoCueNames;
chk_RyoOverrideVolume.Checked = settings.RyoOverrideVolume;

chk_EncodeRename.Checked = settings.EncodeRenameOutput;

foreach (var line in settings.DGVCells)
dgv_RenameTxt.Rows.Add(line);

Expand Down
Loading

0 comments on commit 320abf7

Please sign in to comment.