mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-26 00:36:47 +00:00
MainForm.cs - File Type Handlers now no longer have to check if data is available
This commit is contained in:
@@ -407,20 +407,12 @@ namespace PckStudio
|
||||
|
||||
private void HandleColourFile(PckFile.FileData file)
|
||||
{
|
||||
if (file.Size == 0)
|
||||
{
|
||||
MessageBox.Show("No Color data found.", "Error", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
using COLEditor diag = new COLEditor(file);
|
||||
wasModified = diag.ShowDialog(this) == DialogResult.OK;
|
||||
}
|
||||
|
||||
public void HandleSkinFile(PckFile.FileData file)
|
||||
{
|
||||
if (file.Size <= 0)
|
||||
return;
|
||||
using (var ms = new MemoryStream(file.Data))
|
||||
{
|
||||
var texture = Image.FromStream(ms);
|
||||
@@ -965,6 +957,11 @@ namespace PckStudio
|
||||
{
|
||||
if (treeViewMain.SelectedNode is TreeNode t && t.Tag is PckFile.FileData file)
|
||||
{
|
||||
if (file.Size <= 0)
|
||||
{
|
||||
Debug.WriteLine($"'{file.Filename}' has no data attached.", category: nameof(HandleTextureFile));
|
||||
return;
|
||||
}
|
||||
pckFileTypeHandler[file.Filetype]?.Invoke(file);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user