diff --git a/PCK-Studio/Extensions/PckAssetExtensions.cs b/PCK-Studio/Extensions/PckAssetExtensions.cs index de8bf0d4..76a70386 100644 --- a/PCK-Studio/Extensions/PckAssetExtensions.cs +++ b/PCK-Studio/Extensions/PckAssetExtensions.cs @@ -21,15 +21,15 @@ namespace PckStudio.Extensions { private const string MipMap = "MipMapLevel"; - internal static Image GetTexture(this PckAsset file) + internal static Image GetTexture(this PckAsset asset) { - if (file.Type != PckAssetType.SkinFile && - file.Type != PckAssetType.CapeFile && - file.Type != PckAssetType.TextureFile) + if (asset.Type != PckAssetType.SkinFile && + asset.Type != PckAssetType.CapeFile && + asset.Type != PckAssetType.TextureFile) { - throw new Exception("File is not suitable to contain image data."); + throw new Exception("Asset is not suitable to contain image data."); } - return file.GetDeserializedData(ImageDeserializer.DefaultDeserializer); + return asset.GetDeserializedData(ImageDeserializer.DefaultDeserializer); } /// @@ -122,46 +122,46 @@ namespace PckStudio.Extensions } } - internal static T GetDeserializedData(this PckAsset file, IPckAssetDeserializer deserializer) + internal static T GetDeserializedData(this PckAsset asset, IPckAssetDeserializer deserializer) { - return deserializer.Deserialize(file); + return deserializer.Deserialize(asset); } - internal static T GetData(this PckAsset file, IDataFormatReader formatReader) where T : class + internal static T GetData(this PckAsset asset, IDataFormatReader formatReader) where T : class { - using var ms = new MemoryStream(file.Data); + using var ms = new MemoryStream(asset.Data); return formatReader.FromStream(ms); } - internal static void SetSerializedData(this PckAsset file, T obj, IPckAssetSerializer serializer) + internal static void SetSerializedData(this PckAsset asset, T obj, IPckAssetSerializer serializer) { - serializer.Serialize(obj, ref file); + serializer.Serialize(obj, ref asset); } - internal static void SetData(this PckAsset file, IDataFormatWriter formatWriter) + internal static void SetData(this PckAsset asset, IDataFormatWriter formatWriter) { using (var stream = new MemoryStream()) { formatWriter.WriteToStream(stream); - file.SetData(stream.ToArray()); + asset.SetData(stream.ToArray()); } } - internal static void SetTexture(this PckAsset file, Image image) + internal static void SetTexture(this PckAsset asset, Image image) { - if (file.Type != PckAssetType.SkinFile && - file.Type != PckAssetType.CapeFile && - file.Type != PckAssetType.TextureFile) + if (asset.Type != PckAssetType.SkinFile && + asset.Type != PckAssetType.CapeFile && + asset.Type != PckAssetType.TextureFile) { - throw new Exception("File is not suitable to contain image data."); + throw new Exception("Asset is not suitable to contain image data."); } - file.SetSerializedData(image, ImageSerializer.DefaultSerializer); + asset.SetSerializedData(image, ImageSerializer.DefaultSerializer); } - internal static bool IsMipmappedFile(this PckAsset file) + internal static bool IsMipmappedFile(this PckAsset asset) { // We only want to test the file name itself. ex: "terrainMipMapLevel2" - string name = Path.GetFileNameWithoutExtension(file.Filename); + string name = Path.GetFileNameWithoutExtension(asset.Filename); // check if last character is a digit (0-9). If not return false if (!char.IsDigit(name[name.Length - 1])) @@ -173,15 +173,15 @@ namespace PckStudio.Extensions return true; } - internal static string GetNormalPath(this PckAsset file) + internal static string GetNormalPath(this PckAsset asset) { - if (!file.IsMipmappedFile()) - return file.Filename; - string ext = Path.GetExtension(file.Filename); - return file.Filename.Remove(file.Filename.Length - (MipMap.Length + 1) - ext.Length) + ext; + if (!asset.IsMipmappedFile()) + return asset.Filename; + string ext = Path.GetExtension(asset.Filename); + return asset.Filename.Remove(asset.Filename.Length - (MipMap.Length + 1) - ext.Length) + ext; } - internal static void DeserializePropertiesFromString(this PckAsset file, string serializedData) + internal static void DeserializePropertiesFromString(this PckAsset asset, string serializedData) { string[] lines = serializedData.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); foreach (string line in lines) @@ -189,14 +189,14 @@ namespace PckStudio.Extensions int idx = line.IndexOf(' '); if (idx == -1 || line.Length - 1 == idx) continue; - file.AddProperty(line.Substring(0, idx).Replace(":", string.Empty), line.Substring(idx + 1)); + asset.AddProperty(line.Substring(0, idx).Replace(":", string.Empty), line.Substring(idx + 1)); } } - internal static string SerializePropertiesToString(this PckAsset file) + internal static string SerializePropertiesToString(this PckAsset asset) { - StringBuilder builder = new StringBuilder(file.PropertyCount * 20); - foreach (var property in file.GetProperties()) + StringBuilder builder = new StringBuilder(asset.PropertyCount * 20); + foreach (var property in asset.GetProperties()) { builder.AppendLine(property.Key + ": " + property.Value); } diff --git a/PCK-Studio/Extensions/PckFileExtensions.cs b/PCK-Studio/Extensions/PckFileExtensions.cs index 869b30d6..b6099592 100644 --- a/PCK-Studio/Extensions/PckFileExtensions.cs +++ b/PCK-Studio/Extensions/PckFileExtensions.cs @@ -11,20 +11,20 @@ namespace PckStudio.Extensions { internal static class PckFileExtensions { - internal static PckAsset CreateNewFileIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer) + internal static PckAsset CreateNewAssetIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer) { if (condition) { - return pck.CreateNewFile(filename, filetype, writer); + return pck.CreateNewAsset(filename, filetype, writer); } return null; } - internal static PckAsset CreateNewFile(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer) + internal static PckAsset CreateNewAsset(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer) { - var file = pck.CreateNewFile(filename, filetype); - file.SetData(writer); - return file; + var asset = pck.CreateNewAsset(filename, filetype); + asset.SetData(writer); + return asset; } } } diff --git a/PCK-Studio/Forms/CreditsForm.Designer.cs b/PCK-Studio/Forms/ContributorsForm.Designer.cs similarity index 60% rename from PCK-Studio/Forms/CreditsForm.Designer.cs rename to PCK-Studio/Forms/ContributorsForm.Designer.cs index 97229cae..1fdb6b58 100644 --- a/PCK-Studio/Forms/CreditsForm.Designer.cs +++ b/PCK-Studio/Forms/ContributorsForm.Designer.cs @@ -1,6 +1,6 @@ namespace PckStudio.Forms { - partial class CreditsForm + partial class ContributorsForm { /// /// Required designer variable. @@ -28,88 +28,47 @@ /// private void InitializeComponent() { - System.Windows.Forms.PictureBox pictureBox1; MetroFramework.Controls.MetroLabel metroLabel1; MetroFramework.Controls.MetroLabel metroLabel2; - MetroFramework.Controls.MetroLabel metroLabel3; - MetroFramework.Controls.MetroLabel metroLabel4; MetroFramework.Controls.MetroLabel metroLabel5; MetroFramework.Controls.MetroLabel metroLabel6; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CreditsForm)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ContributorsForm)); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.buildLabel = new MetroFramework.Controls.MetroLabel(); - pictureBox1 = new System.Windows.Forms.PictureBox(); + this.contributorsLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); metroLabel1 = new MetroFramework.Controls.MetroLabel(); metroLabel2 = new MetroFramework.Controls.MetroLabel(); - metroLabel3 = new MetroFramework.Controls.MetroLabel(); - metroLabel4 = new MetroFramework.Controls.MetroLabel(); metroLabel5 = new MetroFramework.Controls.MetroLabel(); metroLabel6 = new MetroFramework.Controls.MetroLabel(); - ((System.ComponentModel.ISupportInitialize)(pictureBox1)).BeginInit(); this.SuspendLayout(); // - // pictureBox1 - // - pictureBox1.BackColor = System.Drawing.Color.Transparent; - pictureBox1.Enabled = false; - pictureBox1.Image = global::PckStudio.Properties.Resources.Splash; - pictureBox1.Location = new System.Drawing.Point(4, 5); - pictureBox1.Margin = new System.Windows.Forms.Padding(0, 0, 11, 0); - pictureBox1.Name = "pictureBox1"; - pictureBox1.Size = new System.Drawing.Size(550, 293); - pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - pictureBox1.TabIndex = 0; - pictureBox1.TabStop = false; - // // metroLabel1 // metroLabel1.AutoSize = true; metroLabel1.Enabled = false; - metroLabel1.Location = new System.Drawing.Point(4, 301); + metroLabel1.Location = new System.Drawing.Point(23, 475); metroLabel1.Name = "metroLabel1"; - metroLabel1.Size = new System.Drawing.Size(250, 19); + metroLabel1.Size = new System.Drawing.Size(168, 19); metroLabel1.TabIndex = 1; - metroLabel1.Text = "Restored and maintained by PhoenixARC"; + metroLabel1.Text = "Maintained by PhoenixARC"; metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; // // metroLabel2 // metroLabel2.AutoSize = true; metroLabel2.Enabled = false; - metroLabel2.Location = new System.Drawing.Point(314, 301); + metroLabel2.Location = new System.Drawing.Point(23, 456); metroLabel2.Name = "metroLabel2"; - metroLabel2.Size = new System.Drawing.Size(269, 19); + metroLabel2.Size = new System.Drawing.Size(368, 19); metroLabel2.TabIndex = 2; - metroLabel2.Text = "Utilizing the Nobledez Website by Newagent"; + metroLabel2.Text = "Originally created and developed by jam1garner && Nobledez"; metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; // - // metroLabel3 - // - metroLabel3.AutoSize = true; - metroLabel3.Enabled = false; - metroLabel3.Location = new System.Drawing.Point(314, 339); - metroLabel3.Name = "metroLabel3"; - metroLabel3.Size = new System.Drawing.Size(212, 19); - metroLabel3.TabIndex = 3; - metroLabel3.Text = "3D skin renderer by Łukasz Rejman"; - metroLabel3.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // metroLabel4 - // - metroLabel4.AutoSize = true; - metroLabel4.Enabled = false; - metroLabel4.Location = new System.Drawing.Point(314, 320); - metroLabel4.Name = "metroLabel4"; - metroLabel4.Size = new System.Drawing.Size(199, 19); - metroLabel4.TabIndex = 4; - metroLabel4.Text = "3D renderer found by Newagent"; - metroLabel4.Theme = MetroFramework.MetroThemeStyle.Dark; - // // metroLabel5 // metroLabel5.AutoSize = true; metroLabel5.Enabled = false; - metroLabel5.Location = new System.Drawing.Point(4, 320); + metroLabel5.Location = new System.Drawing.Point(397, 456); metroLabel5.Name = "metroLabel5"; metroLabel5.Size = new System.Drawing.Size(300, 19); metroLabel5.TabIndex = 5; @@ -120,7 +79,7 @@ // metroLabel6.AutoSize = true; metroLabel6.Enabled = false; - metroLabel6.Location = new System.Drawing.Point(4, 339); + metroLabel6.Location = new System.Drawing.Point(397, 475); metroLabel6.Name = "metroLabel6"; metroLabel6.Size = new System.Drawing.Size(203, 19); metroLabel6.TabIndex = 6; @@ -132,40 +91,46 @@ this.buildLabel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(34)))), ((int)(((byte)(56))))); this.buildLabel.Enabled = false; this.buildLabel.ForeColor = System.Drawing.SystemColors.Control; - this.buildLabel.Location = new System.Drawing.Point(314, 30); + this.buildLabel.Location = new System.Drawing.Point(473, 6); this.buildLabel.Name = "buildLabel"; - this.buildLabel.Size = new System.Drawing.Size(212, 171); + this.buildLabel.Size = new System.Drawing.Size(212, 54); this.buildLabel.TabIndex = 7; this.buildLabel.Text = "Build Information"; this.buildLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; this.buildLabel.Theme = MetroFramework.MetroThemeStyle.Dark; this.buildLabel.WrapToLine = true; // - // CreditsForm + // contributorsLayoutPanel + // + this.contributorsLayoutPanel.AutoScroll = true; + this.contributorsLayoutPanel.Location = new System.Drawing.Point(23, 63); + this.contributorsLayoutPanel.Name = "contributorsLayoutPanel"; + this.contributorsLayoutPanel.Size = new System.Drawing.Size(684, 390); + this.contributorsLayoutPanel.TabIndex = 8; + // + // ContributorsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(585, 364); + this.ClientSize = new System.Drawing.Size(730, 500); + this.Controls.Add(this.contributorsLayoutPanel); this.Controls.Add(this.buildLabel); this.Controls.Add(metroLabel6); this.Controls.Add(metroLabel1); this.Controls.Add(metroLabel5); - this.Controls.Add(metroLabel4); - this.Controls.Add(metroLabel3); this.Controls.Add(metroLabel2); - this.Controls.Add(pictureBox1); - this.DisplayHeader = false; + this.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(730, 500); this.MinimizeBox = false; - this.Name = "CreditsForm"; - this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.MinimumSize = new System.Drawing.Size(730, 500); + this.Name = "ContributorsForm"; this.Resizable = false; this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Black; - this.Text = "programInfo"; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Text = "Contributors"; this.Theme = MetroFramework.MetroThemeStyle.Dark; - ((System.ComponentModel.ISupportInitialize)(pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -175,5 +140,6 @@ private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private MetroFramework.Controls.MetroLabel buildLabel; + private System.Windows.Forms.FlowLayoutPanel contributorsLayoutPanel; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/ContributorsForm.cs b/PCK-Studio/Forms/ContributorsForm.cs new file mode 100644 index 00000000..b4bf59ed --- /dev/null +++ b/PCK-Studio/Forms/ContributorsForm.cs @@ -0,0 +1,44 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; +using MetroFramework.Forms; +using PckStudio.Internal; +using PckStudio.ToolboxItems; + +namespace PckStudio.Forms +{ + public partial class ContributorsForm : MetroForm + { + public ContributorsForm() + { + InitializeComponent(); +#if false + Task.Run(GetContributors); +#endif + string buildConfig = ""; +#if BETA + buildConfig = "Beta"; +#elif DEBUG + buildConfig = "Debug"; +#elif RELEASE + buildConfig = "Release"; +#else + buildConfig = "unknown"; +#endif + buildLabel.Text = $"Verion: {Application.ProductVersion}\nBuild Config: {buildConfig}\nBranch: {CommitInfo.BranchName}@{CommitInfo.CommitHash}"; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + foreach (var contributorsName in ApplicationScope.Contributors) + { + if (InvokeRequired) + Invoke(() => contributorsLayoutPanel.Controls.Add(new GithubUserPanel(contributorsName))); + else + contributorsLayoutPanel.Controls.Add(new GithubUserPanel(contributorsName)); + } + } + } +} diff --git a/PCK-Studio/Forms/CreditsForm.resx b/PCK-Studio/Forms/ContributorsForm.resx similarity index 99% rename from PCK-Studio/Forms/CreditsForm.resx rename to PCK-Studio/Forms/ContributorsForm.resx index b7a2f32a..70546ba1 100644 --- a/PCK-Studio/Forms/CreditsForm.resx +++ b/PCK-Studio/Forms/ContributorsForm.resx @@ -117,21 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - False False - - False - - - False - False diff --git a/PCK-Studio/Forms/CreditsForm.cs b/PCK-Studio/Forms/CreditsForm.cs deleted file mode 100644 index df2c386c..00000000 --- a/PCK-Studio/Forms/CreditsForm.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Windows.Forms; -using MetroFramework.Forms; -using PckStudio.Internal; - -namespace PckStudio.Forms -{ - public partial class CreditsForm : MetroForm - { - public CreditsForm() - { - InitializeComponent(); - string buildConfig = ""; -#if BETA - buildConfig = "Beta"; -#elif DEBUG - buildConfig = "Debug"; -#elif RELEASE - buildConfig = "Release"; -#else - buildConfig = "unknown"; -#endif - buildLabel.Text = $"Verion: {Application.ProductVersion}\nBuild Config: {buildConfig}\nBranch: {CommitInfo.BranchName}@{CommitInfo.CommitHash}"; - } - } -} diff --git a/PCK-Studio/Forms/Editor/AudioEditor.cs b/PCK-Studio/Forms/Editor/AudioEditor.cs index 517f62e5..e081027a 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.cs @@ -28,8 +28,8 @@ namespace PckStudio.Forms.Editor public partial class AudioEditor : MetroForm { public string defaultType = "yes"; - PckAudioFile audioFile = null; - PckAsset audioPCK; + PckAudioFile _audioFile = null; + PckAsset _audioAsset; bool _isLittleEndian = false; MainForm parent = null; @@ -63,7 +63,7 @@ namespace PckStudio.Forms.Editor return (PckAudioFile.AudioCategory.EAudioType)Categories.IndexOf(category); } - public AudioEditor(PckAsset file, bool isLittleEndian) + public AudioEditor(PckAsset asset, bool isLittleEndian) { InitializeComponent(); @@ -71,11 +71,11 @@ namespace PckStudio.Forms.Editor _isLittleEndian = isLittleEndian; - audioPCK = file; - using (var stream = new MemoryStream(file.Data)) + _audioAsset = asset; + using (var stream = new MemoryStream(asset.Data)) { var reader = new PckAudioFileReader(isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); - audioFile = reader.FromStream(stream); + _audioFile = reader.FromStream(stream); } SetUpTree(); @@ -86,7 +86,7 @@ namespace PckStudio.Forms.Editor treeView1.BeginUpdate(); treeView1.Nodes.Clear(); - foreach (var category in audioFile.Categories) + foreach (var category in _audioFile.Categories) { // fix songs with directories using backslash instead of forward slash // Songs with a backslash instead of a forward slash would not play in RPCS3 @@ -96,7 +96,7 @@ namespace PckStudio.Forms.Editor if (category.audioType == PckAudioFile.AudioCategory.EAudioType.Creative) { if (category.Name == "include_overworld" && - audioFile.TryGetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld, out PckAudioFile.AudioCategory overworldCategory)) + _audioFile.TryGetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld, out PckAudioFile.AudioCategory overworldCategory)) { foreach (var name in category.SongNames.ToList()) { @@ -112,7 +112,7 @@ namespace PckStudio.Forms.Editor treeNode.Tag = category; treeView1.Nodes.Add(treeNode); } - playOverworldInCreative.Enabled = audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Creative); + playOverworldInCreative.Enabled = _audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Creative); treeView1.EndUpdate(); } @@ -141,15 +141,15 @@ namespace PckStudio.Forms.Editor private void addCategoryStripMenuItem_Click(object sender, EventArgs e) { - string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray(); + string[] available = Categories.FindAll(str => !_audioFile.HasCategory(GetCategoryId(str))).ToArray(); if (available.Length > 0) { using ItemSelectionPopUp add = new ItemSelectionPopUp(available); if (add.ShowDialog(this) == DialogResult.OK) - audioFile.AddCategory(GetCategoryId(add.SelectedItem)); + _audioFile.AddCategory(GetCategoryId(add.SelectedItem)); else return; - var category = audioFile.GetCategory(GetCategoryId(add.SelectedItem)); + var category = _audioFile.GetCategory(GetCategoryId(add.SelectedItem)); if (GetCategoryId(add.SelectedItem) == PckAudioFile.AudioCategory.EAudioType.Creative) { @@ -190,7 +190,7 @@ namespace PckStudio.Forms.Editor private void removeCategoryStripMenuItem_Click(object sender, EventArgs e) { if (treeView1.SelectedNode is TreeNode main && - audioFile.RemoveCategory(GetCategoryId(treeView1.SelectedNode.Text))) + _audioFile.RemoveCategory(GetCategoryId(treeView1.SelectedNode.Text))) { if(GetCategoryId(treeView1.SelectedNode.Text) == PckAudioFile.AudioCategory.EAudioType.Creative) { @@ -360,18 +360,18 @@ namespace PckStudio.Forms.Editor private void saveToolStripMenuItem1_Click(object sender, EventArgs e) { - if (!audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Overworld) || - !audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Nether) || - !audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.End)) + if (!_audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Overworld) || + !_audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Nether) || + !_audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.End)) { MessageBox.Show(this, "Your changes were not saved. The game will crash when loading your pack if the Overworld, Nether and End categories don't all exist with at least one valid song.", "Mandatory Categories Missing"); return; } - PckAudioFile.AudioCategory overworldCategory = audioFile.GetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld); + PckAudioFile.AudioCategory overworldCategory = _audioFile.GetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld); bool songs_missing = false; - foreach (var category in audioFile.Categories) + foreach (var category in _audioFile.Categories) { if (category.SongNames.Count < 1) { @@ -410,7 +410,7 @@ namespace PckStudio.Forms.Editor return; } - audioPCK.SetData(new PckAudioFileWriter(audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); + _audioAsset.SetData(new PckAudioFileWriter(_audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); DialogResult = DialogResult.OK; } @@ -433,7 +433,7 @@ namespace PckStudio.Forms.Editor DialogResult dr = MessageBox.Show(this, "This will delete all unused BINKA songs in the Data directory. This cannot be undone. Are you sure you want to continue?", "Warning", MessageBoxButtons.YesNo); if (dr != DialogResult.Yes) return; var totalSongList = new List(); - foreach (string song in audioFile.Categories.SelectMany(cat => cat.SongNames)) + foreach (string song in _audioFile.Categories.SelectMany(cat => cat.SongNames)) { Console.WriteLine(song); totalSongList.Add(song); @@ -525,7 +525,7 @@ namespace PckStudio.Forms.Editor if (string.IsNullOrEmpty(ofn.FileName)) return; // Return if name is null or if the user cancels var totalSongList = new List(); - foreach (string song in audioFile.Categories.SelectMany(cat => cat.SongNames)) + foreach (string song in _audioFile.Categories.SelectMany(cat => cat.SongNames)) { totalSongList.Add(song); } @@ -573,18 +573,18 @@ namespace PckStudio.Forms.Editor { if (!(treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category)) return; - string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray(); + string[] available = Categories.FindAll(str => !_audioFile.HasCategory(GetCategoryId(str))).ToArray(); if (available.Length > 0) { using ItemSelectionPopUp add = new ItemSelectionPopUp(available); add.ButtonText = "Save"; if (add.ShowDialog(this) != DialogResult.OK) return; - audioFile.RemoveCategory(category.audioType); + _audioFile.RemoveCategory(category.audioType); - audioFile.AddCategory(category.parameterType, GetCategoryId(add.SelectedItem), category.audioType == PckAudioFile.AudioCategory.EAudioType.Overworld && playOverworldInCreative.Checked ? "include_overworld" : ""); + _audioFile.AddCategory(category.parameterType, GetCategoryId(add.SelectedItem), category.audioType == PckAudioFile.AudioCategory.EAudioType.Overworld && playOverworldInCreative.Checked ? "include_overworld" : ""); - var newCategory = audioFile.GetCategory(GetCategoryId(add.SelectedItem)); + var newCategory = _audioFile.GetCategory(GetCategoryId(add.SelectedItem)); category.SongNames.ForEach(c => newCategory.SongNames.Add(c)); @@ -603,7 +603,7 @@ namespace PckStudio.Forms.Editor if (treeView1.Nodes.Count < 1 || !parent.CreateDataFolder()) return; string musicdir = Path.Combine(parent.GetDataPath(), "Music"); Directory.CreateDirectory(musicdir); - foreach (var category in audioFile.Categories) + foreach (var category in _audioFile.Categories) { for (var i = 0; i < category.SongNames.Count; i++) // using standard for loop so the list can be modified { diff --git a/PCK-Studio/Forms/Editor/BehaviourEditor.cs b/PCK-Studio/Forms/Editor/BehaviourEditor.cs index 0dcf8099..94f22c07 100644 --- a/PCK-Studio/Forms/Editor/BehaviourEditor.cs +++ b/PCK-Studio/Forms/Editor/BehaviourEditor.cs @@ -21,7 +21,7 @@ namespace PckStudio.Forms.Editor public partial class BehaviourEditor : MetroForm { // Behaviours File Format research by Miku and MattNL - private readonly PckAsset _file; + private readonly PckAsset _asset; BehaviourFile behaviourFile; private readonly List BehaviourData = Entities.BehaviourInfos; @@ -54,15 +54,15 @@ namespace PckStudio.Forms.Editor treeView1.EndUpdate(); } - public BehaviourEditor(PckAsset file) + public BehaviourEditor(PckAsset asset) { InitializeComponent(); saveToolStripMenuItem1.Visible = !Settings.Default.AutoSaveChanges; - _file = file; + _asset = asset; - using (var stream = new MemoryStream(file.Data)) + using (var stream = new MemoryStream(asset.Data)) { var reader = new BehavioursReader(); behaviourFile = reader.FromStream(stream); @@ -255,7 +255,7 @@ namespace PckStudio.Forms.Editor } } - _file.SetData(new BehavioursWriter(behaviourFile)); + _asset.SetData(new BehavioursWriter(behaviourFile)); DialogResult = DialogResult.OK; } diff --git a/PCK-Studio/Forms/Editor/COLEditor.cs b/PCK-Studio/Forms/Editor/COLEditor.cs index 5c9bfb10..cf2f9bda 100644 --- a/PCK-Studio/Forms/Editor/COLEditor.cs +++ b/PCK-Studio/Forms/Editor/COLEditor.cs @@ -19,22 +19,22 @@ namespace PckStudio.Forms.Editor ColorContainer colourfile; string clipboard_color = "#FFFFFF"; - private readonly PckAsset _file; + private readonly PckAsset _asset; List colorCache = new List(); List waterCache = new List(); List underwaterCache = new List(); List fogCache = new List(); - public COLEditor(PckAsset file) + public COLEditor(PckAsset asset) { InitializeComponent(); saveToolStripMenuItem1.Visible = !Settings.Default.AutoSaveChanges; - _file = file; + _asset = asset; - using(var stream = new MemoryStream(file.Data)) + using(var stream = new MemoryStream(asset.Data)) { var reader = new COLFileReader(); colourfile = reader.FromStream(stream); @@ -288,7 +288,7 @@ namespace PckStudio.Forms.Editor private void saveToolStripMenuItem1_Click(object sender, EventArgs e) { - _file.SetData(new COLFileWriter(colourfile)); + _asset.SetData(new COLFileWriter(colourfile)); DialogResult = DialogResult.OK; } diff --git a/PCK-Studio/Forms/Editor/LOCEditor.cs b/PCK-Studio/Forms/Editor/LOCEditor.cs index b2c213f6..def6082f 100644 --- a/PCK-Studio/Forms/Editor/LOCEditor.cs +++ b/PCK-Studio/Forms/Editor/LOCEditor.cs @@ -19,13 +19,13 @@ namespace PckStudio.Forms.Editor { DataTable tbl; LOCFile currentLoc; - PckAsset _file; + PckAsset _asset; - public LOCEditor(PckAsset file) + public LOCEditor(PckAsset asset) { InitializeComponent(); - _file = file; - using (var ms = new MemoryStream(file.Data)) + _asset = asset; + using (var ms = new MemoryStream(asset.Data)) { var reader = new LOCFileReader(); currentLoc = reader.FromStream(ms); @@ -145,7 +145,7 @@ namespace PckStudio.Forms.Editor private void saveToolStripMenuItem_Click(object sender, EventArgs e) { - _file.SetData(new LOCFileWriter(currentLoc, 2)); + _asset.SetData(new LOCFileWriter(currentLoc, 2)); DialogResult = DialogResult.OK; } diff --git a/PCK-Studio/Forms/Editor/MaterialsEditor.cs b/PCK-Studio/Forms/Editor/MaterialsEditor.cs index 2129b393..7b0cb021 100644 --- a/PCK-Studio/Forms/Editor/MaterialsEditor.cs +++ b/PCK-Studio/Forms/Editor/MaterialsEditor.cs @@ -19,7 +19,7 @@ namespace PckStudio.Forms.Editor public partial class MaterialsEditor : MetroForm { // Materials File Format research by PhoenixARC - private readonly PckAsset _file; + private readonly PckAsset _asset; MaterialContainer materialFile; private readonly List MaterialData = Entities.BehaviourInfos; @@ -64,12 +64,12 @@ namespace PckStudio.Forms.Editor treeView1.EndUpdate(); } - public MaterialsEditor(PckAsset file) + public MaterialsEditor(PckAsset asset) { InitializeComponent(); - _file = file; + _asset = asset; - using (var stream = new MemoryStream(file.Data)) + using (var stream = new MemoryStream(asset.Data)) { var reader = new MaterialFileReader(); materialFile = reader.FromStream(stream); @@ -136,7 +136,7 @@ namespace PckStudio.Forms.Editor materialFile.Add(mat); } - _file.SetData(new MaterialFileWriter(materialFile)); + _asset.SetData(new MaterialFileWriter(materialFile)); DialogResult = DialogResult.OK; } diff --git a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs index f52f8cb7..86893b9e 100644 --- a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs +++ b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs @@ -170,10 +170,10 @@ namespace PckStudio.Forms.Editor private bool AcquireColorTable(PckFile pckFile) { - if (pckFile.TryGetFile("colours.col", PckAssetType.ColourTableFile, out var colFile) && - colFile.Size > 0) + if (pckFile.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out var colAsset) && + colAsset.Size > 0) { - using var ms = new MemoryStream(colFile.Data); + using var ms = new MemoryStream(colAsset.Data); var reader = new COLFileReader(); _colourTable = reader.FromStream(ms); return true; @@ -243,18 +243,18 @@ namespace PckStudio.Forms.Editor if (animationButton.Enabled = _atlasType == "blocks" || _atlasType == "items") { - PckAsset animationFile; + PckAsset animationAsset; bool hasAnimation = - _pckFile.TryGetValue($"res/textures/{_atlasType}/{dataTile.Tile.InternalName}.png", PckAssetType.TextureFile, out animationFile) || - _pckFile.TryGetValue($"res/textures/{_atlasType}/{dataTile.Tile.InternalName}.tga", PckAssetType.TextureFile, out animationFile); + _pckFile.TryGetValue($"res/textures/{_atlasType}/{dataTile.Tile.InternalName}.png", PckAssetType.TextureFile, out animationAsset) || + _pckFile.TryGetValue($"res/textures/{_atlasType}/{dataTile.Tile.InternalName}.tga", PckAssetType.TextureFile, out animationAsset); animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation"; if (playAnimationsToolStripMenuItem.Checked && hasAnimation && - animationFile.Size > 0) + animationAsset.Size > 0) { - var animation = animationFile.GetDeserializedData(AnimationDeserializer.DefaultDeserializer); + var animation = animationAsset.GetDeserializedData(AnimationDeserializer.DefaultDeserializer); selectTilePictureBox.Image = animation.CreateAnimationImage(); selectTilePictureBox.Start(); } diff --git a/PCK-Studio/Forms/Skins-And-Textures/AdvancedOptions.cs b/PCK-Studio/Forms/Skins-And-Textures/AdvancedOptions.cs index ab5f6864..da4ee2fb 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/AdvancedOptions.cs +++ b/PCK-Studio/Forms/Skins-And-Textures/AdvancedOptions.cs @@ -1,4 +1,5 @@ -using OMI; +using DiscordRPC; +using OMI; using OMI.Formats.Pck; using OMI.Workers.Pck; using PckStudio.Extensions; @@ -37,27 +38,27 @@ namespace PckStudio.Popups { if (fileTypeComboBox.SelectedIndex >= 0 && fileTypeComboBox.SelectedIndex <= 13) { - applyBulkProperties(_pckFile.GetFiles(), fileTypeComboBox.SelectedIndex - 1); + applyBulkProperties(_pckFile.GetAssets(), fileTypeComboBox.SelectedIndex - 1); DialogResult = DialogResult.OK; return; } MessageBox.Show(this, "Please select a filetype before applying"); } - private void applyBulkProperties(IReadOnlyCollection files, int index) + private void applyBulkProperties(IReadOnlyCollection assets, int index) { - foreach (PckAsset file in files) + foreach (PckAsset asset in assets) { - if (file.Type == PckAssetType.TexturePackInfoFile || - file.Type == PckAssetType.SkinDataFile) + if (asset.Type == PckAssetType.TexturePackInfoFile || + asset.Type == PckAssetType.SkinDataFile) { try { var reader = new PckFileReader(_endianness); - using var ms = new MemoryStream(file.Data); + using var ms = new MemoryStream(asset.Data); PckFile subPCK = reader.FromStream(ms); - applyBulkProperties(subPCK.GetFiles(), index); - file.SetData(new PckFileWriter(subPCK, _endianness)); + applyBulkProperties(subPCK.GetAssets(), index); + asset.SetData(new PckFileWriter(subPCK, _endianness)); } catch (OverflowException ex) { @@ -65,9 +66,9 @@ namespace PckStudio.Popups } } - if (index == -1 || (Enum.IsDefined(typeof(PckAssetType), index) && (int)file.Type == index)) + if (index == -1 || (Enum.IsDefined(typeof(PckAssetType), index) && (int)asset.Type == index)) { - file.AddProperty(propertyKeyTextBox.Text, propertyValueTextBox.Text); + asset.AddProperty(propertyKeyTextBox.Text, propertyValueTextBox.Text); } } diff --git a/PCK-Studio/Interfaces/IPckAssetDeserializer.cs b/PCK-Studio/Interfaces/IPckAssetDeserializer.cs index d016cce9..358b23c0 100644 --- a/PCK-Studio/Interfaces/IPckAssetDeserializer.cs +++ b/PCK-Studio/Interfaces/IPckAssetDeserializer.cs @@ -9,6 +9,6 @@ namespace PckStudio.Interfaces { internal interface IPckAssetDeserializer { - public T Deserialize(PckAsset file); + public T Deserialize(PckAsset asset); } } \ No newline at end of file diff --git a/PCK-Studio/Interfaces/IPckAssetSerializer.cs b/PCK-Studio/Interfaces/IPckAssetSerializer.cs index 81370be1..46cdf4e0 100644 --- a/PCK-Studio/Interfaces/IPckAssetSerializer.cs +++ b/PCK-Studio/Interfaces/IPckAssetSerializer.cs @@ -9,6 +9,6 @@ namespace PckStudio.Interfaces { internal interface IPckAssetSerializer { - public void Serialize(T obj, ref PckAsset file); + public void Serialize(T obj, ref PckAsset asset); } } diff --git a/PCK-Studio/Internal/ApplicationScope.cs b/PCK-Studio/Internal/ApplicationScope.cs index 21ee70e9..dfa04d9f 100644 --- a/PCK-Studio/Internal/ApplicationScope.cs +++ b/PCK-Studio/Internal/ApplicationScope.cs @@ -7,6 +7,8 @@ using PckStudio.Extensions; using System.Globalization; using PckStudio.Internal.Json; using PckStudio.Internal.Misc; +using System.Threading.Tasks; +using System.Windows.Forms; namespace PckStudio.Internal { @@ -14,6 +16,8 @@ namespace PckStudio.Internal { public static FileCacher DataCacher { get; private set; } + public static Octokit.RepositoryContributor[] Contributors { get; private set; } + private static Image[] _entityImages; public static Image[] EntityImages => _entityImages; @@ -41,8 +45,17 @@ namespace PckStudio.Internal _ = Tiles.PaintingImageList; SettingsManager.Initialize(); CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; + Task.Run(GetContributors); } Profiler.Stop(); } + + internal static void GetContributors() + { + var ghClient = new Octokit.GitHubClient(new Octokit.ProductHeaderValue(Application.ProductName + "Credits")); + var allContributorsAct = ghClient.Repository.GetAllContributors("PhoenixARC", "-PCK-Studio"); + allContributorsAct.Wait(); + Contributors = allContributorsAct.Result.ToArray(); + } } } \ No newline at end of file diff --git a/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs b/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs index c15eee2b..fca18165 100644 --- a/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs +++ b/PCK-Studio/Internal/Deserializer/AnimationDeserializer.cs @@ -16,14 +16,14 @@ namespace PckStudio.Internal.Deserializer { public static readonly AnimationDeserializer DefaultDeserializer = new AnimationDeserializer(); - public Animation Deserialize(PckAsset file) + public Animation Deserialize(PckAsset asset) { - _ = file ?? throw new ArgumentNullException(nameof(file)); - if (file.Size > 0) + _ = asset ?? throw new ArgumentNullException(nameof(asset)); + if (asset.Size > 0) { - var texture = file.GetTexture(); + var texture = asset.GetTexture(); var frameTextures = texture.Split(ImageLayoutDirection.Vertical); - var _animation = new Animation(frameTextures, file.GetProperty("ANIM")); + var _animation = new Animation(frameTextures, asset.GetProperty("ANIM")); return _animation; } return Animation.CreateEmpty(); diff --git a/PCK-Studio/Internal/Deserializer/ImageDeserializer.cs b/PCK-Studio/Internal/Deserializer/ImageDeserializer.cs index 2a4d5135..eb00b243 100644 --- a/PCK-Studio/Internal/Deserializer/ImageDeserializer.cs +++ b/PCK-Studio/Internal/Deserializer/ImageDeserializer.cs @@ -18,19 +18,19 @@ namespace PckStudio.Internal.Deserializer public static readonly ImageDeserializer DefaultDeserializer = new ImageDeserializer(); private static Image EmptyImage = new Bitmap(1, 1, PixelFormat.Format32bppArgb); - public Image Deserialize(PckAsset file) + public Image Deserialize(PckAsset asset) { - using var stream = new MemoryStream(file.Data); + using var stream = new MemoryStream(asset.Data); try { - if (Path.GetExtension(file.Filename) == ".tga") + if (Path.GetExtension(asset.Filename) == ".tga") return TGADeserializer.DeserializeFromStream(stream); else return Image.FromStream(stream); } catch (Exception ex) { - Trace.TraceError($"Failed to read image from pck file data({file.Filename})."); + Trace.TraceError($"Failed to read image from pck file data({asset.Filename})."); Debug.WriteLine(ex.Message); return EmptyImage; } diff --git a/PCK-Studio/Internal/PckNodeSorter.cs b/PCK-Studio/Internal/PckNodeSorter.cs index 640db7d7..af2390ad 100644 --- a/PCK-Studio/Internal/PckNodeSorter.cs +++ b/PCK-Studio/Internal/PckNodeSorter.cs @@ -15,8 +15,8 @@ namespace PckStudio.Internal private bool CheckForSkinAndCapeFiles(TreeNode node) { - return node.TryGetTagData(out PckAsset file) && - (file.Type == PckAssetType.SkinFile || file.Type == PckAssetType.CapeFile); + return node.TryGetTagData(out PckAsset asset) && + (asset.Type == PckAssetType.SkinFile || asset.Type == PckAssetType.CapeFile); } public int Compare(object x, object y) diff --git a/PCK-Studio/Internal/Serializer/AnimationSerializer.cs b/PCK-Studio/Internal/Serializer/AnimationSerializer.cs index 52010802..fd3bcb9d 100644 --- a/PCK-Studio/Internal/Serializer/AnimationSerializer.cs +++ b/PCK-Studio/Internal/Serializer/AnimationSerializer.cs @@ -17,12 +17,12 @@ namespace PckStudio.Internal.Serializer { public static readonly AnimationSerializer DefaultSerializer = new AnimationSerializer(); - public void Serialize(Animation animation, ref PckAsset file) + public void Serialize(Animation animation, ref PckAsset asset) { string anim = animation.BuildAnim(); - file.SetProperty("ANIM", anim); + asset.SetProperty("ANIM", anim); var texture = animation.BuildTexture(); - file.SetTexture(texture); + asset.SetTexture(texture); } } } diff --git a/PCK-Studio/Internal/Serializer/ImageSerializer.cs b/PCK-Studio/Internal/Serializer/ImageSerializer.cs index 99c9da12..8bd8241b 100644 --- a/PCK-Studio/Internal/Serializer/ImageSerializer.cs +++ b/PCK-Studio/Internal/Serializer/ImageSerializer.cs @@ -17,20 +17,20 @@ namespace PckStudio.Internal.Serializer { public static readonly ImageSerializer DefaultSerializer = new ImageSerializer(); - public void Serialize(Image obj, ref PckAsset file) + public void Serialize(Image obj, ref PckAsset asset) { var stream = new MemoryStream(); try { - if (Path.GetExtension(file.Filename) == ".tga") + if (Path.GetExtension(asset.Filename) == ".tga") TGASerializer.SerializeToStream(stream, obj); else obj.Save(stream, ImageFormat.Png); - file.SetData(stream.ToArray()); + asset.SetData(stream.ToArray()); } catch (Exception ex) { - Trace.TraceError($"Failed to serialize image to pck file data({file.Filename})."); + Trace.TraceError($"Failed to serialize image to pck file data({asset.Filename})."); Debug.WriteLine(ex.Message); } } diff --git a/PCK-Studio/MainForm.Designer.cs b/PCK-Studio/MainForm.Designer.cs index 5f89cede..eb75cbbe 100644 --- a/PCK-Studio/MainForm.Designer.cs +++ b/PCK-Studio/MainForm.Designer.cs @@ -89,12 +89,12 @@ this.texturePackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mashUpPackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.recentlyOpenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.packSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fullBoxSupportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.recentlyOpenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.quickChangeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -534,13 +534,13 @@ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.newToolStripMenuItem, this.openToolStripMenuItem, - this.packSettingsToolStripMenuItem, - this.saveToolStripMenuItem1, - this.saveToolStripMenuItem, - this.closeToolStripMenuItem, toolStripSeparator2, this.recentlyOpenToolStripMenuItem, toolStripSeparator4, + this.closeToolStripMenuItem, + this.packSettingsToolStripMenuItem, + this.saveToolStripMenuItem1, + this.saveToolStripMenuItem, this.exitToolStripMenuItem}); this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.Silver; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; @@ -579,6 +579,11 @@ this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // + // recentlyOpenToolStripMenuItem + // + resources.ApplyResources(this.recentlyOpenToolStripMenuItem, "recentlyOpenToolStripMenuItem"); + this.recentlyOpenToolStripMenuItem.Name = "recentlyOpenToolStripMenuItem"; + // // packSettingsToolStripMenuItem // this.packSettingsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -608,19 +613,14 @@ // // closeToolStripMenuItem // - this.closeToolStripMenuItem.Name = "closeToolStripMenuItem"; resources.ApplyResources(this.closeToolStripMenuItem, "closeToolStripMenuItem"); + this.closeToolStripMenuItem.Name = "closeToolStripMenuItem"; this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click); // - // recentlyOpenToolStripMenuItem - // - this.recentlyOpenToolStripMenuItem.Name = "recentlyOpenToolStripMenuItem"; - resources.ApplyResources(this.recentlyOpenToolStripMenuItem, "recentlyOpenToolStripMenuItem"); - // // exitToolStripMenuItem // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; resources.ApplyResources(this.exitToolStripMenuItem, "exitToolStripMenuItem"); + this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // // editToolStripMenuItem @@ -648,8 +648,8 @@ // // openPckManagerToolStripMenuItem // - this.openPckManagerToolStripMenuItem.Name = "openPckManagerToolStripMenuItem"; resources.ApplyResources(this.openPckManagerToolStripMenuItem, "openPckManagerToolStripMenuItem"); + this.openPckManagerToolStripMenuItem.Name = "openPckManagerToolStripMenuItem"; this.openPckManagerToolStripMenuItem.Click += new System.EventHandler(this.openPckManagerToolStripMenuItem_Click); // // convertMusicFilesToolStripMenuItem @@ -1116,7 +1116,7 @@ this.treeViewMain.PathSeparator = "/"; this.treeViewMain.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeViewMain_BeforeLabelEdit); this.treeViewMain.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewMain_ItemDrag); - this.treeViewMain.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.selectNode); + this.treeViewMain.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewMain_AfterSelect); this.treeViewMain.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragDrop); this.treeViewMain.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragEnter); this.treeViewMain.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragOver); diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 6eda5a5f..808f98c2 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -111,15 +111,15 @@ namespace PckStudio } // TODO: decide on how to handle embedded pck files - private void HandleInnerPckFile(PckAsset file) + private void HandleInnerPckFile(PckAsset asset) { if (Settings.Default.LoadSubPcks && - (file.Type == PckAssetType.SkinDataFile || file.Type == PckAssetType.TexturePackInfoFile) && - file.Size > 0 && treeViewMain.SelectedNode.Nodes.Count == 0) + (asset.Type == PckAssetType.SkinDataFile || asset.Type == PckAssetType.TexturePackInfoFile) && + asset.Size > 0 && treeViewMain.SelectedNode.Nodes.Count == 0) { try { - PckFile subPCKfile = file.GetData(new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); + PckFile subPCKfile = asset.GetData(new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); BuildPckTreeView(treeViewMain.SelectedNode.Nodes, subPCKfile); treeViewMain.SelectedNode.ExpandAll(); } @@ -300,15 +300,15 @@ namespace PckStudio private void CheckForPasswordAndRemove() { - if (currentPCK.TryGetFile("0", PckAssetType.InfoFile, out PckAsset file)) + if (currentPCK.TryGetAsset("0", PckAssetType.InfoFile, out PckAsset asset)) { - file.RemoveProperties("LOCK"); + asset.RemoveProperties("LOCK"); } } private void LoadEditorTab() { - fileEntryCountLabel.Text = "Files:" + currentPCK.FileCount; + fileEntryCountLabel.Text = "Files:" + currentPCK.AssetCount; if (isTemplateFile) pckFileLabel.Text = "Unsaved File!"; else @@ -405,14 +405,14 @@ namespace PckStudio private void BuildPckTreeView(TreeNodeCollection root, PckFile pckFile) { - foreach (PckAsset file in pckFile.GetFiles()) + foreach (PckAsset asset in pckFile.GetAssets()) { // fix any file paths that may be incorrect //if (file.Filename.StartsWith(parentPath)) // file.Filename = file.Filename.Remove(0, parentPath.Length); - TreeNode node = BuildNodeTreeBySeperator(root, file.Filename, '/'); - node.Tag = file; - SetNodeIcon(node, file.Type); + TreeNode node = BuildNodeTreeBySeperator(root, asset.Filename, '/'); + node.Tag = asset; + SetNodeIcon(node, asset.Type); }; } @@ -425,7 +425,7 @@ namespace PckStudio treeViewMain.Nodes.Clear(); BuildPckTreeView(treeViewMain.Nodes, currentPCK); - if (isTemplateFile && currentPCK.HasFile("Skins.pck", PckAssetType.SkinDataFile)) + if (isTemplateFile && currentPCK.HasAsset("Skins.pck", PckAssetType.SkinDataFile)) { TreeNode skinsNode = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault(); TreeNode folderNode = CreateNode("Skins"); @@ -444,33 +444,33 @@ namespace PckStudio } } - private void HandleTextureFile(PckAsset file) + private void HandleTextureFile(PckAsset asset) { - _ = file.IsMipmappedFile() && currentPCK.TryGetValue(file.GetNormalPath(), PckAssetType.TextureFile, out file); + _ = asset.IsMipmappedFile() && currentPCK.TryGetValue(asset.GetNormalPath(), PckAssetType.TextureFile, out asset); - if (file.Size <= 0) + if (asset.Size <= 0) { - Debug.WriteLine($"'{file.Filename}' size is 0.", category: nameof(HandleTextureFile)); + Debug.WriteLine($"'{asset.Filename}' size is 0.", category: nameof(HandleTextureFile)); return; } - bool isTerrain = file.Filename == "res/terrain.png"; - bool isItems = file.Filename == "res/items.png"; - bool isParticles = file.Filename == "res/particles.png"; - bool isMoonPhases = file.Filename == "res/terrain/moon_phases.png"; - bool isMapIcons = file.Filename == "res/misc/mapicons.png"; - bool isAdditionalMapIcons = file.Filename == "res/misc/additionalmapicons.png"; - bool isXPOrbs = file.Filename == "res/item/xporb.png"; - bool isExplosions = file.Filename == "res/misc/explosion.png"; - bool isPaintings = file.Filename == "res/art/kz.png"; - bool isBanners = file.Filename == "res/item/banner/Banner_Atlas.png"; + bool isTerrain = asset.Filename == "res/terrain.png"; + bool isItems = asset.Filename == "res/items.png"; + bool isParticles = asset.Filename == "res/particles.png"; + bool isMoonPhases = asset.Filename == "res/terrain/moon_phases.png"; + bool isMapIcons = asset.Filename == "res/misc/mapicons.png"; + bool isAdditionalMapIcons = asset.Filename == "res/misc/additionalmapicons.png"; + bool isXPOrbs = asset.Filename == "res/item/xporb.png"; + bool isExplosions = asset.Filename == "res/misc/explosion.png"; + bool isPaintings = asset.Filename == "res/art/kz.png"; + bool isBanners = asset.Filename == "res/item/banner/Banner_Atlas.png"; if ( isTerrain || isItems || isParticles || isMoonPhases || isPaintings || isMapIcons || isAdditionalMapIcons || isXPOrbs || isExplosions || isBanners ) { - Image img = file.GetTexture(); + Image img = asset.GetTexture(); var tile_size = new Size(); int banner_scale = img.Width / Resources.banners_atlas.Width; @@ -495,7 +495,7 @@ namespace PckStudio tile_size = new Size(resolution, resolution); } - var viewer = new TextureAtlasEditor(currentPCK, file.Filename, img, tile_size); + var viewer = new TextureAtlasEditor(currentPCK, asset.Filename, img, tile_size); if (viewer.ShowDialog(this) == DialogResult.OK) { Image texture = viewer.FinalTexture; @@ -519,21 +519,21 @@ namespace PckStudio texture = _img; } - file.SetTexture(texture); + asset.SetTexture(texture); wasModified = true; BuildMainTreeView(); } return; } - if (!file.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.ItemAnimation)) && - !file.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.BlockAnimation))) + if (!asset.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.ItemAnimation)) && + !asset.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.BlockAnimation))) return; - Animation animation = file.GetDeserializedData(AnimationDeserializer.DefaultDeserializer); - string filename = Path.GetFileNameWithoutExtension(file.Filename); + Animation animation = asset.GetDeserializedData(AnimationDeserializer.DefaultDeserializer); + string filename = Path.GetFileNameWithoutExtension(asset.Filename); - var textureInfos = ResourceLocation.GetCategoryFromPath(file.Filename) switch + var textureInfos = ResourceLocation.GetCategoryFromPath(asset.Filename) switch { ResourceCategory.BlockAnimation => Tiles.BlockTileInfos, ResourceCategory.ItemAnimation => Tiles.ItemTileInfos, @@ -548,13 +548,13 @@ namespace PckStudio if (animationEditor.ShowDialog(this) == DialogResult.OK) { wasModified = true; - file.SetSerializedData(animationEditor.Result, AnimationSerializer.DefaultSerializer); + asset.SetSerializedData(animationEditor.Result, AnimationSerializer.DefaultSerializer); BuildMainTreeView(); } } } - private void HandleGameRuleFile(PckAsset file) + private void HandleGameRuleFile(PckAsset asset) { const string use_deflate = "PS3"; const string use_xmem = "Xbox 360"; @@ -574,57 +574,57 @@ namespace PckStudio _ => GameRuleFile.CompressionType.Unknown }; - GameRuleFile grf = file.GetData(new GameRuleFileReader(compressiontype)); + GameRuleFile grf = asset.GetData(new GameRuleFileReader(compressiontype)); using GameRuleFileEditor grfEditor = new GameRuleFileEditor(grf); if (grfEditor.ShowDialog(this) == DialogResult.OK) { - file.SetData(new GameRuleFileWriter(grfEditor.Result)); + asset.SetData(new GameRuleFileWriter(grfEditor.Result)); wasModified = true; UpdateRichPresence(); } } - private void HandleAudioFile(PckAsset file) + private void HandleAudioFile(PckAsset asset) { try { - using AudioEditor audioEditor = new AudioEditor(file, LittleEndianCheckBox.Checked); + using AudioEditor audioEditor = new AudioEditor(asset, LittleEndianCheckBox.Checked); wasModified = audioEditor.ShowDialog(this) == DialogResult.OK; } catch (OverflowException) { - MessageBox.Show(this, $"Failed to open {file.Filename}\n" + + MessageBox.Show(this, $"Failed to open {asset.Filename}\n" + "Try converting the file by using the \"Misc. Functions/Set PCK Endianness\" tool and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { - MessageBox.Show($"Failed to open {file.Filename}\n" + ex.Message, + MessageBox.Show($"Failed to open {asset.Filename}\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - private void HandleLocalisationFile(PckAsset file) + private void HandleLocalisationFile(PckAsset asset) { - using LOCEditor locedit = new LOCEditor(file); + using LOCEditor locedit = new LOCEditor(asset); wasModified = locedit.ShowDialog(this) == DialogResult.OK; UpdateRichPresence(); } - private void HandleColourFile(PckAsset file) + private void HandleColourFile(PckAsset asset) { - using COLEditor diag = new COLEditor(file); + using COLEditor diag = new COLEditor(asset); wasModified = diag.ShowDialog(this) == DialogResult.OK; } - public void HandleSkinFile(PckAsset file) + public void HandleSkinFile(PckAsset asset) { - var skin = file.GetSkin(); - if (file.HasProperty("CAPEPATH")) + var skin = asset.GetSkin(); + if (asset.HasProperty("CAPEPATH")) { - string capePath = file.GetProperty("CAPEPATH"); - if (currentPCK.TryGetFile(capePath, PckAssetType.CapeFile, out var cape)) + string capePath = asset.GetProperty("CAPEPATH"); + if (currentPCK.TryGetAsset(capePath, PckAssetType.CapeFile, out var cape)) { skin.CapeTexture = cape.GetTexture(); } @@ -635,7 +635,7 @@ namespace PckStudio { if (!TryGetLocFile(out var locFile)) Debug.Fail("Failed to aquire loc file."); - file.SetSkin(skinEditor.ResultSkin, locFile); + asset.SetSkin(skinEditor.ResultSkin, locFile); entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty; wasModified = true; @@ -648,47 +648,50 @@ namespace PckStudio 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(PckAsset file) + public void HandleBehavioursFile(PckAsset asset) { - using BehaviourEditor edit = new BehaviourEditor(file); + using BehaviourEditor edit = new BehaviourEditor(asset); wasModified = edit.ShowDialog(this) == DialogResult.OK; } - public void HandleMaterialFile(PckAsset file) + public void HandleMaterialFile(PckAsset asset) { - using MaterialsEditor edit = new MaterialsEditor(file); + using MaterialsEditor edit = new MaterialsEditor(asset); wasModified = edit.ShowDialog(this) == DialogResult.OK; } - private void selectNode(object sender, TreeViewEventArgs e) + private void treeViewMain_AfterSelect(object sender, TreeViewEventArgs e) { ReloadMetaTreeView(); + entryTypeTextBox.Text = entryDataTextBox.Text = labelImageSize.Text = string.Empty; buttonEdit.Visible = false; + previewPictureBox.Image = Resources.NoImageFound; viewFileInfoToolStripMenuItem.Visible = false; - if (e.Node.TryGetTagData(out PckAsset file)) + + if (e.Node.TryGetTagData(out PckAsset asset)) { viewFileInfoToolStripMenuItem.Visible = true; - if (file.HasProperty("BOX")) + if (asset.HasProperty("BOX")) { buttonEdit.Text = "EDIT BOXES"; buttonEdit.Visible = true; } - else if (file.HasProperty("ANIM") && - file.GetProperty("ANIM", s => SkinANIM.FromString(s) == (SkinAnimMask.RESOLUTION_64x64 | SkinAnimMask.SLIM_MODEL))) + else if (asset.HasProperty("ANIM") && + asset.GetProperty("ANIM", s => SkinANIM.FromString(s) == (SkinAnimMask.RESOLUTION_64x64 | SkinAnimMask.SLIM_MODEL))) { buttonEdit.Text = "View Skin"; buttonEdit.Visible = true; } - switch (file.Type) + switch (asset.Type) { case PckAssetType.SkinFile: case PckAssetType.CapeFile: case PckAssetType.TextureFile: { - Image img = file.GetTexture(); + Image img = asset.GetTexture(); if (img.RawFormat != ImageFormat.Jpeg || img.RawFormat != ImageFormat.Png) { @@ -708,30 +711,30 @@ namespace PckStudio Debug.WriteLine(string.Format("An error occured of type: {0} with message: {1}", ex.GetType(), ex.Message), "Exception"); } - if ((file.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.ItemAnimation)) || - file.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.BlockAnimation))) && - file.Type == PckAssetType.TextureFile - && !file.IsMipmappedFile()) + if ((asset.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.ItemAnimation)) || + asset.Filename.StartsWith(ResourceLocation.GetPathFromCategory(ResourceCategory.BlockAnimation))) && + asset.Type == PckAssetType.TextureFile + && !asset.IsMipmappedFile()) { buttonEdit.Text = "EDIT TILE ANIMATION"; buttonEdit.Visible = true; } - bool isTerrain = file.Filename == "res/terrain.png"; - bool isItems = file.Filename == "res/items.png"; - bool isParticles = file.Filename == "res/particles.png"; - bool isMoonPhases = file.Filename == "res/terrain/moon_phases.png"; - bool isMapIcons = file.Filename == "res/misc/mapicons.png"; - bool isAdditionalMapIcons = file.Filename == "res/misc/additionalmapicons.png"; - bool isXPOrbs = file.Filename == "res/item/xporb.png"; - bool isExplosions = file.Filename == "res/misc/explosion.png"; - bool isPaintings = file.Filename == "res/art/kz.png"; - bool isBanners = file.Filename == "res/item/banner/Banner_Atlas.png"; + bool isTerrain = asset.Filename == "res/terrain.png"; + bool isItems = asset.Filename == "res/items.png"; + bool isParticles = asset.Filename == "res/particles.png"; + bool isMoonPhases = asset.Filename == "res/terrain/moon_phases.png"; + bool isMapIcons = asset.Filename == "res/misc/mapicons.png"; + bool isAdditionalMapIcons = asset.Filename == "res/misc/additionalmapicons.png"; + bool isXPOrbs = asset.Filename == "res/item/xporb.png"; + bool isExplosions = asset.Filename == "res/misc/explosion.png"; + bool isPaintings = asset.Filename == "res/art/kz.png"; + bool isBanners = asset.Filename == "res/item/banner/Banner_Atlas.png"; if (( isTerrain || isItems || isParticles || isMoonPhases || isPaintings || isMapIcons || isAdditionalMapIcons || isXPOrbs || isExplosions || isBanners - ) && file.Type == PckAssetType.TextureFile) + ) && asset.Type == PckAssetType.TextureFile) { buttonEdit.Text = "EDIT TEXTURE ATLAS"; buttonEdit.Visible = true; @@ -749,12 +752,12 @@ namespace PckStudio buttonEdit.Visible = true; break; - case PckAssetType.ColourTableFile when file.Filename == "colours.col": + case PckAssetType.ColourTableFile when asset.Filename == "colours.col": buttonEdit.Text = "EDIT COLORS"; buttonEdit.Visible = true; break; - case PckAssetType.BehavioursFile when file.Filename == "behaviours.bin": + case PckAssetType.BehavioursFile when asset.Filename == "behaviours.bin": buttonEdit.Text = "EDIT BEHAVIOURS"; buttonEdit.Visible = true; break; @@ -765,28 +768,28 @@ namespace PckStudio } } - private void extractFile(string outFilePath, PckAsset file) + private void extractFile(string outFilePath, PckAsset asset) { - File.WriteAllBytes(outFilePath, file.Data); - if (file.PropertyCount > 0) + File.WriteAllBytes(outFilePath, asset.Data); + if (asset.PropertyCount > 0) { - File.WriteAllText($"{outFilePath}.txt", file.SerializePropertiesToString()); + File.WriteAllText($"{outFilePath}.txt", asset.SerializePropertiesToString()); } } - private void extractFolderFile(string outPath, PckAsset file) + private void extractFolderFile(string outPath, PckAsset asset) { TreeNode node = treeViewMain.SelectedNode; // abb = "Abbreviated Path" - string abbPath = Path.GetDirectoryName(file.Filename); + string abbPath = Path.GetDirectoryName(asset.Filename); int startIndex = abbPath.IndexOf(node.Text); abbPath = abbPath.Substring(startIndex, abbPath.Length - startIndex); string finalPath = ($"{outPath}/{abbPath}/").Replace('\\', '/'); if (!Directory.Exists(finalPath)) Directory.CreateDirectory(finalPath); - extractFile(finalPath + "/" + Path.GetFileName(file.Filename), file); + extractFile(finalPath + "/" + Path.GetFileName(asset.Filename), asset); } private void extractFolder(string outPath) @@ -799,20 +802,20 @@ namespace PckStudio { GetAllChildNodes(node.Nodes).ForEach(fileNode => { - if (fileNode.TryGetTagData(out PckAsset file)) + if (fileNode.TryGetTagData(out PckAsset asset)) { - extractFolderFile(outPath, file); + extractFolderFile(outPath, asset); } } ); } else { - foreach (PckAsset _file in currentPCK.GetFiles()) + foreach (PckAsset _asset in currentPCK.GetAssets()) { - if (_file.Filename.StartsWith(selectedFolder)) + if (_asset.Filename.StartsWith(selectedFolder)) { - extractFolderFile(outPath, _file); + extractFolderFile(outPath, _asset); } }; } @@ -837,11 +840,11 @@ namespace PckStudio if (dialog.ShowDialog(Handle) == true) extractFolder(dialog.ResultPath); } - else if (node.TryGetTagData(out PckAsset file)) + else if (node.TryGetTagData(out PckAsset asset)) { 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); + exFile.FileName = Path.GetFileName(asset.Filename); + exFile.Filter = Path.GetExtension(asset.Filename).Replace(".", string.Empty) + " File|*" + Path.GetExtension(asset.Filename); 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))) @@ -851,7 +854,7 @@ namespace PckStudio return; } - extractFile(exFile.FileName, file); + extractFile(exFile.FileName, asset); } // Verification that file extraction path was successful @@ -883,31 +886,31 @@ namespace PckStudio private void replaceToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.Tag is PckAsset file) + if (treeViewMain.SelectedNode.Tag is PckAsset asset) { using var ofd = new OpenFileDialog(); // Suddenly, and randomly, this started throwing an exception because it wasn't formatted correctly? So now it's formatted correctly and now displays the file type name in the dialog. string extra_extensions = ""; - switch (file.Type) + switch (asset.Type) { case PckAssetType.TextureFile: - if (Path.GetExtension(file.Filename) == ".png") + if (Path.GetExtension(asset.Filename) == ".png") extra_extensions = ";*.tga"; - else if (Path.GetExtension(file.Filename) == ".tga") + else if (Path.GetExtension(asset.Filename) == ".tga") extra_extensions = ";*.png"; break; } - string fileExt = Path.GetExtension(file.Filename); + string fileExt = Path.GetExtension(asset.Filename); - ofd.Filter = $"{file.Type} (*{fileExt}{extra_extensions})|*{fileExt}{extra_extensions}"; + ofd.Filter = $"{asset.Type} (*{fileExt}{extra_extensions})|*{fileExt}{extra_extensions}"; if (ofd.ShowDialog(this) == DialogResult.OK) { string newFileExt = Path.GetExtension(ofd.FileName); - file.SetData(File.ReadAllBytes(ofd.FileName)); - file.Filename = file.Filename.Replace(fileExt, newFileExt); + asset.SetData(File.ReadAllBytes(ofd.FileName)); + asset.Filename = asset.Filename.Replace(fileExt, newFileExt); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); wasModified = true; BuildMainTreeView(); @@ -917,18 +920,18 @@ namespace PckStudio MessageBox.Show(this, "Can't replace a folder."); } - /// - /// Action to run before a file will be deleted - /// - /// File to remove - /// True if the remove should be canceled, otherwise False - private bool BeforeFileRemove(PckAsset file) + /// + /// Action to run before an asset will be deleted + /// + /// Asset to remove + /// True if the remove should be canceled, otherwise False + private bool BeforeFileRemove(PckAsset asset) { string itemPath = ResourceLocation.GetPathFromCategory(ResourceCategory.ItemAnimation); // warn the user about deleting compass.png and clock.png - if (file.Type == PckAssetType.TextureFile && - (file.Filename == itemPath + "/compass.png" || file.Filename == itemPath + "/clock.png")) + if (asset.Type == PckAssetType.TextureFile && + (asset.Filename == itemPath + "/compass.png" || asset.Filename == itemPath + "/clock.png")) { 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) @@ -936,13 +939,13 @@ namespace PckStudio } // remove loc key if its a skin/cape - if (file.Type == PckAssetType.SkinFile || file.Type == PckAssetType.CapeFile) + if (asset.Type == PckAssetType.SkinFile || asset.Type == PckAssetType.CapeFile) { if (TryGetLocFile(out LOCFile locFile)) { - if (file.TryGetProperty("THEMENAMEID", out string value)) + if (asset.TryGetProperty("THEMENAMEID", out string value)) locFile.RemoveLocKey(value); - if (file.TryGetProperty("DISPLAYNAMEID", out value)) + if (asset.TryGetProperty("DISPLAYNAMEID", out value)) locFile.RemoveLocKey(value); TrySetLocFile(locFile); } @@ -958,9 +961,9 @@ namespace PckStudio string path = node.FullPath; - if (node.TryGetTagData(out PckAsset file)) + if (node.TryGetTagData(out PckAsset asset)) { - if (!BeforeFileRemove(file) && currentPCK.RemoveFile(file)) + if (!BeforeFileRemove(asset) && currentPCK.RemoveAsset(asset)) { node.Remove(); wasModified = true; @@ -983,30 +986,30 @@ namespace PckStudio if (node == null) return; string path = node.FullPath; - bool isFile = node.TryGetTagData(out var file); + bool isFile = node.TryGetTagData(out var asset); - using TextPrompt diag = new TextPrompt(isFile ? file.Filename : Path.GetFileName(node.FullPath)); + using TextPrompt diag = new TextPrompt(isFile ? asset.Filename : Path.GetFileName(node.FullPath)); if (diag.ShowDialog(this) == DialogResult.OK) { if (isFile) { - if (currentPCK.Contains(diag.NewText, file.Type)) + if (currentPCK.Contains(diag.NewText, asset.Type)) { MessageBox.Show(this, $"{diag.NewText} already exists", "File already exists"); return; } - file.Filename = diag.NewText; + asset.Filename = diag.NewText; } else // folders { node.Text = diag.NewText; foreach (TreeNode childNode in GetAllChildNodes(node.Nodes)) { - if (childNode.Tag is PckAsset folderFile) + if (childNode.Tag is PckAsset folderAsset) { - if (folderFile.Filename == diag.NewText) continue; - folderFile.Filename = childNode.FullPath; + if (folderAsset.Filename == diag.NewText) continue; + folderAsset.Filename = childNode.FullPath; } } } @@ -1022,16 +1025,16 @@ namespace PckStudio if (addNewSkinDialog.ShowDialog() == DialogResult.OK) { TryGetLocFile(out LOCFile locFile); - var skinFile = addNewSkinDialog.NewSkin.CreateFile(locFile); - currentPCK.AddFile(skinFile); - if (currentPCK.HasFile("Skins.pck", PckAssetType.SkinDataFile)) // Prioritize Skins.pck + var skinAsset = addNewSkinDialog.NewSkin.CreateFile(locFile); + currentPCK.AddAsset(skinAsset); + if (currentPCK.HasAsset("Skins.pck", PckAssetType.SkinDataFile)) // Prioritize Skins.pck { TreeNode subPCK = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault(); if (subPCK.Nodes.ContainsKey("Skins")) - skinFile.Filename = skinFile.Filename.Insert(0, "Skins/"); - skinFile.Filename = skinFile.Filename.Insert(0, "Skins.pck/"); - TreeNode newNode = new TreeNode(Path.GetFileName(skinFile.Filename)); - newNode.Tag = skinFile; + skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins/"); + skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins.pck/"); + TreeNode newNode = new TreeNode(Path.GetFileName(skinAsset.Filename)); + newNode.Tag = skinAsset; SetNodeIcon(newNode, PckAssetType.SkinFile); subPCK.Nodes.Add(newNode); RebuildSubPCK(newNode.FullPath); @@ -1039,14 +1042,14 @@ namespace PckStudio else { if (treeViewMain.Nodes.ContainsKey("Skins")) - skinFile.Filename = skinFile.Filename.Insert(0, "Skins/"); // Then Skins folder - currentPCK.AddFile(skinFile); + skinAsset.Filename = skinAsset.Filename.Insert(0, "Skins/"); // Then Skins folder + currentPCK.AddAsset(skinAsset); } if (addNewSkinDialog.NewSkin.HasCape) { var capeFile = addNewSkinDialog.NewSkin.CreateCapeFile(); - if (currentPCK.HasFile("Skins.pck", PckAssetType.SkinDataFile)) // Prioritize Skins.pck + if (currentPCK.HasAsset("Skins.pck", PckAssetType.SkinDataFile)) // Prioritize Skins.pck { TreeNode subPCK = treeViewMain.Nodes.Find("Skins.pck", false).FirstOrDefault(); if (subPCK.Nodes.ContainsKey("Skins")) @@ -1062,7 +1065,7 @@ namespace PckStudio { if (treeViewMain.Nodes.ContainsKey("Skins")) capeFile.Filename = capeFile.Filename.Insert(0, "Skins/"); // Then Skins folder - currentPCK.AddFile(capeFile); + currentPCK.AddAsset(capeFile); } } @@ -1078,9 +1081,9 @@ namespace PckStudio audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Overworld); audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Nether); audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.End); - PckAsset pckFileData = new PckAsset("audio.pck", PckAssetType.AudioFile); - pckFileData.SetData(new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); - return pckFileData; + PckAsset newAsset = new PckAsset("audio.pck", PckAssetType.AudioFile); + newAsset.SetData(new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); + return newAsset; } private void audiopckToolStripMenuItem_Click(object sender, EventArgs e) @@ -1097,11 +1100,11 @@ namespace PckStudio return; } - PckAsset file = CreateNewAudioFile(LittleEndianCheckBox.Checked); - AudioEditor diag = new AudioEditor(file, LittleEndianCheckBox.Checked); + PckAsset asset = CreateNewAudioFile(LittleEndianCheckBox.Checked); + AudioEditor diag = new AudioEditor(asset, LittleEndianCheckBox.Checked); if (diag.ShowDialog(this) == DialogResult.OK) { - currentPCK.AddFile(file); + currentPCK.AddAsset(asset); } diag.Dispose(); BuildMainTreeView(); @@ -1125,8 +1128,8 @@ namespace PckStudio if (animationEditor.ShowDialog() == DialogResult.OK) { wasModified = true; - PckAsset file = currentPCK.CreateNewFile(animationFilepath, PckAssetType.TextureFile); - file.SetSerializedData(animationEditor.Result, AnimationSerializer.DefaultSerializer); + PckAsset asset = currentPCK.CreateNewAsset(animationFilepath, PckAssetType.TextureFile); + asset.SetSerializedData(animationEditor.Result, AnimationSerializer.DefaultSerializer); BuildMainTreeView(); ReloadMetaTreeView(); } @@ -1171,9 +1174,9 @@ namespace PckStudio foreach (string node in s) { TreeNode parent = treeViewMain.Nodes.Find(node, true)[0]; - if (parent.TryGetTagData(out PckAsset f) && - (f.Type is PckAssetType.TexturePackInfoFile || - f.Type is PckAssetType.SkinDataFile)) + if (parent.TryGetTagData(out PckAsset asset) && + (asset.Type is PckAssetType.TexturePackInfoFile || + asset.Type is PckAssetType.SkinDataFile)) return parent; } @@ -1191,67 +1194,67 @@ namespace PckStudio Debug.WriteLine(parent.Name); if (parent == null) return; - PckAsset parent_file = parent.Tag as PckAsset; - PckFile parent_file_pck = + PckAsset parentAsset = parent.Tag as PckAsset; + PckFile parentAssetPck = new PckFileReader( LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian - ).FromStream(new MemoryStream(parent_file.Data)); + ).FromStream(new MemoryStream(parentAsset.Data)); - if (parent_file.Type is PckAssetType.TexturePackInfoFile || parent_file.Type is PckAssetType.SkinDataFile) + if (parentAsset.Type is PckAssetType.TexturePackInfoFile || parentAsset.Type is PckAssetType.SkinDataFile) { - Debug.WriteLine("Rebuilding " + parent_file.Filename); - PckFile newPCKFile = new PckFile(3, parent_file.Type is PckAssetType.SkinDataFile); + Debug.WriteLine("Rebuilding " + parentAsset.Filename); + PckFile newPCKFile = new PckFile(3, parentAsset.Type is PckAssetType.SkinDataFile); bool hasSkinsFolder = false; // add original pck files to prevent data loss - foreach (PckAsset _fd in parent_file_pck.GetFiles()) + foreach (PckAsset asset in parentAssetPck.GetAssets()) { - PckAsset new_file = newPCKFile.CreateNewFile(_fd.Filename, _fd.Type); + PckAsset newAsset = newPCKFile.CreateNewAsset(asset.Filename, asset.Type); // check for skins folder so files are placed consistently in final pck - if (_fd.Filename.StartsWith("Skins/") && parent_file.Type is PckAssetType.SkinDataFile) hasSkinsFolder = true; - foreach (var prop in _fd.GetProperties()) - new_file.AddProperty(prop); - new_file.SetData(_fd.Data); + if (asset.Filename.StartsWith("Skins/") && parentAsset.Type is PckAssetType.SkinDataFile) hasSkinsFolder = true; + foreach (var prop in asset.GetProperties()) + newAsset.AddProperty(prop); + newAsset.SetData(asset.Data); } foreach (TreeNode node in GetAllChildNodes(parent.Nodes)) { - if (node.Tag is PckAsset node_file) + if (node.Tag is PckAsset nodeAsset) { - PckAsset new_file = newPCKFile.CreateNewFile( + PckAsset newAsset = newPCKFile.CreateNewAsset( (hasSkinsFolder ? "Skins/" : String.Empty) - + node_file.Filename.Replace(parent_file.Filename + "/", String.Empty), node_file.Type); - foreach (var prop in node_file.GetProperties()) - new_file.AddProperty(prop); - new_file.SetData(node_file.Data); + + nodeAsset.Filename.Replace(parentAsset.Filename + "/", String.Empty), nodeAsset.Type); + foreach (var prop in nodeAsset.GetProperties()) + newAsset.AddProperty(prop); + newAsset.SetData(nodeAsset.Data); } } - parent_file.SetData(new PckFileWriter(newPCKFile, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); - parent.Tag = parent_file; + parentAsset.SetData(new PckFileWriter(newPCKFile, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); + parent.Tag = parentAsset; // erase hidden sub-pck nodes to prevent duplication parent.Nodes.Clear(); BuildMainTreeView(); - MessageBox.Show(this, $"Files added successfully to {parent_file.Filename}"); + MessageBox.Show(this, $"Files added successfully to {parentAsset.Filename}"); } } private void treeViewMain_DoubleClick(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file)) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset)) { - if (file.Size <= 0) + if (asset.Size <= 0) { - Trace.WriteLine($"'{file.Filename}' has no data attached.", category: nameof(treeViewMain_DoubleClick)); + Trace.WriteLine($"'{asset.Filename}' has no data attached.", category: nameof(treeViewMain_DoubleClick)); return; } - pckFileTypeHandler[file.Type]?.Invoke(file); + pckFileTypeHandler[asset.Type]?.Invoke(asset); } } @@ -1267,19 +1270,19 @@ namespace PckStudio private void treeMeta_DoubleClick(object sender, EventArgs e) { if (treeMeta.SelectedNode is TreeNode subnode && subnode.Tag is KeyValuePair property && - treeViewMain.SelectedNode is TreeNode node && node.Tag is PckAsset file) + treeViewMain.SelectedNode is TreeNode node && node.Tag is PckAsset asset) { - if (file.HasProperty(property.Key)) + if (asset.HasProperty(property.Key)) { switch (property.Key) { - case "ANIM" when file.Type == PckAssetType.SkinFile: + case "ANIM" when asset.Type == PckAssetType.SkinFile: try { using ANIMEditor diag = new ANIMEditor(property.Value); if (diag.ShowDialog(this) == DialogResult.OK) { - file.SetProperty(file.GetPropertyIndex(property), new KeyValuePair("ANIM", diag.ResultAnim.ToString())); + asset.SetProperty(asset.GetPropertyIndex(property), new KeyValuePair("ANIM", diag.ResultAnim.ToString())); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); ReloadMetaTreeView(); wasModified = true; @@ -1294,13 +1297,13 @@ namespace PckStudio } break; - case "BOX" when file.Type == PckAssetType.SkinFile: + case "BOX" when asset.Type == PckAssetType.SkinFile: try { using BoxEditor diag = new BoxEditor(property.Value, IsSubPCKNode(treeViewMain.SelectedNode.FullPath)); if (diag.ShowDialog(this) == DialogResult.OK) { - file.SetProperty(file.GetPropertyIndex(property), new KeyValuePair("BOX", diag.Result.ToString())); + asset.SetProperty(asset.GetPropertyIndex(property), new KeyValuePair("BOX", diag.Result.ToString())); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); ReloadMetaTreeView(); wasModified = true; @@ -1324,7 +1327,7 @@ namespace PckStudio { if (addProperty.ShowDialog(this) == DialogResult.OK) { - file.SetProperty(file.GetPropertyIndex(property), addProperty.Property); + asset.SetProperty(asset.GetPropertyIndex(property), addProperty.Property); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); ReloadMetaTreeView(); wasModified = true; @@ -1347,16 +1350,16 @@ namespace PckStudio if (diag.ShowDialog(this) == DialogResult.OK) { - if (node.Tag is PckAsset file) + if (node.Tag is PckAsset asset) { TreeNode newNode = new TreeNode(); newNode.Text = Path.GetFileName(diag.NewText); - var newFile = new PckAsset(diag.NewText, file.Type); - foreach (var property in file.GetProperties()) + var newFile = new PckAsset(diag.NewText, asset.Type); + foreach (var property in asset.GetProperties()) { newFile.AddProperty(property); } - newFile.SetData(file.Data); + newFile.SetData(asset.Data); newFile.Filename = diag.NewText; newNode.Tag = newFile; newNode.ImageIndex = node.ImageIndex; @@ -1375,7 +1378,7 @@ namespace PckStudio if (node.Parent == null) treeViewMain.Nodes.Insert(node.Index + 1, newNode); //adds generated file node else node.Parent.Nodes.Insert(node.Index + 1, newNode);//adds generated file node to selected folder - if (!IsSubPCKNode(node.FullPath)) currentPCK.InsertFile(node.Index + 1, newFile); + if (!IsSubPCKNode(node.FullPath)) currentPCK.InsertAsset(node.Index + 1, newFile); else RebuildSubPCK(node.FullPath); BuildMainTreeView(); wasModified = true; @@ -1386,8 +1389,8 @@ namespace PckStudio private void deleteEntryToolStripMenuItem_Click(object sender, EventArgs e) { if (treeMeta.SelectedNode is TreeNode t && t.Tag is KeyValuePair property && - treeViewMain.SelectedNode is TreeNode main && main.Tag is PckAsset file && - file.RemoveProperty(property)) + treeViewMain.SelectedNode is TreeNode main && main.Tag is PckAsset asset && + asset.RemoveProperty(property)) { treeMeta.SelectedNode.Remove(); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); @@ -1399,9 +1402,9 @@ namespace PckStudio { treeMeta.Nodes.Clear(); if (treeViewMain.SelectedNode is TreeNode node && - node.Tag is PckAsset file) + node.Tag is PckAsset asset) { - foreach (var property in file.GetProperties()) + foreach (var property in asset.GetProperties()) { treeMeta.Nodes.Add(CreateNode(property.Key, property)); } @@ -1411,12 +1414,12 @@ namespace PckStudio private void addEntryToolStripMenuItem_Click_1(object sender, EventArgs e) { if (treeViewMain.SelectedNode is TreeNode t && - t.Tag is PckAsset file) + t.Tag is PckAsset asset) { using AddPropertyPrompt addProperty = new AddPropertyPrompt(); if (addProperty.ShowDialog(this) == DialogResult.OK) { - file.AddProperty(addProperty.Property); + asset.AddProperty(addProperty.Property); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); ReloadMetaTreeView(); wasModified = true; @@ -1435,7 +1438,7 @@ namespace PckStudio if (e.Button != MouseButtons.Left || e.Item is not TreeNode node) return; - if ((node.TryGetTagData(out PckAsset file) && currentPCK.Contains(file.Filename, file.Type)) || node.Parent is TreeNode) + if ((node.TryGetTagData(out PckAsset asset) && currentPCK.Contains(asset.Filename, asset.Type)) || node.Parent is TreeNode) { treeViewMain.DoDragDrop(node, DragDropEffects.Move); } @@ -1519,15 +1522,15 @@ namespace PckStudio Debug.WriteLine($"Target drop location is {(isTargetPckFile ? "file" : "folder")}."); // Retrieve the node that was dragged. - if (draggedNode.TryGetTagData(out PckAsset draggedFile) && - targetNode.FullPath != draggedFile.Filename) + if (draggedNode.TryGetTagData(out PckAsset draggedAsset) && + targetNode.FullPath != draggedAsset.Filename) { - Debug.WriteLine(draggedFile.Filename + " was droped onto " + targetNode.FullPath); + Debug.WriteLine(draggedAsset.Filename + " was droped onto " + targetNode.FullPath); string newFilePath = Path.Combine(isTargetPckFile ? Path.GetDirectoryName(targetNode.FullPath) - : targetNode.FullPath, Path.GetFileName(draggedFile.Filename)); + : targetNode.FullPath, Path.GetFileName(draggedAsset.Filename)); Debug.WriteLine("New filepath: " + newFilePath); - draggedFile.Filename = newFilePath; + draggedAsset.Filename = newFilePath; wasModified = true; BuildMainTreeView(); return; @@ -1575,7 +1578,7 @@ namespace PckStudio MessageBox.Show(this, $"'{addFile.Filepath}' of type {addFile.Filetype} already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; } - var importedFile = currentPCK.CreateNewFile(addFile.Filepath, addFile.Filetype, () => File.ReadAllBytes(filepath)); + var importedFile = currentPCK.CreateNewAsset(addFile.Filepath, addFile.Filetype, () => File.ReadAllBytes(filepath)); string propertyFile = filepath + ".txt"; if (File.Exists(propertyFile)) { @@ -1595,15 +1598,15 @@ namespace PckStudio { var pack = new PckFile(3); - PckAsset zeroFile = pack.CreateNewFile("0", PckAssetType.InfoFile); - zeroFile.AddProperty("PACKID", packId); - zeroFile.AddProperty("PACKVERSION", packVersion); + PckAsset zeroAsset = pack.CreateNewAsset("0", PckAssetType.InfoFile); + zeroAsset.AddProperty("PACKID", packId); + zeroAsset.AddProperty("PACKVERSION", packVersion); var locFile = new LOCFile(); locFile.InitializeDefault(packName); - pack.CreateNewFile("localisation.loc", PckAssetType.LocalisationFile, new LOCFileWriter(locFile, 2)); + pack.CreateNewAsset("localisation.loc", PckAssetType.LocalisationFile, new LOCFileWriter(locFile, 2)); - pack.CreateNewFileIf(createSkinsPCK, "Skins.pck", PckAssetType.SkinDataFile, new PckFileWriter(new PckFile(3, true), + pack.CreateNewAssetIf(createSkinsPCK, "Skins.pck", PckAssetType.SkinDataFile, new PckFileWriter(new PckFile(3, true), LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); @@ -1617,17 +1620,17 @@ namespace PckStudio PckFile infoPCK = new PckFile(3); - PckAsset icon = infoPCK.CreateNewFile("icon.png", PckAssetType.TextureFile); - icon.SetTexture(Resources.TexturePackIcon); + PckAsset iconAsset = infoPCK.CreateNewAsset("icon.png", PckAssetType.TextureFile); + iconAsset.SetTexture(Resources.TexturePackIcon); - PckAsset comparison = infoPCK.CreateNewFile("comparison.png", PckAssetType.TextureFile); - comparison.SetTexture(Resources.Comparison); + PckAsset comparisonAsset = infoPCK.CreateNewAsset("comparison.png", PckAssetType.TextureFile); + comparisonAsset.SetTexture(Resources.Comparison); - PckAsset texturepackInfo = pack.CreateNewFile($"{res}/{res}Info.pck", PckAssetType.TexturePackInfoFile); - texturepackInfo.AddProperty("PACKID", "0"); - texturepackInfo.AddProperty("DATAPATH", $"{res}Data.pck"); + PckAsset texturepackInfoAsset = pack.CreateNewAsset($"{res}/{res}Info.pck", PckAssetType.TexturePackInfoFile); + texturepackInfoAsset.AddProperty("PACKID", "0"); + texturepackInfoAsset.AddProperty("DATAPATH", $"{res}Data.pck"); - texturepackInfo.SetData(new PckFileWriter(infoPCK, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); + texturepackInfoAsset.SetData(new PckFileWriter(infoPCK, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); return pack; } @@ -1635,7 +1638,7 @@ namespace PckStudio private PckFile InitializeMashUpPack(int packId, int packVersion, string packName, string res) { PckFile pack = InitializeTexturePack(packId, packVersion, packName, res, true); - PckAsset gameRuleFile = pack.CreateNewFile("GameRules.grf", PckAssetType.GameRulesFile); + PckAsset gameRuleAsset = pack.CreateNewAsset("GameRules.grf", PckAssetType.GameRulesFile); GameRuleFile grfFile = new GameRuleFile(); grfFile.AddRule("MapOptions", new KeyValuePair("seed", "0"), @@ -1652,7 +1655,7 @@ namespace PckStudio new KeyValuePair("spawnZ", "0") ); - gameRuleFile.SetData(new GameRuleFileWriter(grfFile)); + gameRuleAsset.SetData(new GameRuleFileWriter(grfFile)); return pack; } @@ -1716,7 +1719,7 @@ namespace PckStudio private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { - using CreditsForm info = new CreditsForm(); + using ContributorsForm info = new ContributorsForm(); info.ShowDialog(this); } @@ -1795,14 +1798,14 @@ namespace PckStudio continue; } - PckAsset newFile = currentPCK.CreateNewFile(pckfilepath, pckfiletype); + PckAsset newAsset = currentPCK.CreateNewAsset(pckfilepath, pckfiletype); byte[] filedata = File.ReadAllBytes(fullfilename); - newFile.SetData(filedata); + newAsset.SetData(filedata); if (File.Exists(fullfilename + ".txt")) { string propertiesFileContent = File.ReadAllText(fullfilename + ".txt"); - newFile.DeserializePropertiesFromString(propertiesFileContent); + newAsset.DeserializePropertiesFromString(propertiesFileContent); } } BuildMainTreeView(); @@ -1812,8 +1815,8 @@ namespace PckStudio private bool TryGetLocFile(out LOCFile locFile) { - if (!currentPCK.TryGetFile("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locdata) && - !currentPCK.TryGetFile("languages.loc", PckAssetType.LocalisationFile, out locdata)) + if (!currentPCK.TryGetAsset("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locAsset) && + !currentPCK.TryGetAsset("languages.loc", PckAssetType.LocalisationFile, out locAsset)) { locFile = null; return false; @@ -1821,7 +1824,7 @@ namespace PckStudio try { - using (var stream = new MemoryStream(locdata.Data)) + using (var stream = new MemoryStream(locAsset.Data)) { var reader = new LOCFileReader(); locFile = reader.FromStream(stream); @@ -1838,15 +1841,15 @@ namespace PckStudio private bool TrySetLocFile(in LOCFile locFile) { - if (!currentPCK.TryGetFile("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locdata) && - !currentPCK.TryGetFile("languages.loc", PckAssetType.LocalisationFile, out locdata)) + if (!currentPCK.TryGetAsset("localisation.loc", PckAssetType.LocalisationFile, out PckAsset locAsset) && + !currentPCK.TryGetAsset("languages.loc", PckAssetType.LocalisationFile, out locAsset)) { return false; } try { - locdata.SetData(new LOCFileWriter(locFile, 2)); + locAsset.SetData(new LOCFileWriter(locFile, 2)); return true; } catch (Exception ex) @@ -1876,7 +1879,7 @@ namespace PckStudio return; } - PckAsset importSkinAsset = currentPCK.CreateNewFile(skinNameImport, PckAssetType.SkinFile); + PckAsset importSkinAsset = currentPCK.CreateNewAsset(skinNameImport, PckAssetType.SkinFile); importSkinAsset.SetData(data); string propertyFile = contents.FileName + ".txt"; if (File.Exists(propertyFile)) @@ -1915,9 +1918,9 @@ namespace PckStudio TreeNodeCollection nodeCollection = treeViewMain.Nodes; if (treeViewMain.SelectedNode is TreeNode node) { - if (node.Tag is PckAsset fd && - (fd.Type != PckAssetType.TexturePackInfoFile && - fd.Type != PckAssetType.SkinDataFile)) + if (node.Tag is PckAsset asset && + (asset.Type != PckAssetType.TexturePackInfoFile && + asset.Type != PckAssetType.SkinDataFile)) { if (node.Parent is TreeNode parentNode) { @@ -2124,10 +2127,10 @@ namespace PckStudio private void SetFileType(PckAssetType type) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file)) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset)) { - Debug.WriteLine($"Setting {file.Type} to {type}"); - file.Type = type; + Debug.WriteLine($"Setting {asset.Type} to {type}"); + asset.Type = type; SetNodeIcon(treeViewMain.SelectedNode, type); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); } @@ -2149,7 +2152,7 @@ namespace PckStudio MessageBox.Show(this, $"'{renamePrompt.NewText}' already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } - PckAsset file = currentPCK.CreateNewFile(renamePrompt.NewText, PckAssetType.TextureFile, () => File.ReadAllBytes(fileDialog.FileName)); + PckAsset asset = currentPCK.CreateNewAsset(renamePrompt.NewText, PckAssetType.TextureFile, () => File.ReadAllBytes(fileDialog.FileName)); BuildMainTreeView(); wasModified = true; } @@ -2158,28 +2161,28 @@ namespace PckStudio private void viewFileInfoToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.Tag is PckAsset file) + if (treeViewMain.SelectedNode.Tag is PckAsset asset) { MessageBox.Show(this, - "File path: " + file.Filename + - "\nAssigned File type: " + (int)file.Type + " (" + file.Type + ")" + - "\nFile size: " + file.Size + - "\nProperties count: " + file.PropertyCount - , Path.GetFileName(file.Filename) + " file info"); + "File path: " + asset.Filename + + "\nAssigned File type: " + (int)asset.Type + " (" + asset.Type + ")" + + "\nFile size: " + asset.Size + + "\nProperties count: " + asset.PropertyCount + , Path.GetFileName(asset.Filename) + " file info"); } } private void generateMipMapTextureToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.Tag is PckAsset file && file.Type == PckAssetType.TextureFile) + if (treeViewMain.SelectedNode.Tag is PckAsset asset && asset.Type == PckAssetType.TextureFile) { - string textureDirectory = Path.GetDirectoryName(file.Filename); - string textureName = Path.GetFileNameWithoutExtension(file.Filename); + string textureDirectory = Path.GetDirectoryName(asset.Filename); + string textureName = Path.GetFileNameWithoutExtension(asset.Filename); - if (file.IsMipmappedFile()) + if (asset.IsMipmappedFile()) return; - string textureExtension = Path.GetExtension(file.Filename); + string textureExtension = Path.GetExtension(asset.Filename); using NumericPrompt numericPrompt = new NumericPrompt(0); numericPrompt.Minimum = 1; @@ -2194,12 +2197,12 @@ namespace PckStudio { string mippedPath = $"{textureDirectory}/{textureName}MipMapLevel{i}{textureExtension}"; Debug.WriteLine(mippedPath); - if (currentPCK.HasFile(mippedPath, PckAssetType.TextureFile)) - currentPCK.RemoveFile(currentPCK.GetFile(mippedPath, PckAssetType.TextureFile)); - PckAsset MipMappedFile = new PckAsset(mippedPath, PckAssetType.TextureFile); + if (currentPCK.HasAsset(mippedPath, PckAssetType.TextureFile)) + currentPCK.RemoveAsset(currentPCK.GetAsset(mippedPath, PckAssetType.TextureFile)); + PckAsset mipMappedAsset = new PckAsset(mippedPath, PckAssetType.TextureFile); - Image originalTexture = file.GetTexture(); + Image originalTexture = asset.GetTexture(); int NewWidth = Math.Max(originalTexture.Width / (int)Math.Pow(2, i - 1), 1); int NewHeight = Math.Max(originalTexture.Height / (int)Math.Pow(2, i - 1), 1); @@ -2213,9 +2216,9 @@ namespace PckStudio gfx.DrawImage(originalTexture, tileArea); } - MipMappedFile.SetTexture(mippedTexture); + mipMappedAsset.SetTexture(mippedTexture); - currentPCK.InsertFile(currentPCK.IndexOfFile(file) + i - 1, MipMappedFile); + currentPCK.InsertAsset(currentPCK.IndexOfAsset(asset) + i - 1, mipMappedAsset); } BuildMainTreeView(); } @@ -2224,13 +2227,13 @@ namespace PckStudio private void colourscolToolStripMenuItem_Click(object sender, EventArgs e) { - if (currentPCK.TryGetFile("colours.col", PckAssetType.ColourTableFile, out _)) + if (currentPCK.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out _)) { MessageBox.Show(this, "A color table file already exists in this PCK and a new one cannot be created.", "Operation aborted"); return; } - PckAsset newColorFile = currentPCK.CreateNewFile("colours.col", PckAssetType.ColourTableFile); - newColorFile.SetData(Resources.tu69colours); + PckAsset newColorAsset = currentPCK.CreateNewAsset("colours.col", PckAssetType.ColourTableFile); + newColorAsset.SetData(Resources.tu69colours); BuildMainTreeView(); } @@ -2241,15 +2244,15 @@ namespace PckStudio private void as3DSTextureFileToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file) && - file.Type == PckAssetType.SkinFile) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset) && + asset.Type == PckAssetType.SkinFile) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "3DS Texture|*.3dst"; saveFileDialog.DefaultExt = ".3dst"; if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { - Image img = file.GetTexture(); + Image img = asset.GetTexture(); var writer = new _3DSTextureWriter(img); writer.WriteToFile(saveFileDialog.FileName); } @@ -2258,7 +2261,7 @@ namespace PckStudio private void addMultipleEntriesToolStripMenuItem1_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file)) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset)) { using (var input = new MultiTextPrompt()) { @@ -2269,7 +2272,7 @@ namespace PckStudio int idx = line.IndexOf(' '); if (idx == -1 || line.Length - 1 == idx) continue; - file.AddProperty(line.Substring(0, idx), line.Substring(idx + 1)); + asset.AddProperty(line.Substring(0, idx), line.Substring(idx + 1)); } ReloadMetaTreeView(); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); @@ -2281,13 +2284,13 @@ namespace PckStudio private void correctSkinDecimalsToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file) && - file.Type == PckAssetType.SkinFile) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset) && + asset.Type == PckAssetType.SkinFile) { - foreach (KeyValuePair p in file.GetProperties().ToList()) + foreach (KeyValuePair p in asset.GetProperties().ToList()) { if (p.Key == "BOX" || p.Key == "OFFSET") - file.SetProperty(file.GetPropertyIndex(p), new KeyValuePair(p.Key, p.Value.Replace(',', '.'))); + asset.SetProperty(asset.GetPropertyIndex(p), new KeyValuePair(p.Key, p.Value.Replace(',', '.'))); } ReloadMetaTreeView(); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); @@ -2297,13 +2300,13 @@ namespace PckStudio private void CreateSkinsPCKToolStripMenuItem1_Click(object sender, EventArgs e) { - if (currentPCK.TryGetFile("Skins.pck", PckAssetType.SkinDataFile, out _)) + if (currentPCK.TryGetAsset("Skins.pck", PckAssetType.SkinDataFile, out _)) { MessageBox.Show(this, "A Skins.pck file already exists in this PCK and a new one cannot be created.", "Operation aborted"); return; } - currentPCK.CreateNewFile("Skins.pck", PckAssetType.SkinDataFile, new PckFileWriter(new PckFile(3, true), + currentPCK.CreateNewAsset("Skins.pck", PckAssetType.SkinDataFile, new PckFileWriter(new PckFile(3, true), LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian)); BuildMainTreeView(); @@ -2317,20 +2320,20 @@ namespace PckStudio private void editAllEntriesToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file)) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset)) { - string[] props = file.GetProperties().Select(p => p.Key + " " + p.Value).ToArray(); + string[] props = asset.GetProperties().Select(p => p.Key + " " + p.Value).ToArray(); using (var input = new MultiTextPrompt(props)) { if (input.ShowDialog(this) == DialogResult.OK) { - file.ClearProperties(); + asset.ClearProperties(); foreach (string line in input.TextOutput) { int idx = line.IndexOf(' '); if (idx == -1 || line.Length - 1 == idx) continue; - file.AddProperty(line.Substring(0, idx).Replace(":", string.Empty), line.Substring(idx + 1)); + asset.AddProperty(line.Substring(0, idx).Replace(":", string.Empty), line.Substring(idx + 1)); } ReloadMetaTreeView(); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); @@ -2358,7 +2361,7 @@ namespace PckStudio MessageBox.Show(this, $"'{diag.Filepath}' of type {diag.Filetype} already exists.", "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } - PckAsset file = currentPCK.CreateNewFile(diag.Filepath, diag.Filetype, () => File.ReadAllBytes(ofd.FileName)); + PckAsset asset = currentPCK.CreateNewAsset(diag.Filepath, diag.Filetype, () => File.ReadAllBytes(ofd.FileName)); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); @@ -2371,24 +2374,24 @@ namespace PckStudio private void behavioursbinToolStripMenuItem_Click(object sender, EventArgs e) { - if (currentPCK.TryGetFile("behaviours.bin", PckAssetType.BehavioursFile, out _)) + if (currentPCK.TryGetAsset("behaviours.bin", PckAssetType.BehavioursFile, out _)) { MessageBox.Show(this, "A behaviours file already exists in this PCK and a new one cannot be created.", "Operation aborted"); return; } - currentPCK.CreateNewFile("behaviours.bin", PckAssetType.BehavioursFile, BehaviourResources.BehaviourFileInitializer); + currentPCK.CreateNewAsset("behaviours.bin", PckAssetType.BehavioursFile, BehaviourResources.BehaviourFileInitializer); BuildMainTreeView(); } private void entityMaterialsbinToolStripMenuItem_Click(object sender, EventArgs e) { - if (currentPCK.TryGetFile("entityMaterials.bin", PckAssetType.MaterialFile, out _)) + if (currentPCK.TryGetAsset("entityMaterials.bin", PckAssetType.MaterialFile, out _)) { 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", PckAssetType.MaterialFile, MaterialResources.MaterialsFileInitializer); + currentPCK.CreateNewAsset("entityMaterials.bin", PckAssetType.MaterialFile, MaterialResources.MaterialsFileInitializer); BuildMainTreeView(); } @@ -2453,12 +2456,12 @@ namespace PckStudio private void addBOXEntryToolStripMenuItem1_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode is TreeNode t && t.Tag is PckAsset file) + if (treeViewMain.SelectedNode is TreeNode t && t.Tag is PckAsset asset) { using BoxEditor diag = new BoxEditor(SkinBOX.Empty, IsSubPCKNode(treeViewMain.SelectedNode.FullPath)); if (diag.ShowDialog(this) == DialogResult.OK) { - file.AddProperty("BOX", diag.Result); + asset.AddProperty("BOX", diag.Result); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); ReloadMetaTreeView(); wasModified = true; @@ -2469,12 +2472,12 @@ namespace PckStudio private void addANIMEntryToolStripMenuItem1_Click(object sender, EventArgs e) { - if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset file)) + if (treeViewMain.SelectedNode.TryGetTagData(out PckAsset asset)) { using ANIMEditor diag = new ANIMEditor(SkinANIM.Empty); if (diag.ShowDialog(this) == DialogResult.OK) { - file.AddProperty("ANIM", diag.ResultAnim); + asset.AddProperty("ANIM", diag.ResultAnim); RebuildSubPCK(treeViewMain.SelectedNode.FullPath); ReloadMetaTreeView(); wasModified = true; @@ -2502,19 +2505,19 @@ namespace PckStudio { try { - if (treeViewMain.SelectedNode.Tag is PckAsset file && (file.Type is PckAssetType.AudioFile || file.Type is PckAssetType.SkinDataFile || file.Type is PckAssetType.TexturePackInfoFile)) + if (treeViewMain.SelectedNode.Tag is PckAsset asset && (asset.Type is PckAssetType.AudioFile || asset.Type is PckAssetType.SkinDataFile || asset.Type is PckAssetType.TexturePackInfoFile)) { - IDataFormatReader reader = file.Type is PckAssetType.AudioFile + IDataFormatReader reader = asset.Type is PckAssetType.AudioFile ? new PckAudioFileReader(endianness == OMI.Endianness.BigEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian) : new PckFileReader(endianness == OMI.Endianness.BigEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); - object pck = reader.FromStream(new MemoryStream(file.Data)); + object pck = reader.FromStream(new MemoryStream(asset.Data)); - IDataFormatWriter writer = file.Type is PckAssetType.AudioFile + IDataFormatWriter writer = asset.Type is PckAssetType.AudioFile ? new PckAudioFileWriter((PckAudioFile)pck, endianness) : new PckFileWriter((PckFile)pck, endianness); - file.SetData(writer); + asset.SetData(writer); wasModified = true; - MessageBox.Show($"\"{file.Filename}\" successfully converted to {(endianness == OMI.Endianness.LittleEndian ? "little" : "big")} endian.", "Converted PCK file"); + MessageBox.Show($"\"{asset.Filename}\" successfully converted to {(endianness == OMI.Endianness.LittleEndian ? "little" : "big")} endian.", "Converted PCK file"); } } catch (OverflowException) @@ -2534,11 +2537,11 @@ namespace PckStudio private void SetModelVersion(int version) { - if (treeViewMain.SelectedNode.Tag is PckAsset file && file.Type is PckAssetType.ModelsFile) + if (treeViewMain.SelectedNode.Tag is PckAsset asset && asset.Type is PckAssetType.ModelsFile) { try { - ModelContainer container = file.GetData(new ModelFileReader()); + ModelContainer container = asset.GetData(new ModelFileReader()); if (container.Version == version) { @@ -2570,11 +2573,11 @@ namespace PckStudio return; } - file.SetData(new ModelFileWriter(container, version)); + asset.SetData(new ModelFileWriter(container, version)); wasModified = true; MessageBox.Show( this, - $"\"{file.Filename}\" successfully converted to Version {version + 1} format.", + $"\"{asset.Filename}\" successfully converted to Version {version + 1} format.", "Converted model container file" ); } diff --git a/PCK-Studio/MainForm.resx b/PCK-Studio/MainForm.resx index 2d5a3cd8..53843773 100644 --- a/PCK-Studio/MainForm.resx +++ b/PCK-Studio/MainForm.resx @@ -833,6 +833,29 @@ 116, 17 + + 224, 324 + + + contextMenuPCKEntries + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAA3SURBVDhPY/j/ + /z9FGKsgGIsCKWSMTQ0QYxUE45FmALpiYvFwMgAbxqIYG8YqCMajBhCJ/zMAAPGwpV/Xje8RAAAAAElF + TkSuQmCC + + + + 223, 22 + + + Create + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -921,19 +944,20 @@ EntityMaterials.bin - + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAA3SURBVDhPY/j/ - /z9FGKsgGIsCKWSMTQ0QYxUE45FmALpiYvFwMgAbxqIYG8YqCMajBhCJ/zMAAPGwpV/Xje8RAAAAAElF + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAABzSURBVDhPpYzB + DQAhCARp4hr3Txu254WTjYRb9cEmk/BgRjBVHTv85Twmgt77PcJEYIFrhIkAgWOEiSAGthEmgtbaD9fW + mBgpB4xywCgFxiMf5YDdrq3l5wjEjKtzTARMNlydY2IGot2ureVnRjkQmZbICyCi7XU5cfqKAAAAAElF TkSuQmCC - + 223, 22 - - Create + + Import @@ -987,20 +1011,11 @@ Add File - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAABzSURBVDhPpYzB - DQAhCARp4hr3Txu254WTjYRb9cEmk/BgRjBVHTv85Twmgt77PcJEYIFrhIkAgWOEiSAGthEmgtbaD9fW - mBgpB4xywCgFxiMf5YDdrq3l5wjEjKtzTARMNlydY2IGot2ureVnRjkQmZbICyCi7XU5cfqKAAAAAElF - TkSuQmCC - - - + 223, 22 - - Import + + Export 186, 22 @@ -1008,11 +1023,11 @@ Export as 3DS Texture - + 223, 22 - - Export + + Set File Type 222, 22 @@ -1086,12 +1101,6 @@ Entity Materials File (.BIN) - - 223, 22 - - - Set File Type - 220, 6 @@ -1113,6 +1122,12 @@ Correct Skin Decimals + + 223, 22 + + + Set SubPCK Endianness + 250, 22 @@ -1125,11 +1140,11 @@ Little Endian (PS4/PS Vita/Switch) - + 223, 22 - - Set SubPCK Endianness + + Set Model Container Format 216, 22 @@ -1149,12 +1164,6 @@ Version 3 (1.14 [PS4 ONLY]) - - 223, 22 - - - Set Model Container Format - 220, 6 @@ -1223,15 +1232,6 @@ Delete - - 224, 346 - - - contextMenuPCKEntries - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 17, 17 @@ -1244,24 +1244,6 @@ None - - 151, 22 - - - Skin Pack - - - 151, 22 - - - Texture Pack - - - 151, 22 - - - Mash-Up Pack - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -1296,11 +1278,56 @@ Open - - 160, 22 + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAT + rAAAE6wBzl+vrgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAHkSURBVFhH1ZfN + KwVRGIevBRslZUtZsPG1kEhZ21hYKfkTpMTCwoqF4l+QNbKysraU8rW1ZEEUpcg3v2fMYXLn471zz+12 + n3q6c8685z3vzJy65xRqhT45LidyytheWTKD8lR+efJEDkgTTP4kGXgj9+ROThlLDnI9SlMR7sm3ZCMd + ZUKObUnOYzrS6JHuyX1M7iDXrSR3Nx1JsGgI4tX5hpzkZo5EWLkE8f18Q05yM0cipRYwG2qhIgW8h1qo + SAHEooXYAliR93I5aBUXMCy5Pxe0ivFSwKv8lGMyWkCLvAjbizKOsguABcmNOzkdXhO8G14fyAYZB/fR + QmIBddJNdh7+noW/FNUukyAGLSQWANHXjR/SfZY0XHxb0EontQAYkm/SJV2TWRxKYi9l1t9uZgGwLgm6 + lvV0ZNAs9yVjHuSoTMJUAOthRrYGLRss0E1J8hc5JeMwFZAXCl+VTMDaWZL/qWgBjnnJAmaiFToimD/B + iGwKWvmYlM/yKmj9YSqARUTQRtDKT4fs/Ln8xVQANwki2De1UUDVt2RuU8oGslKb0i460uAQQSBbaR9F + kMNty4/oyILDA4cI9yZ4dXy/PDLWPTk5+6UJiuAQwUAf8uTmyaOwY2LRsHLzyNjUg0iVKBS+AWAi5w3z + cKwSAAAAAElFTkSuQmCC + - - Full box support + + 186, 22 + + + Recently open + + + + iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAAJ10AACddAWJ4eeMAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwa + AAADaElEQVR4Xu2bO49NURiGx/1OhCiERhQKFZ2CBAlxvyv8BtHTKTUKkaCViFuCiEQoFESiICiUKgoR + BZGgcHmfYpKTPe+aOWfvb629JftJnmbOmf2t7519XXvNWE9PT09PGZbKE/K8vCZv1vCK3C7/K+bIs/K7 + /BvgH3lc/hcsk0+la6SJbLPzsMu/lK6BpqYC2CLfyG/ytlwuW2GxfCHd4JvKIXBMVtktf8rB73LeKM5C + +UwODmTQT/K+rJ7ghpGT4DZZxTWPX2VR5ssnsjqQca9LAook1Ty+ksWYKx9JNxC8IWfISCZrnp9vlkWY + Ldmt3UDwjpwlI9kpf0hX75fcJ4tAYzToBoIPJAFFMtlfHk/KIrBLs2u7QSCHBIdGJFM1j0dldqbLq9IN + ALkSRJ/wJtvtB80ewDR5Sbri+FwukpEM2zxmDYDmL0pXGLn0cBcYySjNY9YATktXFHM0P9Wlzv08WwAb + 5W/pir6VPPxEMlXzfO4+yxbAPekKvpMrZCTDNA/u8ywBcFLjBqNa7L1cKSMZtnlw38kSwCbpiu2QkYzS + PLjvHZHhHJCu2DwZxajNc0Vy380SABt1xRhEBHXu7VMBHJbh5Ayg7oMNd6Pud7IEwEZdsaYB1G0eUgEc + kuGkAmAQdWnSPPAw5n43SwBs1BWrG0DT5qETAdSZ5YloHlIBHJThRAUQ1TzMlG47WQJgo67YKAFENg+p + ALhnCScVAIMYhujmgek4t70sAaTuBIcJIEfz0IkApprtzdU8pALYL8OpE0DO5oHZZrftLAHwSqpaiOZS + 9wGjPtjUoWgAS+RnOVjornSUaB6KBgDMCfDKm5eOvH52s0ClmgcWX7g6TQ+t2uQ+5qukAtgri1O6eeCt + k6tXPIA2modOBNBW85AKYI8sQpvNA/ORrnaRANpuHloLoAvNA0ty3BgiL7UT6ErzUDyALjUPqQB2yXC6 + 1jwskG484QF0sXkoEgDLT1P39uhWbZZilXRj2irDYO2tKzIuCyba4ox0Y1orw2DhsSsy6Gv5WPKEWF3e + Gi01qEVNN5aPssnLmgnckq5QVz0nQ2HJOakzB8DhQMKucBf8IKPXKE1gvfwi3QDalNmqDbIIq+VD6QbS + hqxIXSOLs06ekhfkZVn3n6FGkRrUoia1GUNPT09Pz+iMjf0D9wsBsNeAg5QAAAAASUVORK5CYII= + + + + 186, 22 + + + Close + + + False 186, 22 @@ -1355,20 +1382,17 @@ Save As - - 186, 22 - - - Close - - - False - - - 186, 22 - - - Recently open + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wQAADsEBuJFr7QAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEkSURBVFhH7ZfN + asJAFEbzEoo/b6QU36a6LhR8IzdKlVJoQTd24WuUtpuu9Dsjs5FI594ZCEQPHHBg7s2XxISb6k4CE7mW + v/KYKHtf5IPMYi7rDmDxWbrgzGnwJx/lQKbC3qmklh5jaYbLTjGNvFBLj1VYGfmRFPfDykdP0uM7rIxQ + iLm4+7QmAI8jmikVwE0rAizkVnbDykiJABycHp/SHKJEgI7cS/ocpOmd8l+AjYx7Un2XycSia3gCfMhk + YlEOl7eAV3MyJQLsJD0a+xNyyRt9DLNoTYA3+Xr+aaNUAHefxgPEkcwyjF4ylPT4CisjDBEU5wylM0mP + ZVgZ4aOCYkZrQuSM5SPpgo8KGuT4JLPgo4K5ntG67gB1spfL7j7zW6GqTtAaslLCb2cpAAAAAElFTkSu + QmCC + 186, 22 @@ -1382,6 +1406,108 @@ File + + 39, 20 + + + Edit + + + + iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL + DAAACwwBP0AiyAAAA6pJREFUeF7tms9vDVEYhouqpFZVRFpdd+cPkFphQeKPqIUfSVl0Y9OQWNpXE/ak + SEhYkEjZUFZERCxtCaKKWKDe787jpNftmTlzz4x0rvMkb3Lzzfu9c8690zkz0+lLJBKJRCKRqIOVlZUx + 6Yb0WSqL9dyUxolrFhq4Tf6DFMtHaYzY5qBB2y9fFdeIbQ4adDeHvY8lYpsDA3dQDoY2B+XmwLgdlIOh + zUG5OTBuB+VgaHNQbg6M20E5GNoclP8N2l/M+r3eKHc9IWNV6/d6I+x6QqYq1+/1RvH1hEy9cNj7KL6e + wNizME0/+HoWpukHX8/CNP3gK8NeWq13IivVStT+aPUjz6R0S/pmDUXQ5qBcG+zGQbmIr5LNaZK2YmQe + lA5K56V70hvpu9QGdgfl2mA3DsqrsTHaWO9KNvYD0iD2RKIIHS7T0h5pA6XGY3NhTtOU/Mj0h7fSFem4 + ZGfbXdIWbOsWGyNjtTGfkK5KNpcW2PzgC4Y2B+XaYDcOysHQ5gdfMLQ5KNcGu3FQDoY2P/jKMEGr9e7L + SrUStT9a/eDrWZimH3x18Ez6kX3M5af0PPtYPUzTD74qeS0dJnumVclnBu9+6UWrUiGWnQu+KrBHUGek + AaIte6N0X/LxUNqE3fz90jHpnVQJRPvBF8ttaZjINlQfkeyXfSktSA+kV5IdKSPY2lB9WLojRUOkH3yx + XCCuMiwzi46DOD/4YrHDfyuR0SjL7kzfW3AsRPrBVwUniYzGsrLIeIj0g68KFoiMRll2nqgEIv3gi+WX + dITIaJR1iMxoiPSDL5aLxFWGZWbRcRDnB18M9ixxB3EdaJvdrp6WnkhfkH0+JXlvt7Vtu2TP9qIgzg++ + GOaI6kDbRqW8y1y7XB7F3oG2zbZcERDlB18ZHkmXpLOSPVEeIqoN1e2XD7nGty9hzSNB9SHpqHROuiw9 + lkpBlB98ZeinNRf57LAPZYq2XOTbnNnDodUPvmBoK0TWp1lHEIu0FYI/GNr84AuGtkJkXc46glimrRD8 + wdDmB18wtBUia5kvIPi1OPzB0OYHXzC0FSJrY/4Eyr4gEXoStHU+lLpOgp9o9SOTvVBUBluKbEmypcmW + qLxl0Ja4IszjHqKsRvVtUswyOE+UH5nGJbud7ZZZojrQNrsQyvsSii6E5lqu7rDb6d1E5SOjvSl2Xerm + fSG7XF3zaZChbQPSlLQo2YnRZL+k1db85Q1t2ykF/cv+L5akeSls8olEIpFIJP4T+vp+A8lMcFIN42ej + AAAAAElFTkSuQmCC + + + + 62, 20 + + + Tools + + + + iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL + DAAACwwBP0AiyAAAAeRJREFUeF7tzjGOIzEMAEH//9N3SaEzwzLH2plAFTZEUq/jOI7jOI5f+beZM8/l + n9s481z+uY0zz+Wf2zjzHP4VeRtnIt/HPyJv40zk+/hH5G2ciXwf/4i8jTOR/467kW/jG5H3cSfybXwj + 8j7uRL6Nb0Tex53It/GNyL9jb+RlxsasWWYs8pw9kZcZG7NmmbHIc/ZEXmZszJplxiLP2RN5mbExa5YZ + izxnT+RlxiK/5VnkZcYiz9kTeZmxyG95FnmZschz9kReZizyW55FXmYs8pw9kZcZi/yWZ5GXGYs8Z0/k + bZyJvMxY5Dl7Im/jTORlxiLP2RN5G2ciLzMWec6eyNs4E3mZschz9kS+zLqPPF9mLPKcPZEvs+4jz5cZ + izxnT+TLrPvI82XGIs/ZE/ky6z7yfJmxyHP2RL7MusiXWRd5zp7Il1kX+TLrIs/ZE/mxfDPynD2RH8s3 + I8/ZE/mxfDPynD2RH8s3I8/ZE/ky6yJfZl3kOXsiX2Zd5Musi/w79kb+mvHIXzMeeR93In/NeOSvGY+8 + jzuRb+MbkfdxJ/JtfCPy33E38jbORL6Pf0TexpnI9/GPyNs4E/k+/hF5G2ciP4d/bePMc/nnNs48l39u + 48xz+ec2zhzHcRzHcVz0ev0HFtq118xXwn0AAAAASUVORK5CYII= + + + + 60, 20 + + + Help + + + 24, 44 + + + 1016, 24 + + + 2 + + + MainMenuStrip + + + menuStrip + + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + 151, 22 + + + Skin Pack + + + 151, 22 + + + Texture Pack + + + 151, 22 + + + Mash-Up Pack + + + 160, 22 + + + Full box support + False @@ -1539,11 +1665,20 @@ Quick Change - - 39, 20 - - - Edit + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAA + rgAAAK4B+ff3XQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAHrSURBVFhH7dZB + KCVxAMfxhyinTbQHXOyFLW1JbW1tkshBIuHi4LxtOWhbm/ZkLw6iOEgpJyUHJScUUqK4bBSrlCthV3bb + k13f3zP/Z+b5z/PGvMfl/epTM/znP795b95/JpJJEilHD/p8tCMfaUkF/uL/A5aQlujKdYJ52K5eDqAx + DUh5PkGTq4hfOqEx6ygIIAvWvMUYJrAJTb7h7MswqmGSjT1oXBDnaIYnRbiC7QA3jSmGSSV0HxwFcI1D + eFILnWAR9T4moTEjCJNL/LzdvEsdNPlUdM+el/iNP2iCraTNG7i/91iBGqxgBz+gAmfOvug++Ar3wd+g + cUFNwyRW4AS2wfG6YKIb7zNmMJukU2gefYJKrID+qLvY9lORRmjMPnLw2KxC87yK7sUV+K6NBFmDxo3D + thjZfEAJTEIV0NqQzJIcTx97IZRQBZQq9MJ2tTZaGTW3WWxCFwiaIWhuPS2VTIFMAVPgFy7wD7t4tgJa + /N7jyQuYryCWMAX0gGqB3iNeoBW5UEyBj9BJt5z9MngSpsA76PhR9DvbKqGYAm56C8qDJ/rHYwuUQk/T + brQ526+hmAKaexlzUOF7CVMgUeLvAd9o0DE6UmwBmtt8Jb7Zhgamg17d3C+v1ugO/oLBFBuA3gMzSZBI + 5Ab5tjecGDuUzgAAAABJRU5ErkJggg== + 161, 22 @@ -1551,6 +1686,12 @@ Pck Manager + + 161, 22 + + + Audio Converter + 145, 22 @@ -1563,40 +1704,6 @@ Binka -> Wav - - 161, 22 - - - Audio Converter - - - - iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DAAACwwBP0AiyAAAA6pJREFUeF7tms9vDVEYhouqpFZVRFpdd+cPkFphQeKPqIUfSVl0Y9OQWNpXE/ak - SEhYkEjZUFZERCxtCaKKWKDe787jpNftmTlzz4x0rvMkb3Lzzfu9c8690zkz0+lLJBKJRCKRqIOVlZUx - 6Yb0WSqL9dyUxolrFhq4Tf6DFMtHaYzY5qBB2y9fFdeIbQ4adDeHvY8lYpsDA3dQDoY2B+XmwLgdlIOh - zUG5OTBuB+VgaHNQbg6M20E5GNoclP8N2l/M+r3eKHc9IWNV6/d6I+x6QqYq1+/1RvH1hEy9cNj7KL6e - wNizME0/+HoWpukHX8/CNP3gK8NeWq13IivVStT+aPUjz6R0S/pmDUXQ5qBcG+zGQbmIr5LNaZK2YmQe - lA5K56V70hvpu9QGdgfl2mA3DsqrsTHaWO9KNvYD0iD2RKIIHS7T0h5pA6XGY3NhTtOU/Mj0h7fSFem4 - ZGfbXdIWbOsWGyNjtTGfkK5KNpcW2PzgC4Y2B+XaYDcOysHQ5gdfMLQ5KNcGu3FQDoY2P/jKMEGr9e7L - SrUStT9a/eDrWZimH3x18Ez6kX3M5af0PPtYPUzTD74qeS0dJnumVclnBu9+6UWrUiGWnQu+KrBHUGek - AaIte6N0X/LxUNqE3fz90jHpnVQJRPvBF8ttaZjINlQfkeyXfSktSA+kV5IdKSPY2lB9WLojRUOkH3yx - XCCuMiwzi46DOD/4YrHDfyuR0SjL7kzfW3AsRPrBVwUniYzGsrLIeIj0g68KFoiMRll2nqgEIv3gi+WX - dITIaJR1iMxoiPSDL5aLxFWGZWbRcRDnB18M9ixxB3EdaJvdrp6WnkhfkH0+JXlvt7Vtu2TP9qIgzg++ - GOaI6kDbRqW8y1y7XB7F3oG2zbZcERDlB18ZHkmXpLOSPVEeIqoN1e2XD7nGty9hzSNB9SHpqHROuiw9 - lkpBlB98ZeinNRf57LAPZYq2XOTbnNnDodUPvmBoK0TWp1lHEIu0FYI/GNr84AuGtkJkXc46glimrRD8 - wdDmB18wtBUia5kvIPi1OPzB0OYHXzC0FSJrY/4Eyr4gEXoStHU+lLpOgp9o9SOTvVBUBluKbEmypcmW - qLxl0Ja4IszjHqKsRvVtUswyOE+UH5nGJbud7ZZZojrQNrsQyvsSii6E5lqu7rDb6d1E5SOjvSl2Xerm - fSG7XF3zaZChbQPSlLQo2YnRZL+k1db85Q1t2ykF/cv+L5akeSls8olEIpFIJP4T+vp+A8lMcFIN42ej - AAAAAElFTkSuQmCC - - - - 62, 20 - - - Tools - iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -2110,6 +2217,20 @@ About + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAKdJREFUOE+1 + jzEKwzAQBNUEXKQIBOwifcgTUvkDbt2p9qP0Ev1E31FYkVXOx2FLRRYWi7NnTnZ/z/MxZPY7aguhbZlq + myQafL+ubRINshCwnO0kFqi3HkpwWOf7DkC1RBfvx9slV4ElscqbxBiz9/4nwOBIQjCEUL7FswhwDYAp + JVMiN0oYs/ILiCXRIGHOwVQBoiXsKSgjJdzaBMpQ0g3KEOoG++PcBx9PFJGNjU4vAAAAAElFTkSuQmCC + + + + 205, 22 + + + Tutorials + 312, 22 @@ -2152,38 +2273,6 @@ How PCKs work - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAKdJREFUOE+1 - jzEKwzAQBNUEXKQIBOwifcgTUvkDbt2p9qP0Ev1E31FYkVXOx2FLRRYWi7NnTnZ/z/MxZPY7aguhbZlq - myQafL+ubRINshCwnO0kFqi3HkpwWOf7DkC1RBfvx9slV4ElscqbxBiz9/4nwOBIQjCEUL7FswhwDYAp - JVMiN0oYs/ILiCXRIGHOwVQBoiXsKSgjJdzaBMpQ0g3KEOoG++PcBx9PFJGNjU4vAAAAAElFTkSuQmCC - - - - 205, 22 - - - Tutorials - - - 233, 22 - - - Nobledez (Original Developer) - - - 233, 22 - - - PhoenixARC (Developer) - - - 233, 22 - - - MattNL (Other Developer) - iVBORw0KGgoAAAANSUhEUgAAAgAAAAIBCAYAAAA/JAdfAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAN @@ -2482,6 +2571,24 @@ Support a Developer + + 233, 22 + + + Nobledez (Original Developer) + + + 233, 22 + + + PhoenixARC (Developer) + + + 233, 22 + + + MattNL (Other Developer) + iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -2938,53 +3045,32 @@ Settings - - - iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL - DAAACwwBP0AiyAAAAeRJREFUeF7tzjGOIzEMAEH//9N3SaEzwzLH2plAFTZEUq/jOI7jOI5f+beZM8/l - n9s481z+uY0zz+Wf2zjzHP4VeRtnIt/HPyJv40zk+/hH5G2ciXwf/4i8jTOR/467kW/jG5H3cSfybXwj - 8j7uRL6Nb0Tex53It/GNyL9jb+RlxsasWWYs8pw9kZcZG7NmmbHIc/ZEXmZszJplxiLP2RN5mbExa5YZ - izxnT+RlxiK/5VnkZcYiz9kTeZmxyG95FnmZschz9kReZizyW55FXmYs8pw9kZcZi/yWZ5GXGYs8Z0/k - bZyJvMxY5Dl7Im/jTORlxiLP2RN5G2ciLzMWec6eyNs4E3mZschz9kS+zLqPPF9mLPKcPZEvs+4jz5cZ - izxnT+TLrPvI82XGIs/ZE/ky6z7yfJmxyHP2RL7MusiXWRd5zp7Il1kX+TLrIs/ZE/mxfDPynD2RH8s3 - I8/ZE/mxfDPynD2RH8s3I8/ZE/ky6yJfZl3kOXsiX2Zd5Musi/w79kb+mvHIXzMeeR93In/NeOSvGY+8 - jzuRb+MbkfdxJ/JtfCPy33E38jbORL6Pf0TexpnI9/GPyNs4E/k+/hF5G2ciP4d/bePMc/nnNs48l39u - 48xz+ec2zhzHcRzHcVz0ev0HFtq118xXwn0AAAAASUVORK5CYII= - - - - 60, 20 - - - Help - - - 24, 44 - - - 1016, 24 - - - 2 - - - MainMenuStrip - - - menuStrip - - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - 298, 17 + + 182, 92 + + + contextMenuMetaTree + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x + DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 + jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC + + + + 181, 22 + + + Add Entry + 160, 22 @@ -3003,20 +3089,6 @@ Add ANIM Entry - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x - DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 - jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC - - - - 181, 22 - - - Add Entry - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -3052,14 +3124,128 @@ Edit All Entries - - 182, 92 + + openTab - - contextMenuMetaTree + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tabControl + + + 0 + + + editorTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 1 + + + Fill + + + 20, 30 + + + 0, 0, 0, 0 + + + 1024, 600 + + + 0 + + + tabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 4 + + + pckOpen + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + openTab + + + 2 + + + label5 + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + openTab + + + 3 + + + labelVersion + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + openTab + + + 4 + + + ChangelogRichTextBox + + + System.Windows.Forms.RichTextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + openTab + + + 5 + + + 4, 38 + + + 18, 30, 20, 5 + + + 1016, 558 + + + 1 + + + openTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 0 None @@ -4171,33 +4357,120 @@ 5 - - 4, 38 - - - 18, 30, 20, 5 - - - 1016, 558 - - - 1 - - - openTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - tabControl - - - 0 - + + True + None + + pckFileLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 2 + + + labelImageSize + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 3 + + + fileEntryCountLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 4 + + + PropertiesTabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 5 + + + label11 + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 6 + + + treeViewMain + + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + editorTab + + + 7 + + + previewPictureBox + + + PckStudio.ToolboxItems.InterpolationPictureBox, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null + + + editorTab + + + 9 + + + 4, 38 + + + 5, 50, 5, 7 + + + 1016, 558 + + + 0 + + + editorTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 1 + 3, 17 @@ -4276,6 +4549,138 @@ Top, Bottom, Right + + MetaTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + PropertiesTabControl + + + 0 + + + 338, 277 + + + 671, 282 + + + 11 + + + PropertiesTabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 5 + + + metroLabel2 + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + MetaTab + + + 2 + + + treeMeta + + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MetaTab + + + 3 + + + entryTypeTextBox + + + MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + MetaTab + + + 4 + + + entryDataTextBox + + + MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + MetaTab + + + 5 + + + buttonEdit + + + MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + MetaTab + + + 6 + + + metroLabel1 + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + MetaTab + + + 7 + + + 4, 38 + + + 3, 3, 3, 3 + + + 663, 240 + + + 0 + + + Properties + + + MetaTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + PropertiesTabControl + + + 0 + Top, Right @@ -4477,54 +4882,6 @@ 7 - - 4, 38 - - - 3, 3, 3, 3 - - - 663, 240 - - - 0 - - - Properties - - - MetaTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - PropertiesTabControl - - - 0 - - - 338, 277 - - - 671, 282 - - - 11 - - - PropertiesTabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 5 - True @@ -4627,57 +4984,6 @@ 9 - - 4, 38 - - - 5, 50, 5, 7 - - - 1016, 558 - - - 0 - - - editorTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - tabControl - - - 1 - - - Fill - - - 20, 30 - - - 0, 0, 0, 0 - - - 1024, 600 - - - 0 - - - tabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 4 - Top, Right @@ -7574,6 +7880,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + recentlyOpenToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + packSettingsToolStripMenuItem @@ -7604,12 +7916,6 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - recentlyOpenToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - exitToolStripMenuItem diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index db069a0c..31e1a151 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -134,6 +134,12 @@ + + Form + + + ContributorsForm.cs + @@ -209,6 +215,12 @@ Component + + UserControl + + + GithubUserPanel.cs + Component @@ -450,14 +462,11 @@ - - Form - - - CreditsForm.cs - + + ContributorsForm.cs + CemuPanel.cs @@ -585,9 +594,6 @@ AudioEditor.cs Designer - - CreditsForm.cs - PublicResXFileCodeGenerator Designer @@ -596,6 +602,9 @@ SkinRenderer.cs + + GithubUserPanel.cs + @@ -658,7 +667,6 @@ - @@ -746,6 +754,9 @@ 3.3.3 + + 12.0.0 + 4.5.0 diff --git a/PCK-Studio/Properties/Resources.Designer.cs b/PCK-Studio/Properties/Resources.Designer.cs index 17f94778..6eb441de 100644 --- a/PCK-Studio/Properties/Resources.Designer.cs +++ b/PCK-Studio/Properties/Resources.Designer.cs @@ -1269,16 +1269,6 @@ namespace PckStudio.Properties { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap Splash { - get { - object obj = ResourceManager.GetObject("Splash", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PCK-Studio/Properties/Resources.resx b/PCK-Studio/Properties/Resources.resx index feeff45d..c9ad906e 100644 --- a/PCK-Studio/Properties/Resources.resx +++ b/PCK-Studio/Properties/Resources.resx @@ -283,9 +283,6 @@ ..\Resources\atlases\explosion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Splash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\external\WiiU.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/PCK-Studio/Resources/Splash.png b/PCK-Studio/Resources/Splash.png deleted file mode 100644 index 5b1a9b19..00000000 Binary files a/PCK-Studio/Resources/Splash.png and /dev/null differ diff --git a/PCK-Studio/ToolboxItems/GithubUserPanel.Designer.cs b/PCK-Studio/ToolboxItems/GithubUserPanel.Designer.cs new file mode 100644 index 00000000..43aa9849 --- /dev/null +++ b/PCK-Studio/ToolboxItems/GithubUserPanel.Designer.cs @@ -0,0 +1,90 @@ +namespace PckStudio.ToolboxItems +{ + partial class GithubUserPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.userPictureBox = new System.Windows.Forms.PictureBox(); + this.userNameLabel = new MetroFramework.Controls.MetroLabel(); + this.aboutButton = new MetroFramework.Controls.MetroButton(); + ((System.ComponentModel.ISupportInitialize)(this.userPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // userPictureBox + // + this.userPictureBox.BackColor = System.Drawing.Color.Transparent; + this.userPictureBox.Location = new System.Drawing.Point(8, 34); + this.userPictureBox.Name = "userPictureBox"; + this.userPictureBox.Size = new System.Drawing.Size(100, 100); + this.userPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.userPictureBox.TabIndex = 0; + this.userPictureBox.TabStop = false; + // + // userNameLabel + // + this.userNameLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.userNameLabel.Location = new System.Drawing.Point(8, 6); + this.userNameLabel.Name = "userNameLabel"; + this.userNameLabel.Size = new System.Drawing.Size(100, 25); + this.userNameLabel.TabIndex = 0; + this.userNameLabel.Text = "user name"; + this.userNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.userNameLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // aboutButton + // + this.aboutButton.Location = new System.Drawing.Point(8, 140); + this.aboutButton.Name = "aboutButton"; + this.aboutButton.Size = new System.Drawing.Size(100, 23); + this.aboutButton.TabIndex = 0; + this.aboutButton.Text = "about button"; + this.aboutButton.Theme = MetroFramework.MetroThemeStyle.Dark; + this.aboutButton.UseSelectable = true; + // + // GithubUserPanel + // + this.Controls.Add(this.userPictureBox); + this.Controls.Add(this.aboutButton); + this.Controls.Add(this.userNameLabel); + this.MaximumSize = new System.Drawing.Size(115, 170); + this.MinimumSize = new System.Drawing.Size(115, 170); + this.Name = "GithubUserPanel"; + this.Padding = new System.Windows.Forms.Padding(5); + this.Size = new System.Drawing.Size(115, 170); + this.Theme = MetroFramework.MetroThemeStyle.Dark; + ((System.ComponentModel.ISupportInitialize)(this.userPictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox userPictureBox; + private MetroFramework.Controls.MetroLabel userNameLabel; + private MetroFramework.Controls.MetroButton aboutButton; + } +} diff --git a/PCK-Studio/ToolboxItems/GithubUserPanel.cs b/PCK-Studio/ToolboxItems/GithubUserPanel.cs new file mode 100644 index 00000000..124717d7 --- /dev/null +++ b/PCK-Studio/ToolboxItems/GithubUserPanel.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Octokit; +using MetroFramework.Controls; +using System.Drawing; +using System.Net; +using System.IO; +using System.Threading.Tasks; +using PckStudio.Internal; +using System.Drawing.Imaging; + +namespace PckStudio.ToolboxItems +{ + public partial class GithubUserPanel : MetroUserControl + { + private Author _contributor; + + public GithubUserPanel() + { + InitializeComponent(); + } + + public GithubUserPanel(Author contributor) : this() + { + _contributor = contributor; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (DesignMode) + return; + + Visible = false; + Task.Run(LoadAuthor); + } + + private void LoadAuthor() + { + // TODO: find a better way to check if the avatar has changed since last cache. + string cacheKey = Convert.ToBase64String(Encoding.Default.GetBytes(_contributor.AvatarUrl)); + + if (!ApplicationScope.DataCacher.HasFileCached(cacheKey)) + { + using (WebClient webClient = new WebClient()) + { + Stream avatarImgStream = webClient.OpenRead(_contributor.AvatarUrl); + MemoryStream ms = new MemoryStream(); + new Bitmap(avatarImgStream).Save(ms, ImageFormat.Png); + avatarImgStream.Flush(); + avatarImgStream.Dispose(); + ApplicationScope.DataCacher.Cache(ms.ToArray(), cacheKey); + } + } + + Image avatarUserImg = Image.FromFile(ApplicationScope.DataCacher.GetCachedFilepath(cacheKey)); + + Action setUiElements = () => + { + userPictureBox.Image = avatarUserImg; + userNameLabel.Text = _contributor.Login; + aboutButton.Text = "Github profile"; + aboutButton.Click += (s, e) => Process.Start(_contributor.HtmlUrl); + Visible = true; + }; + + if (InvokeRequired) + { + Invoke(setUiElements); + return; + } + setUiElements(); + } + } +} diff --git a/PCK-Studio/ToolboxItems/GithubUserPanel.resx b/PCK-Studio/ToolboxItems/GithubUserPanel.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/PCK-Studio/ToolboxItems/GithubUserPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Vendor/OMI-Lib b/Vendor/OMI-Lib index 16893bc5..55b084f4 160000 --- a/Vendor/OMI-Lib +++ b/Vendor/OMI-Lib @@ -1 +1 @@ -Subproject commit 16893bc51e459f48c6c95d3f5adbb231186728dd +Subproject commit 55b084f40e32e1427c12146fa35fa0525273a696