mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-07-19 06:08:31 +00:00
Merge branch 'main' into https://github.com/PhoenixARC/-PCK-Studio
This commit is contained in:
@@ -127,7 +127,7 @@ namespace PckStudio
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
MessageBox.Show("Failed to open pck\n" +
|
||||
MessageBox.Show(this, "Failed to open pck\n" +
|
||||
"Try checking the 'Open/Save as Switch/Vita/PS4 pck' checkbox in the upper right corner.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Debug.WriteLine(ex.Message);
|
||||
@@ -151,7 +151,7 @@ namespace PckStudio
|
||||
currentPCK = openPck(filepath);
|
||||
if (currentPCK == null)
|
||||
{
|
||||
MessageBox.Show(string.Format("Failed to load {0}", Path.GetFileName(filepath)), "Error");
|
||||
MessageBox.Show(this, string.Format("Failed to load {0}", Path.GetFileName(filepath)), "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace PckStudio
|
||||
{
|
||||
ofd.CheckFileExists = true;
|
||||
ofd.Filter = "PCK (Minecraft Console Package)|*.pck";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
LoadPckFromFile(ofd.FileName);
|
||||
}
|
||||
@@ -275,14 +275,14 @@ namespace PckStudio
|
||||
}
|
||||
catch (OverflowException ex)
|
||||
{
|
||||
MessageBox.Show("Failed to open pck\n" +
|
||||
MessageBox.Show(this, "Failed to open pck\n" +
|
||||
$"Try {(LittleEndianCheckBox.Checked ? "unchecking" : "checking")} the 'Open/Save as Switch/Vita/PS4 pck' check box in the upper right corner.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Failed to open pck. There's two common reasons for this:\n" +
|
||||
MessageBox.Show(this, "Failed to open pck. There's two common reasons for this:\n" +
|
||||
"1. The file is audio/music cues PCK file. Please use the specialized editor while inside of a pck file.\n" +
|
||||
"2. We're aware of an issue where a pck file might fail to load because it contains multiple entries with the same path.",
|
||||
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
@@ -482,7 +482,7 @@ namespace PckStudio
|
||||
}
|
||||
|
||||
var viewer = new TextureAtlasEditor(currentPCK, file.Filename, img, tile_size);
|
||||
if (viewer.ShowDialog() == DialogResult.OK)
|
||||
if (viewer.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
Image texture = viewer.FinalTexture;
|
||||
if(isBanners)
|
||||
@@ -595,7 +595,7 @@ namespace PckStudio
|
||||
if (file.HasProperty("BOX"))
|
||||
{
|
||||
using generateModel generate = new generateModel(file);
|
||||
if (generate.ShowDialog() == DialogResult.OK)
|
||||
if (generate.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty;
|
||||
wasModified = true;
|
||||
@@ -611,7 +611,7 @@ namespace PckStudio
|
||||
|
||||
public void HandleModelsFile(PckFileData file)
|
||||
{
|
||||
MessageBox.Show("Models.bin support has not been implemented. You can use the Spark Editor for the time being to edit these files.", "Not implemented yet.");
|
||||
MessageBox.Show(this, "Models.bin support has not been implemented. You can use the Spark Editor for the time being to edit these files.", "Not implemented yet.");
|
||||
}
|
||||
|
||||
public void HandleBehavioursFile(PckFileData file)
|
||||
@@ -791,7 +791,7 @@ namespace PckStudio
|
||||
using SaveFileDialog exFile = new SaveFileDialog();
|
||||
exFile.FileName = Path.GetFileName(file.Filename);
|
||||
exFile.Filter = Path.GetExtension(file.Filename).Replace(".", string.Empty) + " File|*" + Path.GetExtension(file.Filename);
|
||||
if (exFile.ShowDialog() != DialogResult.OK ||
|
||||
if (exFile.ShowDialog(this) != DialogResult.OK ||
|
||||
// Makes sure chosen directory isn't null or whitespace AKA makes sure its usable
|
||||
string.IsNullOrWhiteSpace(Path.GetDirectoryName(exFile.FileName)))
|
||||
{
|
||||
@@ -804,7 +804,7 @@ namespace PckStudio
|
||||
}
|
||||
|
||||
// Verification that file extraction path was successful
|
||||
MessageBox.Show($"\"{node.Text}\" successfully extracted");
|
||||
MessageBox.Show(this, $"\"{node.Text}\" successfully extracted");
|
||||
}
|
||||
|
||||
private void SaveTemplate()
|
||||
@@ -812,7 +812,7 @@ namespace PckStudio
|
||||
using SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "PCK (Minecraft Console Package)|*.pck";
|
||||
saveFileDialog.DefaultExt = ".pck";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
Save(saveFileDialog.FileName);
|
||||
saveLocation = saveFileDialog.FileName;
|
||||
@@ -827,7 +827,7 @@ namespace PckStudio
|
||||
var writer = new PckFileWriter(currentPCK, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToFile(filePath);
|
||||
wasModified = false;
|
||||
MessageBox.Show("Saved Pck file", "File Saved");
|
||||
MessageBox.Show(this, "Saved Pck file", "File Saved");
|
||||
}
|
||||
|
||||
private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@@ -850,7 +850,7 @@ namespace PckStudio
|
||||
string fileExt = Path.GetExtension(file.Filename);
|
||||
|
||||
ofd.Filter = $"{file.Filetype} (*{fileExt}{extra_extensions})|*{fileExt}{extra_extensions}";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
string newFileExt = Path.GetExtension(ofd.FileName);
|
||||
file.SetData(File.ReadAllBytes(ofd.FileName));
|
||||
@@ -861,7 +861,7 @@ namespace PckStudio
|
||||
}
|
||||
return;
|
||||
}
|
||||
MessageBox.Show("Can't replace a folder.");
|
||||
MessageBox.Show(this, "Can't replace a folder.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -877,7 +877,7 @@ namespace PckStudio
|
||||
if (file.Filetype == PckFileType.TextureFile &&
|
||||
(file.Filename == itemPath + "/compass.png" || file.Filename == itemPath + "/clock.png"))
|
||||
{
|
||||
if (MessageBox.Show("Are you sure want to delete this file? If \"compass.png\" or \"clock.png\" are missing, your game will crash upon loading this pack.", "Warning",
|
||||
if (MessageBox.Show(this, "Are you sure want to delete this file? If \"compass.png\" or \"clock.png\" are missing, your game will crash upon loading this pack.", "Warning",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
|
||||
return true;
|
||||
}
|
||||
@@ -913,7 +913,7 @@ namespace PckStudio
|
||||
wasModified = true;
|
||||
}
|
||||
}
|
||||
else if (MessageBox.Show("Are you sure want to delete this folder? All contents will be deleted", "Warning",
|
||||
else if (MessageBox.Show(this, "Are you sure want to delete this folder? All contents will be deleted", "Warning",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
string pckFolderDir = node.FullPath;
|
||||
@@ -938,7 +938,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK.TryGetFile(diag.NewText, file.Filetype, out _))
|
||||
{
|
||||
MessageBox.Show($"{diag.NewText} already exists", "File already exists");
|
||||
MessageBox.Show(this, $"{diag.NewText} already exists", "File already exists");
|
||||
return;
|
||||
}
|
||||
file.Filename = diag.NewText;
|
||||
@@ -966,9 +966,8 @@ namespace PckStudio
|
||||
LOCFile locFile = null;
|
||||
TryGetLocFile(out locFile);
|
||||
using AddNewSkin add = new AddNewSkin(locFile);
|
||||
if (add.ShowDialog() == DialogResult.OK)
|
||||
if (add.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
|
||||
if (currentPCK.HasFile("Skins.pck", PckFileType.SkinDataFile)) // Prioritize Skins.pck
|
||||
{
|
||||
TreeNode subPCK = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault();
|
||||
@@ -1027,12 +1026,12 @@ namespace PckStudio
|
||||
if (currentPCK.Contains(PckFileType.AudioFile))
|
||||
{
|
||||
// the chance of this happening is really really slim but just in case
|
||||
MessageBox.Show("There is already an audio file in this PCK!", "Can't create audio.pck");
|
||||
MessageBox.Show(this, "There is already an audio file in this PCK!", "Can't create audio.pck");
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(saveLocation))
|
||||
{
|
||||
MessageBox.Show("You must save your pck before creating or opening a music cues PCK file", "Can't create audio.pck");
|
||||
MessageBox.Show(this, "You must save your pck before creating or opening a music cues PCK file", "Can't create audio.pck");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1056,7 +1055,7 @@ namespace PckStudio
|
||||
|
||||
if (currentPCK.Contains(animationFilepath, PckFileType.TextureFile))
|
||||
{
|
||||
MessageBox.Show($"{diag.SelectedTile} is already present.", "File already present");
|
||||
MessageBox.Show(this, $"{diag.SelectedTile} is already present.", "File already present");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1131,16 +1130,38 @@ namespace PckStudio
|
||||
if (parent == null) return;
|
||||
|
||||
PckFileData parent_file = parent.Tag as PckFileData;
|
||||
PckFile parent_file_pck =
|
||||
new PckFileReader(
|
||||
LittleEndianCheckBox.Checked ?
|
||||
OMI.Endianness.LittleEndian :
|
||||
OMI.Endianness.BigEndian
|
||||
).FromStream(new MemoryStream(parent_file.Data));
|
||||
|
||||
if (parent_file.Filetype is PckFileType.TexturePackInfoFile || parent_file.Filetype is PckFileType.SkinDataFile)
|
||||
{
|
||||
Debug.WriteLine("Rebuilding " + parent_file.Filename);
|
||||
PckFile newPCKFile = new PckFile(3, parent_file.Filetype is PckFileType.SkinDataFile);
|
||||
|
||||
bool hasSkinsFolder = false;
|
||||
|
||||
// add original pck files to prevent data loss
|
||||
foreach (PckFileData _fd in parent_file_pck.GetFiles())
|
||||
{
|
||||
PckFileData new_file = newPCKFile.CreateNewFile(_fd.Filename, _fd.Filetype);
|
||||
// check for skins folder so files are placed consistently in final pck
|
||||
if (_fd.Filename.StartsWith("Skins/") && parent_file.Filetype is PckFileType.SkinDataFile) hasSkinsFolder = true;
|
||||
foreach (var prop in _fd.GetProperties())
|
||||
new_file.AddProperty(prop);
|
||||
new_file.SetData(_fd.Data);
|
||||
}
|
||||
|
||||
foreach (TreeNode node in GetAllChildNodes(parent.Nodes))
|
||||
{
|
||||
if (node.Tag is PckFileData node_file)
|
||||
{
|
||||
PckFileData new_file = newPCKFile.CreateNewFile(node_file.Filename.Replace(parent_file.Filename + "/", String.Empty), node_file.Filetype);
|
||||
PckFileData new_file = newPCKFile.CreateNewFile(
|
||||
(hasSkinsFolder ? "Skins/" : String.Empty)
|
||||
+ node_file.Filename.Replace(parent_file.Filename + "/", String.Empty), node_file.Filetype);
|
||||
foreach (var prop in node_file.GetProperties())
|
||||
new_file.AddProperty(prop);
|
||||
new_file.SetData(node_file.Data);
|
||||
@@ -1150,7 +1171,12 @@ namespace PckStudio
|
||||
parent_file.SetData(new PckFileWriter(newPCKFile, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
parent.Tag = parent_file;
|
||||
|
||||
// erase hidden sub-pck nodes to prevent duplication
|
||||
parent.Nodes.Clear();
|
||||
|
||||
BuildMainTreeView();
|
||||
|
||||
MessageBox.Show(this, $"Files added successfully to {parent_file.Filename}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1202,7 +1228,7 @@ namespace PckStudio
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
Trace.WriteLine("Invalid ANIM value: " + property.Value);
|
||||
MessageBox.Show("Failed to parse ANIM value, aborting to normal functionality. Please make sure the value only includes hexadecimal characters (0-9,A-F) and has no more than 8 characters.");
|
||||
MessageBox.Show(this, "Failed to parse ANIM value, aborting to normal functionality. Please make sure the value only includes hexadecimal characters (0-9,A-F) and has no more than 8 characters.");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1223,7 +1249,7 @@ namespace PckStudio
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
Trace.WriteLine("Invalid BOX value: " + property.Value);
|
||||
MessageBox.Show("Failed to parse BOX value, aborting to normal functionality.");
|
||||
MessageBox.Show(this, "Failed to parse BOX value, aborting to normal functionality.");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1234,7 +1260,7 @@ namespace PckStudio
|
||||
|
||||
using (AddPropertyPrompt addProperty = new AddPropertyPrompt(property))
|
||||
{
|
||||
if (addProperty.ShowDialog() == DialogResult.OK)
|
||||
if (addProperty.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
file.SetProperty(file.GetPropertyIndex(property), addProperty.Property);
|
||||
RebuildSubPCK(treeViewMain.SelectedNode.FullPath);
|
||||
@@ -1326,7 +1352,7 @@ namespace PckStudio
|
||||
t.Tag is PckFileData file)
|
||||
{
|
||||
using AddPropertyPrompt addProperty = new AddPropertyPrompt();
|
||||
if (addProperty.ShowDialog() == DialogResult.OK)
|
||||
if (addProperty.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
file.AddProperty(addProperty.Property);
|
||||
RebuildSubPCK(treeViewMain.SelectedNode.FullPath);
|
||||
@@ -1438,7 +1464,7 @@ namespace PckStudio
|
||||
checkSaveState();
|
||||
TextPrompt namePrompt = new TextPrompt();
|
||||
namePrompt.OKButtonText = "Ok";
|
||||
if (namePrompt.ShowDialog() == DialogResult.OK)
|
||||
if (namePrompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
currentPCK = InitializePack(new Random().Next(8000, int.MaxValue), 0, namePrompt.NewText, true);
|
||||
isTemplateFile = true;
|
||||
@@ -1451,7 +1477,7 @@ namespace PckStudio
|
||||
{
|
||||
checkSaveState();
|
||||
CreateTexturePackPrompt packPrompt = new CreateTexturePackPrompt();
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
if (packPrompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes, packPrompt.CreateSkinsPck);
|
||||
isTemplateFile = true;
|
||||
@@ -1464,7 +1490,7 @@ namespace PckStudio
|
||||
{
|
||||
checkSaveState();
|
||||
CreateTexturePackPrompt packPrompt = new CreateTexturePackPrompt();
|
||||
if (packPrompt.ShowDialog() == DialogResult.OK)
|
||||
if (packPrompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes);
|
||||
isTemplateFile = true;
|
||||
@@ -1477,7 +1503,7 @@ namespace PckStudio
|
||||
{
|
||||
using AdvancedOptions advanced = new AdvancedOptions(currentPCK);
|
||||
advanced.IsLittleEndian = LittleEndianCheckBox.Checked;
|
||||
if (advanced.ShowDialog() == DialogResult.OK)
|
||||
if (advanced.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
wasModified = true;
|
||||
BuildMainTreeView();
|
||||
@@ -1493,7 +1519,7 @@ namespace PckStudio
|
||||
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using CreditsForm info = new CreditsForm();
|
||||
info.ShowDialog();
|
||||
info.ShowDialog(this);
|
||||
}
|
||||
|
||||
private void treeViewMain_KeyDown(object sender, KeyEventArgs e)
|
||||
@@ -1531,7 +1557,7 @@ namespace PckStudio
|
||||
{
|
||||
if (!HasDataFolder())
|
||||
{
|
||||
DialogResult result = MessageBox.Show("There is not a \"Data\" folder present in the pack folder. Would you like to create one?", "Folder missing", MessageBoxButtons.YesNo);
|
||||
DialogResult result = MessageBox.Show(this, "There is not a \"Data\" folder present in the pack folder. Would you like to create one?", "Folder missing", MessageBoxButtons.YesNo);
|
||||
if (result == DialogResult.No) return false;
|
||||
else Directory.CreateDirectory(GetDataPath());
|
||||
}
|
||||
@@ -1547,7 +1573,7 @@ namespace PckStudio
|
||||
private void importExtractedSkinsFolder(object sender, EventArgs e)
|
||||
{
|
||||
using FolderBrowserDialog contents = new FolderBrowserDialog();
|
||||
if (contents.ShowDialog() == DialogResult.OK && Directory.Exists(contents.SelectedPath))
|
||||
if (contents.ShowDialog(this) == DialogResult.OK && Directory.Exists(contents.SelectedPath))
|
||||
{
|
||||
string filepath = treeViewMain.SelectedNode?.FullPath ?? "";
|
||||
if (treeViewMain.SelectedNode is not null && treeViewMain.SelectedNode.IsTagOfType<PckFileData>())
|
||||
@@ -1644,7 +1670,7 @@ namespace PckStudio
|
||||
contents.Title = "Select Extracted Skin File";
|
||||
contents.Filter = "Skin File (*.png)|*.png";
|
||||
|
||||
if (contents.ShowDialog() == DialogResult.OK)
|
||||
if (contents.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
string skinNameImport = Path.GetFileName(contents.FileName);
|
||||
byte[] data = File.ReadAllBytes(contents.FileName);
|
||||
@@ -1685,7 +1711,7 @@ namespace PckStudio
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
MessageBox.Show(this, ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1697,7 +1723,7 @@ namespace PckStudio
|
||||
TextPrompt folderNamePrompt = new TextPrompt();
|
||||
if (treeViewMain.SelectedNode is not null) folderNamePrompt.contextLabel.Text = $"New folder at the location of \"{treeViewMain.SelectedNode.FullPath}\"";
|
||||
folderNamePrompt.OKButtonText = "Add";
|
||||
if (folderNamePrompt.ShowDialog() == DialogResult.OK)
|
||||
if (folderNamePrompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
TreeNode folerNode = CreateNode(folderNamePrompt.NewText);
|
||||
folerNode.ImageIndex = 0;
|
||||
@@ -1790,7 +1816,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK is not null &&
|
||||
wasModified &&
|
||||
MessageBox.Show("Save PCK?", "Unsaved PCK", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
MessageBox.Show(this, "Save PCK?", "Unsaved PCK", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
{
|
||||
if (isTemplateFile || string.IsNullOrEmpty(saveLocation))
|
||||
{
|
||||
@@ -1818,7 +1844,7 @@ namespace PckStudio
|
||||
{
|
||||
string[] Filepaths = (string[])e.Data.GetData(DataFormats.FileDrop, false);
|
||||
if (Filepaths.Length > 1)
|
||||
MessageBox.Show("Only one pck file at a time is currently supported");
|
||||
MessageBox.Show(this, "Only one pck file at a time is currently supported");
|
||||
LoadPckFromFile(Filepaths[0]);
|
||||
}
|
||||
|
||||
@@ -1929,15 +1955,15 @@ namespace PckStudio
|
||||
{
|
||||
using OpenFileDialog fileDialog = new OpenFileDialog();
|
||||
fileDialog.Filter = "Texture File(*.png,*.tga)|*.png;*.tga";
|
||||
if (fileDialog.ShowDialog() == DialogResult.OK)
|
||||
if (fileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
using TextPrompt renamePrompt = new TextPrompt(Path.GetFileName(fileDialog.FileName));
|
||||
renamePrompt.LabelText = "Path";
|
||||
if (renamePrompt.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(renamePrompt.NewText))
|
||||
if (renamePrompt.ShowDialog(this) == DialogResult.OK && !string.IsNullOrEmpty(renamePrompt.NewText))
|
||||
{
|
||||
if (currentPCK.Contains(renamePrompt.NewText, PckFileType.TextureFile))
|
||||
{
|
||||
MessageBox.Show($"'{renamePrompt.NewText}' already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, $"'{renamePrompt.NewText}' already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PckFileData file = currentPCK.CreateNewFile(renamePrompt.NewText, PckFileType.TextureFile, () => File.ReadAllBytes(fileDialog.FileName));
|
||||
@@ -1951,7 +1977,7 @@ namespace PckStudio
|
||||
{
|
||||
if (treeViewMain.SelectedNode.Tag is PckFileData file)
|
||||
{
|
||||
MessageBox.Show(
|
||||
MessageBox.Show(this,
|
||||
"File path: " + file.Filename +
|
||||
"\nAssigned File type: " + (int)file.Filetype + " (" + file.Filetype + ")" +
|
||||
"\nFile size: " + file.Size +
|
||||
@@ -2017,7 +2043,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK.TryGetFile("colours.col", PckFileType.ColourTableFile, out _))
|
||||
{
|
||||
MessageBox.Show("A color table file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
MessageBox.Show(this, "A color table file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
PckFileData newColorFile = currentPCK.CreateNewFile("colours.col", PckFileType.ColourTableFile);
|
||||
@@ -2038,11 +2064,11 @@ namespace PckStudio
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "3DS Texture|*.3dst";
|
||||
saveFileDialog.DefaultExt = ".3dst";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
Image img = file.GetTexture();
|
||||
var writer = new _3DSTextureWriter(img);
|
||||
writer.WriteToFile(saveFileDialog.FileName);
|
||||
writer.WriteToFile(saveFileDialog.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2090,7 +2116,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK.TryGetFile("Skins.pck", PckFileType.SkinDataFile, out _))
|
||||
{
|
||||
MessageBox.Show("A Skins.pck file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
MessageBox.Show(this, "A Skins.pck file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2139,14 +2165,14 @@ namespace PckStudio
|
||||
ofd.Filter = "All files (*.*)|*.*";
|
||||
ofd.Multiselect = false;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
using AddFilePrompt diag = new AddFilePrompt("res/" + Path.GetFileName(ofd.FileName));
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (currentPCK.Contains(diag.Filepath, diag.Filetype))
|
||||
{
|
||||
MessageBox.Show($"'{diag.Filepath}' of type {diag.Filetype} already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
MessageBox.Show(this, $"'{diag.Filepath}' of type {diag.Filetype} already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PckFileData file = currentPCK.CreateNewFile(diag.Filepath, diag.Filetype, () => File.ReadAllBytes(ofd.FileName));
|
||||
@@ -2164,7 +2190,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK.TryGetFile("behaviours.bin", PckFileType.BehavioursFile, out _))
|
||||
{
|
||||
MessageBox.Show("A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
MessageBox.Show(this, "A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2176,7 +2202,7 @@ namespace PckStudio
|
||||
{
|
||||
if (currentPCK.TryGetFile("entityMaterials.bin", PckFileType.MaterialFile, out _))
|
||||
{
|
||||
MessageBox.Show("A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
MessageBox.Show(this, "A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted");
|
||||
return;
|
||||
}
|
||||
currentPCK.CreateNewFile("entityMaterials.bin", PckFileType.MaterialFile, MaterialResources.MaterialsFileInitializer);
|
||||
@@ -2198,7 +2224,7 @@ namespace PckStudio
|
||||
};
|
||||
if (!PckManager.Visible)
|
||||
{
|
||||
PckManager.Show();
|
||||
PckManager.Show(this);
|
||||
PckManager.BringToFront();
|
||||
}
|
||||
if (PckManager.Focus())
|
||||
@@ -2213,9 +2239,24 @@ namespace PckStudio
|
||||
Filter = "WAV files (*.wav)|*.wav",
|
||||
Title = "Please choose WAV files to convert to BINKA"
|
||||
};
|
||||
if (fileDialog.ShowDialog() == DialogResult.OK)
|
||||
if (fileDialog.ShowDialog(this) == 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(this) == DialogResult.OK)
|
||||
{
|
||||
BinkaConverter.ToBinka(
|
||||
fileDialog.FileNames,
|
||||
new DirectoryInfo(Path.GetDirectoryName(fileDialog.FileName)),
|
||||
dialog.SelectedIndex + 1 // compression level
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2227,7 +2268,7 @@ namespace PckStudio
|
||||
Filter = "BINKA files (*.binka)|*.binka",
|
||||
Title = "Please choose BINKA files to convert to WAV"
|
||||
};
|
||||
if (fileDialog.ShowDialog() == DialogResult.OK)
|
||||
if (fileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
BinkaConverter.ToWav(fileDialog.FileNames, new DirectoryInfo(Path.GetDirectoryName(fileDialog.FileName)));
|
||||
}
|
||||
@@ -2283,7 +2324,7 @@ namespace PckStudio
|
||||
Program.UpdateToLatest("Would you like to download it?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, DialogResult.Yes);
|
||||
return;
|
||||
}
|
||||
MessageBox.Show("Already up to date.", "No update available");
|
||||
MessageBox.Show(this, "Already up to date.", "No update available");
|
||||
}
|
||||
|
||||
[Obsolete] // the move functions are to eventually be removed in favor of drag and drop
|
||||
@@ -2311,21 +2352,28 @@ namespace PckStudio
|
||||
|
||||
int index = pck.IndexOfFile(file);
|
||||
|
||||
if (index + amount < 0 || index + amount > pck.FileCount) return;
|
||||
pck.RemoveFile(file);
|
||||
pck.InsertFile(index + amount, file);
|
||||
try
|
||||
{
|
||||
if (index + amount < 0 || index + amount > pck.FileCount) return;
|
||||
pck.RemoveFile(file);
|
||||
pck.InsertFile(index + amount, file);
|
||||
|
||||
if (IsSubPCK)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
if (IsSubPCK)
|
||||
{
|
||||
var writer = new PckFileWriter(pck, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
(GetSubPCK(path).Tag as PckFileData).SetData(stream.ToArray());
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
var writer = new PckFileWriter(pck, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian);
|
||||
writer.WriteToStream(stream);
|
||||
(GetSubPCK(path).Tag as PckFileData).SetData(stream.ToArray());
|
||||
}
|
||||
}
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
}
|
||||
BuildMainTreeView();
|
||||
wasModified = true;
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, "Can't move file under or above a folder");
|
||||
}
|
||||
}
|
||||
[Obsolete]
|
||||
private void moveUpToolStripMenuItem_Click(object sender, EventArgs e) => moveFile(-1);
|
||||
|
||||
Reference in New Issue
Block a user