diff --git a/.gitmodules b/.gitmodules index 34a02b34..b193fa01 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "CrEaTiiOn-Brotherhood-Theme-Library"] path = Vendor/CrEaTiiOn-Brotherhood-Theme-Library-Net url = https://github.com/EternalModz/CrEaTiiOn-Brotherhood-Theme-Library-NET.git +[submodule "Vendor/SharpMss32"] + path = Vendor/SharpMss32 + url = https://github.com/NessieHax/SharpMss32.git diff --git a/PCK-Studio/Classes/Extentions/ImageExtentions.cs b/PCK-Studio/Classes/Extentions/ImageExtentions.cs deleted file mode 100644 index 7701a936..00000000 --- a/PCK-Studio/Classes/Extentions/ImageExtentions.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System.Collections.Generic; -using System.Drawing.Drawing2D; -using System.Drawing; -using System.Diagnostics; -using System; -using System.Drawing.Imaging; -using System.IO; -using System.Net; - -namespace PckStudio.Classes.Extentions -{ - internal static class ImageExtentions - { - public enum ImageLayoutDirection - { - Horizontal, - Vertical - } - - private struct ImageLayoutInfo - { - /// - /// Size of sub section of the image - /// - public Size SectionSize; - public Point SectionPoint; - - public ImageLayoutInfo(int width, int height, int index, ImageLayoutDirection layoutDirection) - { - bool horizontal = layoutDirection == ImageLayoutDirection.Horizontal; - SectionSize = horizontal ? new Size(width, width) : new Size(height, height); - SectionPoint = horizontal ? new Point(0, index * width) : new Point(index * height, 0); - } - } - - private static Image GetTileImage(Image source, Rectangle area, Size size, GraphicsUnit unit = GraphicsUnit.Pixel) - { - Image tileImage = new Bitmap(size.Width, size.Height); - using (Graphics gfx = Graphics.FromImage(tileImage)) - { - gfx.SmoothingMode = SmoothingMode.None; - gfx.InterpolationMode = InterpolationMode.NearestNeighbor; - gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; - gfx.DrawImage(source, new Rectangle(Point.Empty, size), area, unit); - } - return tileImage; - } - - public static IEnumerable CreateImageList(this Image source, Size size) - { - int img_row_count = source.Width / size.Width; - int img_column_count = source.Height / size.Height; - Debug.WriteLine($"{source.Width} {source.Height} {size} {img_column_count} {img_row_count}"); - for (int i = 0; i < img_column_count * img_row_count; i++) - { - int row = i / img_row_count; - int column = i % img_row_count; - Rectangle tileArea = new Rectangle(new Point(column * size.Height, row * size.Width), size); - yield return GetTileImage(source, tileArea, size); - } - yield break; - } - - public static IEnumerable CreateImageList(this Image source, int scalar) - { - return CreateImageList(source, new Size(scalar, scalar)); - } - - public static IEnumerable CreateImageList(this Image source, ImageLayoutDirection layoutDirection) - { - for (int i = 0; i < source.Height / source.Width; i++) - { - ImageLayoutInfo locationInfo = new ImageLayoutInfo(source.Width, source.Height, i, layoutDirection); - Rectangle tileArea = new Rectangle(locationInfo.SectionPoint, locationInfo.SectionSize); - yield return GetTileImage(source, tileArea, locationInfo.SectionSize); - } - yield break; - } - - public static Image ImageFromImageArray(Image[] sources, ImageLayoutDirection layoutDirection) - { - Size imageSize = CalculateImageSize(sources, layoutDirection); - var result = new Bitmap(imageSize.Width, imageSize.Height); - - using (var graphic = Graphics.FromImage(result)) - { - foreach (var (i, texture) in sources.enumerate()) - { - var info = new ImageLayoutInfo(imageSize.Width, imageSize.Height, i, layoutDirection); - graphic.DrawImage(texture, info.SectionPoint); - }; - } - return result; - } - - public static Image ImageFromUrl(string imageUrl) - { - WebClient client = new WebClient(); - Stream stream = client.OpenRead(imageUrl); - Bitmap bitmap = new Bitmap(stream); - stream.Flush(); - stream.Close(); - client.Dispose(); - return bitmap; - } - - private static Size CalculateImageSize(Image[] sources, ImageLayoutDirection layoutDirection) - { - var horizontal = layoutDirection == ImageLayoutDirection.Horizontal; - - // TODO: Validate all source images to be the same size. - int width = sources[0].Width; - int heigh = sources[0].Height; - - if (horizontal) - width *= sources.Length; - else - heigh *= sources.Length; - - return new Size(width, heigh); - } - - public struct GraphicsConfig - { - public CompositingMode CompositingMode { get; set; } - public CompositingQuality CompositingQuality { get; set; } - public InterpolationMode InterpolationMode { get; set; } - public SmoothingMode SmoothingMode {get; set; } - public PixelOffsetMode PixelOffsetMode { get; set; } - } - - public static Image ResizeImage(this Image image, int width, int height, GraphicsConfig graphicsConfig) - { - var destRect = new Rectangle(0, 0, width, height); - var destImage = new Bitmap(width, height); - - destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); - - using (var graphics = Graphics.FromImage(destImage)) - { - graphics.CompositingMode = graphicsConfig.CompositingMode; - graphics.CompositingQuality = graphicsConfig.CompositingQuality; - graphics.InterpolationMode = graphicsConfig.InterpolationMode; - graphics.SmoothingMode = graphicsConfig.SmoothingMode; - graphics.PixelOffsetMode = graphicsConfig.PixelOffsetMode; - - using (var wrapMode = new ImageAttributes()) - { - wrapMode.SetWrapMode(WrapMode.TileFlipXY); - graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode); - } - } - return destImage; - } - } -} diff --git a/PCK-Studio/Classes/FileTypes/Binka.cs b/PCK-Studio/Classes/FileTypes/Binka.cs index 67e731dc..26776e15 100644 --- a/PCK-Studio/Classes/FileTypes/Binka.cs +++ b/PCK-Studio/Classes/FileTypes/Binka.cs @@ -2,43 +2,22 @@ using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; +using System.Web.Caching; +using PckStudio.Classes.Misc; +using SharpMSS; namespace PckStudio.Classes { internal static class Binka { - private class LibHandle - { - [DllImport("kernel32.dll")] - public static extern IntPtr LoadLibrary(string lpFileName); - - [DllImport("kernel32.dll")] - public static extern int FreeLibrary(IntPtr library); - - private IntPtr libHandle; - - public IntPtr Handle => libHandle; - - public LibHandle(string libraryPath) - { - libHandle = LoadLibrary(libraryPath); - } - - ~LibHandle() - { - FreeLibrary(libHandle); - } - } - - private static string dataCache = Program.AppDataCache; - - public static uint LastAILErrorCode = 0xffffffff; + private static FileCacher cacher = new FileCacher(Program.AppDataCache); public static int FromWav(string inputFilepath, string outputFilepath, int compressionLevel) { - var process = Process.Start(new ProcessStartInfo + cacher.Cache(Properties.Resources.binka_encode, "binka_encode.exe"); + var process = Process.Start(new ProcessStartInfo { - FileName = GetAndCacheResource("binka_encode.exe"), + FileName = cacher.GetCachedFilepath("binka_encode.exe"), Arguments = $"\"{inputFilepath}\" \"{outputFilepath}\" -s -b{compressionLevel}", UseShellExecute = true, CreateNoWindow = true, @@ -48,94 +27,45 @@ namespace PckStudio.Classes return process.ExitCode; } - public static unsafe void ToWav(string inputFilename, string outputFilepath) + public static void ToWav(string inputFilepath, string outputFilepath) { - // handle should be closed when function gets out of scope - LibHandle mss32LibHandle = new LibHandle(GetAndCacheResource("mss32.dll")); - - string ext = Path.GetExtension(inputFilename).ToLower(); - switch (ext) + if (!inputFilepath.EndsWith(".binka")) { - case ".binka": - case ".wav": - break; - default: - throw new NotSupportedException(nameof(ext)+":"+ext); + throw new Exception("Not a Bink Audio file."); } - string outputDirectory = Path.GetDirectoryName(outputFilepath); - Directory.CreateDirectory(outputDirectory); - string destinationFilepath = Path.Combine(outputDirectory, Path.GetFileName(inputFilename)); - byte[] inputFiledata = File.ReadAllBytes(inputFilename); - Debug.WriteLine($"{nameof(inputFiledata)}: {inputFiledata.Length}"); + cacher.Cache(Properties.Resources.mss32, "mss32.dll"); + cacher.Cache(Properties.Resources.binkawin, "binkawin.asi"); - AILInternalCalls.SetRedistDirectory("."); - AILInternalCalls.Startup(); // __fastcall + LibHandle mss32LibHandle = new LibHandle(cacher.GetCachedFilepath("mss32.dll")); + + string destinationFilepath = Path.Combine( + Path.GetDirectoryName(outputFilepath), + Path.GetFileNameWithoutExtension(inputFilepath) + ".wav"); + + AILAPI.SetRedistDirectory(cacher.CacheDirectory.Replace('\\', '/')); + + RIBAPI.LoadApplicationProviders("*.asi"); + + byte[] inputFiledata = File.ReadAllBytes(inputFilepath); int resultBufferSize = 0; IntPtr resultBuffer = new IntPtr(); - // crash happens in AIL_decompress_ASI - LastAILErrorCode = (uint)AILInternalCalls.DecompressASI(inputFiledata, inputFiledata.Length, ".binka", resultBuffer, &resultBufferSize); - Debug.WriteLine("AIL Error Code: " + LastAILErrorCode.ToString()); + if (AILAPI.DecompressASI(inputFiledata, inputFiledata.Length, ".binka", ref resultBuffer, ref resultBufferSize, null) == 0) + { + Console.WriteLine(AILAPI.GetLastError()); + return; + } byte[] buffer = new byte[resultBufferSize]; Marshal.Copy(resultBuffer, buffer, 0, resultBufferSize); - AILInternalCalls.MemFreeLock(resultBuffer); - AILInternalCalls.Shutdown(); - File.WriteAllBytes(destinationFilepath, buffer); - } + + AILAPI.MemFreeLock(resultBuffer); + RIBAPI.FreeProviderLibrary(0); // free all loaded providers + AILAPI.Shutdown(); - // Move to a cache class ? - private static string GetAndCacheResource(string resourceName) - { - _ = resourceName ?? throw new ArgumentNullException(nameof(resourceName)); - string destinationFilepath = Path.Combine(dataCache, resourceName); - if (!File.Exists(destinationFilepath)) - { - byte[] resourceData = ExtractResource(resourceName); - using (FileStream fsDst = File.OpenWrite(destinationFilepath)) - { - fsDst.Write(resourceData, 0, resourceData.Length); - } - } - return destinationFilepath; - } + File.WriteAllBytes(destinationFilepath, buffer); - internal static byte[] ExtractResource(string resourceName) - { - byte[] resourceData = (byte[])Properties.Resources.ResourceManager.GetObject(Path.GetFileNameWithoutExtension(resourceName)); - return resourceData; - } - - private class AILInternalCalls - { - public delegate int AIL_decomp_func(); - - [DllImport("mss32.dll", EntryPoint = "_AIL_decompress_ASI@24")] - public unsafe static extern int DecompressASI( - [MarshalAs(UnmanagedType.LPArray)] byte[] indata, - int insize, - [MarshalAs(UnmanagedType.LPStr)] string ext, - IntPtr result, - int *resultSize, - [MarshalAs(UnmanagedType.FunctionPtr)] AIL_decomp_func func = null); - - [DllImport("mss32.dll", EntryPoint = "_AIL_last_error@0")] - [return: MarshalAs(UnmanagedType.LPStr)] - public static extern string LastError(); - - [DllImport("mss32.dll", EntryPoint = "_AIL_set_redist_directory@4")] - [return: MarshalAs(UnmanagedType.LPStr)] - public static extern string SetRedistDirectory([MarshalAs(UnmanagedType.LPStr)] string redistDir); - - [DllImport("mss32.dll", EntryPoint = "_AIL_mem_free_lock@4")] - public static extern void MemFreeLock(IntPtr ptr); - - [DllImport("mss32.dll", EntryPoint = "_AIL_startup@0")] - public static extern int Startup(); - - [DllImport("mss32.dll", EntryPoint = "_AIL_shutdown@0")] - public static extern int Shutdown(); - } - } + } + } } diff --git a/PCK-Studio/Classes/FileTypes/CSM.cs b/PCK-Studio/Classes/FileTypes/CSM.cs deleted file mode 100644 index 5c8e27ff..00000000 --- a/PCK-Studio/Classes/FileTypes/CSM.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using PckStudio.Models; - -namespace PckStudio.Classes -{ - class CSM - { - - //Part Name - //Part Parent(HEAD, BODY, LEG0, LEG1, ARM0, ARM1) - //Part Name - //Position-X - //Position-Y - //Position-Z - //Size-X - //Size-Y - //Size-Z - //UV-Y - //UV-X - - public static List CSMBlock = new List(); - - public static void TryParse(string CSM, MinecraftModelView modelView) - { - try - { - int i = 0; - string[] CSMLines = CSM.Split(new[] { "\n", "\r\n" }, StringSplitOptions.None); - foreach (string line in CSMLines) - { - if (i > 10) - { - GetModelPartFromCSM(CSMBlock, modelView); - CSMBlock.Clear(); - i = 0; - } - CSMBlock.Add(line + "\n"); - i++; - } - - modelView.Invalidate(); - } - catch { } - } - - public static void GetModelPartFromCSM(List CSM, MinecraftModelView modelView) - { - string PartName = CSM[0]; - string PartParent = CSM[1]; - string PartName2 = CSM[2]; - int PositionX = int.Parse(CSM[3]); - int PositionY = int.Parse(CSM[4]); - int PositionZ = int.Parse(CSM[5]); - int SizeX = int.Parse(CSM[6]); - int SizeY = int.Parse(CSM[7]); - int SizeZ = int.Parse(CSM[8]); - int UVY = int.Parse(CSM[9]); - int UVX = int.Parse(CSM[10]); - - //RenderBox - System.Drawing.Image source = Textures[0].Source; - Object3D object3D = new Box(source, new Rectangle(8, 0, 0x10, 8), new Rectangle(0, 8, 0x20, 8), new Point3D(0f, 0f, 0f), Effects.None); - Object3D object3D2 = new Box(source, new Rectangle(0x28, 0, 0x10, 8), new Rectangle(0x20, 8, 0x20, 8), new Point3D(0f, 0f, 0f), Effects.None); - Object3D object3D3 = new Box(source, new Rectangle(0x2C, 0x10, 8, 4), new Rectangle(0x28, 0x14, 0x20, 0xC), new Point3D(0f, 4f, 0f), Effects.FlipHorizontally); - - - //RenderGroup - Object3DGroup object3DGroup = new Object3DGroup(); - object3D2.Scale = 1.16f; - object3DGroup.RotationOrder = RotationOrders.XY; - object3DGroup.MinDegrees1 = -80f; - object3DGroup.MaxDegrees1 = 80f; - object3DGroup.MinDegrees2 = -57f; - object3DGroup.MaxDegrees2 = 57f; - object3DGroup.Add(object3D); - object3DGroup.Add(object3D2); - object3DGroup.Position = new Point3D(0f, 8f, 0f); - object3DGroup.Origin = new Point3D(0f, -4f, 0f); - object3DGroup.RotationOrder = RotationOrders.XY; - modelView.AddDynamic(object3DGroup); - } - - public static Texture[] Textures = new Texture[] { new Texture(Bitmap.FromFile(Environment.CurrentDirectory + "\\default.png")) }; - } -} diff --git a/PCK-Studio/Classes/FileTypes/PCKAudioFile.cs b/PCK-Studio/Classes/FileTypes/PckAudioFile.cs similarity index 99% rename from PCK-Studio/Classes/FileTypes/PCKAudioFile.cs rename to PCK-Studio/Classes/FileTypes/PckAudioFile.cs index f6b02138..d9524b10 100644 --- a/PCK-Studio/Classes/FileTypes/PCKAudioFile.cs +++ b/PCK-Studio/Classes/FileTypes/PckAudioFile.cs @@ -7,7 +7,7 @@ using OMI.Formats.Languages; namespace PckStudio.Classes.FileTypes { - public class PCKAudioFile + public class PckAudioFile { public class InvalidCategoryException : Exception { diff --git a/PCK-Studio/Classes/IO/3DST/3DSTextureReader.cs b/PCK-Studio/Classes/IO/3DST/3DSTextureReader.cs new file mode 100644 index 00000000..e944003f --- /dev/null +++ b/PCK-Studio/Classes/IO/3DST/3DSTextureReader.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OMI.Workers; +using PckStudio.Classes._3ds; +using OMI; + +namespace PckStudio.Classes.IO._3DST +{ + internal class _3DSTextureReader : IDataFormatReader, IDataFormatReader + { + public Image FromFile(string filename) + { + if (File.Exists(filename)) + { + Image img = null; + using (var fs = File.OpenRead(filename)) + { + img = FromStream(fs); + } + return img; + } + throw new FileNotFoundException(filename); + } + + public Image FromStream(Stream stream) + { + Image img = null; + using (var reader = new EndiannessAwareBinaryReader(stream, Encoding.ASCII, leaveOpen: true, Endianness.LittleEndian)) + { + if (reader.ReadString(4) == "3DST") + { + const int offset = 32; + reader.ReadInt32(); // unknown value + _3DSTextureFormat format = reader.ReadInt32() switch + { + 0 => _3DSTextureFormat.argb8, + 1 => _3DSTextureFormat.rgb8, + 2 => _3DSTextureFormat.rgba5551, + 3 => _3DSTextureFormat.rgb8, + 4 => _3DSTextureFormat.rgba4, + 9 => _3DSTextureFormat.la4, + _ => _3DSTextureFormat.dontCare, + }; + int width = reader.ReadInt32(); + int height = reader.ReadInt32(); + int bufferSize = CalcBufferSize(format, width, height); + stream.Seek(offset, SeekOrigin.Begin); + byte[] buffer = new byte[bufferSize]; + reader.Read(buffer, 0, bufferSize); + img = TextureCodec.Decode(buffer, width, height, format); + img.RotateFlip(RotateFlipType.RotateNoneFlipY); + } + } + return img; + } + + private static int CalcBufferSize(_3DSTextureFormat textureFormat, int width, int height) + { + switch (textureFormat) + { + case _3DSTextureFormat.argb8: + return width * height * 4; + case _3DSTextureFormat.rgb8: + return width * height * 3; + case _3DSTextureFormat.rgba5551: + case _3DSTextureFormat.rgb565: + case _3DSTextureFormat.rgba4: + case _3DSTextureFormat.la8: + case _3DSTextureFormat.hilo8: + return width * height * 2; + case _3DSTextureFormat.l8: + case _3DSTextureFormat.a8: + case _3DSTextureFormat.la4: + case _3DSTextureFormat.etc1a4: + return width * height; + case _3DSTextureFormat.l4: + case _3DSTextureFormat.a4: + case _3DSTextureFormat.etc1: + return width * height >> 1; + default: + throw new InvalidDataException("Invalid texture format on BCH!"); + } + } + + object IDataFormatReader.FromFile(string filename) => FromFile(filename); + + object IDataFormatReader.FromStream(Stream stream) => FromStream(stream); + } +} diff --git a/PCK-Studio/Classes/IO/3DST/3DSTextureWriter.cs b/PCK-Studio/Classes/IO/3DST/3DSTextureWriter.cs new file mode 100644 index 00000000..28864ed2 --- /dev/null +++ b/PCK-Studio/Classes/IO/3DST/3DSTextureWriter.cs @@ -0,0 +1,47 @@ +using System; +using System.Drawing; +using System.IO; +using System.Text; +using OMI; +using OMI.Workers; +using PckStudio.Classes._3ds; + +namespace PckStudio.Classes.IO._3DST +{ + internal class _3DSTextureWriter : IDataFormatWriter + { + private Image _image; + private _3DSTextureFormat _format; + public _3DSTextureWriter(Image image, _3DSTextureFormat format = _3DSTextureFormat.argb8) + { + _image = image; + _format = format; + } + + public void WriteToFile(string filename) + { + using(var fs = File.OpenWrite(filename)) + { + WriteToStream(fs); + } + } + + public void WriteToStream(Stream stream) + { + using (var writer = new EndiannessAwareBinaryWriter(stream, Encoding.ASCII, leaveOpen: true, Endianness.LittleEndian)) + { + writer.WriteString("3DST"); // 0 + writer.Write(2); // 4 unknown + writer.Write((int)_format); // 8 + writer.Write(_image.Width); // 12 + writer.Write(_image.Height); // 16 + writer.Write(0); // 20 + writer.Write(0); // 24 + writer.Write(0); // 28 + _image.RotateFlip(RotateFlipType.RotateNoneFlipY); + byte[] buffer = TextureCodec.Encode(new Bitmap(_image), _format); + stream.Write(buffer, 0, buffer.Length); + } + } + } +} diff --git a/PCK-Studio/Classes/Utils/3DS/TextureCodec.cs b/PCK-Studio/Classes/IO/3DST/TextureCodec.cs similarity index 96% rename from PCK-Studio/Classes/Utils/3DS/TextureCodec.cs rename to PCK-Studio/Classes/IO/3DST/TextureCodec.cs index aa0b963a..2f208a2f 100644 --- a/PCK-Studio/Classes/Utils/3DS/TextureCodec.cs +++ b/PCK-Studio/Classes/IO/3DST/TextureCodec.cs @@ -2,14 +2,35 @@ using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; -using PckStudio.Classes._3ds.Utils; namespace PckStudio.Classes._3ds { + /// + /// Format of the texture used on the PICA200. + /// + public enum _3DSTextureFormat + { + argb8 = 0, + rgb8 = 1, + rgba5551 = 2, + rgb565 = 3, + rgba4 = 4, + la8 = 5, + hilo8 = 6, + l8 = 7, + a8 = 8, + la4 = 9, + l4 = 0xa, + a4 = 0xb, + etc1 = 0xc, + etc1a4 = 0xd, + dontCare + } + class TextureCodec { - private static int[] tileOrder = { 0, 1, 8, 9, 2, 3, 10, 11, 16, 17, 24, 25, 18, 19, 26, 27, 4, 5, 12, 13, 6, 7, 14, 15, 20, 21, 28, 29, 22, 23, 30, 31, 32, 33, 40, 41, 34, 35, 42, 43, 48, 49, 56, 57, 50, 51, 58, 59, 36, 37, 44, 45, 38, 39, 46, 47, 52, 53, 60, 61, 54, 55, 62, 63 }; - private static int[,] etc1LUT = { { 2, 8, -2, -8 }, { 5, 17, -5, -17 }, { 9, 29, -9, -29 }, { 13, 42, -13, -42 }, { 18, 60, -18, -60 }, { 24, 80, -24, -80 }, { 33, 106, -33, -106 }, { 47, 183, -47, -183 } }; + private static readonly int[] tileOrder = { 0, 1, 8, 9, 2, 3, 10, 11, 16, 17, 24, 25, 18, 19, 26, 27, 4, 5, 12, 13, 6, 7, 14, 15, 20, 21, 28, 29, 22, 23, 30, 31, 32, 33, 40, 41, 34, 35, 42, 43, 48, 49, 56, 57, 50, 51, 58, 59, 36, 37, 44, 45, 38, 39, 46, 47, 52, 53, 60, 61, 54, 55, 62, 63 }; + private static readonly int[,] etc1LUT = { { 2, 8, -2, -8 }, { 5, 17, -5, -17 }, { 9, 29, -9, -29 }, { 13, 42, -13, -42 }, { 18, 60, -18, -60 }, { 24, 80, -24, -80 }, { 33, 106, -33, -106 }, { 47, 183, -47, -183 } }; private static class TextureConverter { diff --git a/PCK-Studio/Classes/IO/PCK/PCKAudioFileReader.cs b/PCK-Studio/Classes/IO/PckAudio/PckAudioFileReader.cs similarity index 88% rename from PCK-Studio/Classes/IO/PCK/PCKAudioFileReader.cs rename to PCK-Studio/Classes/IO/PckAudio/PckAudioFileReader.cs index 4eb1710a..66893c5f 100644 --- a/PCK-Studio/Classes/IO/PCK/PCKAudioFileReader.cs +++ b/PCK-Studio/Classes/IO/PckAudio/PckAudioFileReader.cs @@ -17,23 +17,23 @@ namespace PckStudio.Classes.IO.PCK { } } - internal class PCKAudioFileReader : IDataFormatReader, IDataFormatReader + internal class PckAudioFileReader : IDataFormatReader, IDataFormatReader { - private PCKAudioFile _file; + private PckAudioFile _file; private Endianness _endianness; private List LUT = new List(); - private List _OriginalAudioTypeOrder = new List(); + private List _OriginalAudioTypeOrder = new List(); - public PCKAudioFileReader(Endianness endianness) + public PckAudioFileReader(Endianness endianness) { _endianness = endianness; } - public PCKAudioFile FromFile(string filename) + public PckAudioFile FromFile(string filename) { if(File.Exists(filename)) { - PCKAudioFile file; + PckAudioFile file; using(var fs = File.OpenRead(filename)) { file = FromStream(fs); @@ -43,7 +43,7 @@ namespace PckStudio.Classes.IO.PCK throw new FileNotFoundException(filename); } - public PCKAudioFile FromStream(Stream stream) + public PckAudioFile FromStream(Stream stream) { using (var reader = new EndiannessAwareBinaryReader(stream, _endianness == Endianness.BigEndian @@ -56,7 +56,7 @@ namespace PckStudio.Classes.IO.PCK throw new OverflowException(nameof(pck_type)); if (pck_type > 1) throw new InvalidAudioPckException(nameof(pck_type)); - _file = new PCKAudioFile(); + _file = new PckAudioFile(); ReadLookUpTable(reader); ReadCategories(reader); ReadCategorySongs(reader); @@ -81,8 +81,8 @@ namespace PckStudio.Classes.IO.PCK int categoryEntryCount = reader.ReadInt32(); for (; 0 < categoryEntryCount; categoryEntryCount--) { - var parameterType = (PCKAudioFile.AudioCategory.EAudioParameterType)reader.ReadInt32(); - var audioType = (PCKAudioFile.AudioCategory.EAudioType)reader.ReadInt32(); + var parameterType = (PckAudioFile.AudioCategory.EAudioParameterType)reader.ReadInt32(); + var audioType = (PckAudioFile.AudioCategory.EAudioType)reader.ReadInt32(); string name = ReadString(reader); // AddCategory puts the file's categories out of order and causes some songs to be put in the wrong categories // This is my simple fix for the issue. diff --git a/PCK-Studio/Classes/IO/PCK/PCKAudioFileWriter.cs b/PCK-Studio/Classes/IO/PckAudio/PckAudioFileWriter.cs similarity index 95% rename from PCK-Studio/Classes/IO/PCK/PCKAudioFileWriter.cs rename to PCK-Studio/Classes/IO/PckAudio/PckAudioFileWriter.cs index 3a1d9223..afed490a 100644 --- a/PCK-Studio/Classes/IO/PCK/PCKAudioFileWriter.cs +++ b/PCK-Studio/Classes/IO/PckAudio/PckAudioFileWriter.cs @@ -7,10 +7,10 @@ using System.Text; namespace PckStudio.Classes.IO.PCK { - internal class PCKAudioFileWriter : IDataFormatWriter + internal class PckAudioFileWriter : IDataFormatWriter { - private PCKAudioFile _file; + private PckAudioFile _file; private Endianness _endianness; private static readonly List LUT = new List { @@ -19,7 +19,7 @@ namespace PckStudio.Classes.IO.PCK "CREDITID" }; - public PCKAudioFileWriter(PCKAudioFile file, Endianness endianness) + public PckAudioFileWriter(PckAudioFile file, Endianness endianness) { _file = file; _endianness = endianness; diff --git a/PCK-Studio/Classes/Misc/FileCacher.cs b/PCK-Studio/Classes/Misc/FileCacher.cs new file mode 100644 index 00000000..f2b6ecc5 --- /dev/null +++ b/PCK-Studio/Classes/Misc/FileCacher.cs @@ -0,0 +1,68 @@ +/* Copyright (c) 2023-present miku-666 + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. +**/ +using System; +using System.IO; + +namespace PckStudio.Classes.Misc +{ + internal class FileCacher + { + private string _cacheDirectory; + + public string CacheDirectory => _cacheDirectory; + + public FileCacher(string cacheDirectory) + { + _cacheDirectory = cacheDirectory; + } + + public bool HasFileCached(string filename) + { + string destinationFilepath = Path.Combine(_cacheDirectory, filename); + return File.Exists(destinationFilepath); + } + + public string GetCachedFilepath(string filename) + { + if (HasFileCached(filename)) + { + return Path.Combine(_cacheDirectory, filename); + } + return null; + } + + /// + /// Caches data if the doesn't already exists in the + /// + /// Data to cache + /// Filename with extension + /// + public void Cache(byte[] data, string filename) + { + _ = filename ?? throw new ArgumentNullException("filename"); + string destinationFilepath = Path.Combine(_cacheDirectory, filename); + if (!File.Exists(destinationFilepath)) + { + using (FileStream fsDst = File.OpenWrite(destinationFilepath)) + { + fsDst.Write(data, 0, data.Length); + } + } + } + } +} diff --git a/PCK-Studio/Classes/Models/DefaultModels/Steve64x64Model.cs b/PCK-Studio/Classes/Models/DefaultModels/Steve64x64Model.cs index 481f5877..34bd557e 100644 --- a/PCK-Studio/Classes/Models/DefaultModels/Steve64x64Model.cs +++ b/PCK-Studio/Classes/Models/DefaultModels/Steve64x64Model.cs @@ -1,12 +1,12 @@ -using PckStudio.Classes.Utils; -using PckStudio.Models; -using System; +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Security.Policy; using System.Text; using System.Threading.Tasks; +using PckStudio.Internal; +using PckStudio.Models; namespace PckStudio.Classes.Models.DefaultModels { diff --git a/PCK-Studio/Classes/Models/ModelView.cs b/PCK-Studio/Classes/Models/ModelView.cs index 28b65eb3..f53d9c54 100644 --- a/PCK-Studio/Classes/Models/ModelView.cs +++ b/PCK-Studio/Classes/Models/ModelView.cs @@ -279,7 +279,7 @@ namespace PckStudio.Models { System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(0x154, 0x12); Version version = new Version(Application.ProductVersion); - string s = string.Format("{0} {1}.{2}{3}", Application.ProductName, version.Major, version.Minor, (version.Build != 0) ? ("." + version.Build) : ""); + string s = string.Format("{0} {1}.{2}{3}", Application.ProductName, version.Major, version.Minor, (version.Build > 0) ? ("." + version.Build) : ""); using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap)) { using (System.Drawing.Brush brush = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0x7F, System.Drawing.Color.Gray))) diff --git a/PCK-Studio/Classes/Networking/Network.cs b/PCK-Studio/Classes/Networking/Network.cs index 2b232564..f35575ac 100644 --- a/PCK-Studio/Classes/Networking/Network.cs +++ b/PCK-Studio/Classes/Networking/Network.cs @@ -5,6 +5,7 @@ using System.Windows.Forms; namespace PckStudio.Classes.Networking { + [Obsolete] class Network { public static string Version = Application.ProductVersion; diff --git a/PCK-Studio/Classes/Networking/Update.cs b/PCK-Studio/Classes/Networking/Update.cs index 7c674e9d..4813ae45 100644 --- a/PCK-Studio/Classes/Networking/Update.cs +++ b/PCK-Studio/Classes/Networking/Update.cs @@ -7,6 +7,7 @@ using System.Windows.Forms; namespace PckStudio.Classes.Networking { + [Obsolete] public enum UpdateResult { // Base Failure value @@ -19,6 +20,7 @@ namespace PckStudio.Classes.Networking UpdateFailure, } + [Obsolete] class UpdateOptions { public bool IsBeta { get; set; } @@ -45,6 +47,7 @@ namespace PckStudio.Classes.Networking } } + [Obsolete] static class Update { public static UpdateResult CheckForUpdate(UpdateOptions options) diff --git a/PCK-Studio/Classes/Utils/3DS/3DSUtil.cs b/PCK-Studio/Classes/Utils/3DS/3DSUtil.cs deleted file mode 100644 index 485420a7..00000000 --- a/PCK-Studio/Classes/Utils/3DS/3DSUtil.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using System.Text; - -namespace PckStudio.Classes._3ds.Utils -{ - /// - /// Format of the texture used on the PICA200. - /// - public enum _3DSTextureFormat - { - argb8 = 0, - rgb8 = 1, - rgba5551 = 2, - rgb565 = 3, - rgba4 = 4, - la8 = 5, - hilo8 = 6, - l8 = 7, - a8 = 8, - la4 = 9, - l4 = 0xa, - a4 = 0xb, - etc1 = 0xc, - etc1a4 = 0xd, - dontCare - } - - internal class _3DSUtil - { - private static string ReadString(Stream stream, int len) - { - byte[] buffer = new byte[len]; - stream.Read(buffer, 0, len); - return Encoding.ASCII.GetString(buffer); - } - - private static int ReadInt32(Stream stream) - { - byte[] buffer = new byte[4]; - stream.Read(buffer, 0, 4); - return BitConverter.ToInt32(buffer, 0); - } - - private static void WriteString(Stream stream, string s) - { - byte[] buffer = Encoding.ASCII.GetBytes(s); - stream.Write(buffer, 0, buffer.Length); - } - - private static void WriteInt32(Stream stream, int value) - { - byte[] buffer = BitConverter.GetBytes(value); - stream.Write(buffer, 0, 4); - } - - public static int CalcBufferSize(_3DSTextureFormat textureFormat, int width, int height) - { - switch (textureFormat) - { - case _3DSTextureFormat.argb8: - return width * height * 4; - case _3DSTextureFormat.rgb8: - return width * height * 3; - case _3DSTextureFormat.rgba5551: - case _3DSTextureFormat.rgb565: - case _3DSTextureFormat.rgba4: - case _3DSTextureFormat.la8: - case _3DSTextureFormat.hilo8: - return width * height * 2; - case _3DSTextureFormat.l8: - case _3DSTextureFormat.a8: - case _3DSTextureFormat.la4: - case _3DSTextureFormat.etc1a4: - return width * height; - case _3DSTextureFormat.l4: - case _3DSTextureFormat.a4: - case _3DSTextureFormat.etc1: - return width * height >> 1; - default: - throw new InvalidDataException("Invalid texture format on BCH!"); - } - } - - public static Image GetImageFrom3DST(Stream stream) - { - if (ReadString(stream, 4) == "3DST") - { - const int offset = 32; - stream.Seek(8L, SeekOrigin.Begin); - _3DSTextureFormat format = ReadInt32(stream) switch - { - 0 => _3DSTextureFormat.argb8, - 1 => _3DSTextureFormat.rgb8, - 2 => _3DSTextureFormat.rgba5551, - 3 => _3DSTextureFormat.rgb8, - 4 => _3DSTextureFormat.rgba4, - 9 => _3DSTextureFormat.la4, - _ => _3DSTextureFormat.dontCare, - }; - int width = ReadInt32(stream); - int height = ReadInt32(stream); - int bufferSize = CalcBufferSize(format, width, height); - stream.Seek(offset, SeekOrigin.Begin); - byte[] buffer = new byte[bufferSize]; - stream.Read(buffer, 0, bufferSize); - var img = TextureCodec.Decode(buffer, width, height, format); - img.RotateFlip(RotateFlipType.RotateNoneFlipY); - return img; - } - return null; - } - - public static void SetImageTo3DST(Stream stream, Image source, _3DSTextureFormat format = _3DSTextureFormat.argb8) - { - // TODO: fix Encoding - WriteString(stream, "3DST"); // 0 - WriteInt32(stream, 2); // 4 unknown - WriteInt32(stream, (int)format); // 8 - WriteInt32(stream, source.Width); // 12 - WriteInt32(stream, source.Height); // 16 - WriteInt32(stream, 0); // 20 - WriteInt32(stream, 0); // 24 - WriteInt32(stream, 0); // 28 - source.RotateFlip(RotateFlipType.RotateNoneFlipY); - byte[] buffer = TextureCodec.Encode(new Bitmap(source), format); - stream.Write(buffer, 0, buffer.Length); - } - } -} diff --git a/PCK-Studio/Classes/Utils/BedrockJSONtoCSM.cs b/PCK-Studio/Classes/Utils/BedrockJSONtoCSM.cs deleted file mode 100644 index b9989707..00000000 --- a/PCK-Studio/Classes/Utils/BedrockJSONtoCSM.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -namespace PckStudio.Classes.Utils.ModelConversion -{ - public class BedrockJSONtoCSM - { - public string JSONtoCSM(string JsonString) - { - dynamic jsonDe = JsonConvert.DeserializeObject(JsonString); - string NewJSON = JsonConvert.SerializeObject(jsonDe["minecraft:geometry"]); - JObject[] NewJObject = JsonConvert.DeserializeObject(NewJSON); - - string CSMData = ""; - foreach (JBone bone in NewJObject[0].bones) - { - int i = 0; - string PARENT = bone.name; - foreach (JCube Cube in bone.cubes) - { - string name = PARENT + " " + i; - - float PosXModifier = 0; - float PosYModifier = 0; - float PosZModifier = 0; - - switch (PARENT) - { - case "ARM0": - PosXModifier = 5; - PosYModifier = 22; - break; - case "ARM1": - PosXModifier = -5; - PosYModifier = 22; - break; - case "LEG0": - PosXModifier = 1.9f; - PosYModifier = 12; - break; - case "LEG1": - PosXModifier = -1.9f; - PosYModifier = 12; - break; - case "BODY": - PosYModifier = 24; - break; - case "HEAD": - PosYModifier = 24; - break; - } - - - float PosX = Cube.origin[0] + PosXModifier; - float PosY = Cube.origin[1] + PosYModifier; - float PosZ = Cube.origin[2] + PosZModifier; - float SizeX = Cube.size[0]; - float SizeY = Cube.size[1]; - float SizeZ = Cube.size[2]; - float UvX = Cube.uv[0]; - float UvY = Cube.uv[1]; - - CSMData += name + "\n" + PARENT + "\n" + name + "\n" + PosX + "\n" + PosY + "\n" + PosZ + "\n" + SizeX + "\n" + SizeY + "\n" + SizeZ + "\n" + UvX + "\n" + UvY + "\n"; - i++; - } - } - return CSMData; - } - } - - internal class WholeJSON - { - public string format_version = "1.12.0"; - public Dictionary entries = new Dictionary(); - } - - internal class JObject - { - public Dictionary description = new Dictionary(); - public JBone[] bones = { }; - } - internal class JBone - { - public string name = ""; - public int[] pivot = {0, 0, 0}; - public JCube[] cubes = { }; - } - internal class JCube - { - public float[] origin = new float[3]; - public float[] size = new float [3]; - public float[] uv = new float[2]; - } -} diff --git a/PCK-Studio/Classes/Utils/CSMtoBedrockJSON.cs b/PCK-Studio/Classes/Utils/CSMtoBedrockJSON.cs deleted file mode 100644 index 93df0546..00000000 --- a/PCK-Studio/Classes/Utils/CSMtoBedrockJSON.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; - -namespace PckStudio.Classes.Utils.ModelConversion -{ - public class CSMtoBedrockJSON - { - public string CSMtoJSON(string CSMString) - { - List CSMLIST = new List(); - CSMLIST.AddRange(CSMString.Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries)); - List> CSMS = SplitToSublists(CSMLIST, 11); - - JObject jobj = new JObject(); - List bones = new List(); - Dictionary> CubeList = new Dictionary> - { - {"HEAD", new List()}, - {"BODY", new List()}, - {"ARM0", new List()}, - {"ARM1", new List()}, - {"LEG0", new List()}, - {"LEG1", new List()} - }; - - foreach (List CSMItem in CSMS) - { - JCube NewCube = new JCube(); - - - float PosXModifier = 0; - float PosYModifier = 0; - float PosZModifier = 0; - - switch (CSMItem[1]) - { - case "ARM0": - PosXModifier = -5; - PosYModifier = -22; - break; - case "ARM1": - PosXModifier = 5; - PosYModifier = -22; - break; - case "LEG0": - PosXModifier = -1.9f; - PosYModifier = -12; - break; - case "LEG1": - PosXModifier = 1.9f; - PosYModifier = -12; - break; - case "BODY": - PosYModifier = -24; - break; - case "HEAD": - PosYModifier = -24; - break; - } - NewCube.origin[0] = float.Parse(CSMItem[3]) + PosXModifier; - NewCube.origin[1] = float.Parse(CSMItem[4]) + PosYModifier; - NewCube.origin[2] = float.Parse(CSMItem[5]) + PosZModifier; - NewCube.size[0] = float.Parse(CSMItem[6]); - NewCube.size[1] = float.Parse(CSMItem[7]); - NewCube.size[2] = float.Parse(CSMItem[8]); - NewCube.uv[0] = float.Parse(CSMItem[9]); - NewCube.uv[1] = float.Parse(CSMItem[10]); - CubeList[CSMItem[1]].Add(NewCube); - } - foreach (KeyValuePair> bone in CubeList) - { - JBone jb = new JBone(); - jb.name = bone.Key; - jb.cubes = bone.Value.ToArray(); - bones.Add(jb); - } - jobj.bones = bones.ToArray(); - jobj.description.Add("identifier", "geometry.steve"); - jobj.description.Add("texture_width", 64); - jobj.description.Add("texture_height", 64); - jobj.description.Add("visible_bounds_width", 2); - jobj.description.Add("visible_bounds_height", 3.5f); - jobj.description.Add("visible_bounds_offset", new float[] { 0, 1.25f, 0 }); - WholeJSON WJ = new WholeJSON(); - WJ.entries.Add("format_version", "1.12.0"); - WJ.entries.Add("minecraft:geometry", new JObject[] { jobj }); - string JSONDATA = JsonConvert.SerializeObject(WJ.entries, Formatting.Indented); - return JSONDATA; - } - - public List> SplitToSublists(List source, int size) - { - return source - .Select((x, i) => new { Index = i, Value = x }) - .GroupBy(x => x.Index / size) - .Select(x => x.Select(v => v.Value).ToList()) - .ToList(); - } - } - -} diff --git a/PCK-Studio/Extensions/BlendMode.cs b/PCK-Studio/Extensions/BlendMode.cs new file mode 100644 index 00000000..7fb02709 --- /dev/null +++ b/PCK-Studio/Extensions/BlendMode.cs @@ -0,0 +1,13 @@ +namespace PckStudio.Extensions +{ + public enum BlendMode + { + Add, + Subtract, + Multiply, + Average, + DescendingOrder, + AscendingOrder, + Screen + } +} \ No newline at end of file diff --git a/PCK-Studio/Extensions/ColorExtensions.cs b/PCK-Studio/Extensions/ColorExtensions.cs new file mode 100644 index 00000000..e2bb0ed7 --- /dev/null +++ b/PCK-Studio/Extensions/ColorExtensions.cs @@ -0,0 +1,45 @@ +using System; +using System.Drawing; +using System.Numerics; + +namespace PckStudio.Extensions +{ + internal static class ColorExtensions + { + /// + /// Normalizes the Color between 0.0 - 1.0 + /// + /// + public static Vector3 Normalize(this Color color) + { + return new Vector3(color.R / 255f, color.G / 255f, color.B / 255f); + } + + private static T Clamp(T value, T min, T max) where T : IComparable + { + if (value.CompareTo(min) < 0) return min; + if (value.CompareTo(max) > 0) return max; + return value; + } + + public static byte BlendValues(float source, float overlay, BlendMode blendType) + { + source = Clamp(source, 0.0f, 1.0f); + overlay = Clamp(overlay, 0.0f, 1.0f); + + float resultValue = blendType switch + { + BlendMode.Add => source + overlay, + BlendMode.Subtract => source - overlay, + BlendMode.Multiply => source * overlay, + BlendMode.Average => (source + overlay) / 2.0f, + BlendMode.AscendingOrder => source > overlay ? overlay : source, + BlendMode.DescendingOrder => source < overlay ? overlay : source, + BlendMode.Screen => 1f - (1f - source) * (1f - overlay), + _ => 0.0f + }; + return (byte)Clamp(resultValue * 255, 0, 255); + } + + } +} diff --git a/PCK-Studio/Classes/Extentions/ControlExtensions.cs b/PCK-Studio/Extensions/ControlExtensions.cs similarity index 91% rename from PCK-Studio/Classes/Extentions/ControlExtensions.cs rename to PCK-Studio/Extensions/ControlExtensions.cs index 40c99620..85701590 100644 --- a/PCK-Studio/Classes/Extentions/ControlExtensions.cs +++ b/PCK-Studio/Extensions/ControlExtensions.cs @@ -1,13 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Linq.Expressions; using System.Reflection; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; -namespace PckStudio.Classes.Extentions +namespace PckStudio.Extensions { internal static class ControlExtensions { diff --git a/PCK-Studio/Classes/Extentions/EnumerableExtentions.cs b/PCK-Studio/Extensions/EnumerableExtensions.cs similarity index 79% rename from PCK-Studio/Classes/Extentions/EnumerableExtentions.cs rename to PCK-Studio/Extensions/EnumerableExtensions.cs index cda71bba..ed95e29f 100644 --- a/PCK-Studio/Classes/Extentions/EnumerableExtentions.cs +++ b/PCK-Studio/Extensions/EnumerableExtensions.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace PckStudio.Classes.Extentions +namespace PckStudio.Extensions { - internal static class EnumerableExtentions + internal static class EnumerableExtensions { public static IEnumerable<(int index, T type)>enumerate(this IEnumerable array) { diff --git a/PCK-Studio/Extensions/GraphicsExtensions.cs b/PCK-Studio/Extensions/GraphicsExtensions.cs new file mode 100644 index 00000000..22f7885d --- /dev/null +++ b/PCK-Studio/Extensions/GraphicsExtensions.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; + +namespace PckStudio.Extensions +{ + public struct GraphicsConfig + { + public GraphicsConfig() + { + CompositingQuality = CompositingQuality.Default; + InterpolationMode = InterpolationMode.Default; + SmoothingMode = SmoothingMode.Default; + PixelOffsetMode = PixelOffsetMode.Default; + CompositingMode = CompositingMode.SourceOver; + } + + public CompositingMode CompositingMode { get; set; } + public CompositingQuality CompositingQuality { get; set; } + public InterpolationMode InterpolationMode { get; set; } + public SmoothingMode SmoothingMode { get; set; } + public PixelOffsetMode PixelOffsetMode { get; set; } + } + + internal static class GraphicsExtensions + { + public static void ApplyConfig(this Graphics graphics, GraphicsConfig config) + { + graphics.CompositingMode = config.CompositingMode; + graphics.CompositingQuality = config.CompositingQuality; + graphics.InterpolationMode = config.InterpolationMode; + graphics.SmoothingMode = config.SmoothingMode; + graphics.PixelOffsetMode = config.PixelOffsetMode; + } + } +} diff --git a/PCK-Studio/Extensions/ImageExtensions.cs b/PCK-Studio/Extensions/ImageExtensions.cs new file mode 100644 index 00000000..6ff27f23 --- /dev/null +++ b/PCK-Studio/Extensions/ImageExtensions.cs @@ -0,0 +1,254 @@ +using System; +using System.Drawing; +using System.Diagnostics; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Linq; +using System.IO; +using System.Net; + +namespace PckStudio.Extensions +{ + public enum ImageLayoutDirection + { + Horizontal, + Vertical + } + + internal static class ImageExtensions + { + private struct ImageSection + { + public readonly Size Size; + public readonly Point Point; + public readonly Rectangle Area; + + public ImageSection(Size sectionSize, int index, ImageLayoutDirection layoutDirection) + { + switch(layoutDirection) + { + case ImageLayoutDirection.Horizontal: + { + Size = new Size(sectionSize.Height, sectionSize.Height); + Point = new Point(index * sectionSize.Height, 0); + } + break; + + case ImageLayoutDirection.Vertical: + { + Size = new Size(sectionSize.Width, sectionSize.Width); + Point = new Point(0, index * sectionSize.Width); + } + break; + + default: + Size = Size.Empty; + Point = new Point(-1, -1); + break; + } + Area = new Rectangle(Point, Size); + } + } + + public static Image GetArea(this Image source, Rectangle area) + { + Image tileImage = new Bitmap(area.Width, area.Height); + using (Graphics gfx = Graphics.FromImage(tileImage)) + { + gfx.SmoothingMode = SmoothingMode.None; + gfx.InterpolationMode = InterpolationMode.NearestNeighbor; + gfx.PixelOffsetMode = PixelOffsetMode.HighQuality; + gfx.DrawImage(source, new Rectangle(Point.Empty, area.Size), area, GraphicsUnit.Pixel); + } + return tileImage; + } + + public static IEnumerable CreateImageList(this Image source, Size size) + { + int rowCount = source.Width / size.Width; + int columnCount = source.Height / size.Height; + Debug.WriteLine($"{source.Width} {source.Height} {size} {columnCount} {rowCount}"); + for (int i = 0; i < columnCount * rowCount; i++) + { + int row = Math.DivRem(i, rowCount, out int column); + Rectangle tileArea = new Rectangle(new Point(column * size.Height, row * size.Width), size); + yield return source.GetArea(tileArea); + } + yield break; + } + + public static IEnumerable CreateImageList(this Image source, int scalar) + { + return CreateImageList(source, new Size(scalar, scalar)); + } + + public static IEnumerable CreateImageList(this Image source, ImageLayoutDirection layoutDirection) + { + for (int i = 0; i < source.Height / source.Width; i++) + { + ImageSection locationInfo = new ImageSection(source.Size, i, layoutDirection); + yield return source.GetArea(locationInfo.Area); + } + yield break; + } + + public static Image CombineImages(IList sources, ImageLayoutDirection layoutDirection) + { + Size imageSize = CalculateImageSize(sources, layoutDirection); + var image = new Bitmap(imageSize.Width, imageSize.Height); + + using (var graphic = Graphics.FromImage(image)) + { + foreach (var (i, texture) in sources.enumerate()) + { + var info = new ImageSection(texture.Size, i, layoutDirection); + graphic.DrawImage(texture, info.Point); + }; + } + return image; + } + + private static Size CalculateImageSize(IList sources, ImageLayoutDirection layoutDirection) + { + if (sources.Count == 0) + { + return Size.Empty; + } + var horizontal = layoutDirection == ImageLayoutDirection.Horizontal; + + int width = sources[0].Width; + int height = sources[0].Height; + + if (!sources.All(img => img.Width.Equals(width) && img.Height.Equals(height))) + throw new InvalidOperationException("Images must have the same width and height."); + + if (horizontal) + width *= sources.Count; + else + height *= sources.Count; + + return new Size(width, height); + } + + public static Image ResizeImage(this Image image, int width, int height, GraphicsConfig graphicsConfig) + { + var destRect = new Rectangle(0, 0, width, height); + var destImage = new Bitmap(width, height); + + destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); + + using (var graphics = Graphics.FromImage(destImage)) + { + graphics.ApplyConfig(graphicsConfig); + using (var wrapMode = new ImageAttributes()) + { + wrapMode.SetWrapMode(WrapMode.TileFlipXY); + graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode); + } + } + return destImage; + } + + public static Image Fill(this Image image, Color color) + { + using (var g = Graphics.FromImage(image)) + { + using (SolidBrush brush = new SolidBrush(color)) + { + g.FillRectangle(brush, new Rectangle(Point.Empty, image.Size)); + } + } + return image; + } + + public static Image Blend(this Image image, Color overlayColor, BlendMode mode) + { + if (image is not Bitmap baseImage) + return image; + + BitmapData baseImageData = baseImage.LockBits(new Rectangle(Point.Empty, baseImage.Size), + ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + byte[] baseImageBuffer = new byte[baseImageData.Stride * baseImageData.Height]; + + Marshal.Copy(baseImageData.Scan0, baseImageBuffer, 0, baseImageBuffer.Length); + + var normalized = overlayColor.Normalize(); + + for (int k = 0; k < baseImageBuffer.Length; k += 4) + { + baseImageBuffer[k + 0] = ColorExtensions.BlendValues(baseImageBuffer[k + 0] / 255f, normalized.X, mode); + baseImageBuffer[k + 1] = ColorExtensions.BlendValues(baseImageBuffer[k + 1] / 255f, normalized.Y, mode); + baseImageBuffer[k + 2] = ColorExtensions.BlendValues(baseImageBuffer[k + 2] / 255f, normalized.Z, mode); + } + + Bitmap bitmapResult = new Bitmap(baseImage.Width, baseImage.Height, PixelFormat.Format32bppArgb); + BitmapData resultImageData = bitmapResult.LockBits(new Rectangle(Point.Empty, bitmapResult.Size), + ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + + Marshal.Copy(baseImageBuffer, 0, resultImageData.Scan0, baseImageBuffer.Length); + + bitmapResult.UnlockBits(resultImageData); + baseImage.UnlockBits(baseImageData); + + return bitmapResult; + } + + public static Image Blend(this Image image, Image overlay, BlendMode mode) + { + if (image is not Bitmap baseImage || overlay is not Bitmap overlayImage || + image.Width != overlay.Width || image.Height != overlay.Height) + return image; + + BitmapData baseImageData = baseImage.LockBits(new Rectangle(Point.Empty, baseImage.Size), + ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + byte[] baseImageBuffer = new byte[baseImageData.Stride * baseImageData.Height]; + + Marshal.Copy(baseImageData.Scan0, baseImageBuffer, 0, baseImageBuffer.Length); + + BitmapData overlayImageData = overlayImage.LockBits(new Rectangle(Point.Empty, overlayImage.Size), + ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); + byte[] overlayImageBuffer = new byte[overlayImageData.Stride * overlayImageData.Height]; + + Marshal.Copy(overlayImageData.Scan0, overlayImageBuffer, 0, overlayImageBuffer.Length); + + for (int k = 0; k < baseImageBuffer.Length && k < overlayImageBuffer.Length; k += 4) + { + baseImageBuffer[k + 0] = ColorExtensions.BlendValues(baseImageBuffer[k + 0] / 255f, overlayImageBuffer[k + 0] / 255f, mode); + baseImageBuffer[k + 1] = ColorExtensions.BlendValues(baseImageBuffer[k + 1] / 255f, overlayImageBuffer[k + 1] / 255f, mode); + baseImageBuffer[k + 2] = ColorExtensions.BlendValues(baseImageBuffer[k + 2] / 255f, overlayImageBuffer[k + 2] / 255f, mode); + } + + Bitmap bitmapResult = new Bitmap(baseImage.Width, baseImage.Height, PixelFormat.Format32bppArgb); + BitmapData resultImageData = bitmapResult.LockBits(new Rectangle(Point.Empty, bitmapResult.Size), + ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); + + Marshal.Copy(baseImageBuffer, 0, resultImageData.Scan0, baseImageBuffer.Length); + + bitmapResult.UnlockBits(resultImageData); + baseImage.UnlockBits(baseImageData); + overlayImage.UnlockBits(overlayImageData); + return bitmapResult; + } + + public static Image ImageFromUrl(string imageUrl) + { + WebClient client = new WebClient(); + Stream stream = client.OpenRead(imageUrl); + Bitmap bitmap = new Bitmap(stream); + stream.Flush(); + stream.Close(); + client.Dispose(); + return bitmap; + } + + public static Image ImageFromBuffer(byte[] buffer) + { + var ms = new MemoryStream(buffer); + var img = Image.FromStream(ms); + ms.Close(); + return img; + } + } +} diff --git a/PCK-Studio/Classes/Utils/ListUtils.cs b/PCK-Studio/Extensions/ListExtensions.cs similarity index 80% rename from PCK-Studio/Classes/Utils/ListUtils.cs rename to PCK-Studio/Extensions/ListExtensions.cs index ff200c6b..8ec3b636 100644 --- a/PCK-Studio/Classes/Utils/ListUtils.cs +++ b/PCK-Studio/Extensions/ListExtensions.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; -namespace PckStudio.Forms.Utilities +namespace PckStudio.Extensions { - public static class ListUtils + public static class ListExtensions { public static IList Swap(this IList list, int index1, int index2) { diff --git a/PCK-Studio/Forms/Additional-Popups/AboutThisProgram.cs b/PCK-Studio/Forms/Additional-Popups/AboutThisProgram.cs index bc9f8d1f..f032157b 100644 --- a/PCK-Studio/Forms/Additional-Popups/AboutThisProgram.cs +++ b/PCK-Studio/Forms/Additional-Popups/AboutThisProgram.cs @@ -8,7 +8,7 @@ using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; using Octokit; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using PckStudio.ToolboxItems; namespace PckStudio @@ -38,19 +38,19 @@ namespace PckStudio // TODO: check if avatar has changed and only acquire info once var devs = await AcquireDeveloperUserInfoAsync("PhoenixARC", "MattN-L", "EternalModz", "NessieHax"); - phoenixarcPictureBox.SetPropertyThreadSafe(() => phoenixarcPictureBox.Image, ImageExtentions.ImageFromUrl(devs[0].AvatarUrl)); + phoenixarcPictureBox.SetPropertyThreadSafe(() => phoenixarcPictureBox.Image, ImageExtensions.ImageFromUrl(devs[0].AvatarUrl)); phoenixarcPictureBox.SetPropertyThreadSafe(() => phoenixarcPictureBox.Text, devs[0].Name); phoenixarcGitHubButton.Click += (sender, e) => Process.Start(devs[0].HtmlUrl); - mattNLPictureBox.SetPropertyThreadSafe(() => mattNLPictureBox.Image, ImageExtentions.ImageFromUrl(devs[1].AvatarUrl)); + mattNLPictureBox.SetPropertyThreadSafe(() => mattNLPictureBox.Image, ImageExtensions.ImageFromUrl(devs[1].AvatarUrl)); mattNLPictureBox.SetPropertyThreadSafe(() => mattNLPictureBox.Text, devs[1].Name); mattNLGitHubButton.Click += (sender, e) => Process.Start(devs[1].HtmlUrl); - eternalModzPictureBox.SetPropertyThreadSafe(() => eternalModzPictureBox.Image, ImageExtentions.ImageFromUrl(devs[2].AvatarUrl)); + eternalModzPictureBox.SetPropertyThreadSafe(() => eternalModzPictureBox.Image, ImageExtensions.ImageFromUrl(devs[2].AvatarUrl)); eternalModzPictureBox.SetPropertyThreadSafe(() => eternalModzPictureBox.Text, devs[2].Name); eternalModzGitHubButton.Click += (sender, e) => Process.Start(devs[2].HtmlUrl); - mikuPictureBox.SetPropertyThreadSafe(() => mikuPictureBox.Image, ImageExtentions.ImageFromUrl(devs[3].AvatarUrl)); + mikuPictureBox.SetPropertyThreadSafe(() => mikuPictureBox.Image, ImageExtensions.ImageFromUrl(devs[3].AvatarUrl)); mikuPictureBox.SetPropertyThreadSafe(() => mikuLabel.Text, devs[3].Name); mikuGitHubButton.Click += (sender, e) => Process.Start(devs[3].HtmlUrl); }); diff --git a/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.Designer.cs index 50dbca23..01c35936 100644 --- a/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.Designer.cs @@ -28,70 +28,70 @@ /// private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddFilePrompt)); - this.TextLabel = new System.Windows.Forms.Label(); - this.OKButton = new System.Windows.Forms.Button(); - this.InputTextBox = new MetroFramework.Controls.MetroTextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.FileTypeComboBox = new MetroFramework.Controls.MetroComboBox(); - this.SuspendLayout(); - // - // TextLabel - // - resources.ApplyResources(this.TextLabel, "TextLabel"); - this.TextLabel.ForeColor = System.Drawing.Color.White; - this.TextLabel.Name = "TextLabel"; - // - // OKButton - // - resources.ApplyResources(this.OKButton, "OKButton"); - this.OKButton.ForeColor = System.Drawing.Color.White; - this.OKButton.Name = "OKButton"; - this.OKButton.UseVisualStyleBackColor = true; - this.OKButton.Click += new System.EventHandler(this.OKBtn_Click); - // - // InputTextBox - // - // - // - // - this.InputTextBox.CustomButton.Image = ((System.Drawing.Image)(resources.GetObject("resource.Image"))); - this.InputTextBox.CustomButton.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("resource.ImeMode"))); - this.InputTextBox.CustomButton.Location = ((System.Drawing.Point)(resources.GetObject("resource.Location"))); - this.InputTextBox.CustomButton.Name = ""; - this.InputTextBox.CustomButton.Size = ((System.Drawing.Size)(resources.GetObject("resource.Size"))); - this.InputTextBox.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; - this.InputTextBox.CustomButton.TabIndex = ((int)(resources.GetObject("resource.TabIndex"))); - this.InputTextBox.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; - this.InputTextBox.CustomButton.UseSelectable = true; - this.InputTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible"))); - this.InputTextBox.Lines = new string[0]; - resources.ApplyResources(this.InputTextBox, "InputTextBox"); - this.InputTextBox.MaxLength = 255; - this.InputTextBox.Name = "InputTextBox"; - this.InputTextBox.PasswordChar = '\0'; - this.InputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.InputTextBox.SelectedText = ""; - this.InputTextBox.SelectionLength = 0; - this.InputTextBox.SelectionStart = 0; - this.InputTextBox.ShortcutsEnabled = true; - this.InputTextBox.Style = MetroFramework.MetroColorStyle.White; - this.InputTextBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.InputTextBox.UseSelectable = true; - this.InputTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); - this.InputTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); - // - // label1 - // - resources.ApplyResources(this.label1, "label1"); - this.label1.ForeColor = System.Drawing.Color.White; - this.label1.Name = "label1"; - // - // FileTypeComboBox - // - this.FileTypeComboBox.FormattingEnabled = true; - resources.ApplyResources(this.FileTypeComboBox, "FileTypeComboBox"); - this.FileTypeComboBox.Items.AddRange(new object[] { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddFilePrompt)); + this.TextLabel = new System.Windows.Forms.Label(); + this.OKButton = new System.Windows.Forms.Button(); + this.InputTextBox = new MetroFramework.Controls.MetroTextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.FileTypeComboBox = new MetroFramework.Controls.MetroComboBox(); + this.SuspendLayout(); + // + // TextLabel + // + resources.ApplyResources(this.TextLabel, "TextLabel"); + this.TextLabel.ForeColor = System.Drawing.Color.White; + this.TextLabel.Name = "TextLabel"; + // + // OKButton + // + resources.ApplyResources(this.OKButton, "OKButton"); + this.OKButton.ForeColor = System.Drawing.Color.White; + this.OKButton.Name = "OKButton"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKBtn_Click); + // + // InputTextBox + // + // + // + // + this.InputTextBox.CustomButton.Image = ((System.Drawing.Image)(resources.GetObject("resource.Image"))); + this.InputTextBox.CustomButton.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("resource.ImeMode"))); + this.InputTextBox.CustomButton.Location = ((System.Drawing.Point)(resources.GetObject("resource.Location"))); + this.InputTextBox.CustomButton.Name = ""; + this.InputTextBox.CustomButton.Size = ((System.Drawing.Size)(resources.GetObject("resource.Size"))); + this.InputTextBox.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; + this.InputTextBox.CustomButton.TabIndex = ((int)(resources.GetObject("resource.TabIndex"))); + this.InputTextBox.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; + this.InputTextBox.CustomButton.UseSelectable = true; + this.InputTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible"))); + this.InputTextBox.Lines = new string[0]; + resources.ApplyResources(this.InputTextBox, "InputTextBox"); + this.InputTextBox.MaxLength = 255; + this.InputTextBox.Name = "InputTextBox"; + this.InputTextBox.PasswordChar = '\0'; + this.InputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.InputTextBox.SelectedText = ""; + this.InputTextBox.SelectionLength = 0; + this.InputTextBox.SelectionStart = 0; + this.InputTextBox.ShortcutsEnabled = true; + this.InputTextBox.Style = MetroFramework.MetroColorStyle.White; + this.InputTextBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.InputTextBox.UseSelectable = true; + this.InputTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); + this.InputTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); + // + // label1 + // + resources.ApplyResources(this.label1, "label1"); + this.label1.ForeColor = System.Drawing.Color.White; + this.label1.Name = "label1"; + // + // FileTypeComboBox + // + this.FileTypeComboBox.FormattingEnabled = true; + resources.ApplyResources(this.FileTypeComboBox, "FileTypeComboBox"); + this.FileTypeComboBox.Items.AddRange(new object[] { resources.GetString("FileTypeComboBox.Items"), resources.GetString("FileTypeComboBox.Items1"), resources.GetString("FileTypeComboBox.Items2"), @@ -107,31 +107,28 @@ resources.GetString("FileTypeComboBox.Items12"), resources.GetString("FileTypeComboBox.Items13"), resources.GetString("FileTypeComboBox.Items14")}); - this.FileTypeComboBox.Name = "FileTypeComboBox"; - this.FileTypeComboBox.Style = MetroFramework.MetroColorStyle.Blue; - this.FileTypeComboBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.FileTypeComboBox.UseSelectable = true; - // - // AddFilePrompt - // - this.AcceptButton = this.OKButton; - resources.ApplyResources(this, "$this"); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.FileTypeComboBox); - this.Controls.Add(this.label1); - this.Controls.Add(this.InputTextBox); - this.Controls.Add(this.OKButton); - this.Controls.Add(this.TextLabel); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "AddFilePrompt"; - this.Resizable = false; - this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - this.ResumeLayout(false); - this.PerformLayout(); + this.FileTypeComboBox.Name = "FileTypeComboBox"; + this.FileTypeComboBox.Style = MetroFramework.MetroColorStyle.Blue; + this.FileTypeComboBox.Theme = MetroFramework.MetroThemeStyle.Dark; + this.FileTypeComboBox.UseSelectable = true; + // + // AddFilePrompt + // + this.AcceptButton = this.OKButton; + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); + this.Controls.Add(this.FileTypeComboBox); + this.Controls.Add(this.label1); + this.Controls.Add(this.InputTextBox); + this.Controls.Add(this.OKButton); + this.Controls.Add(this.TextLabel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AddFilePrompt"; + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.cs b/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.cs index 70b1b436..45c363fc 100644 --- a/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.cs +++ b/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.cs @@ -1,10 +1,10 @@ using System; using System.Windows.Forms; -using MetroFramework.Forms; +using PckStudio.ToolboxItems; namespace PckStudio { - public partial class AddFilePrompt : MetroForm + public partial class AddFilePrompt : ThemeForm { /// /// Text entered only valid when == , diff --git a/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.resx b/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.resx index d01e2de7..04198135 100644 --- a/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.resx +++ b/PCK-Studio/Forms/Additional-Popups/AddFilePrompt.resx @@ -2547,8 +2547,8 @@ vbLH9tge22N7bI/tsT22x/bYHttjC+3/B71iqRn22EDpAAAAAElFTkSuQmCC - - NoControl + + 0, 0 CenterParent @@ -2557,6 +2557,6 @@ AddFilePrompt - MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + PckStudio.ToolboxItems.ThemeForm, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.cs b/PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.cs deleted file mode 100644 index 8b8c8cc3..00000000 --- a/PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.cs +++ /dev/null @@ -1,14 +0,0 @@ -using MetroFramework.Forms; -using PckStudio.ToolboxItems; -using System.Windows.Forms; - -namespace PckStudio.Forms.Additional_Popups.Audio -{ - public partial class PleaseWait : ThemeForm - { - public PleaseWait() - { - InitializeComponent(); - } - } -} diff --git a/PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/InProgressPrompt.Designer.cs similarity index 77% rename from PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.Designer.cs rename to PCK-Studio/Forms/Additional-Popups/InProgressPrompt.Designer.cs index 53b95b62..b05562cd 100644 --- a/PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/InProgressPrompt.Designer.cs @@ -1,6 +1,6 @@ -namespace PckStudio.Forms.Additional_Popups.Audio +namespace PckStudio.Forms.Additional_Popups { - partial class PleaseWait + partial class InProgressPrompt { /// /// Required designer variable. @@ -34,26 +34,22 @@ // metroLabel1 // this.metroLabel1.AutoSize = true; - this.metroLabel1.Location = new System.Drawing.Point(22, 20); + this.metroLabel1.Location = new System.Drawing.Point(43, 20); this.metroLabel1.Name = "metroLabel1"; - this.metroLabel1.Size = new System.Drawing.Size(352, 19); + this.metroLabel1.Size = new System.Drawing.Size(307, 19); this.metroLabel1.TabIndex = 0; - this.metroLabel1.Text = "Please wait while PCK Studio converts the requested files. (:"; - this.metroLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.metroLabel1.Text = "Please wait while PCK Studio processes the request."; this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; // - // PleaseWait + // InProgressPrompt // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.ClientSize = new System.Drawing.Size(396, 59); this.Controls.Add(this.metroLabel1); - this.Font = new System.Drawing.Font("Segoe UI", 8.25F); - this.ForeColor = System.Drawing.Color.White; this.Location = new System.Drawing.Point(0, 0); - this.Name = "PleaseWait"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Name = "InProgressPrompt"; this.ResumeLayout(false); this.PerformLayout(); diff --git a/PCK-Studio/Forms/Additional-Popups/InProgressPrompt.cs b/PCK-Studio/Forms/Additional-Popups/InProgressPrompt.cs new file mode 100644 index 00000000..937dbc77 --- /dev/null +++ b/PCK-Studio/Forms/Additional-Popups/InProgressPrompt.cs @@ -0,0 +1,12 @@ +using PckStudio.ToolboxItems; + +namespace PckStudio.Forms.Additional_Popups +{ + public partial class InProgressPrompt : ThemeForm + { + public InProgressPrompt() + { + InitializeComponent(); + } + } +} diff --git a/PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.resx b/PCK-Studio/Forms/Additional-Popups/InProgressPrompt.resx similarity index 100% rename from PCK-Studio/Forms/Additional-Popups/Audio/PleaseWaitPrompt.resx rename to PCK-Studio/Forms/Additional-Popups/InProgressPrompt.resx diff --git a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs index 1dbbd2a5..952b25cd 100644 --- a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.Designer.cs @@ -47,7 +47,7 @@ this.okBtn.ForeColor = System.Drawing.Color.White; this.okBtn.Name = "okBtn"; this.okBtn.UseVisualStyleBackColor = true; - this.okBtn.Click += new System.EventHandler(this.button1_Click); + this.okBtn.Click += new System.EventHandler(this.okBtn_Click); // // cancelButton // @@ -69,6 +69,7 @@ // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); this.ControlBox = false; this.Controls.Add(this.ComboBox); this.Controls.Add(this.cancelButton); @@ -78,19 +79,15 @@ this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ItemSelectionPopUp"; - this.Resizable = false; - this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Theme = MetroFramework.MetroThemeStyle.Dark; this.ResumeLayout(false); this.PerformLayout(); } #endregion - private System.Windows.Forms.Button cancelButton; - public System.Windows.Forms.Label label2; - public System.Windows.Forms.Button okBtn; + private System.Windows.Forms.Button cancelButton; + public System.Windows.Forms.Label label2; + public System.Windows.Forms.Button okBtn; private MetroFramework.Controls.MetroComboBox ComboBox; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs index 8f981857..940157a9 100644 --- a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs +++ b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.cs @@ -1,11 +1,10 @@ using System; using System.Windows.Forms; - -// Audio Editor by MattNL +using PckStudio.ToolboxItems; namespace PckStudio.Forms.Additional_Popups { - public partial class ItemSelectionPopUp : MetroFramework.Forms.MetroForm + public partial class ItemSelectionPopUp : ThemeForm { public string SelectedItem => DialogResult == DialogResult.OK ? ComboBox.Text : string.Empty; @@ -15,7 +14,7 @@ namespace PckStudio.Forms.Additional_Popups ComboBox.Items.AddRange(items); } - private void button1_Click(object sender, EventArgs e) + private void okBtn_Click(object sender, EventArgs e) { if(ComboBox.SelectedIndex > -1) cancelButton_Click(sender, e); diff --git a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx index fb410a6c..bd478f97 100644 --- a/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx +++ b/PCK-Studio/Forms/Additional-Popups/ItemSelectionPopUp.resx @@ -117,143 +117,22 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Flat - - - - Segoe UI, 12pt - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAASBJREFUWEft - lk0KgzAQhd1Ll0K76xW9iHdrN932JvZ95QXUiiRp/Fn4wWCYzLw3TQ1YnZwcmr7vL15mk62hxk7xVtyd - SoZea3ROxaGGWvFSAM+rt6JRz829wLP2VhxqaBRPukXSSVDrHkCj8VYaNFoAooagxrWQbx5AwEKwOAR7 - roH/zQMIWRBmhyDnPShnHkDQwjAagrVzUN48gLAN4DuEY33zgAym12u4Tr6uWchoOARsZw4yGx47jN6J - VZHRfn+BDH5eOMfs7SgKwjaA0dvO2jkoPwSCFobZq0bOe1BuCIQsCLPmAfZcA/8PgYCFYNE8QI1rIX8I - Gi0AUeYBat0D6UOo4RAfJK3ioYj+5VPoVXASrVNpqHG/j9KTk22oqg+FO4+5CKyPOAAAAABJRU5ErkJg - gg== - - - - NoControl - - - 141, 63 - - - 120, 40 - - - 18 - - - Cancel - - - MiddleRight - - - ImageBeforeText - - - CancelButton - - - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 0 - - - Flat - - - Segoe UI, 12pt - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAABBSURBVFhH7dIxCgAgFMPQ3v/SumR3sHwQ8zZBagYjPW2B4zzeN8AAAwzoB7Bbx/wZ9+uY72HX - T2iAAQZ8HCDdSzYZRU7AU4PQAAAAAABJRU5ErkJggg== - - - - NoControl - - - 15, 63 - - - 120, 40 - - - 17 - - - Add - - - MiddleRight - - - ImageBeforeText - - - AddButton - - - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 1 - - - 67, 22 - - - 192, 21 - - - 5 - - - comboBox1 - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 2 - True - - NoControl - + - 12, 25 + 15, 41 - 53, 13 + 35, 13 3 - Category + Items: label2 @@ -267,6 +146,88 @@ 3 + + + Flat + + + 54, 76 + + + 75, 23 + + + 4 + + + Add + + + okBtn + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Flat + + + NoControl + + + 135, 76 + + + 75, 23 + + + 6 + + + Cancel + + + cancelButton + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 23 + + + 60, 34 + + + 192, 29 + + + 7 + + + ComboBox + + + MetroFramework.Controls.MetroComboBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 0 + True @@ -274,10 +235,7 @@ 6, 13 - 274, 115 - - - Segoe UI, 8.25pt + 264, 105 @@ -2499,23 +2457,14 @@ vbLH9tge22N7bI/tsT22x/bYHttjC+3/B71iqRn22EDpAAAAAElFTkSuQmCC - - NoControl - 0, 0 - - 280, 121 - - - 280, 121 - CenterParent - AddCategory + ItemSelectionPopUp PckStudio.ToolboxItems.ThemeForm, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null diff --git a/PCK-Studio/Forms/Additional-Popups/RenamePrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/RenamePrompt.Designer.cs index 148d6f06..fdce42e2 100644 --- a/PCK-Studio/Forms/Additional-Popups/RenamePrompt.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/RenamePrompt.Designer.cs @@ -29,13 +29,29 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RenamePrompt)); - this.InputTextBox = new MetroFramework.Controls.MetroTextBox(); this.TextLabel = new System.Windows.Forms.Label(); - this.RenameButton = new CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton(); + this.OKButton = new System.Windows.Forms.Button(); + this.InputTextBox = new MetroFramework.Controls.MetroTextBox(); + this.contextLabel = new MetroFramework.Controls.MetroLabel(); this.SuspendLayout(); // + // TextLabel + // + resources.ApplyResources(this.TextLabel, "TextLabel"); + this.TextLabel.ForeColor = System.Drawing.Color.White; + this.TextLabel.Name = "TextLabel"; + // + // OKButton + // + resources.ApplyResources(this.OKButton, "OKButton"); + this.OKButton.ForeColor = System.Drawing.Color.White; + this.OKButton.Name = "OKButton"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKBtn_Click); + // // InputTextBox // + resources.ApplyResources(this.InputTextBox, "InputTextBox"); // // // @@ -50,7 +66,6 @@ this.InputTextBox.CustomButton.UseSelectable = true; this.InputTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible"))); this.InputTextBox.Lines = new string[0]; - resources.ApplyResources(this.InputTextBox, "InputTextBox"); this.InputTextBox.MaxLength = 255; this.InputTextBox.Name = "InputTextBox"; this.InputTextBox.PasswordChar = '\0'; @@ -65,43 +80,24 @@ this.InputTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); this.InputTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); // - // TextLabel + // contextLabel // - resources.ApplyResources(this.TextLabel, "TextLabel"); - this.TextLabel.ForeColor = System.Drawing.Color.White; - this.TextLabel.Name = "TextLabel"; - // - // RenameButton - // - this.RenameButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25))))); - this.RenameButton.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25))))); - this.RenameButton.BorderRadius = 10; - this.RenameButton.BorderSize = 1; - this.RenameButton.ClickedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15))))); - this.RenameButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.RenameButton.FlatAppearance.BorderSize = 0; - this.RenameButton.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15))))); - this.RenameButton.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(250)))), ((int)(((byte)(165))))); - resources.ApplyResources(this.RenameButton, "RenameButton"); - this.RenameButton.ForeColor = System.Drawing.Color.White; - this.RenameButton.GradientColorPrimary = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70))))); - this.RenameButton.GradientColorSecondary = System.Drawing.Color.FromArgb(((int)(((byte)(70)))), ((int)(((byte)(70)))), ((int)(((byte)(70))))); - this.RenameButton.HoverOverColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(250)))), ((int)(((byte)(165))))); - this.RenameButton.Name = "RenameButton"; - this.RenameButton.TextColor = System.Drawing.Color.White; - this.RenameButton.UseVisualStyleBackColor = false; - this.RenameButton.Click += new System.EventHandler(this.RenameButton_Click); + resources.ApplyResources(this.contextLabel, "contextLabel"); + this.contextLabel.FontSize = MetroFramework.MetroLabelSize.Small; + this.contextLabel.Name = "contextLabel"; + this.contextLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + this.contextLabel.WrapToLine = true; // // RenamePrompt // + this.AcceptButton = this.OKButton; resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); - this.Controls.Add(this.RenameButton); + this.Controls.Add(this.contextLabel); this.Controls.Add(this.InputTextBox); + this.Controls.Add(this.OKButton); this.Controls.Add(this.TextLabel); - this.ForeColor = System.Drawing.Color.White; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "RenamePrompt"; @@ -111,8 +107,9 @@ } #endregion + public System.Windows.Forms.Button OKButton; public System.Windows.Forms.Label TextLabel; private MetroFramework.Controls.MetroTextBox InputTextBox; - internal CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton RenameButton; - } + public MetroFramework.Controls.MetroLabel contextLabel; + } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/RenamePrompt.cs b/PCK-Studio/Forms/Additional-Popups/RenamePrompt.cs index 40bfcf4d..f44800f3 100644 --- a/PCK-Studio/Forms/Additional-Popups/RenamePrompt.cs +++ b/PCK-Studio/Forms/Additional-Popups/RenamePrompt.cs @@ -22,17 +22,6 @@ namespace PckStudio } private void OKBtn_Click(object sender, EventArgs e) - { - - } - - private void InputTextBox_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - OKBtn_Click(sender, e); - } - - private void RenameButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; } diff --git a/PCK-Studio/Forms/Additional-Popups/RenamePrompt.resx b/PCK-Studio/Forms/Additional-Popups/RenamePrompt.resx index e9205026..77170edc 100644 --- a/PCK-Studio/Forms/Additional-Popups/RenamePrompt.resx +++ b/PCK-Studio/Forms/Additional-Popups/RenamePrompt.resx @@ -118,58 +118,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - NoControl - - - - 143, 1 - - - 21, 21 + + Bottom - - 1 - - - False - - - 70, 18 - - - 165, 23 - - - 5 - - - InputTextBox - - - MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 1 - True - - NoControl - + - 29, 23 + 19, 91 - 36, 13 + 35, 13 3 @@ -190,54 +151,108 @@ $this - 2 + 3 - + + Bottom + + Flat - - Segoe UI, 12pt - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAANZJREFUWEft - lkEKwjAQRUMXXbnqAXThvUTPqJfQvW7UC/QE3cUffEVpCBWS1Bby4IHpDPMHV2MKhRRYa1t5lUe5lys8 - yJO8yZb29Gj4kId8vn9+oD09mt3IrdzJi+w5S/fN1Rra86KgSvZUfJ4WwvP95WOQ//sC9EfDOG8Bnh6U - Z7QAz2gYF5xHecYL8AxCWxDaygILXiAWxi1wgVgY5wXw9KA8gwVSw/x8AWOQ/58FlDv9QaKgWm5k6CRb - y5r29LikAXc56VHaSXcJh85yV+toLxS+MOYFNxb0u7ASzysAAAAASUVORK5CYII= - - - + NoControl - - 72, 53 + + 95, 119 - - 120, 40 + + 75, 23 - - 20 + + 4 - + Rename - - MiddleRight + + OKButton - - ImageBeforeText + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - RenameButton - - - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - + $this - + + 2 + + + Bottom + + + + + + NoControl + + + 143, 1 + + + 21, 21 + + + 1 + + + False + + + 60, 86 + + + 165, 23 + + + 5 + + + InputTextBox + + + MetroFramework.Controls.MetroTextBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 1 + + + Top + + + 17, 43 + + + 231, 32 + + + 6 + + + TopCenter + + + contextLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + 0 @@ -247,10 +262,7 @@ 6, 13 - 264, 105 - - - Segoe UI, 8.25pt + 264, 151 diff --git a/PCK-Studio/Forms/Editor/ANIMEditor.Designer.cs b/PCK-Studio/Forms/Editor/ANIMEditor.Designer.cs index c2172245..46d3c650 100644 --- a/PCK-Studio/Forms/Editor/ANIMEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/ANIMEditor.Designer.cs @@ -702,7 +702,8 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(630, 554); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20))))); + this.ClientSize = new System.Drawing.Size(614, 515); this.Controls.Add(this.templateButton); this.Controls.Add(this.effectsGroup); this.Controls.Add(this.resetButton); @@ -716,15 +717,13 @@ this.Controls.Add(this.effectsGroup2); this.Controls.Add(this.saveButton); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Location = new System.Drawing.Point(0, 0); this.MaximizeBox = false; this.MaximumSize = new System.Drawing.Size(630, 554); this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(630, 554); this.Name = "ANIMEditor"; - this.Resizable = false; - this.Style = MetroFramework.MetroColorStyle.Silver; this.Text = "ANIM Editor"; - this.Theme = MetroFramework.MetroThemeStyle.Dark; this.effectsGroup.ResumeLayout(false); this.effectsGroup.PerformLayout(); this.effectsGroup2.ResumeLayout(false); diff --git a/PCK-Studio/Forms/Editor/ANIMEditor.cs b/PCK-Studio/Forms/Editor/ANIMEditor.cs index f4f3c8f3..7cb73f9b 100644 --- a/PCK-Studio/Forms/Editor/ANIMEditor.cs +++ b/PCK-Studio/Forms/Editor/ANIMEditor.cs @@ -5,12 +5,13 @@ using System.Diagnostics; using System.Windows.Forms; using System.Collections.Generic; -using PckStudio.Classes.Utils; +using PckStudio.Internal; using PckStudio.Forms.Additional_Popups; +using PckStudio.ToolboxItems; namespace PckStudio.Forms.Editor { - public partial class ANIMEditor : MetroFramework.Forms.MetroForm + public partial class ANIMEditor : ThemeForm { public SkinANIM ResultAnim => ruleset.Value; @@ -214,7 +215,7 @@ namespace PckStudio.Forms.Editor if (!string.IsNullOrWhiteSpace(value)) MessageBox.Show($"The following value \"{value}\" is not valid. Please try again."); RenamePrompt diag = new RenamePrompt(value); diag.TextLabel.Text = "ANIM"; - diag.RenameButton.Text = "Ok"; + diag.OKButton.Text = "Ok"; if (diag.ShowDialog() == DialogResult.OK) { value = diag.NewText; diff --git a/PCK-Studio/Forms/Editor/Animation.cs b/PCK-Studio/Forms/Editor/Animation.cs index ad8a1ccd..66f25134 100644 --- a/PCK-Studio/Forms/Editor/Animation.cs +++ b/PCK-Studio/Forms/Editor/Animation.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Drawing; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using System.Text; @@ -140,7 +140,7 @@ namespace PckStudio.Forms.Editor var textures = isClockOrCompass ? linearImages : frameTextures; - return ImageExtentions.ImageFromImageArray(textures.ToArray(), ImageExtentions.ImageLayoutDirection.Vertical); + return ImageExtensions.CombineImages(textures, ImageLayoutDirection.Vertical); } } } diff --git a/PCK-Studio/Forms/Editor/AnimationEditor.cs b/PCK-Studio/Forms/Editor/AnimationEditor.cs index dbce50d6..6ced4063 100644 --- a/PCK-Studio/Forms/Editor/AnimationEditor.cs +++ b/PCK-Studio/Forms/Editor/AnimationEditor.cs @@ -3,15 +3,13 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Drawing; -using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Windows.Forms; -using PckStudio.Classes.FileTypes; using PckStudio.Forms.Additional_Popups.Animation; using PckStudio.Forms.Utilities; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using OMI.Formats.Pck; namespace PckStudio.Forms.Editor @@ -51,7 +49,7 @@ namespace PckStudio.Forms.Editor using MemoryStream textureMem = new MemoryStream(animationFile.Data); var texture = new Bitmap(textureMem); - var frameTextures = texture.CreateImageList(ImageExtentions.ImageLayoutDirection.Horizontal); + var frameTextures = texture.CreateImageList(ImageLayoutDirection.Vertical); currentAnimation = animationFile.Properties.HasProperty("ANIM") ? new Animation(frameTextures, animationFile.Properties.GetPropertyValue("ANIM")) @@ -297,7 +295,7 @@ namespace PckStudio.Forms.Editor return; } using MemoryStream textureMem = new MemoryStream(File.ReadAllBytes(textureFile)); - var textures = Image.FromStream(textureMem).CreateImageList(ImageExtentions.ImageLayoutDirection.Horizontal); + var textures = Image.FromStream(textureMem).CreateImageList(ImageLayoutDirection.Horizontal); var new_animation = new Animation(textures); try { diff --git a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs index ef4521f7..a6c41e9c 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.Designer.cs @@ -345,5 +345,6 @@ namespace PckStudio.Forms.Editor private System.Windows.Forms.ToolStripMenuItem bulkReplaceExistingTracksToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem changeCategoryToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem organizeTracksToolStripMenuItem; - } + private System.Windows.Forms.ToolStripMenuItem convertToWAVToolStripMenuItem; + } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/AudioEditor.cs b/PCK-Studio/Forms/Editor/AudioEditor.cs index 67809b0d..ce22a2c9 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.cs +++ b/PCK-Studio/Forms/Editor/AudioEditor.cs @@ -26,7 +26,7 @@ namespace PckStudio.Forms.Editor public partial class AudioEditor : ThemeForm { public string defaultType = "yes"; - PCKAudioFile audioFile = null; + PckAudioFile audioFile = null; PckFile.FileData audioPCK; LOCFile loc; bool _isLittleEndian = false; @@ -45,15 +45,15 @@ namespace PckStudio.Forms.Editor "Unused?" }; - private string GetCategoryFromId(PCKAudioFile.AudioCategory.EAudioType categoryId) - => categoryId >= PCKAudioFile.AudioCategory.EAudioType.Overworld && - categoryId <= PCKAudioFile.AudioCategory.EAudioType.Unused + private string GetCategoryFromId(PckAudioFile.AudioCategory.EAudioType categoryId) + => categoryId >= PckAudioFile.AudioCategory.EAudioType.Overworld && + categoryId <= PckAudioFile.AudioCategory.EAudioType.Unused ? Categories[(int)categoryId] : "Not valid"; - private PCKAudioFile.AudioCategory.EAudioType GetCategoryId(string category) + private PckAudioFile.AudioCategory.EAudioType GetCategoryId(string category) { - return (PCKAudioFile.AudioCategory.EAudioType)Categories.IndexOf(category); + return (PckAudioFile.AudioCategory.EAudioType)Categories.IndexOf(category); } public AudioEditor(PckFile.FileData file, LOCFile locFile, bool isLittleEndian) @@ -65,7 +65,7 @@ namespace PckStudio.Forms.Editor audioPCK = file; using (var stream = new MemoryStream(file.Data)) { - var reader = new PCKAudioFileReader(isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); + var reader = new PckAudioFileReader(isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); audioFile = reader.FromStream(stream); } @@ -78,10 +78,10 @@ namespace PckStudio.Forms.Editor treeView1.Nodes.Clear(); foreach (var category in audioFile.Categories) { - if(category.audioType == PCKAudioFile.AudioCategory.EAudioType.Creative) + 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()) { @@ -97,7 +97,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(); } @@ -122,7 +122,7 @@ namespace PckStudio.Forms.Editor private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { treeView2.Nodes.Clear(); - if (e.Node.Tag is PCKAudioFile.AudioCategory category) + if (e.Node.Tag is PckAudioFile.AudioCategory category) foreach (var name in category.SongNames) { treeView2.Nodes.Add(name); @@ -142,7 +142,7 @@ namespace PckStudio.Forms.Editor var category = audioFile.GetCategory(GetCategoryId(add.SelectedItem)); - if (GetCategoryId(add.SelectedItem) == PCKAudioFile.AudioCategory.EAudioType.Creative) + if (GetCategoryId(add.SelectedItem) == PckAudioFile.AudioCategory.EAudioType.Creative) { playOverworldInCreative.Visible = true; playOverworldInCreative.Checked = false; @@ -162,7 +162,7 @@ namespace PckStudio.Forms.Editor private void addEntryMenuItem_Click(object sender, EventArgs e) { - if (treeView1.SelectedNode is TreeNode t && t.Tag is PCKAudioFile.AudioCategory) + if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory) { if (!parent.CreateDataFolder()) return; @@ -183,7 +183,7 @@ namespace PckStudio.Forms.Editor if (treeView1.SelectedNode is TreeNode main && audioFile.RemoveCategory(GetCategoryId(treeView1.SelectedNode.Text))) { - if(GetCategoryId(treeView1.SelectedNode.Text) == PCKAudioFile.AudioCategory.EAudioType.Creative) + if(GetCategoryId(treeView1.SelectedNode.Text) == PckAudioFile.AudioCategory.EAudioType.Creative) { playOverworldInCreative.Visible = false; playOverworldInCreative.Checked = false; @@ -207,7 +207,7 @@ namespace PckStudio.Forms.Editor private void removeEntryMenuItem_Click(object sender, EventArgs e) { - if (treeView2.SelectedNode != null && treeView1.SelectedNode.Tag is PCKAudioFile.AudioCategory category) + if (treeView2.SelectedNode != null && treeView1.SelectedNode.Tag is PckAudioFile.AudioCategory category) { category.SongNames.Remove(treeView2.SelectedNode.Text); treeView2.SelectedNode.Remove(); @@ -218,7 +218,7 @@ namespace PckStudio.Forms.Editor { int success = 0; int exitCode = 0; - PleaseWait waitDiag = new PleaseWait(); + InProgressPrompt waitDiag = new InProgressPrompt(); waitDiag.Show(this); foreach (string file in FileList) { @@ -262,7 +262,7 @@ namespace PckStudio.Forms.Editor } else if (user_prompt == DialogResult.No) { - if (treeView1.SelectedNode is TreeNode node && node.Tag is PCKAudioFile.AudioCategory cat) + if (treeView1.SelectedNode is TreeNode node && node.Tag is PckAudioFile.AudioCategory cat) { //adds song without affecting the binka file cat.SongNames.Add(songName); @@ -319,7 +319,7 @@ namespace PckStudio.Forms.Editor } // this is repeated again becuase this is meant to prevent any files that fail to convert from being added to the category - if (treeView1.SelectedNode is TreeNode t && t.Tag is PCKAudioFile.AudioCategory category) + if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category) { category.SongNames.Add(songName); treeView2.Nodes.Add(songName); @@ -346,15 +346,15 @@ 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("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) @@ -376,7 +376,7 @@ namespace PckStudio.Forms.Editor } category.Name = ""; - if (playOverworldInCreative.Checked && category.audioType == PCKAudioFile.AudioCategory.EAudioType.Creative) + if (playOverworldInCreative.Checked && category.audioType == PckAudioFile.AudioCategory.EAudioType.Creative) { foreach (var name in overworldCategory.SongNames) { @@ -398,7 +398,7 @@ namespace PckStudio.Forms.Editor using (var stream = new MemoryStream()) { - var writer = new PCKAudioFileWriter(audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); + var writer = new PckAudioFileWriter(audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); writer.WriteToStream(stream); audioPCK.SetData(stream.ToArray()); } @@ -416,8 +416,7 @@ namespace PckStudio.Forms.Editor "The \"Menu\" category will only play once when loading the pack, and never again.\n\n" + "The \"Creative\" category will only play songs listed in that category, and unlike other editions of Minecraft, will NOT play songs from the Overworld category. You can fix this by clicking the checkbox found at the top of the form.\n\n" + "The mini game categories will only play if you have your pack loaded in those mini games.\n\n" + - "You can edit the credits for the PCK in the Credits editor! No more managing credit IDs!\n\n" + - "You can modify and create PSVita and PS4 audio pcks by clicking \"PS4/Vita\" in the \"Create -> Audio.pck\" context menu", "Help"); + "You can edit the credits for the PCK in the Credits editor! No more managing credit IDs!\n\n", "Help"); } private void creditsEditorToolStripMenuItem_Click(object sender, EventArgs e) @@ -545,7 +544,7 @@ namespace PckStudio.Forms.Editor if (file_ext == ".wav") // Convert Wave to BINKA { Cursor.Current = Cursors.WaitCursor; - PleaseWait waitDiag = new PleaseWait(); + InProgressPrompt waitDiag = new InProgressPrompt(); waitDiag.Show(this); await Task.Run(() => @@ -565,7 +564,7 @@ namespace PckStudio.Forms.Editor private void convertToWAVToolStripMenuItem_Click(object sender, EventArgs e) { - if (treeView2.SelectedNode != null && treeView1.SelectedNode.Tag is PCKAudioFile.AudioCategory) + if (treeView2.SelectedNode != null && treeView1.SelectedNode.Tag is PckAudioFile.AudioCategory) { Binka.ToWav(Path.Combine(parent.GetDataPath(), treeView2.SelectedNode.Text + ".binka"), Path.Combine(parent.GetDataPath())); } @@ -573,7 +572,7 @@ namespace PckStudio.Forms.Editor private void setCategoryToolStripMenuItem_Click(object sender, EventArgs e) { - if (!(treeView1.SelectedNode is TreeNode t && t.Tag is PCKAudioFile.AudioCategory category)) return; + if (!(treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category)) return; string[] available = Categories.FindAll(str => !audioFile.HasCategory(GetCategoryId(str))).ToArray(); if (available.Length > 0) @@ -584,7 +583,7 @@ namespace PckStudio.Forms.Editor 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)); diff --git a/PCK-Studio/Forms/Editor/AudioEditor.resx b/PCK-Studio/Forms/Editor/AudioEditor.resx index cc2c9b5c..9e5ea696 100644 --- a/PCK-Studio/Forms/Editor/AudioEditor.resx +++ b/PCK-Studio/Forms/Editor/AudioEditor.resx @@ -404,12 +404,68 @@ 5 + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x + DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5 + jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC + + + + 168, 22 + + + Add Category + + + 168, 22 + + + Remove Category + + + 168, 22 + + + Set Category + 19, 8 False + + 20, 60 + + + 410, 24 + + + 11 + + + menuStrip1 + + + menuStrip + + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + + + 37, 20 + + + File + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -426,11 +482,11 @@ Save - - 37, 20 + + 46, 20 - - File + + Tools 220, 22 @@ -459,8 +515,8 @@ 46, 20 - - Tools + + Help 243, 22 @@ -534,25 +590,31 @@ - 173, 22 + 180, 22 Add Entry - 173, 22 + 180, 22 Remove Entry - 173, 22 + 180, 22 Verify File Location + + 180, 22 + + + Convert To WAV + - 174, 70 + 181, 114 contextMenuStrip2 @@ -3309,6 +3371,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + convertToWAVToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + AudioEditor diff --git a/PCK-Studio/Forms/Editor/BehaviourEditor.cs b/PCK-Studio/Forms/Editor/BehaviourEditor.cs index c6559842..214151fc 100644 --- a/PCK-Studio/Forms/Editor/BehaviourEditor.cs +++ b/PCK-Studio/Forms/Editor/BehaviourEditor.cs @@ -28,13 +28,13 @@ namespace PckStudio.Forms.Editor { TreeNode EntryNode = new TreeNode(entry.name); - foreach (JObject content in Utilities.BehaviourResources.entityData["entities"].Children()) + foreach (JObject content in Utilities.BehaviourResources.entityData["behaviours"].Children()) { var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.name); if (prop is JProperty) { EntryNode.Text = (string)prop.Value; - EntryNode.ImageIndex = Utilities.BehaviourResources.entityData["entities"].Children().ToList().IndexOf(content); + EntryNode.ImageIndex = Utilities.BehaviourResources.entityData["behaviours"].Children().ToList().IndexOf(content); EntryNode.SelectedImageIndex = EntryNode.ImageIndex; break; } @@ -164,13 +164,13 @@ namespace PckStudio.Forms.Editor entry.name = diag.SelectedEntity; treeView1.SelectedNode.Tag = entry; - foreach (JObject content in Utilities.BehaviourResources.entityData["entities"].Children()) + foreach (JObject content in Utilities.BehaviourResources.entityData["behaviours"].Children()) { var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.name); if (prop is JProperty) { treeView1.SelectedNode.Text = (string)prop.Value; - treeView1.SelectedNode.ImageIndex = Utilities.BehaviourResources.entityData["entities"].Children().ToList().IndexOf(content); + treeView1.SelectedNode.ImageIndex = Utilities.BehaviourResources.entityData["behaviours"].Children().ToList().IndexOf(content); treeView1.SelectedNode.SelectedImageIndex = treeView1.SelectedNode.ImageIndex; break; } @@ -217,13 +217,13 @@ namespace PckStudio.Forms.Editor TreeNode NewOverrideNode = new TreeNode(NewOverride.name); NewOverrideNode.Tag = NewOverride; - foreach (JObject content in Utilities.BehaviourResources.entityData["entities"].Children()) + foreach (JObject content in Utilities.BehaviourResources.entityData["behaviours"].Children()) { var prop = content.Properties().FirstOrDefault(prop => prop.Name == NewOverride.name); if (prop is JProperty) { NewOverrideNode.Text = (string)prop.Value; - NewOverrideNode.ImageIndex = Utilities.BehaviourResources.entityData["entities"].Children().ToList().IndexOf(content); + NewOverrideNode.ImageIndex = Utilities.BehaviourResources.entityData["behaviours"].Children().ToList().IndexOf(content); NewOverrideNode.SelectedImageIndex = NewOverrideNode.ImageIndex; break; } diff --git a/PCK-Studio/Forms/Editor/BoxEditor.cs b/PCK-Studio/Forms/Editor/BoxEditor.cs index f86ca522..32d99150 100644 --- a/PCK-Studio/Forms/Editor/BoxEditor.cs +++ b/PCK-Studio/Forms/Editor/BoxEditor.cs @@ -1,8 +1,7 @@ using PckStudio.ToolboxItems; using System; -using System.Numerics; -using System.Text.RegularExpressions; using System.Windows.Forms; +using PckStudio.Internal; namespace PckStudio.Forms.Editor { @@ -10,68 +9,31 @@ namespace PckStudio.Forms.Editor { public string Result; - class BOX - { - public string Parent; - public Vector3 Pos; - public Vector3 Size; - public float U, V; - public bool HideWithArmor; - public bool Mirror; - public float Inflation; - public BOX(string input) - { - string[] arguments = Regex.Split(input, @"\s+"); - - try - { - Parent = arguments[0].ToUpper(); // just in case a box has all lower, the editor still parses correctly - Pos = new Vector3(float.Parse(arguments[1]), float.Parse(arguments[2]), float.Parse(arguments[3])); - Size = new Vector3(float.Parse(arguments[4]), float.Parse(arguments[5]), float.Parse(arguments[6])); - U = float.Parse(arguments[7]); - V = float.Parse(arguments[8]); - HideWithArmor = Convert.ToBoolean(int.Parse(arguments[9])); - Mirror = Convert.ToBoolean(int.Parse(arguments[10])); - Inflation = float.Parse(arguments[11]); - } - catch (IndexOutOfRangeException) - { - // This is normal as some box values can have less parameters but no more than 12 - return; - } - catch (Exception ex) - { - Parent = string.Empty; - } - } - - } - - public BoxEditor(string inBOX, bool hasInflation) + public BoxEditor(string inBOX, bool hasInflation) { InitializeComponent(); inflationUpDown.Enabled = hasInflation; - BOX box = new BOX(inBOX); + var box = SkinBOX.FromString(inBOX); - if (string.IsNullOrEmpty(box.Parent) || !parentComboBox.Items.Contains(box.Parent)) + if (string.IsNullOrEmpty(box.Type) || !parentComboBox.Items.Contains(box.Type)) { throw new Exception("Failed to parse BOX value"); } - parentComboBox.SelectedItem = parentComboBox.Items[parentComboBox.Items.IndexOf(box.Parent)]; + parentComboBox.SelectedItem = parentComboBox.Items[parentComboBox.Items.IndexOf(box.Type)]; PosXUpDown.Value = (decimal)box.Pos.X; PosYUpDown.Value = (decimal)box.Pos.Y; PosZUpDown.Value = (decimal)box.Pos.Z; SizeXUpDown.Value = (decimal)box.Size.X; SizeYUpDown.Value = (decimal)box.Size.Y; SizeZUpDown.Value = (decimal)box.Size.Z; - uvXUpDown.Value = (decimal)box.U; - uvYUpDown.Value = (decimal)box.V; + uvXUpDown.Value = (decimal)box.UV.X; + uvYUpDown.Value = (decimal)box.UV.Y; armorCheckBox.Checked = box.HideWithArmor; mirrorCheckBox.Checked = box.Mirror; - inflationUpDown.Value = (decimal)box.Inflation; + inflationUpDown.Value = (decimal)box.Scale; } private void saveButton_Click(object sender, EventArgs e) diff --git a/PCK-Studio/Forms/Editor/GameRuleFileEditor.Designer.cs b/PCK-Studio/Forms/Editor/GameRuleFileEditor.Designer.cs index ecd2f193..e76b80ae 100644 --- a/PCK-Studio/Forms/Editor/GameRuleFileEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/GameRuleFileEditor.Designer.cs @@ -28,251 +28,251 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GameRuleFileEditor)); - this.GrfTreeView = new System.Windows.Forms.TreeView(); - this.MessageContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components); - this.addGameRuleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeGameRuleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.GrfParametersTreeView = new System.Windows.Forms.TreeView(); - this.DetailContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components); - this.addToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); - this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); - this.menuStrip1 = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.compressionLvlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox(); - this.compressionTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.compressionTypeComboBox = new System.Windows.Forms.ToolStripComboBox(); - this.metroPanel1 = new MetroFramework.Controls.MetroPanel(); - this.MessageContextMenu.SuspendLayout(); - this.DetailContextMenu.SuspendLayout(); - this.menuStrip1.SuspendLayout(); - this.metroPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // GrfTreeView - // - this.GrfTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.GrfTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.GrfTreeView.ContextMenuStrip = this.MessageContextMenu; - this.GrfTreeView.Dock = System.Windows.Forms.DockStyle.Left; - this.GrfTreeView.ForeColor = System.Drawing.SystemColors.MenuBar; - this.GrfTreeView.Location = new System.Drawing.Point(0, 0); - this.GrfTreeView.Name = "GrfTreeView"; - this.GrfTreeView.Size = new System.Drawing.Size(223, 312); - this.GrfTreeView.TabIndex = 0; - this.GrfTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.GrfTreeView_AfterSelect); - this.GrfTreeView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GrfTreeView_KeyDown); - // - // MessageContextMenu - // - this.MessageContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GameRuleFileEditor)); + this.GrfTreeView = new System.Windows.Forms.TreeView(); + this.MessageContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components); + this.addGameRuleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeGameRuleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.GrfParametersTreeView = new System.Windows.Forms.TreeView(); + this.DetailContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components); + this.addToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.compressionLvlToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox(); + this.compressionTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.compressionTypeComboBox = new System.Windows.Forms.ToolStripComboBox(); + this.metroPanel1 = new MetroFramework.Controls.MetroPanel(); + this.MessageContextMenu.SuspendLayout(); + this.DetailContextMenu.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.metroPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // GrfTreeView + // + this.GrfTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.GrfTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.GrfTreeView.ContextMenuStrip = this.MessageContextMenu; + this.GrfTreeView.Dock = System.Windows.Forms.DockStyle.Left; + this.GrfTreeView.ForeColor = System.Drawing.SystemColors.MenuBar; + this.GrfTreeView.Location = new System.Drawing.Point(0, 0); + this.GrfTreeView.Name = "GrfTreeView"; + this.GrfTreeView.Size = new System.Drawing.Size(223, 312); + this.GrfTreeView.TabIndex = 0; + this.GrfTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.GrfTreeView_AfterSelect); + this.GrfTreeView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GrfTreeView_KeyDown); + // + // MessageContextMenu + // + this.MessageContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addGameRuleToolStripMenuItem, this.removeGameRuleToolStripMenuItem}); - this.MessageContextMenu.Name = "MessageContextMenu"; - this.MessageContextMenu.Size = new System.Drawing.Size(178, 48); - // - // addGameRuleToolStripMenuItem - // - this.addGameRuleToolStripMenuItem.Name = "addGameRuleToolStripMenuItem"; - this.addGameRuleToolStripMenuItem.Size = new System.Drawing.Size(177, 22); - this.addGameRuleToolStripMenuItem.Text = "Add Game Rule"; - this.addGameRuleToolStripMenuItem.Click += new System.EventHandler(this.addGameRuleToolStripMenuItem_Click); - // - // removeGameRuleToolStripMenuItem - // - this.removeGameRuleToolStripMenuItem.Name = "removeGameRuleToolStripMenuItem"; - this.removeGameRuleToolStripMenuItem.Size = new System.Drawing.Size(177, 22); - this.removeGameRuleToolStripMenuItem.Text = "Remove Game Rule"; - this.removeGameRuleToolStripMenuItem.Click += new System.EventHandler(this.removeGameRuleToolStripMenuItem_Click); - // - // GrfParametersTreeView - // - this.GrfParametersTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.GrfParametersTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.GrfParametersTreeView.ContextMenuStrip = this.DetailContextMenu; - this.GrfParametersTreeView.Dock = System.Windows.Forms.DockStyle.Right; - this.GrfParametersTreeView.ForeColor = System.Drawing.SystemColors.MenuBar; - this.GrfParametersTreeView.Location = new System.Drawing.Point(227, 0); - this.GrfParametersTreeView.Name = "GrfParametersTreeView"; - this.GrfParametersTreeView.Size = new System.Drawing.Size(223, 312); - this.GrfParametersTreeView.TabIndex = 1; - this.GrfParametersTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.GrfDetailsTreeView_NodeMouseDoubleClick); - this.GrfParametersTreeView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GrfDetailsTreeView_KeyDown); - // - // DetailContextMenu - // - this.DetailContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.MessageContextMenu.Name = "MessageContextMenu"; + this.MessageContextMenu.Size = new System.Drawing.Size(178, 48); + // + // addGameRuleToolStripMenuItem + // + this.addGameRuleToolStripMenuItem.Name = "addGameRuleToolStripMenuItem"; + this.addGameRuleToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.addGameRuleToolStripMenuItem.Text = "Add Game Rule"; + this.addGameRuleToolStripMenuItem.Click += new System.EventHandler(this.addGameRuleToolStripMenuItem_Click); + // + // removeGameRuleToolStripMenuItem + // + this.removeGameRuleToolStripMenuItem.Name = "removeGameRuleToolStripMenuItem"; + this.removeGameRuleToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.removeGameRuleToolStripMenuItem.Text = "Remove Game Rule"; + this.removeGameRuleToolStripMenuItem.Click += new System.EventHandler(this.removeGameRuleToolStripMenuItem_Click); + // + // GrfParametersTreeView + // + this.GrfParametersTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.GrfParametersTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.GrfParametersTreeView.ContextMenuStrip = this.DetailContextMenu; + this.GrfParametersTreeView.Dock = System.Windows.Forms.DockStyle.Right; + this.GrfParametersTreeView.ForeColor = System.Drawing.SystemColors.MenuBar; + this.GrfParametersTreeView.Location = new System.Drawing.Point(227, 0); + this.GrfParametersTreeView.Name = "GrfParametersTreeView"; + this.GrfParametersTreeView.Size = new System.Drawing.Size(223, 312); + this.GrfParametersTreeView.TabIndex = 1; + this.GrfParametersTreeView.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.GrfDetailsTreeView_NodeMouseDoubleClick); + this.GrfParametersTreeView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GrfDetailsTreeView_KeyDown); + // + // DetailContextMenu + // + this.DetailContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.addToolStripMenuItem1, this.removeToolStripMenuItem}); - this.DetailContextMenu.Name = "DetailContextMenu"; - this.DetailContextMenu.Size = new System.Drawing.Size(118, 48); - // - // addToolStripMenuItem1 - // - this.addToolStripMenuItem1.Name = "addToolStripMenuItem1"; - this.addToolStripMenuItem1.Size = new System.Drawing.Size(117, 22); - this.addToolStripMenuItem1.Text = "Add"; - this.addToolStripMenuItem1.Click += new System.EventHandler(this.addDetailContextMenuItem_Click); - // - // removeToolStripMenuItem - // - this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.removeToolStripMenuItem.Text = "Remove"; - this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); - // - // metroLabel1 - // - this.metroLabel1.AutoSize = true; - this.metroLabel1.Location = new System.Drawing.Point(25, 88); - this.metroLabel1.Name = "metroLabel1"; - this.metroLabel1.Size = new System.Drawing.Size(73, 19); - this.metroLabel1.TabIndex = 2; - this.metroLabel1.Text = "Game Rule"; - this.metroLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // metroLabel2 - // - this.metroLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.metroLabel2.AutoSize = true; - this.metroLabel2.Location = new System.Drawing.Point(252, 88); - this.metroLabel2.Name = "metroLabel2"; - this.metroLabel2.Size = new System.Drawing.Size(75, 19); - this.metroLabel2.TabIndex = 0; - this.metroLabel2.Text = "Parameters"; - this.metroLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // menuStrip1 - // - this.menuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.DetailContextMenu.Name = "DetailContextMenu"; + this.DetailContextMenu.Size = new System.Drawing.Size(118, 48); + // + // addToolStripMenuItem1 + // + this.addToolStripMenuItem1.Name = "addToolStripMenuItem1"; + this.addToolStripMenuItem1.Size = new System.Drawing.Size(117, 22); + this.addToolStripMenuItem1.Text = "Add"; + this.addToolStripMenuItem1.Click += new System.EventHandler(this.addDetailContextMenuItem_Click); + // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22); + this.removeToolStripMenuItem.Text = "Remove"; + this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); + // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.Location = new System.Drawing.Point(25, 88); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(73, 19); + this.metroLabel1.TabIndex = 2; + this.metroLabel1.Text = "Game Rule"; + this.metroLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // metroLabel2 + // + this.metroLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.metroLabel2.AutoSize = true; + this.metroLabel2.Location = new System.Drawing.Point(252, 88); + this.metroLabel2.Name = "metroLabel2"; + this.metroLabel2.Size = new System.Drawing.Size(75, 19); + this.metroLabel2.TabIndex = 0; + this.metroLabel2.Text = "Parameters"; + this.metroLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // menuStrip1 + // + this.menuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.compressionLvlToolStripMenuItem, this.compressionTypeToolStripMenuItem}); - this.menuStrip1.Location = new System.Drawing.Point(25, 60); - this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(450, 24); - this.menuStrip1.TabIndex = 3; - this.menuStrip1.Text = "menuStrip1"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuStrip1.Location = new System.Drawing.Point(25, 60); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(450, 24); + this.menuStrip1.TabIndex = 3; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.openToolStripMenuItem, this.saveToolStripMenuItem}); - this.fileToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Menu; - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); - this.fileToolStripMenuItem.Text = "File"; - // - // openToolStripMenuItem - // - this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); - this.openToolStripMenuItem.Text = "Open"; - this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); - // - // saveToolStripMenuItem - // - this.saveToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); - this.saveToolStripMenuItem.Text = "Save"; - this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); - // - // compressionLvlToolStripMenuItem - // - this.compressionLvlToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Menu; + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.openToolStripMenuItem.Text = "Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem.Text = "Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // compressionLvlToolStripMenuItem + // + this.compressionLvlToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripComboBox1}); - this.compressionLvlToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Menu; - this.compressionLvlToolStripMenuItem.Name = "compressionLvlToolStripMenuItem"; - this.compressionLvlToolStripMenuItem.Size = new System.Drawing.Size(106, 20); - this.compressionLvlToolStripMenuItem.Text = "Compression Lvl"; - // - // toolStripComboBox1 - // - this.toolStripComboBox1.Items.AddRange(new object[] { + this.compressionLvlToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Menu; + this.compressionLvlToolStripMenuItem.Name = "compressionLvlToolStripMenuItem"; + this.compressionLvlToolStripMenuItem.Size = new System.Drawing.Size(106, 20); + this.compressionLvlToolStripMenuItem.Text = "Compression Lvl"; + // + // toolStripComboBox1 + // + this.toolStripComboBox1.Items.AddRange(new object[] { "None", "Compressed", "Compressed + RLE", "Compressed + RLE + CRC"}); - this.toolStripComboBox1.Name = "toolStripComboBox1"; - this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23); - this.toolStripComboBox1.Text = "None"; - // - // compressionTypeToolStripMenuItem - // - this.compressionTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripComboBox1.Name = "toolStripComboBox1"; + this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23); + this.toolStripComboBox1.Text = "None"; + // + // compressionTypeToolStripMenuItem + // + this.compressionTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.compressionTypeComboBox}); - this.compressionTypeToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Menu; - this.compressionTypeToolStripMenuItem.Name = "compressionTypeToolStripMenuItem"; - this.compressionTypeToolStripMenuItem.Size = new System.Drawing.Size(116, 20); - this.compressionTypeToolStripMenuItem.Text = "Compression Type"; - // - // compressionTypeComboBox - // - this.compressionTypeComboBox.Items.AddRange(new object[] { - "Zlib", - "Deflate", - "XMem"}); - this.compressionTypeComboBox.Name = "compressionTypeComboBox"; - this.compressionTypeComboBox.Size = new System.Drawing.Size(121, 23); - // - // metroPanel1 - // - this.metroPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.compressionTypeToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Menu; + this.compressionTypeToolStripMenuItem.Name = "compressionTypeToolStripMenuItem"; + this.compressionTypeToolStripMenuItem.Size = new System.Drawing.Size(116, 20); + this.compressionTypeToolStripMenuItem.Text = "Compression Type"; + // + // compressionTypeComboBox + // + this.compressionTypeComboBox.Items.AddRange(new object[] { + "Wii U, PS Vita", + "PS3", + "Xbox 360"}); + this.compressionTypeComboBox.Name = "compressionTypeComboBox"; + this.compressionTypeComboBox.Size = new System.Drawing.Size(121, 23); + // + // metroPanel1 + // + this.metroPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.metroPanel1.Controls.Add(this.GrfParametersTreeView); - this.metroPanel1.Controls.Add(this.GrfTreeView); - this.metroPanel1.HorizontalScrollbarBarColor = true; - this.metroPanel1.HorizontalScrollbarHighlightOnWheel = false; - this.metroPanel1.HorizontalScrollbarSize = 10; - this.metroPanel1.Location = new System.Drawing.Point(25, 110); - this.metroPanel1.Name = "metroPanel1"; - this.metroPanel1.Size = new System.Drawing.Size(450, 312); - this.metroPanel1.TabIndex = 4; - this.metroPanel1.Theme = MetroFramework.MetroThemeStyle.Dark; - this.metroPanel1.VerticalScrollbarBarColor = true; - this.metroPanel1.VerticalScrollbarHighlightOnWheel = false; - this.metroPanel1.VerticalScrollbarSize = 10; - this.metroPanel1.Resize += new System.EventHandler(this.metroPanel1_Resize); - // - // GameRuleFileEditor - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(500, 450); - this.Controls.Add(this.metroPanel1); - this.Controls.Add(this.menuStrip1); - this.Controls.Add(this.metroLabel2); - this.Controls.Add(this.metroLabel1); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MainMenuStrip = this.menuStrip1; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(500, 450); - this.Name = "GameRuleFileEditor"; - this.Padding = new System.Windows.Forms.Padding(25, 60, 25, 25); - this.Style = MetroFramework.MetroColorStyle.Silver; - this.Text = "GRF Editor"; - this.Theme = MetroFramework.MetroThemeStyle.Dark; - this.Load += new System.EventHandler(this.OnLoad); - this.MessageContextMenu.ResumeLayout(false); - this.DetailContextMenu.ResumeLayout(false); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); - this.metroPanel1.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); + this.metroPanel1.Controls.Add(this.GrfParametersTreeView); + this.metroPanel1.Controls.Add(this.GrfTreeView); + this.metroPanel1.HorizontalScrollbarBarColor = true; + this.metroPanel1.HorizontalScrollbarHighlightOnWheel = false; + this.metroPanel1.HorizontalScrollbarSize = 10; + this.metroPanel1.Location = new System.Drawing.Point(25, 110); + this.metroPanel1.Name = "metroPanel1"; + this.metroPanel1.Size = new System.Drawing.Size(450, 312); + this.metroPanel1.TabIndex = 4; + this.metroPanel1.Theme = MetroFramework.MetroThemeStyle.Dark; + this.metroPanel1.VerticalScrollbarBarColor = true; + this.metroPanel1.VerticalScrollbarHighlightOnWheel = false; + this.metroPanel1.VerticalScrollbarSize = 10; + this.metroPanel1.Resize += new System.EventHandler(this.metroPanel1_Resize); + // + // GameRuleFileEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(500, 450); + this.Controls.Add(this.metroPanel1); + this.Controls.Add(this.menuStrip1); + this.Controls.Add(this.metroLabel2); + this.Controls.Add(this.metroLabel1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip1; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(500, 450); + this.Name = "GameRuleFileEditor"; + this.Padding = new System.Windows.Forms.Padding(25, 60, 25, 25); + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Text = "GRF Editor"; + this.Theme = MetroFramework.MetroThemeStyle.Dark; + this.Load += new System.EventHandler(this.OnLoad); + this.MessageContextMenu.ResumeLayout(false); + this.DetailContextMenu.ResumeLayout(false); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.metroPanel1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs b/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs index fad54f10..1172e90a 100644 --- a/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs +++ b/PCK-Studio/Forms/Editor/GameRuleFileEditor.cs @@ -169,7 +169,7 @@ namespace PckStudio.Forms.Editor using (RenamePrompt prompt = new RenamePrompt("")) { - prompt.RenameButton.Text = "Add"; + prompt.OKButton.Text = "Add"; if (MessageBox.Show($"Add Game Rule to {parentRule.Name}", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes && prompt.ShowDialog() == DialogResult.OK && diff --git a/PCK-Studio/Forms/Editor/LOCEditor.cs b/PCK-Studio/Forms/Editor/LOCEditor.cs index 971c3877..3605a3f7 100644 --- a/PCK-Studio/Forms/Editor/LOCEditor.cs +++ b/PCK-Studio/Forms/Editor/LOCEditor.cs @@ -60,7 +60,7 @@ namespace PckStudio.Forms.Editor if (treeViewLocKeys.SelectedNode is TreeNode) using (RenamePrompt prompt = new RenamePrompt("")) { - prompt.RenameButton.Text = "Add"; + prompt.OKButton.Text = "Add"; if (prompt.ShowDialog() == DialogResult.OK && !currentLoc.LocKeys.ContainsKey(prompt.NewText) && currentLoc.AddLocKey(prompt.NewText, "")) diff --git a/PCK-Studio/Forms/Editor/MaterialsEditor.cs b/PCK-Studio/Forms/Editor/MaterialsEditor.cs index 83ceb106..33f421d5 100644 --- a/PCK-Studio/Forms/Editor/MaterialsEditor.cs +++ b/PCK-Studio/Forms/Editor/MaterialsEditor.cs @@ -15,7 +15,7 @@ namespace PckStudio.Forms.Editor { public partial class MaterialsEditor : MetroForm { - // Behaviours File Format research by Miku and MattNL + // Materials File Format research by PhoenixARC private readonly PckFile.FileData _file; MaterialContainer materialFile; @@ -27,13 +27,13 @@ namespace PckStudio.Forms.Editor { TreeNode EntryNode = new TreeNode(entry.Name); - foreach (JObject content in Utilities.MaterialResources.entityData["entities"].Children()) + foreach (JObject content in Utilities.MaterialResources.entityData["materials"].Children()) { var prop = content.Properties().FirstOrDefault(prop => prop.Name == entry.Name); if (prop is JProperty) { EntryNode.Text = (string)prop.Value; - EntryNode.ImageIndex = Utilities.MaterialResources.entityData["entities"].Children().ToList().IndexOf(content); + EntryNode.ImageIndex = Utilities.MaterialResources.entityData["materials"].Children().ToList().IndexOf(content); EntryNode.SelectedImageIndex = EntryNode.ImageIndex; break; } @@ -146,13 +146,13 @@ namespace PckStudio.Forms.Editor TreeNode NewEntryNode = new TreeNode(NewEntry.Name); NewEntryNode.Tag = NewEntry; - foreach (JObject content in Utilities.MaterialResources.entityData["entities"].Children()) + foreach (JObject content in Utilities.MaterialResources.entityData["materials"].Children()) { var prop = content.Properties().FirstOrDefault(prop => prop.Name == NewEntry.Name); if (prop is JProperty) { NewEntryNode.Text = (string)prop.Value; - NewEntryNode.ImageIndex = Utilities.MaterialResources.entityData["entities"].Children().ToList().IndexOf(content); + NewEntryNode.ImageIndex = Utilities.MaterialResources.entityData["materials"].Children().ToList().IndexOf(content); NewEntryNode.SelectedImageIndex = NewEntryNode.ImageIndex; break; } diff --git a/PCK-Studio/Forms/Skins-And-Textures/SkinPreview.cs b/PCK-Studio/Forms/Skins-And-Textures/SkinPreview.cs index ce9fee5a..e00dd5e2 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/SkinPreview.cs +++ b/PCK-Studio/Forms/Skins-And-Textures/SkinPreview.cs @@ -1,9 +1,9 @@ using System; using System.Drawing; using PckStudio.Classes.Models.DefaultModels; -using PckStudio.ToolboxItems; -using PckStudio.Classes.Utils; +using PckStudio.Internal; using PckStudio.Models; +using PckStudio.ToolboxItems; namespace PckStudio.Forms { diff --git a/PCK-Studio/Forms/Skins-And-Textures/addnewskin.cs b/PCK-Studio/Forms/Skins-And-Textures/addnewskin.cs index 92639e3a..38415221 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/addnewskin.cs +++ b/PCK-Studio/Forms/Skins-And-Textures/addnewskin.cs @@ -4,12 +4,12 @@ using System.IO; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using PckStudio.Classes.Utils; -using PckStudio.Classes._3ds.Utils; -using PckStudio.ToolboxItems; using OMI.Formats.Languages; using OMI.Formats.Pck; +using PckStudio.Internal; using PckStudio.Forms.Editor; +using PckStudio.Classes.IO._3DST; +using PckStudio.ToolboxItems; namespace PckStudio { @@ -88,7 +88,7 @@ namespace PckStudio //comboBoxSkinType.Text = "Steve (64x64)"; skinType = eSkinType._64x64HD; } - else if (img.Width == img.Height / 2) // 64x32 HD + else if (img.Height == img.Width / 2) // 64x32 HD { anim.SetFlag(ANIM_EFFECTS.RESOLUTION_64x64, false); anim.SetFlag(ANIM_EFFECTS.SLIM_MODEL, false); @@ -305,7 +305,8 @@ namespace PckStudio { using (var fs = File.OpenRead(ofdd.FileName)) { - CheckImage(_3DSUtil.GetImageFrom3DST(fs)); + var reader = new _3DSTextureReader(); + CheckImage(reader.FromStream(fs)); textSkinName.Text = Path.GetFileNameWithoutExtension(ofdd.FileName); } return; diff --git a/PCK-Studio/Forms/Skins-And-Textures/generateModel.cs b/PCK-Studio/Forms/Skins-And-Textures/generateModel.cs index dfe24b40..3e65ab99 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/generateModel.cs +++ b/PCK-Studio/Forms/Skins-And-Textures/generateModel.cs @@ -7,17 +7,20 @@ using System.Linq; using System.Windows.Forms; using System.Collections; using System.IO; +using System.Text.RegularExpressions; + using Newtonsoft.Json; using PckStudio.Classes.FileTypes; using System.Text.RegularExpressions; using PckStudio.ToolboxItems; using OMI.Formats.Pck; +using PckStudio.Internal; namespace PckStudio { public partial class GenerateModel : ThemeForm { - PictureBox skinPreview; + PictureBox skinPreview = new PictureBox(); eViewDirection direction = eViewDirection.front; @@ -46,12 +49,24 @@ namespace PckStudio // 64x64 Overlay Parts "HEADWEAR", "JACKET", - "SHOULDER0", - "SHOULDER1", "SLEEVE0", "SLEEVE1", + "WAIST", "PANTS0", "PANTS1", + "SOCK0", + "SOCK1", + + // Armor Parts + "HELMET", + "CHEST", "BODYARMOR", + "SHOULDER0", "ARMARMOR0", + "SHOULDER1", "ARMARMOR0", + "BELT", + "LEGGING0", + "LEGGING1", + "BOOT0", + "BOOT1", }; private static readonly string[] ValidModelOffsetTypes = new string[] @@ -66,50 +81,22 @@ namespace PckStudio // Armor Offsets "HELMET", - "CHEST", + "CHEST", "BODYARMOR", + "SHOULDER0", "ARMARMOR0", + "SHOULDER1", "ARMARMOR0", + "BELT", + "LEGGING0", + "LEGGING1", "BOOT0", "BOOT1", - "WAIST", - "PANTS0", - "PANTS1", "TOOL0", "TOOL1", }; - List modelParts = new List(); + List modelBoxes = new List(); List modelOffsets = new List(); - class ModelPart - { - public string Type; - public float X, Y, Z; - public float Width; - public float Height; - public float Length; - public int U, V; - - public ModelPart(string type, float x, float y, float z, float width, float height, float length, int u, int v) - { - Type = type; - X = x; - Y = y; - Z = z; - Width = width; - Height = height; - Length = length; - U = u; - V = v; - } - - public ValueTuple ToProperty() - { - string value = $"{Type} {X} {Y} {Z} {Width} {Height} {Length} {U} {V}"; - return new ValueTuple("BOX", value.Replace(',', '.')); - } - - } - class ModelOffset { public string Name; @@ -128,13 +115,13 @@ namespace PckStudio } - public GenerateModel(PckFile.PCKProperties skinProperties, PictureBox preview) + public GenerateModel(PckFile.PCKProperties skinProperties, Image texture) { InitializeComponent(); boxes = skinProperties; - skinPreview = preview; - if (texturePreview.Image == null) - texturePreview.Image = new Bitmap(64, 64); + texturePreview.Image = texture; + comboParent.Items.Clear(); + ValidModelBoxTypes.ToList().ForEach(p => comboParent.Items.Add(p)); loadData(); } private static readonly Regex sWhitespace = new Regex(@"\s+"); @@ -152,56 +139,14 @@ namespace PckStudio { case "BOX": { - string[] Format = ReplaceWhitespace(property.Item2, ",").TrimEnd('\n', '\r', ' ').Split(','); - if (Format.Length < 9) - { - Console.WriteLine($"'{property.Item1}' property has too few arguments: {property.Item2}"); - continue; - } - string name = Format[0]; + var box = SkinBOX.FromString(property.Item2); + + string name = box.Type; if (ValidModelBoxTypes.Contains(name)) { - // %10ls = name - // %f - // %f - // %f - // %f - // %f - // %f - // %f - // %f - // %d - // %d - // %f - try - { - float x = float.Parse(Format[1]); - float y = float.Parse(Format[2]); - float z = float.Parse(Format[3]); - float sizeX = float.Parse(Format[4]); - float sizeY = float.Parse(Format[5]); - float sizeZ = float.Parse(Format[6]); - int u = int.Parse(Format[7]); - int v = int.Parse(Format[8]); - modelParts.Add(new ModelPart(name, x, y, z, sizeX, sizeY, sizeZ, u, v)); - } - catch (FormatException ex) - { - Console.WriteLine(ex.Message); - MessageBox.Show("A Format Exception was thrown\nFailed to parse BOX value", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - catch (OverflowException ex) - { - Console.WriteLine(ex.Message); - MessageBox.Show("An Overflow Exception was thrown\nFailed to parse BOX value", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - if (Format.Length >= 11) - { - string unk1 = Format[9]; - string unk2 = Format[10]; - Console.WriteLine($"{unk1} | {unk2}"); + modelBoxes.Add(box); } + comboParent.Enabled = true; break; } @@ -260,52 +205,76 @@ namespace PckStudio float legY = (displayBox.Height / 2) + 85; // -80; float groundLevel = (displayBox.Height / 2) + 145; graphics.DrawLine(Pens.White, 0, groundLevel, displayBox.Width, groundLevel); + float gfx_scale = texturePreview.Image.Width / 64; // used for displaying larger graphics properly; 64 is the base skin width for all models + // Chooses Render settings based on current direction foreach (ListViewItem listViewItem in listViewBoxes.Items) { - if (!(listViewItem.Tag is ModelPart)) continue; - ModelPart part = listViewItem.Tag as ModelPart; + if (!(listViewItem.Tag is SkinBOX part)) + continue; float x = displayBox.Width / 2; float y = 0; + switch (direction) { case eViewDirection.front: { //Sets X & Y based on model part class // listViewItem.Text -> part.Type - // listViewItem.SubItems[1] -> part.X - // listViewItem.SubItems[2] -> part.Y - // listViewItem.SubItems[3] -> part.Z - // listViewItem.SubItems[4] -> part.Width - // listViewItem.SubItems[5] -> part.Height - // listViewItem.SubItems[6] -> part.Length + // listViewItem.SubItems[1] -> part.Pos.X + // listViewItem.SubItems[2] -> part.Pos.Y + // listViewItem.SubItems[3] -> part.Pos.Z + // listViewItem.SubItems[4] -> part.Size.X + // listViewItem.SubItems[5] -> part.Size.Y + // listViewItem.SubItems[6] -> part.Size.Z // listViewItem.SubItems[7] -> part.U // listViewItem.SubItems[8] -> part.V switch (part.Type) { case "HEAD": + case "HEADWEAR": + case "HELMET": y = headbodyY + int.Parse(offsetHead.Text) * 5; break; case "BODY": + case "JACKET": + case "CHEST": + case "BODYARMOR": + case "BELT": + case "WAIST": y = headbodyY + int.Parse(offsetBody.Text) * 5; break; case "ARM0": + case "ARMARMOR0": + case "SLEEVE0": + case "SHOULDER0": x -= 25; y = armY + int.Parse(offsetArms.Text) * 5; break; case "ARM1": + case "ARMARMOR1": + case "SLEEVE1": + case "SHOULDER1": x += 25; y = armY + int.Parse(offsetArms.Text) * 5; break; case "LEG0": + case "PANTS0": + case "SOCK0": + case "LEGGING0": + case "BOOT0": x -= 10; y = legY + int.Parse(offsetLegs.Text) * 5; break; case "LEG1": + case "PANTS1": + case "SOCK1": + case "LEGGING1": + case "BOOT1": x += 10; y = legY + int.Parse(offsetLegs.Text) * 5; break; @@ -315,20 +284,20 @@ namespace PckStudio if (!checkTextureGenerate.Checked) { RectangleF destRect = new RectangleF( - x + part.X * 5, - y + part.Y * 5, - part.Width * 5, - part.Height * 5); + x + part.Pos.X * 5, + y + part.Pos.Y * 5, + part.Size.X * 5, + part.Size.Y * 5); RectangleF srcRect = new RectangleF( - part.U + part.Length, - part.V + part.Length, - part.Width, - part.Height); + (part.UV.X + part.Size.Z) * gfx_scale, + (part.UV.Y + part.Size.Z) * gfx_scale, + part.Size.X * gfx_scale, + part.Size.Y * gfx_scale); graphics.DrawImage(texturePreview.Image, destRect, srcRect, GraphicsUnit.Pixel); } else { - graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.X * 5, y + part.Y * 5, part.Width * 5, part.Height * 5); + graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.Pos.X * 5, y + part.Pos.Y * 5, part.Size.X * 5, part.Size.Y * 5); } break; @@ -340,27 +309,47 @@ namespace PckStudio switch (part.Type) { case "HEAD": - y = headbodyY + float.Parse(offsetHead.Text) * 5; + case "HEADWEAR": + case "HELMET": + y = headbodyY + int.Parse(offsetHead.Text) * 5; break; - case "BODY": - y = headbodyY + float.Parse(offsetBody.Text) * 5; + case "JACKET": + case "CHEST": + case "BODYARMOR": + case "BELT": + case "WAIST": + y = headbodyY + int.Parse(offsetBody.Text) * 5; break; case "ARM0": - y = armY + float.Parse(offsetArms.Text) * 5; + case "ARMARMOR0": + case "SLEEVE0": + case "SHOULDER0": + y = armY + int.Parse(offsetArms.Text) * 5; break; case "ARM1": - y = armY + float.Parse(offsetArms.Text) * 5; + case "ARMARMOR1": + case "SLEEVE1": + case "SHOULDER1": + y = armY + int.Parse(offsetArms.Text) * 5; break; case "LEG0": - y = legY + float.Parse(offsetLegs.Text) * 5; + case "PANTS0": + case "SOCK0": + case "LEGGING0": + case "BOOT0": + y = legY + int.Parse(offsetLegs.Text) * 5; break; case "LEG1": - y = legY + float.Parse(offsetLegs.Text) * 5; + case "PANTS1": + case "SOCK1": + case "LEGGING1": + case "BOOT1": + y = legY + int.Parse(offsetLegs.Text) * 5; break; } @@ -368,21 +357,21 @@ namespace PckStudio if (!checkTextureGenerate.Checked) { RectangleF destRect = new RectangleF( - x + part.Z * 5, - y + part.Y * 5, - part.Length * 5, - part.Height * 5); + x + part.Pos.Z * 5, + y + part.Pos.Y * 5, + part.Size.Z * 5, + part.Size.Y * 5); RectangleF srcRect = new RectangleF( - part.U + part.Length + part.Width, - part.V + part.Length, - part.Length, - part.Height); + (part.UV.X + part.Size.Z + part.Size.X) * gfx_scale, + (part.UV.Y + part.Size.Z) * gfx_scale, + part.Size.Z * gfx_scale, + part.Size.Y * gfx_scale); graphics.DrawImage(texturePreview.Image, destRect, srcRect, GraphicsUnit.Pixel); } else { //Draws Part - graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.Z * 5, y + part.Y * 5, part.Length * 5, part.Height * 5); + graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.Pos.Z * 5, y + part.Pos.Y * 5, part.Size.Z * 5, part.Size.Y * 5); } bitmapModelPreview.RotateFlip(RotateFlipType.RotateNoneFlipX); break; @@ -394,26 +383,51 @@ namespace PckStudio switch (part.Type) { case "HEAD": - y = headbodyY + float.Parse(offsetHead.Text) * 5; + case "HEADWEAR": + case "HELMET": + y = headbodyY + int.Parse(offsetHead.Text) * 5; break; case "BODY": - y = headbodyY + float.Parse(offsetBody.Text) * 5; + case "JACKET": + case "CHEST": + case "BODYARMOR": + case "BELT": + case "WAIST": + y = headbodyY + int.Parse(offsetBody.Text) * 5; break; + case "ARM0": + case "ARMARMOR0": + case "SLEEVE0": + case "SHOULDER0": x -= 25; - y = armY + float.Parse(offsetArms.Text) * 5; + y = armY + int.Parse(offsetArms.Text) * 5; break; + case "ARM1": + case "ARMARMOR1": + case "SLEEVE1": + case "SHOULDER1": x += 25; - y = armY + float.Parse(offsetArms.Text) * 5; + y = armY + int.Parse(offsetArms.Text) * 5; break; + case "LEG0": + case "PANTS0": + case "SOCK0": + case "LEGGING0": + case "BOOT0": x -= 10; - y = legY + float.Parse(offsetLegs.Text) * 5; + y = legY + int.Parse(offsetLegs.Text) * 5; break; + case "LEG1": + case "PANTS1": + case "SOCK1": + case "LEGGING1": + case "BOOT1": x += 10; - y = legY + float.Parse(offsetLegs.Text) * 5; + y = legY + int.Parse(offsetLegs.Text) * 5; break; } @@ -421,21 +435,21 @@ namespace PckStudio if (!checkTextureGenerate.Checked) { RectangleF destRect = new RectangleF( - x + part.X * 5, - y + part.Y * 5, - part.Width * 5, - part.Height * 5); + x + part.Pos.X * 5, + y + part.Pos.Y * 5, + part.Size.X * 5, + part.Size.Y * 5); RectangleF srcRect = new RectangleF( - part.U + part.Length * 2 + part.Width, - part.V + part.Length, - part.Width, - part.Height); + (part.UV.X + part.Size.Z * 2 + part.Size.X) * gfx_scale, + (part.UV.Y + part.Size.Z) * gfx_scale, + part.Size.X * gfx_scale, + part.Size.Y * gfx_scale); graphics.DrawImage(texturePreview.Image, destRect, srcRect, GraphicsUnit.Pixel); } else { //Draws Part - graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.X * 5, y + part.Y * 5, part.Width * 5, part.Height * 5); + graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.Pos.X * 5, y + part.Pos.Y * 5, part.Size.X * 5, part.Size.Y * 5); } bitmapModelPreview.RotateFlip(RotateFlipType.RotateNoneFlipX); break; @@ -446,46 +460,68 @@ namespace PckStudio switch (part.Type) { case "HEAD": - y = headbodyY + float.Parse(offsetHead.Text) * 5; + case "HEADWEAR": + case "HELMET": + y = headbodyY + int.Parse(offsetHead.Text) * 5; break; case "BODY": - y = headbodyY + float.Parse(offsetBody.Text) * 5; + case "JACKET": + case "CHEST": + case "BODYARMOR": + case "BELT": + case "WAIST": + y = headbodyY + int.Parse(offsetBody.Text) * 5; break; case "ARM0": - y = armY + float.Parse(offsetArms.Text) * 5; + case "ARMARMOR0": + case "SLEEVE0": + case "SHOULDER0": + y = armY + int.Parse(offsetArms.Text) * 5; break; + case "ARM1": - y = armY + float.Parse(offsetArms.Text) * 5; + case "ARMARMOR1": + case "SLEEVE1": + case "SHOULDER1": + y = armY + int.Parse(offsetArms.Text) * 5; break; case "LEG0": - y = legY + float.Parse(offsetLegs.Text) * 5; + case "PANTS0": + case "SOCK0": + case "LEGGING0": + case "BOOT0": + y = legY + int.Parse(offsetLegs.Text) * 5; break; case "LEG1": - y = legY + float.Parse(offsetLegs.Text) * 5; + case "PANTS1": + case "SOCK1": + case "LEGGING1": + case "BOOT1": + y = legY + int.Parse(offsetLegs.Text) * 5; break; } //Maps imported Texture if auto texture is disabled if (!checkTextureGenerate.Checked) { RectangleF destRect = new RectangleF( - x + part.Z * 5, - y + part.Y * 5, - part.Length * 5, - part.Height * 5); + x + part.Pos.Z * 5, + y + part.Pos.Y * 5, + part.Size.Z * 5, + part.Size.Y * 5); RectangleF srcRect = new RectangleF( - part.U + part.Length + part.Width, - part.V + part.Length, - part.Length, - part.Height); + (part.UV.X + part.Size.Z + part.Size.X) * gfx_scale, + (part.UV.Y + part.Size.Z) * gfx_scale, + part.Size.Z * gfx_scale, + part.Size.Y * gfx_scale); graphics.DrawImage(texturePreview.Image, destRect, srcRect, GraphicsUnit.Pixel); } else { //Draws Part - graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.Z * 5, y + part.Y * 5, part.Length * 5, part.Height * 5); + graphics.FillRectangle(new SolidBrush(listViewItem.ForeColor), x + part.Pos.Z * 5, y + part.Pos.Y * 5, part.Size.Z * 5, part.Size.Y * 5); } break; } @@ -507,13 +543,13 @@ namespace PckStudio Bitmap bitmapAutoTexture = new Bitmap(texturePreview.Width, texturePreview.Height); using (Graphics graphics = Graphics.FromImage(bitmapAutoTexture)) { - foreach (var part in modelParts) + foreach (var part in modelBoxes) { - float width = part.Width * 2; - float height = part.Height * 2; - float length = part.Length * 2; - int u = part.U * 2; - int v = part.V * 2; + float width = part.Size.X * 2; + float height = part.Size.Y * 2; + float length = part.Size.Z * 2; + float u = part.UV.X * 2; + float v = part.UV.Y * 2; Random r = new Random(); Brush brush = new SolidBrush(Color.FromArgb(r.Next(int.MinValue, int.MaxValue))); graphics.FillRectangle(brush, u + length, v, width, length); @@ -839,7 +875,7 @@ namespace PckStudio //Creates Item private void createToolStripMenuItem_Click(object sender, EventArgs e) { - modelParts.Add(new ModelPart("New Part", 0, 0, 0, 0, 0, 0, 0, 0)); + modelBoxes.Add(SkinBOX.FromString("NEW_BOX 0 0 0 1 1 1 0 0 0 0 0")); updateListView(); render(); } @@ -849,21 +885,21 @@ namespace PckStudio private void listView1_SelectedIndexChanged(object sender, EventArgs e) { changeColorToolStripMenuItem.Visible = false; - if (listViewBoxes.SelectedItems.Count != 0 && listViewBoxes.SelectedItems[0].Tag is ModelPart) + if (listViewBoxes.SelectedItems.Count != 0 && listViewBoxes.SelectedItems[0].Tag is SkinBOX) { changeColorToolStripMenuItem.Visible = true; - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; + var part = listViewBoxes.SelectedItems[0].Tag as SkinBOX; //graphics.DrawRectangle(Pens.Yellow, x + (float)double.Parse(this.selected.SubItems[3].Text) * 5 - 1, y + (float)double.Parse(this.selected.SubItems[2].Text) * 5 - 1, (float)double.Parse(this.selected.SubItems[6].Text) * 5 + 2, (float)double.Parse(this.selected.SubItems[5].Text) * 5 + 2); //graphics.DrawRectangle(Pens.Black, x + (float)double.Parse(this.selected.SubItems[3].Text) * 5, y + (float)double.Parse(this.selected.SubItems[2].Text) * 5, (float)double.Parse(this.selected.SubItems[6].Text) * 5, (float)double.Parse(this.selected.SubItems[5].Text) * 5); comboParent.Text = part.Type; - PosXUpDown.Value = (decimal)part.X; - PosYUpDown.Value = (decimal)part.Y; - PosZUpDown.Value = (decimal)part.Z; - SizeXUpDown.Value = (decimal)part.Width; - SizeYUpDown.Value = (decimal)part.Height; - SizeZUpDown.Value = (decimal)part.Length; - TextureXUpDown.Value = part.U; - TextureYUpDown.Value = part.V; + PosXUpDown.Value = (decimal)part.Pos.X; + PosYUpDown.Value = (decimal)part.Pos.Y; + PosZUpDown.Value = (decimal)part.Pos.Z; + SizeXUpDown.Value = (decimal)part.Size.X; + SizeYUpDown.Value = (decimal)part.Size.Y; + SizeZUpDown.Value = (decimal)part.Size.Z; + TextureXUpDown.Value = (decimal)part.UV.X; + TextureYUpDown.Value = (decimal)part.UV.Y; render(); } } @@ -873,9 +909,8 @@ namespace PckStudio private void comboParent_SelectedIndexChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; part.Type = comboParent.Text; buttonIMPORT.Enabled = true; buttonEXPORT.Enabled = true; @@ -894,10 +929,9 @@ namespace PckStudio private void SizeXUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.Width = (float)SizeXUpDown.Value; + part.Size.X = (float)SizeXUpDown.Value; } updateListView(); render(); @@ -906,10 +940,9 @@ namespace PckStudio private void SizeYUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.Height = (float)SizeYUpDown.Value; + part.Size.Y = (float)SizeYUpDown.Value; } updateListView(); render(); @@ -918,10 +951,9 @@ namespace PckStudio private void SizeZUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.Length = (float)SizeZUpDown.Value; + part.Size.Z = (float)SizeZUpDown.Value; } updateListView(); render(); @@ -930,10 +962,9 @@ namespace PckStudio private void PosXUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.X = (float)PosXUpDown.Value; + part.Pos.X = (float)PosXUpDown.Value; } updateListView(); render(); @@ -943,10 +974,9 @@ namespace PckStudio private void PosYUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.Y = (float)PosYUpDown.Value; + part.Pos.Y = (float)PosYUpDown.Value; } updateListView(); render(); @@ -956,10 +986,9 @@ namespace PckStudio private void PosZUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.Z = (float)PosZUpDown.Value; + part.Pos.Z = (float)PosZUpDown.Value; } updateListView(); render(); @@ -998,10 +1027,9 @@ namespace PckStudio private void TextureXUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.U = (int)TextureXUpDown.Value; + part.UV.X = (int)TextureXUpDown.Value; } updateListView(); render(); @@ -1012,10 +1040,9 @@ namespace PckStudio private void TextureYUpDown_ValueChanged(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; - part.V = (int)TextureXUpDown.Value; + part.UV.Y = (int)TextureYUpDown.Value; } updateListView(); render(); @@ -1042,18 +1069,29 @@ namespace PckStudio OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "PNG Image Files | *.png"; openFileDialog.Title = "Select Skin Texture"; - if (openFileDialog.ShowDialog() == DialogResult.OK && Image.FromFile(openFileDialog.FileName).Width == Image.FromFile(openFileDialog.FileName).Height) + + if (openFileDialog.ShowDialog() == DialogResult.OK) // skins can only be a 1:1 ratio (base 64x64) or a 2:1 ratio (base 64x32) { - checkTextureGenerate.Checked = false; - Bitmap bitmap = new Bitmap(64, 64); - using (Graphics graphics = Graphics.FromImage(bitmap)) - { - graphics.DrawImage(Image.FromFile(openFileDialog.FileName), 0, 0, 64, 64); - graphics.InterpolationMode = InterpolationMode.NearestNeighbor; + using (var img = Image.FromFile(openFileDialog.FileName)) + { + if ((img.Width == img.Height || img.Height == img.Width / 2)) + { + checkTextureGenerate.Checked = false; + Bitmap bitmap = new Bitmap(img.Width, img.Width); + using (Graphics graphics = Graphics.FromImage(bitmap)) + { + graphics.DrawImage(img, 0, 0, img.Width, img.Height); + graphics.InterpolationMode = InterpolationMode.NearestNeighbor; + } + texturePreview.Image = bitmap; + render(); + } + else + { + MessageBox.Show(this, "Not a valid skin file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } - texturePreview.Image = bitmap; } - render(); } @@ -1061,7 +1099,7 @@ namespace PckStudio private void buttonDone_Click(object sender, EventArgs e) { Bitmap bitmap1 = new Bitmap(displayBox.Width, displayBox.Height); - foreach (var part in modelParts) + foreach (var part in modelBoxes) { boxes.Add(part.ToProperty()); } @@ -1110,12 +1148,12 @@ namespace PckStudio //Loads in model template(Steve) private void buttonTemplate_Click(object sender, EventArgs e) { - modelParts.Add(new ModelPart("HEAD", -4, -8, -4, 8, 8, 8, 0, 0)); - modelParts.Add(new ModelPart("BODY", -4, 0, -2, 8, 12, 4, 16, 16)); - modelParts.Add(new ModelPart("ARM0", -3, -2, -2, 4, 12, 4, 40, 16)); - modelParts.Add(new ModelPart("ARM1", -1, -2, -2, 4, 12, 4, 40, 16)); - modelParts.Add(new ModelPart("LEG0", -2, 0, -2, 4, 12, 4, 0, 16)); - modelParts.Add(new ModelPart("LEG1", -2, 0, -2, 4, 12, 4, 0, 16)); + modelBoxes.Add(SkinBOX.FromString("HEAD -4 -8 -4 8 8 8 0 0 0 0 0")); + modelBoxes.Add(SkinBOX.FromString("BODY -4 0 -2 8 12 4 16 16 0 0 0")); + modelBoxes.Add(SkinBOX.FromString("ARM0 -3 -2 -2 4 12 4 40 16 0 0 0")); + modelBoxes.Add(SkinBOX.FromString("ARM1 -1 -2 -2 4 12 4 40 16 0 1 0")); + modelBoxes.Add(SkinBOX.FromString("LEG0 -2 0 -2 4 12 4 0 16 0 0 0")); + modelBoxes.Add(SkinBOX.FromString("LEG1 -2 0 -2 4 12 4 0 16 0 1 0")); comboParent.Enabled = true; updateListView(); render(); @@ -1124,18 +1162,18 @@ namespace PckStudio private void updateListView() { listViewBoxes.Items.Clear(); - foreach (var part in modelParts) + foreach (var part in modelBoxes) { ListViewItem listViewItem = new ListViewItem(part.Type); listViewItem.Tag = part; - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.X.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Y.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Z.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Width.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Height.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Length.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.U.ToString())); - listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.V.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Pos.X.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Pos.Y.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Pos.Z.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Size.X.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Size.Y.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.Size.Z.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.UV.X.ToString())); + listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, part.UV.Y.ToString())); listViewBoxes.Items.Add(listViewItem); } } @@ -1174,27 +1212,25 @@ namespace PckStudio listViewBoxes.Items.Clear(); string str1 = File.ReadAllText(openFileDialog.FileName); - modelParts.Clear(); + modelBoxes.Clear(); List lines = str1.Split(new[] { "\n\r", "\n" }, StringSplitOptions.None).ToList(); if (string.IsNullOrEmpty(lines[lines.Count - 1])) lines.RemoveAt(lines.Count - 1); - int currentLine = 0; - int passedlines = 0; - for (int i = 0; i < lines.Count;) + for (int i = 0; i < lines.Count; i += 11) { - string name = lines[0 + passedlines]; - string parent = lines[1 + passedlines]; - float PosX = float.Parse(lines[3 + passedlines]); - float PosY = float.Parse(lines[4 + passedlines]); - float PosZ = float.Parse(lines[5 + passedlines]); - float SizeX = float.Parse(lines[6 + passedlines]); - float SizeY = float.Parse(lines[7 + passedlines]); - float SizeZ = float.Parse(lines[8 + passedlines]); - int UvX = int.Parse(lines[9 + passedlines]); - int UvY = int.Parse(lines[10 + passedlines]); - passedlines += 11; - i += 11; - modelParts.Add(new ModelPart(parent, PosX, PosY, PosZ, SizeX, SizeY, SizeZ, UvX, UvY)); + string name = lines[0 + i]; + string parent = lines[1 + i]; + float PosX = float.Parse(lines[3 + i]); + float PosY = float.Parse(lines[4 + i]); + float PosZ = float.Parse(lines[5 + i]); + float SizeX = float.Parse(lines[6 + i]); + float SizeY = float.Parse(lines[7 + i]); + float SizeZ = float.Parse(lines[8 + i]); + float UvX = float.Parse(lines[9 + i]); + float UvY = float.Parse(lines[10 + i]); + + // CSM doesn't support armor, mirror, or scale values as far as I know of - May + modelBoxes.Add(SkinBOX.FromString($"{parent} {PosX} {PosY} {PosZ} {SizeX} {SizeY} {SizeZ} {UvX} {UvY} {false} {false} {0}")); } } comboParent.Enabled = true; @@ -1281,18 +1317,17 @@ namespace PckStudio private void listView1_Click(object sender, EventArgs e) { if (listViewBoxes.SelectedItems.Count != 0 && listViewBoxes.SelectedItems[0] != null && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - var part = listViewBoxes.SelectedItems[0].Tag as ModelPart; comboParent.Text = part.Type; - PosXUpDown.Value = (decimal)part.X; - PosYUpDown.Value = (decimal)part.Y; - PosZUpDown.Value = (decimal)part.Z; - SizeXUpDown.Value = (decimal)part.Width; - SizeYUpDown.Value = (decimal)part.Height; - SizeZUpDown.Value = (decimal)part.Length; - TextureXUpDown.Value = part.U; - TextureYUpDown.Value = part.V; + PosXUpDown.Value = (decimal)part.Pos.X; + PosYUpDown.Value = (decimal)part.Pos.Y; + PosZUpDown.Value = (decimal)part.Pos.Z; + SizeXUpDown.Value = (decimal)part.Size.X; + SizeYUpDown.Value = (decimal)part.Size.Y; + SizeZUpDown.Value = (decimal)part.Size.Z; + TextureXUpDown.Value = (decimal)part.UV.X; + TextureYUpDown.Value = (decimal)part.UV.Y; SizeXUpDown.Enabled = true; SizeYUpDown.Enabled = true; SizeZUpDown.Enabled = true; @@ -1331,9 +1366,9 @@ namespace PckStudio private void delStuffUsingDelKey(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete && listViewBoxes.SelectedItems.Count != 0 && - listViewBoxes.SelectedItems[0].Tag is ModelPart) + listViewBoxes.SelectedItems[0].Tag is SkinBOX part) { - if (modelParts.Remove(listViewBoxes.SelectedItems[0].Tag as ModelPart)) + if (modelBoxes.Remove(part)) listViewBoxes.SelectedItems[0].Remove(); render(); } diff --git a/PCK-Studio/Forms/Skins-And-Textures/generateModel.resx b/PCK-Studio/Forms/Skins-And-Textures/generateModel.resx index 77b58380..b7a78d0d 100644 --- a/PCK-Studio/Forms/Skins-And-Textures/generateModel.resx +++ b/PCK-Studio/Forms/Skins-And-Textures/generateModel.resx @@ -610,7 +610,7 @@ myTablePanel2 - PckStudio.Forms.MyTablePanel, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tabPage1 diff --git a/PCK-Studio/Forms/Utilities/AnimationResources.cs b/PCK-Studio/Forms/Utilities/AnimationResources.cs index 4d8c1f4a..237d153a 100644 --- a/PCK-Studio/Forms/Utilities/AnimationResources.cs +++ b/PCK-Studio/Forms/Utilities/AnimationResources.cs @@ -1,12 +1,9 @@ using Newtonsoft.Json.Linq; using System.Drawing; using System.Linq; -using System.IO; using PckStudio.Properties; -using System.Drawing.Imaging; -using PckStudio.Classes.Extentions; -using OMI.Formats.Pck; +using PckStudio.Extensions; namespace PckStudio.Forms.Utilities { diff --git a/PCK-Studio/Forms/Utilities/BehaviourResources.cs b/PCK-Studio/Forms/Utilities/BehaviourResources.cs index 763c4e71..36d295b8 100644 --- a/PCK-Studio/Forms/Utilities/BehaviourResources.cs +++ b/PCK-Studio/Forms/Utilities/BehaviourResources.cs @@ -4,17 +4,15 @@ using System.Linq; using System.IO; using PckStudio.Properties; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using OMI.Formats.Behaviour; using OMI.Workers.Behaviour; -using OMI.Formats.Pck; -using System; namespace PckStudio.Forms.Utilities { public static class BehaviourResources { - public static readonly JObject entityData = JObject.Parse(Resources.entityBehaviourData); + public static readonly JObject entityData = JObject.Parse(Resources.entityData); private static Image[] _entityImages; public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray(); diff --git a/PCK-Studio/Forms/Utilities/MaterialResources.cs b/PCK-Studio/Forms/Utilities/MaterialResources.cs index 7d27eda1..ccc1493d 100644 --- a/PCK-Studio/Forms/Utilities/MaterialResources.cs +++ b/PCK-Studio/Forms/Utilities/MaterialResources.cs @@ -4,7 +4,7 @@ using System.Linq; using System.IO; using PckStudio.Properties; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using OMI.Formats.Pck; using OMI.Formats.Material; using OMI.Workers.Material; @@ -14,7 +14,7 @@ namespace PckStudio.Forms.Utilities { public static class MaterialResources { - public static readonly JObject entityData = JObject.Parse(Resources.entityMaterialData); + public static readonly JObject entityData = JObject.Parse(Resources.entityData); private static Image[] _entityImages; public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray(); diff --git a/PCK-Studio/Forms/Utilities/ModelsResources.cs b/PCK-Studio/Forms/Utilities/ModelsResources.cs index cdf91454..47795210 100644 --- a/PCK-Studio/Forms/Utilities/ModelsResources.cs +++ b/PCK-Studio/Forms/Utilities/ModelsResources.cs @@ -4,7 +4,7 @@ using System.Linq; using System.IO; using PckStudio.Properties; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using OMI.Formats.Model; using OMI.Formats.Pck; using OMI.Workers.Model; @@ -13,7 +13,7 @@ namespace PckStudio.Forms.Utilities { public static class ModelsResources { - public static readonly JObject entityData = JObject.Parse(Resources.entityModelData); + public static readonly JObject entityData = JObject.Parse(Resources.entityData); private static Image[] _entityImages; public static Image[] entityImages => _entityImages ??= Resources.entities_sheet.CreateImageList(32).ToArray(); diff --git a/PCK-Studio/Forms/Utilities/TextureConverterUtility.cs b/PCK-Studio/Forms/Utilities/TextureConverterUtility.cs index 317fc9e6..7cab8e53 100644 --- a/PCK-Studio/Forms/Utilities/TextureConverterUtility.cs +++ b/PCK-Studio/Forms/Utilities/TextureConverterUtility.cs @@ -5,11 +5,11 @@ using System.Drawing.Imaging; using System.Windows.Forms; using PckStudio.ToolboxItems; using PckStudio.Properties; -using PckStudio.Classes.FileTypes; using OMI.Formats.Pck; namespace PckStudio.Forms.Utilities { + [Obsolete()] public partial class TextureConverterUtility : ThemeForm { public TextureConverterUtility(TreeView tv0, PckFile pck) diff --git a/PCK-Studio/Forms/Utilities/pckCenterOpen.cs b/PCK-Studio/Forms/Utilities/pckCenterOpen.cs index 14edd839..0a2a8b6d 100644 --- a/PCK-Studio/Forms/Utilities/pckCenterOpen.cs +++ b/PCK-Studio/Forms/Utilities/pckCenterOpen.cs @@ -19,7 +19,7 @@ using PckStudio.Classes.FileTypes; using PckStudio.Classes.IO.PCK; using OMI.Formats.Pck; using OMI.Workers.Pck; -using PckStudio.Classes.Extentions; +using PckStudio.Extensions; using PckStudio.ToolboxItems; namespace PckStudio.Forms @@ -1028,7 +1028,7 @@ namespace PckStudio.Forms { var ms = new MemoryStream(skinTexture.Data); Bitmap saveSkin = new Bitmap(Image.FromStream(ms)); - var config = new ImageExtentions.GraphicsConfig() + var config = new GraphicsConfig() { CompositingMode = CompositingMode.SourceCopy, CompositingQuality = CompositingQuality.HighQuality, diff --git a/PCK-Studio/Internals/ApplicationBuildInfo.cs b/PCK-Studio/Internals/ApplicationBuildInfo.cs new file mode 100644 index 00000000..acd9f6e8 --- /dev/null +++ b/PCK-Studio/Internals/ApplicationBuildInfo.cs @@ -0,0 +1,47 @@ +/* Copyright (c) 2023-present miku-666, MattNL + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. +**/ +using System; +using System.IO; +using System.Reflection; + +namespace PckStudio.Internal +{ + static internal class ApplicationBuildInfo + { + // this is to specify which build release this is. This is manually updated for now + // TODO: add different chars for different configurations + private const string BuildType = "b"; + private static System.Globalization.Calendar _buildCalendar; + private static DateTime date = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime; + private static string _betaBuildVersion; + + public static string BetaBuildVersion + { + get + { + // adopted Minecraft Java Edition Snapshot format (YYwWWn) + // to keep better track of work in progress features and builds + _buildCalendar ??= new System.Globalization.CultureInfo("en-US").Calendar; + return _betaBuildVersion ??= string.Format("#{0}w{1}{2}", + date.ToString("yy"), + _buildCalendar.GetWeekOfYear(date, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday), + BuildType); + } + } + } +} diff --git a/PCK-Studio/Internals/CommitInfo.cs b/PCK-Studio/Internals/CommitInfo.cs new file mode 100644 index 00000000..1ccfe3e0 --- /dev/null +++ b/PCK-Studio/Internals/CommitInfo.cs @@ -0,0 +1,50 @@ +/* Copyright (c) 2023-present miku-666 + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. +**/ +using System.Linq; +using System.Reflection; + +namespace PckStudio.Internal +{ + static internal class CommitInfo + { + private static string _branchName = null; + private static string _commitHash = null; + + public static string BranchName + { + get + { + return _branchName ??= Assembly + .GetEntryAssembly() + .GetCustomAttributes() + .FirstOrDefault(attr => attr.Key == "GitBranch")?.Value; + } + } + + public static string CommitHash + { + get + { + return _commitHash ??= Assembly + .GetEntryAssembly() + .GetCustomAttributes() + .FirstOrDefault(attr => attr.Key == "GitHash")?.Value; + } + } + } +} diff --git a/PCK-Studio/Classes/Utils/SkinANIM.cs b/PCK-Studio/Internals/SkinANIM.cs similarity index 99% rename from PCK-Studio/Classes/Utils/SkinANIM.cs rename to PCK-Studio/Internals/SkinANIM.cs index 58f56a2e..13fd332e 100644 --- a/PCK-Studio/Classes/Utils/SkinANIM.cs +++ b/PCK-Studio/Internals/SkinANIM.cs @@ -18,7 +18,7 @@ using System; using System.Text.RegularExpressions; -namespace PckStudio.Classes.Utils +namespace PckStudio.Internal { /// /// For usage see diff --git a/PCK-Studio/Internals/SkinBOX.cs b/PCK-Studio/Internals/SkinBOX.cs new file mode 100644 index 00000000..764444e7 --- /dev/null +++ b/PCK-Studio/Internals/SkinBOX.cs @@ -0,0 +1,113 @@ +/* Copyright (c) 2023-present miku-666, MattNL + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1.The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. +**/ +using System; +using System.Numerics; + +namespace PckStudio.Internal +{ + public class SkinBOX : ICloneable, IEquatable + { + public string Type; + public Vector3 Pos; + public Vector3 Size; + public Vector2 UV; + public bool HideWithArmor; + public bool Mirror; + public float Scale; + + public SkinBOX(string type, Vector3 pos, Vector3 size, Vector2 uv, + bool hideWithArmor = false, bool mirror = false, float scale = 0.0f) + { + Type = type; + Pos = pos; + Size = size; + UV = uv; + HideWithArmor = hideWithArmor; + Mirror = mirror; + Scale = scale; + } + + public static SkinBOX FromString(string value) + { + var arguments = value.Split(' '); + if (arguments.Length < 9) + { + throw new ArgumentException("Arguments must have at least a length of 9"); + } + var type = arguments[0]; + var pos = TryGetVector3(arguments, 1); + var size = TryGetVector3(arguments, 4); + var uv = TryGetVector2(arguments, 7); + var skinBox = new SkinBOX(type, pos, size, uv); + if (arguments.Length >= 10) + skinBox.HideWithArmor = arguments[9] == "1"; + if (arguments.Length >= 11) + skinBox.Mirror = arguments[10] == "1"; + if (arguments.Length >= 12) + float.TryParse(arguments[11], out skinBox.Scale); + return skinBox; + } + + public ValueTuple ToProperty() + { + return new ValueTuple("BOX", ToString().Replace(',', '.')); + } + + public override string ToString() + { + return $"{Type} {Pos.X} {Pos.Y} {Pos.Z} {Size.X} {Size.Y} {Size.Z} {UV.X} {UV.Y} {Convert.ToInt32(HideWithArmor)} {Convert.ToInt32(Mirror)} {Scale}"; + } + + private static Vector2 TryGetVector2(string[] arguments, int startIndex) + { + float.TryParse(arguments[startIndex], out float x); + float.TryParse(arguments[startIndex + 1], out float y); + return new Vector2(x, y); + } + + private static Vector3 TryGetVector3(string[] arguments, int startIndex) + { + var vec2 = TryGetVector2(arguments, startIndex); + float.TryParse(arguments[startIndex + 2], out float z); + return new Vector3(vec2, z); + } + + public override int GetHashCode() + { + return Type.GetHashCode() % Pos.GetHashCode() * UV.GetHashCode() % Size.GetHashCode(); + } + + public override bool Equals(object obj) + { + return obj is SkinBOX box && Equals(box); + } + + public bool Equals(SkinBOX other) + { + return Type.Equals(other.Type) && + Pos.Equals(other.Pos) && + Size.Equals(other.Size) && + UV.Equals(other.UV); + } + + public object Clone() + { + return new SkinBOX((string)Type.Clone(), Pos, Size, UV, HideWithArmor, Mirror, Scale); + } + } +} diff --git a/PCK-Studio/MainForm.Designer.cs b/PCK-Studio/MainForm.Designer.cs index ca73f58a..001ce0cf 100644 --- a/PCK-Studio/MainForm.Designer.cs +++ b/PCK-Studio/MainForm.Designer.cs @@ -77,13 +77,15 @@ this.extractToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.convertPCTextrurePackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.advancedMetaAddingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.convertToBedrockToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.miscToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addCustomPackImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.convertMusicFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.wavBinkaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.binkaWavToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.programInfoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.binkaConversionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -108,6 +110,7 @@ this.PS3PCKInstallerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.VitaPCKInstallerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.joinDevelopmentDiscordToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.trelloBoardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuMetaTree = new System.Windows.Forms.ContextMenuStrip(this.components); this.addEntryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addMultipleEntriesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); @@ -424,7 +427,6 @@ this.extractToolStripMenuItem1, this.saveToolStripMenuItem1, this.saveToolStripMenuItem, - this.convertPCTextrurePackToolStripMenuItem, this.closeToolStripMenuItem}); this.fileToolStripMenuItem.ForeColor = System.Drawing.Color.White; resources.ApplyResources(this.fileToolStripMenuItem, "fileToolStripMenuItem"); @@ -481,12 +483,6 @@ this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveAsPCK); // - // convertPCTextrurePackToolStripMenuItem - // - this.convertPCTextrurePackToolStripMenuItem.Name = "convertPCTextrurePackToolStripMenuItem"; - resources.ApplyResources(this.convertPCTextrurePackToolStripMenuItem, "convertPCTextrurePackToolStripMenuItem"); - this.convertPCTextrurePackToolStripMenuItem.Click += new System.EventHandler(this.convertPCTextrurePackToolStripMenuItem_Click); - // // closeToolStripMenuItem // this.closeToolStripMenuItem.Name = "closeToolStripMenuItem"; @@ -517,7 +513,8 @@ // miscToolStripMenuItem // this.miscToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addCustomPackImageToolStripMenuItem}); + this.addCustomPackImageToolStripMenuItem, + this.convertMusicFilesToolStripMenuItem}); this.miscToolStripMenuItem.ForeColor = System.Drawing.Color.White; resources.ApplyResources(this.miscToolStripMenuItem, "miscToolStripMenuItem"); this.miscToolStripMenuItem.Name = "miscToolStripMenuItem"; @@ -528,6 +525,26 @@ this.addCustomPackImageToolStripMenuItem.Name = "addCustomPackImageToolStripMenuItem"; this.addCustomPackImageToolStripMenuItem.Click += new System.EventHandler(this.addCustomPackIconToolStripMenuItem_Click); // + // convertMusicFilesToolStripMenuItem + // + this.convertMusicFilesToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.wavBinkaToolStripMenuItem, + this.binkaWavToolStripMenuItem}); + this.convertMusicFilesToolStripMenuItem.Name = "convertMusicFilesToolStripMenuItem"; + resources.ApplyResources(this.convertMusicFilesToolStripMenuItem, "convertMusicFilesToolStripMenuItem"); + // + // wavBinkaToolStripMenuItem + // + this.wavBinkaToolStripMenuItem.Name = "wavBinkaToolStripMenuItem"; + resources.ApplyResources(this.wavBinkaToolStripMenuItem, "wavBinkaToolStripMenuItem"); + this.wavBinkaToolStripMenuItem.Click += new System.EventHandler(this.wavBinkaToolStripMenuItem_Click); + // + // binkaWavToolStripMenuItem + // + this.binkaWavToolStripMenuItem.Name = "binkaWavToolStripMenuItem"; + resources.ApplyResources(this.binkaWavToolStripMenuItem, "binkaWavToolStripMenuItem"); + this.binkaWavToolStripMenuItem.Click += new System.EventHandler(this.binkaWavToolStripMenuItem_Click); + // // helpToolStripMenuItem // this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -667,7 +684,8 @@ this.wiiUPCKInstallerToolStripMenuItem, this.PS3PCKInstallerToolStripMenuItem, this.VitaPCKInstallerToolStripMenuItem, - this.joinDevelopmentDiscordToolStripMenuItem}); + this.joinDevelopmentDiscordToolStripMenuItem, + this.trelloBoardToolStripMenuItem}); this.storeToolStripMenuItem.ForeColor = System.Drawing.Color.White; resources.ApplyResources(this.storeToolStripMenuItem, "storeToolStripMenuItem"); this.storeToolStripMenuItem.Name = "storeToolStripMenuItem"; @@ -696,6 +714,12 @@ this.joinDevelopmentDiscordToolStripMenuItem.Name = "joinDevelopmentDiscordToolStripMenuItem"; this.joinDevelopmentDiscordToolStripMenuItem.Click += new System.EventHandler(this.joinDevelopmentDiscordToolStripMenuItem_Click); // + // trelloBoardToolStripMenuItem + // + this.trelloBoardToolStripMenuItem.Name = "trelloBoardToolStripMenuItem"; + resources.ApplyResources(this.trelloBoardToolStripMenuItem, "trelloBoardToolStripMenuItem"); + this.trelloBoardToolStripMenuItem.Click += new System.EventHandler(this.trelloBoardToolStripMenuItem_Click); + // // contextMenuMetaTree // this.contextMenuMetaTree.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1175,7 +1199,6 @@ private MetroFramework.Controls.MetroTabPage editorTab; private MetroFramework.Controls.MetroCheckBox LittleEndianCheckBox; private MetroFramework.Controls.MetroLabel label11; - private MetroFramework.Controls.MetroLabel pckFileLabel; private System.Windows.Forms.ToolStripMenuItem wiiUPCKInstallerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem PS3PCKInstallerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; @@ -1184,7 +1207,6 @@ private System.Windows.Forms.ToolStripMenuItem toNobledezJackToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toPhoenixARCDeveloperToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem joinDevelopmentDiscordToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem convertPCTextrurePackToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem forMattNLContributorToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem audiopckToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem videosToolStripMenuItem; @@ -1246,6 +1268,14 @@ private CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton crEaTiiOn_Ultimate_GradientButton3; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Panel panel2; - } + private System.Windows.Forms.ToolStripMenuItem addFileToolStripMenuItem; + private MetroFramework.Controls.MetroLabel pckFileLabel; + private System.Windows.Forms.ToolStripMenuItem behavioursbinToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem entityMaterialsbinToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem trelloBoardToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem convertMusicFilesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem wavBinkaToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem binkaWavToolStripMenuItem; + } } diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 325ac496..0544bd91 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -19,20 +19,16 @@ using PckStudio.Properties; using PckStudio.Classes.FileTypes; using PckStudio.Classes.Utils; using PckStudio.Classes.Utils.ARC; -using PckStudio.Classes._3ds.Utils; using PckStudio.Forms; using PckStudio.Forms.Utilities; using PckStudio.Forms.Editor; using PckStudio.Forms.Additional_Popups.Animation; using PckStudio.Forms.Additional_Popups; using PckStudio.Classes.Misc; -using OMI.Formats.Pck; -using OMI.Workers.Pck; -using OMI.Formats.Languages; -using OMI.Workers.Language; using PckStudio.Classes.IO.PCK; -using OMI.Formats.GameRule; -using OMI.Workers.GameRule; +using PckStudio.Classes.IO._3DST; +using PckStudio.Internal; +using PckStudio.Extensions; namespace PckStudio { @@ -43,7 +39,9 @@ namespace PckStudio bool wasModified = false; bool isTemplateFile = false; + [Obsolete] bool needsUpdate = false; + bool isSelectingTab = false; readonly Dictionary> pckFileTypeHandler; @@ -71,16 +69,22 @@ namespace PckStudio imageList.Images.Add(Resources.ENTITY_MATERIALS_ICON); // Icon for Entity Material files (entityMaterials.bin) pckOpen.AllowDrop = true; - isSelectingTab = true; + isSelectingTab = true; tabControl.SelectTab(0); - isSelectingTab = false; + isSelectingTab = false; - labelVersion.Text = "PCK Studio: " + Application.ProductVersion; + Text = Application.ProductName; + + labelVersion.Text = $"{Application.ProductName}: {Application.ProductVersion}"; + +#if BETA + labelVersion.Text += $"{ApplicationBuildInfo.BetaBuildVersion}"; +#endif #if DEBUG - labelVersion.Text += Program.Info.BuildVersion + " " + Program.Info.LastCommitHash; + labelVersion.Text += $" (Debug build: {CommitInfo.BranchName}@{CommitInfo.CommitHash})"; #endif - pckFileTypeHandler = new Dictionary>(15) + pckFileTypeHandler = new Dictionary>(15) { [PckFile.FileData.FileType.SkinFile] = HandleSkinFile, [PckFile.FileData.FileType.CapeFile] = null, @@ -102,9 +106,9 @@ namespace PckStudio public void LoadPck(string filepath) { - checkSaveState(); + checkSaveState(); treeViewMain.Nodes.Clear(); - currentPCK = openPck(filepath); + currentPCK = openPck(filepath); if (currentPCK == null) { MessageBox.Show(string.Format("Failed to load {0}", Path.GetFileName(filepath)), "Error"); @@ -112,8 +116,8 @@ namespace PckStudio } CheckForPasswordAndRemove(); - LoadEditorTab(); - } + LoadEditorTab(); + } private void Form1_Load(object sender, EventArgs e) { @@ -132,16 +136,6 @@ namespace PckStudio modelsFileBINToolStripMenuItem.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.ModelsFile); behavioursFileBINToolStripMenuItem.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.BehavioursFile); entityMaterialsFileBINToolStripMenuItem.Click += (sender, e) => setFileType_Click(sender, e, PckFile.FileData.FileType.MaterialFile); - - try - { - Directory.CreateDirectory(Program.AppDataCache + "\\mods\\"); - } - catch (UnauthorizedAccessException ex) - { - MessageBox.Show("Could not Create directory due to Unauthorized Access"); - Debug.WriteLine(ex.Message); - } } private void FormMain_FormClosing(object sender, FormClosingEventArgs e) @@ -176,7 +170,7 @@ namespace PckStudio catch (OverflowException ex) { MessageBox.Show("Failed to open pck\n" + - $"Try {(LittleEndianCheckBox.Checked ? "unchecking" : "checking")} the 'Open/Save as Vita/PS4 pck' check box in the upper right corner.", + $"Try {(LittleEndianCheckBox.Checked ? "unchecking" : "checking")} the 'Open/Save as Switch/Vita/PS4 pck' check box in the upper right corner.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Debug.WriteLine(ex.Message); } @@ -204,7 +198,7 @@ namespace PckStudio pckFileLabel.Text = "Unsaved File!"; else pckFileLabel.Text = "Current PCK File: " + Path.GetFileName(saveLocation); - treeViewMain.Enabled = treeMeta.Enabled = true; + treeViewMain.Enabled = treeMeta.Enabled = true; closeToolStripMenuItem.Visible = true; saveToolStripMenuItem.Enabled = true; saveToolStripMenuItem1.Enabled = true; @@ -237,12 +231,12 @@ namespace PckStudio advancedMetaAddingToolStripMenuItem.Enabled = false; closeToolStripMenuItem.Visible = false; convertToBedrockToolStripMenuItem.Enabled = false; - addCustomPackImageToolStripMenuItem.Enabled = false; - fileEntryCountLabel.Text = string.Empty; - pckFileLabel.Text = string.Empty; - UpdateRPC(); + addCustomPackImageToolStripMenuItem.Enabled = false; + fileEntryCountLabel.Text = string.Empty; + pckFileLabel.Text = string.Empty; + UpdateRPC(); - } + } /// /// wrapper that allows the use of in TreeNode.Nodes.Find(, ...) and TreeNode.Nodes.ContainsKey() @@ -293,14 +287,14 @@ namespace PckStudio try { var writer = new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); - PckFile subPCKfile = writer.FromStream(stream); + PckFile subPCKfile = writer.FromStream(stream); // passes parent path to remove from sub pck filepaths BuildPckTreeView(node.Nodes, subPCKfile, file.Filename + "/"); } catch (OverflowException ex) { MessageBox.Show("Failed to open pck\n" + - "Try checking the 'Open/Save as Vita/PS4 pck' checkbox in the upper right corner.", + "Try checking the 'Open/Save as Switch/Vita/PS4 pck' checkbox in the upper right corner.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Debug.WriteLine(ex.Message); } @@ -340,7 +334,7 @@ namespace PckStudio treeViewMain.Nodes.Find(Path.GetFileName(filepath), true).ToList() .Find(t => (t.Tag as PckFile.FileData).Filename == filepath); } - } + } bool IsFilePathMipMapped(string filepath) { @@ -401,40 +395,40 @@ namespace PckStudio private void HandleAudioFile(PckFile.FileData file) { - if (!TryGetLocFile(out LOCFile locFile)) - throw new Exception("No .loc File found."); - using AudioEditor audioEditor = new AudioEditor(file, locFile, LittleEndianCheckBox.Checked); + if (!TryGetLocFile(out LOCFile locFile)) + throw new Exception("No .loc File found."); + using AudioEditor audioEditor = new AudioEditor(file, locFile, LittleEndianCheckBox.Checked); if (audioEditor.ShowDialog(this) == DialogResult.OK) { wasModified = true; TrySetLocFile(locFile); } - } + } private void HandleLocalisationFile(PckFile.FileData file) { - using LOCEditor locedit = new LOCEditor(file); + using LOCEditor locedit = new LOCEditor(file); wasModified = locedit.ShowDialog(this) == DialogResult.OK; UpdateRPC(); - } + } private void HandleColourFile(PckFile.FileData file) { - if (file.Size == 0) - { - MessageBox.Show("No Color data found.", "Error", MessageBoxButtons.OK, - MessageBoxIcon.Error); - return; - } - using COLEditor diag = new COLEditor(file); + if (file.Size == 0) + { + MessageBox.Show("No Color data found.", "Error", MessageBoxButtons.OK, + MessageBoxIcon.Error); + return; + } + using COLEditor diag = new COLEditor(file); wasModified = diag.ShowDialog(this) == DialogResult.OK; - } + } public void HandleSkinFile(PckFile.FileData file) { if (file.Properties.HasProperty("BOX")) { - using (GenerateModel generate = new GenerateModel(file.Properties, new PictureBox())) + using (GenerateModel generate = new GenerateModel(file.Properties, ImageExtensions.ImageFromBuffer(file.Data))) if (generate.ShowDialog() == DialogResult.OK) { entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty; @@ -452,21 +446,24 @@ namespace PckStudio frm.Dispose(); } } - } + } public void HandleModelsFile(PckFile.FileData file) { MessageBox.Show("Models.bin support has not been implemented. You can use the Spark Editor for the time being to edit these files.", "Not implemented yet."); } + public void HandleBehavioursFile(PckFile.FileData file) { using BehaviourEditor edit = new BehaviourEditor(file); wasModified = edit.ShowDialog(this) == DialogResult.OK; } + public void HandleMaterialFile(PckFile.FileData file) { using MaterialsEditor edit = new MaterialsEditor(file); wasModified = edit.ShowDialog(this) == DialogResult.OK; } + private void selectNode(object sender, TreeViewEventArgs e) { ReloadMetaTreeView(); @@ -495,13 +492,21 @@ namespace PckStudio case PckFile.FileData.FileType.SkinFile: case PckFile.FileData.FileType.CapeFile: case PckFile.FileData.FileType.TextureFile: - // TODO: Add tga support - if (Path.GetExtension(file.Filename) == ".tga") break; - using (MemoryStream stream = new MemoryStream(file.Data)) { - try + // TODO: Add tga support + if (Path.GetExtension(file.Filename) == ".tga") break; + using MemoryStream stream = new MemoryStream(file.Data); + + var img = Image.FromStream(stream); + + if (img.RawFormat != ImageFormat.Jpeg || img.RawFormat != ImageFormat.Png) { - pictureBoxImagePreview.Image = Image.FromStream(stream); + img = new Bitmap(img); + } + + try + { + pictureBoxImagePreview.Image = img; labelImageSize.Text = $"{pictureBoxImagePreview.Image.Size.Width}x{pictureBoxImagePreview.Image.Size.Height}"; } catch (Exception ex) @@ -511,15 +516,15 @@ namespace PckStudio Debug.WriteLine("Not a supported image format. Setting back to default"); Debug.WriteLine(string.Format("An error occured of type: {0} with message: {1}", ex.GetType(), ex.Message), "Exception"); } - } - if ((file.Filename.StartsWith("res/textures/blocks/") || file.Filename.StartsWith("res/textures/items/")) && - !file.Filename.EndsWith("clock.png") && !file.Filename.EndsWith("compass.png") && - file.Filetype == PckFile.FileData.FileType.TextureFile - && !IsFilePathMipMapped(file.Filename)) - { - buttonEdit.Text = "EDIT TEXTURE ANIMATION"; - buttonEdit.Visible = true; + + if ((file.Filename.StartsWith("res/textures/blocks/") || file.Filename.StartsWith("res/textures/items/")) && + file.Filetype == PckFile.FileData.FileType.TextureFile + && !IsFilePathMipMapped(file.Filename)) + { + buttonEdit.Text = "EDIT TILE ANIMATION"; + buttonEdit.Visible = true; + } } break; @@ -627,6 +632,7 @@ namespace PckStudio { Save(saveFileDialog.FileName); saveLocation = saveFileDialog.FileName; + pckFileLabel.Text = "Current PCK File: " + Path.GetFileName(saveLocation); isTemplateFile = false; } } @@ -691,16 +697,16 @@ namespace PckStudio MessageBox.Show("Can't replace a folder."); } - private void deleteFileToolStripMenuItem_Click(object sender, EventArgs e) - { - var node = treeViewMain.SelectedNode; - if (node == null) return; + private void deleteFileToolStripMenuItem_Click(object sender, EventArgs e) + { + var node = treeViewMain.SelectedNode; + if (node == null) return; string path = node.FullPath; - if (node.Tag is PckFile.FileData) - { - PckFile.FileData file = node.Tag as PckFile.FileData; + if (node.Tag is PckFile.FileData) + { + PckFile.FileData file = node.Tag as PckFile.FileData; string itemPath = "res/textures/items/"; @@ -712,69 +718,63 @@ namespace PckStudio MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) return; } - // remove loc key if its a skin/cape + // remove loc key if its a skin/cape if (file.Filetype == PckFile.FileData.FileType.SkinFile || file.Filetype == PckFile.FileData.FileType.CapeFile) - { - if (TryGetLocFile(out LOCFile locFile)) - { - foreach (var property in file.Properties) - { - if (property.Item1 == "THEMENAMEID" || property.Item1 == "DISPLAYNAMEID") - locFile.RemoveLocKey(property.Item2); - } - TrySetLocFile(locFile); - } - } - currentPCK.Files.Remove(file); - node.Remove(); - wasModified = true; - } - else if (MessageBox.Show("Are you sure want to delete this folder? All contents will be deleted", "Warning", - MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) - { - string pckFolderDir = node.FullPath; - currentPCK.Files.RemoveAll(file => file.Filename.StartsWith(pckFolderDir)); - node.Remove(); - wasModified = true; - } + { + if (TryGetLocFile(out LOCFile locFile)) + { + foreach (var property in file.Properties) + { + if (property.Item1 == "THEMENAMEID" || property.Item1 == "DISPLAYNAMEID") + locFile.RemoveLocKey(property.Item2); + } + TrySetLocFile(locFile); + } + } + currentPCK.Files.Remove(file); + node.Remove(); + wasModified = true; + } + else if (MessageBox.Show("Are you sure want to delete this folder? All contents will be deleted", "Warning", + MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + { + string pckFolderDir = node.FullPath; + currentPCK.Files.RemoveAll(file => file.Filename.StartsWith(pckFolderDir)); + node.Remove(); + wasModified = true; + } if (IsSubPCKNode(path)) RebuildSubPCK(node); - } + } private void renameFileToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = treeViewMain.SelectedNode; if (node == null) return; string path = node.FullPath; - using RenamePrompt diag = new RenamePrompt(node.FullPath); + + bool sub = IsSubPCKNode(path); + + using RenamePrompt diag = new RenamePrompt(node.Tag is null ? Path.GetFileName(node.FullPath) : node.FullPath); + if (diag.ShowDialog(this) == DialogResult.OK) { - if (node.Tag is PckFile.FileData file - && file.Filetype is not PckFile.FileData.FileType.TexturePackInfoFile - && file.Filetype is not PckFile.FileData.FileType.SkinDataFile) + if (node.Tag is PckFile.FileData file) { file.Filename = diag.NewText; } - else if(!IsSubPCKNode(path)) // folder + else // folders { + node.Text = diag.NewText; foreach (var childNode in GetAllChildNodes(node.Nodes)) { - if (childNode.Tag is PckFile.FileData folderFile && - childNode.FullPath.StartsWith(childNode.FullPath)) + if (childNode.Tag is PckFile.FileData folderFile) { - folderFile.Filename = diag.NewText + childNode.FullPath.Substring(childNode.FullPath.Length); + folderFile.Filename = childNode.FullPath; } } } - else - { - currentPCK.Files.ForEach(file => - { - if (file.Filename.StartsWith(node.FullPath)) - file.Filename = diag.NewText + file.Filename.Substring(node.FullPath.Length); - }); - } wasModified = true; - if (IsSubPCKNode(path)) RebuildSubPCK(node); + if (sub) RebuildSubPCK(node); BuildMainTreeView(); } } @@ -832,38 +832,54 @@ namespace PckStudio } } - private PckFile.FileData CreateNewAudioFile(bool isLittle) - { - // create actual valid pck file structure - PCKAudioFile audioPck = new PCKAudioFile(); - audioPck.AddCategory(PCKAudioFile.AudioCategory.EAudioType.Overworld); - audioPck.AddCategory(PCKAudioFile.AudioCategory.EAudioType.Nether); - audioPck.AddCategory(PCKAudioFile.AudioCategory.EAudioType.End); + private PckFile.FileData CreateNewAudioFile(bool isLittle) + { + // create actual valid pck file structure + PckAudioFile audioPck = new PckAudioFile(); + audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Overworld); + audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.Nether); + audioPck.AddCategory(PckAudioFile.AudioCategory.EAudioType.End); PckFile.FileData pckFileData = currentPCK.CreateNewFile("audio.pck", PckFile.FileData.FileType.AudioFile, () => { using (var stream = new MemoryStream()) { - var writer = new PCKAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); + var writer = new PckAudioFileWriter(audioPck, isLittle ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); writer.WriteToStream(stream); return stream.ToArray(); } }); - return pckFileData; - } + return pckFileData; + } private void audiopckToolStripMenuItem_Click(object sender, EventArgs e) { - if (currentPCK.Files.FindIndex(file => file.Filename.Contains("audio.pck")) != -1) + if (currentPCK.Files.FindIndex(file => file.Filetype == PckFile.FileData.FileType.AudioFile) != -1) { - MessageBox.Show("There is already an audio.pck present in this file!", "Can't create audio.pck"); + MessageBox.Show("There is already an music cues PCK present in this PCK!", "Can't create audio.pck"); return; } + else if (currentPCK.Files.FindIndex(file => file.Filename == "audio.pck") != -1) + { + // the chances of this happening is really really slim but just in case + MessageBox.Show("There is already a file in this PCK named \"audio.pck\"!", "Can't create audio.pck"); + return; + } + if (String.IsNullOrEmpty(saveLocation)) + { + MessageBox.Show("You must save your pck before creating or opening a music cues PCK file", "Can't create audio.pck"); + return; + } + if (!TryGetLocFile(out LOCFile locFile)) throw new Exception("No .loc file found."); var file = CreateNewAudioFile(LittleEndianCheckBox.Checked); AudioEditor diag = new AudioEditor(file, locFile, LittleEndianCheckBox.Checked); if (diag.ShowDialog(this) == DialogResult.OK) TrySetLocFile(locFile); + else + { + currentPCK.Files.Remove(file); //delete file if not saved + } diag.Dispose(); BuildMainTreeView(); } @@ -940,8 +956,8 @@ namespace PckStudio { parent = parent.Parent; Console.WriteLine(parent.Text); - if (parent.Tag is PckFile.FileData f && - (f.Filetype is PckFile.FileData.FileType.TexturePackInfoFile || + if (parent.Tag is PckFile.FileData f && + (f.Filetype is PckFile.FileData.FileType.TexturePackInfoFile || f.Filetype is PckFile.FileData.FileType.SkinDataFile)) return parent; } @@ -968,7 +984,7 @@ namespace PckStudio { if (node.Tag is PckFile.FileData node_file) { - PckFile.FileData new_file = newPCKFile.CreateNewFile(node_file.Filename, node_file.Filetype); + PckFile.FileData new_file = newPCKFile.CreateNewFile(node_file.Filename.Replace(parent_file.Filename + "/", String.Empty), node_file.Filetype); foreach (var prop in node_file.Properties) new_file.Properties.Add(prop); new_file.SetData(node_file.Data); } @@ -1105,18 +1121,18 @@ namespace PckStudio mf.Properties.Add(property); } - TreeNode newNode = new TreeNode(); - newNode.Text = newFileName; - newNode.Tag = mf; - newNode.ImageIndex = node.ImageIndex; - newNode.SelectedImageIndex = node.SelectedImageIndex; + TreeNode newNode = new TreeNode(); + newNode.Text = newFileName; + newNode.Tag = mf; + newNode.ImageIndex = node.ImageIndex; + newNode.SelectedImageIndex = node.SelectedImageIndex; - if (node.Parent == null) treeViewMain.Nodes.Insert(node.Index + 1, newNode); //adds generated minefile node - else node.Parent.Nodes.Insert(node.Index + 1, newNode);//adds generated minefile node to selected folder + if (node.Parent == null) treeViewMain.Nodes.Insert(node.Index + 1, newNode); //adds generated minefile node + else node.Parent.Nodes.Insert(node.Index + 1, newNode);//adds generated minefile node to selected folder if (!IsSubPCKNode(node.FullPath)) currentPCK.Files.Insert(node.Index + 1, mf); else RebuildSubPCK(node); - } + } private void deleteEntryToolStripMenuItem_Click(object sender, EventArgs e) { @@ -1226,13 +1242,13 @@ namespace PckStudio locFile.InitializeDefault(packName); using var stream = new MemoryStream(); var writer = new LOCFileWriter(locFile, 2); - writer.WriteToStream(stream); + writer.WriteToStream(stream); return stream.ToArray(); - }); + }); if (createSkinsPCK) { - PckFile.FileData skinsPCKFile = newPck.CreateNewFile("Skins.pck", PckFile.FileData.FileType.SkinDataFile, () => + PckFile.FileData skinsPCKFile = newPck.CreateNewFile("Skins.pck", PckFile.FileData.FileType.SkinDataFile, () => { using var stream = new MemoryStream(); var writer = new PckFileWriter(new PckFile(3) @@ -1243,26 +1259,26 @@ namespace PckStudio ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); writer.WriteToStream(stream); - return stream.ToArray(); - }); - } + return stream.ToArray(); + }); + } return newPck; } private PckFile InitializeTexturePack(int packId, int packVersion, string packName, string res, bool createSkinsPCK = false) { - var newPck = InitializePack(packId, packVersion, packName, createSkinsPCK); + var newPck = InitializePack(packId, packVersion, packName, createSkinsPCK); var texturepackInfo = newPck.CreateNewFile($"{res}/{res}Info.pck", PckFile.FileData.FileType.TexturePackInfoFile, () => { - using var ms = new MemoryStream(); - var writer = new PckFileWriter(new PckFile(3), - LittleEndianCheckBox.Checked - ? OMI.Endianness.LittleEndian - : OMI.Endianness.BigEndian); - writer.WriteToStream(ms); - return ms.ToArray(); - }); + using var ms = new MemoryStream(); + var writer = new PckFileWriter(new PckFile(3), + LittleEndianCheckBox.Checked + ? OMI.Endianness.LittleEndian + : OMI.Endianness.BigEndian); + writer.WriteToStream(ms); + return ms.ToArray(); + }); texturepackInfo.Properties.Add(("PACKID", "0")); texturepackInfo.Properties.Add(("DATAPATH", $"{res}Data.pck")); @@ -1287,7 +1303,7 @@ namespace PckStudio private PckFile InitializeMashUpPack(int packId, int packVersion, string packName, string res) { - var newPck = InitializeTexturePack(packId, packVersion, packName, res, true); + var newPck = InitializeTexturePack(packId, packVersion, packName, res, true); var gameRuleFile = newPck.CreateNewFile("GameRules.grf", PckFile.FileData.FileType.GameRulesFile); var grfFile = new GameRuleFile(); grfFile.AddRule("MapOptions", @@ -1305,7 +1321,7 @@ namespace PckStudio new KeyValuePair("spawnZ", "0") ); using (var stream = new MemoryStream()) - { + { var writer = new GameRuleFileWriter(grfFile); writer.WriteToStream(stream); gameRuleFile.SetData(stream.ToArray()); @@ -1317,37 +1333,37 @@ namespace PckStudio { checkSaveState(); RenamePrompt namePrompt = new RenamePrompt(""); - namePrompt.RenameButton.Text = "Ok"; + namePrompt.OKButton.Text = "Ok"; if (namePrompt.ShowDialog() == DialogResult.OK) { currentPCK = InitializePack(new Random().Next(8000, int.MaxValue), 0, namePrompt.NewText, true); isTemplateFile = true; - wasModified = true; - LoadEditorTab(); + wasModified = true; + LoadEditorTab(); } } private void texturePackToolStripMenuItem_Click(object sender, EventArgs e) { - checkSaveState(); - CreateTexturePack packPrompt = new CreateTexturePack(); + checkSaveState(); + CreateTexturePack packPrompt = new CreateTexturePack(); if (packPrompt.ShowDialog() == DialogResult.OK) { - currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes); + currentPCK = InitializeTexturePack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes); isTemplateFile = true; - wasModified = true; - LoadEditorTab(); + wasModified = true; + LoadEditorTab(); } } private void mashUpPackToolStripMenuItem_Click(object sender, EventArgs e) { - checkSaveState(); - CreateTexturePack packPrompt = new CreateTexturePack(); + checkSaveState(); + CreateTexturePack packPrompt = new CreateTexturePack(); if (packPrompt.ShowDialog() == DialogResult.OK) { - currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes); + currentPCK = InitializeMashUpPack(new Random().Next(8000, int.MaxValue), 0, packPrompt.PackName, packPrompt.PackRes); isTemplateFile = true; wasModified = false; LoadEditorTab(); @@ -1412,14 +1428,14 @@ namespace PckStudio { try { - var reader = new PckFileReader(LittleEndianCheckBox.Checked + var reader = new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); - pckfile = reader.FromStream(fs); + pckfile = reader.FromStream(fs); } catch (OverflowException ex) { - MessageBox.Show("Error", "Failed to open pck\nTry checking the 'Open/Save as Vita/PS4 pck' check box in the upper right corner.", + MessageBox.Show("Error", "Failed to open pck\nTry checking the 'Open/Save as Switch/Vita/PS4 pck' check box in the upper right corner.", MessageBoxButtons.OK, MessageBoxIcon.Error); Debug.WriteLine(ex.Message); } @@ -1494,51 +1510,51 @@ namespace PckStudio { string filename = Path.GetFileNameWithoutExtension(fullfilename); // sets file type based on wether its a cape or skin - PckFile.FileData.FileType pckfiletype = filename.StartsWith("dlccape", StringComparison.OrdinalIgnoreCase) + PckFile.FileData.FileType pckfiletype = filename.StartsWith("dlccape", StringComparison.OrdinalIgnoreCase) ? PckFile.FileData.FileType.CapeFile : PckFile.FileData.FileType.SkinFile; string pckfilepath = (hasSkinsPck ? "Skins/" : string.Empty) + filename + ".png"; - PckFile.FileData newFile = new PckFile.FileData(pckfilepath, pckfiletype); + PckFile.FileData newFile = new PckFile.FileData(pckfilepath, pckfiletype); byte[] filedata = File.ReadAllBytes(fullfilename); - newFile.SetData(filedata); + newFile.SetData(filedata); if (File.Exists(fullfilename + ".txt")) { - string[] properties = File.ReadAllText(fullfilename + ".txt").Split(new string[]{ Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + string[] properties = File.ReadAllText(fullfilename + ".txt").Split(new string[]{ Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); foreach (string property in properties) { - string[] param = property.Split(':'); - if (param.Length < 2) continue; - newFile.Properties.Add((param[0], param[1])); - //switch (param[0]) - //{ - // case "DISPLAYNAMEID": - // locNameId = param[1]; - // continue; + string[] param = property.Split(':'); + if (param.Length < 2) continue; + newFile.Properties.Add((param[0], param[1])); + //switch (param[0]) + //{ + // case "DISPLAYNAMEID": + // locNameId = param[1]; + // continue; - // case "DISPLAYNAME": - // locName = param[1]; - // continue; + // case "DISPLAYNAME": + // locName = param[1]; + // continue; - // case "THEMENAMEID": - // locThemeId = param[1]; - // continue; + // case "THEMENAMEID": + // locThemeId = param[1]; + // continue; - // case "THEMENAME": - // locTheme = param[1]; - // continue; - //} - } - } + // case "THEMENAME": + // locTheme = param[1]; + // continue; + //} + } + } if (hasSkinsPck) { var skinsfile = currentPCK.GetFile("Skins.pck", PckFile.FileData.FileType.SkinDataFile); - using (var ms = new MemoryStream(skinsfile.Data)) + using (var ms = new MemoryStream(skinsfile.Data)) { var reader = new PckFileReader(LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); - var skinspck = reader.FromStream(ms); + var skinspck = reader.FromStream(ms); skinspck.Files.Add(newFile); ms.Position = 0; var writer = new PckFileWriter(skinspck, LittleEndianCheckBox.Checked ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian); @@ -1546,7 +1562,7 @@ namespace PckStudio skinsfile.SetData(ms.ToArray()); } continue; - } + } currentPCK.Files.Add(newFile); } BuildMainTreeView(); @@ -1569,7 +1585,7 @@ namespace PckStudio using (var stream = new MemoryStream(locdata.Data)) { var reader = new LOCFileReader(); - locFile = reader.FromStream(stream); + locFile = reader.FromStream(stream); } return true; } @@ -1583,18 +1599,18 @@ namespace PckStudio private bool TrySetLocFile(in LOCFile locFile) { - if (!currentPCK.TryGetFile("localisation.loc", PckFile.FileData.FileType.LocalisationFile, out PckFile.FileData locdata) && - !currentPCK.TryGetFile("languages.loc", PckFile.FileData.FileType.LocalisationFile, out locdata)) - { - return false; - } + if (!currentPCK.TryGetFile("localisation.loc", PckFile.FileData.FileType.LocalisationFile, out PckFile.FileData locdata) && + !currentPCK.TryGetFile("languages.loc", PckFile.FileData.FileType.LocalisationFile, out locdata)) + { + return false; + } - try + try { using (var stream = new MemoryStream()) { var writer = new LOCFileWriter(locFile, 2); - writer.WriteToStream(stream); + writer.WriteToStream(stream); locdata.SetData(stream.ToArray()); } return true; @@ -1665,7 +1681,7 @@ namespace PckStudio private void folderToolStripMenuItem_Click(object sender, EventArgs e) { RenamePrompt folderNamePrompt = new RenamePrompt(""); - folderNamePrompt.RenameButton.Text = "Add"; + folderNamePrompt.OKButton.Text = "Add"; if (folderNamePrompt.ShowDialog() == DialogResult.OK) { TreeNode folerNode = CreateNode(folderNamePrompt.NewText); @@ -1675,16 +1691,17 @@ namespace PckStudio TreeNodeCollection nodeCollection = treeViewMain.Nodes; if (treeViewMain.SelectedNode is TreeNode node) { - if (node.Tag is PckFile.FileData) + if (node.Tag is PckFile.FileData fd && + (fd.Filetype != PckFile.FileData.FileType.TexturePackInfoFile && + fd.Filetype != PckFile.FileData.FileType.SkinDataFile)) { if (node.Parent is TreeNode parentNode) { nodeCollection = parentNode.Nodes; } } - else - nodeCollection = node.Nodes; - } + else nodeCollection = node.Nodes; + } nodeCollection.Add(folerNode); } } @@ -1704,8 +1721,9 @@ namespace PckStudio MessageBox.Show("This feature is currently being reworked.", "Currently unavailable", MessageBoxButtons.OK, MessageBoxIcon.Information); } - private void openToolStripMenuItem1_Click(object sender, EventArgs e) + private void openPckCenterToolStripMenuItem_Click(object sender, EventArgs e) { +#if BETA || DEBUG DateTime Begin = DateTime.Now; //pckCenter open = new pckCenter(); PCKCenterBeta open = new PCKCenterBeta(); @@ -1713,6 +1731,7 @@ namespace PckStudio TimeSpan duration = new TimeSpan(DateTime.Now.Ticks - Begin.Ticks); Debug.WriteLine("Completed in: " + duration); +#endif } private void wiiUPCKInstallerToolStripMenuItem_Click(object sender, EventArgs e) @@ -1796,12 +1815,6 @@ namespace PckStudio Process.Start("https://discord.gg/aJtZNFVQTv"); } - private void convertPCTextrurePackToolStripMenuItem_Click(object sender, EventArgs e) - { - TextureConverterUtility tex = new TextureConverterUtility(treeViewMain, currentPCK); - tex.ShowDialog(); - } - private void OpenPck_MouseEnter(object sender, EventArgs e) { pckOpen.Image = Resources.pckOpen; @@ -1884,7 +1897,7 @@ namespace PckStudio private void SetPckFileIcon(TreeNode node, PckFile.FileData.FileType type) { - switch (type) + switch (type) { case PckFile.FileData.FileType.AudioFile: node.ImageIndex = 1; @@ -2069,11 +2082,11 @@ namespace PckStudio saveFileDialog.DefaultExt = ".3dst"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { - using (var fs = saveFileDialog.OpenFile()) + using (var ms = new MemoryStream(file.Data)) { - using var ms = new MemoryStream(file.Data); Image img = Image.FromStream(ms); - _3DSUtil.SetImageTo3DST(fs, img); + var writer = new _3DSTextureWriter(img); + writer.WriteToFile(saveFileDialog.FileName); } } } @@ -2119,7 +2132,7 @@ namespace PckStudio private void addCustomPackIconToolStripMenuItem_Click(object sender, EventArgs e) { - if (!currentPCK.TryGetFile("0", PckFile.FileData.FileType.InfoFile, out PckFile.FileData file) || + if (!currentPCK.TryGetFile("0", PckFile.FileData.FileType.InfoFile, out PckFile.FileData file) || string.IsNullOrEmpty(file.Properties.GetPropertyValue("PACKID")) ) { @@ -2132,7 +2145,7 @@ namespace PckStudio if (dialog.ShowDialog(this) == DialogResult.OK) { string filepath = dialog.FileName; - dialog.Filter = "Pack Icon|*.png"; + dialog.Filter = "Pack Icon|*.png"; if (dialog.ShowDialog(this) == DialogResult.OK) { using (var fs = File.OpenRead(filepath)) @@ -2189,7 +2202,7 @@ namespace PckStudio int idx = line.IndexOf(' '); if (idx == -1 || line.Length - 1 == idx) continue; - file.Properties.Add((line.Substring(0, idx), line.Substring(idx + 1))); + file.Properties.Add((line.Substring(0, idx).Replace(":", string.Empty), line.Substring(idx + 1))); } ReloadMetaTreeView(); if (IsSubPCKNode(node.FullPath)) RebuildSubPCK(node); @@ -2269,40 +2282,93 @@ namespace PckStudio Debug.WriteLine("Completed in: " + duration); } - } - public class PckNodeSorter : System.Collections.IComparer, IComparer - { - private bool CheckForSkinAndCapeFiles(TreeNode node) + private void trelloBoardToolStripMenuItem_Click(object sender, EventArgs e) { - if (node.Tag is PckFile.FileData file) - { - return file.Filetype == PckFile.FileData.FileType.SkinFile || - file.Filetype == PckFile.FileData.FileType.CapeFile; - } - return false; - } + Process.Start("https://trello.com/b/0XLNOEbe/pck-studio"); + } - public int Compare(TreeNode first, TreeNode second) - { - // ignore these files in order to preserve skin(and cape) files - if (CheckForSkinAndCapeFiles(first)) - { - return 0; - } - if (CheckForSkinAndCapeFiles(second)) - { - return 0; - } - - int result = first.Text.CompareTo(second.Text); - if (result != 0) return result; - return first.ImageIndex.CompareTo(second.ImageIndex); - } - - int System.Collections.IComparer.Compare(object x, object y) + private async void wavBinkaToolStripMenuItem_Click(object sender, EventArgs e) { - return x is TreeNode NodeX && y is TreeNode NodeY ? Compare(NodeX, NodeY) : 0; + using OpenFileDialog fileDialog = new OpenFileDialog + { + Multiselect = true, + Filter = "WAV files (*.wav)|*.wav", + Title = "Please choose WAV files to convert to BINKA" + }; + if (fileDialog.ShowDialog() != DialogResult.OK) + return; + + InProgressPrompt waitDiag = new InProgressPrompt(); + waitDiag.Show(this); + + int convertedCounter = 0; + foreach (string file in fileDialog.FileNames) + { + string[] a = Path.GetFileNameWithoutExtension(file).Split(Path.GetInvalidFileNameChars()); + + string songName = string.Join("_", a); + songName = System.Text.RegularExpressions.Regex.Replace(songName, @"[^\u0000-\u007F]+", "_"); // Replace UTF characters + string cacheSongLoc = Path.Combine(Program.AppDataCache, songName + Path.GetExtension(file)); + + if (File.Exists(cacheSongLoc)) + File.Delete(cacheSongLoc); + + using (var reader = new NAudio.Wave.WaveFileReader(file)) //read from original location + { + var newFormat = new NAudio.Wave.WaveFormat(reader.WaveFormat.SampleRate, 16, reader.WaveFormat.Channels); + using (var conversionStream = new NAudio.Wave.WaveFormatConversionStream(newFormat, reader)) + { + NAudio.Wave.WaveFileWriter.CreateWaveFile(cacheSongLoc, conversionStream); //write to new location + } + } + + Cursor.Current = Cursors.WaitCursor; + + int exitCode = 0; + await System.Threading.Tasks.Task.Run(() => + { + exitCode = Classes.Binka.FromWav(cacheSongLoc, Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file) + ".binka"), 4); + }); + + if (exitCode != 0) + continue; + + convertedCounter++; + } + + int fileCount = fileDialog.FileNames.Length; + + waitDiag.Close(); + waitDiag.Dispose(); + MessageBox.Show(this, $"Successfully converted {convertedCounter}/{fileCount} file{(fileCount != 1 ? "s" : "")}", "Done!"); + } + + private void binkaWavToolStripMenuItem_Click(object sender, EventArgs e) + { + int success = 0; + + using OpenFileDialog fileDialog = new OpenFileDialog + { + Multiselect = true, + Filter = "BINKA files (*.binka)|*.binka", + Title = "Please choose BINKA files to convert to WAV" + }; + + if (fileDialog.ShowDialog() != DialogResult.OK) + return; + + InProgressPrompt waitDiag = new InProgressPrompt(); + waitDiag.Show(this); + foreach (string file in fileDialog.FileNames) + { + Classes.Binka.ToWav(file, Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file) + ".binka")); + success++; + } + + waitDiag.Close(); + waitDiag.Dispose(); + MessageBox.Show(this, $"Successfully converted {success}/{fileDialog.FileNames.Length} file{(fileDialog.FileNames.Length != 1 ? "s" : "")}", "Done!"); } } } \ No newline at end of file diff --git a/PCK-Studio/MainForm.resx b/PCK-Studio/MainForm.resx index 311b2d66..6c437782 100644 --- a/PCK-Studio/MainForm.resx +++ b/PCK-Studio/MainForm.resx @@ -22280,29 +22280,6 @@ 116, 17 - - 158, 224 - - - 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 - - - - 157, 22 - - - Create - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -22379,20 +22356,19 @@ Skins.pck - + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAABzSURBVDhPpYzB - DQAhCARp4hr3Txu254WTjYRb9cEmk/BgRjBVHTv85Twmgt77PcJEYIFrhIkAgWOEiSAGthEmgtbaD9fW - mBgpB4xywCgFxiMf5YDdrq3l5wjEjKtzTARMNlydY2IGot2ureVnRjkQmZbICyCi7XU5cfqKAAAAAElF + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAA3SURBVDhPY/j/ + /z9FGKsgGIsCKWSMTQ0QYxUE45FmALpiYvFwMgAbxqIYG8YqCMajBhCJ/zMAAPGwpV/Xje8RAAAAAElF TkSuQmCC - + 157, 22 - - Import + + Create @@ -22440,11 +22416,20 @@ Add Texture - + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAABzSURBVDhPpYzB + DQAhCARp4hr3Txu254WTjYRb9cEmk/BgRjBVHTv85Twmgt77PcJEYIFrhIkAgWOEiSAGthEmgtbaD9fW + mBgpB4xywCgFxiMf5YDdrq3l5wjEjKtzTARMNlydY2IGot2ureVnRjkQmZbICyCi7XU5cfqKAAAAAElF + TkSuQmCC + + + 157, 22 - - Export + + Import 186, 22 @@ -22452,11 +22437,11 @@ Export as 3DS Texture - + 157, 22 - - Set File Type + + Export 222, 22 @@ -22530,11 +22515,11 @@ Entity Materials File (.BIN) - + 157, 22 - - Misc. Functions + + Set File Type 210, 22 @@ -22554,6 +22539,12 @@ Correct Skin Decimals + + 157, 22 + + + Misc. Functions + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -22619,6 +22610,15 @@ Delete + + 158, 224 + + + contextMenuPCKEntries + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 17, 17 @@ -22628,62 +22628,6 @@ Segoe UI, 9.5pt - - 0, 10 - - - 1064, 24 - - - 2 - - - menuStrip1 - - - menuStrip - - - System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAN9JREFUWEft - lz0KwkAQhRe01Nt4hFzBU9gLYuFxQjyHlfexUIv1TfYtiGSzP5NGmA8ehGTm8ZUZZ6Tw3q+QHbIvTMdV - PSjbInekliMrdKDoHPqa0EugpA9dI11BbsgbiegkUDCEHu/5ahaMXZEH8pQdcuHnerDcIiAsI4HFVgFB - L4EljYCgk8CCVkAQiVd4HDlwPA+GlxAQRCIycDyPDIedMoE5WCOYgAmYgAmYgAn8l8D3T+nUDVCTSM/6 - PBjW/JanOLE+D4ZbD5MU0rVhfRlYiKfZ1B1QE+lYs9b4wbkPJT1laD5Q34oAAAAASUVORK5CYII= - - - - 55, 20 - - - File - - - - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADuSURBVFhH7ZbB - CsMgEERDbv5A/v83e2jNTmCKGdegJk0heHgUn7vrKBQyxRj/iivJPM9WMTWjc45wJeAwhAghVJEG1nkl - XNkziLCvtteXphFCfQ08nOi+4kvTeFL1NfBQ/BLuefjS9NkAADOwPnpNX14UADBEaV4mNnkygN34Y/1v - AgeWZXll9So2eTLAEVm9ik2a7g1Qgn9t9bvFV/4gAOZdHgB1RPeUEeAZAeBr0d4R4JIACuqI7ikjwDMD - tDACNAfo/Sou0fQ9wGKvoQfO8i61W6SkTXi+XtLLgOwcFSna3It3c+LKO3HlfcRpBa3JBjU5E8DiAAAA - AElFTkSuQmCC - - - - 233, 22 - - - New - 160, 22 @@ -22702,6 +22646,23 @@ Mash-Up Pack + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADuSURBVFhH7ZbB + CsMgEERDbv5A/v83e2jNTmCKGdegJk0heHgUn7vrKBQyxRj/iivJPM9WMTWjc45wJeAwhAghVJEG1nkl + XNkziLCvtteXphFCfQ08nOi+4kvTeFL1NfBQ/BLuefjS9NkAADOwPnpNX14UADBEaV4mNnkygN34Y/1v + AgeWZXll9So2eTLAEVm9ik2a7g1Qgn9t9bvFV/4gAOZdHgB1RPeUEeAZAeBr0d4R4JIACuqI7ikjwDMD + tDACNAfo/Sou0fQ9wGKvoQfO8i61W6SkTXi+XtLLgOwcFSna3It3c+LKO3HlfcRpBa3JBjU5E8DiAAAA + AElFTkSuQmCC + + + + 130, 22 + + + New + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -22711,7 +22672,7 @@ - 233, 22 + 130, 22 Open @@ -22725,7 +22686,7 @@ - 233, 22 + 130, 22 Extract @@ -22744,7 +22705,7 @@ - 233, 22 + 130, 22 Save @@ -22763,19 +22724,13 @@ - 233, 22 + 130, 22 Save As... - - 233, 22 - - - Convert to PC Texture pack - - 233, 22 + 130, 22 Close @@ -22783,26 +22738,20 @@ False - + - iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABGdBTUEAALGPC/xhBQAAAjRJREFUSEut - lc1LVFEYxgdDdBFG1ErSTGhhH1iQTWizai+iBKXF5FQGfWhGELZQhBAh/4TBjSBCgSv/gaCdf0JlLaIP - xExXWXn7PWfeE4dBhnPHeeDHzH3u+77P3HvPPZOplZIkOQnz8AoumV1bMfgsrIPXL+iz07URAxugHT5B - qB3ot7L9iUEF+Awd0ALvINQfyFt5dWJAE3zVNPQR2uAElF/Zb+ixtnSi8QooSM/mO0hrcBwUpuBQS9Ya - L5oGQPf/DdSBwr6B9AH2Citae5xouAq6Fbr3N8zTYjgDYVgr+DD5bW5AjCi+BuUhU/AWDsJp8GHvQYtD - YZ1uQIwoHgQFlId4rZinML9AtAIPyY8SxTfBhwyZNwle25AzX7fxFHyBp/KiRHEeKoVswWXzn8EqHIYm - eVGieBj+QqUQ937wqRCvW/KiRPEo7IKW8YB5L8FL+9p582edU6q/Jy9KFI9Z0/+9is+YkBF5UaJ4wrVV - DjlnfhhyV16UKH5gTXomg+aFz2QTsub7HyQ9kRctGrSlSDN2HIb8gIvmhyHj8qJFw1HQlWgl6V24D14K - 6bI6H6Irf+ya04imIdeeJMtmyctBGPIcJIWMuqK0onHRjUiSO2bJa4QL9j0MeeQK0orGA6BfriHHzHbi - uB6KIOn8QzuVXjR3uzGlQb3QDLfhNfwESTtEwVqqEwNeuFElaaACvbRA9DdQ/ZV4MUQbYagNWIDrcMTK - 9i+GzYHeoWnIQp2dqqEymX85CxFGItzW/gAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAN9JREFUWEft + lz0KwkAQhRe01Nt4hFzBU9gLYuFxQjyHlfexUIv1TfYtiGSzP5NGmA8ehGTm8ZUZZ6Tw3q+QHbIvTMdV + PSjbInekliMrdKDoHPqa0EugpA9dI11BbsgbiegkUDCEHu/5ahaMXZEH8pQdcuHnerDcIiAsI4HFVgFB + L4EljYCgk8CCVkAQiVd4HDlwPA+GlxAQRCIycDyPDIedMoE5WCOYgAmYgAmYgAn8l8D3T+nUDVCTSM/6 + PBjW/JanOLE+D4ZbD5MU0rVhfRlYiKfZ1B1QE+lYs9b4wbkPJT1laD5Q34oAAAAASUVORK5CYII= - - 58, 20 + + 55, 20 - - Edit + + File False @@ -22848,6 +22797,54 @@ Convert to Bedrock + + + iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABGdBTUEAALGPC/xhBQAAAjRJREFUSEut + lc1LVFEYxgdDdBFG1ErSTGhhH1iQTWizai+iBKXF5FQGfWhGELZQhBAh/4TBjSBCgSv/gaCdf0JlLaIP + xExXWXn7PWfeE4dBhnPHeeDHzH3u+77P3HvPPZOplZIkOQnz8AoumV1bMfgsrIPXL+iz07URAxugHT5B + qB3ot7L9iUEF+Awd0ALvINQfyFt5dWJAE3zVNPQR2uAElF/Zb+ixtnSi8QooSM/mO0hrcBwUpuBQS9Ya + L5oGQPf/DdSBwr6B9AH2Citae5xouAq6Fbr3N8zTYjgDYVgr+DD5bW5AjCi+BuUhU/AWDsJp8GHvQYtD + YZ1uQIwoHgQFlId4rZinML9AtAIPyY8SxTfBhwyZNwle25AzX7fxFHyBp/KiRHEeKoVswWXzn8EqHIYm + eVGieBj+QqUQ937wqRCvW/KiRPEo7IKW8YB5L8FL+9p582edU6q/Jy9KFI9Z0/+9is+YkBF5UaJ4wrVV + DjlnfhhyV16UKH5gTXomg+aFz2QTsub7HyQ9kRctGrSlSDN2HIb8gIvmhyHj8qJFw1HQlWgl6V24D14K + 6bI6H6Irf+ya04imIdeeJMtmyctBGPIcJIWMuqK0onHRjUiSO2bJa4QL9j0MeeQK0orGA6BfriHHzHbi + uB6KIOn8QzuVXjR3uzGlQb3QDLfhNfwESTtEwVqqEwNeuFElaaACvbRA9DdQ/ZV4MUQbYagNWIDrcMTK + 9i+GzYHeoWnIQp2dqqEymX85CxFGItzW/gAAAABJRU5ErkJggg== + + + + 58, 20 + + + Edit + + + False + + + 206, 22 + + + Add Custom Pack Icon + + + 155, 22 + + + WAV -> BinkA + + + 155, 22 + + + BinkA -> WAV + + + 206, 22 + + + Convert Music Files + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -22864,34 +22861,6 @@ Misc. - - False - - - 206, 22 - - - Add Custom Pack Icon - - - - iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAAa9JREFUSEvt - lt0qRFEYhucGJBoxohzMfThGagxJ7mA0Ra7CPThw4i8XIM5dAyIyHDqaIT+F8Xxrf1ti/eyfMTmYp57s - vdb7fYtttfYu9Ph3tNvtEq7gMZ7ivSrXR1jDEY3nh2ZlPMB3DCEZyZa1PBs0mMdHTMsDVrRNOihcxw/p - khH569e0XTIoWMI8i8ZIj0Vt64fgGLakykEDq1hU5/ASXTSxpO3dENoycTuy6IBGv2BsEO8k4GBTo3YI - TKBv91Y1N4PXeIXTOraALt5wXHJWmFw1MTd9mruNbg03OtYf3TqpS84Kk3IQpKWhtfL/9nFoFrHB5EWU - ScwTTmrtshlxc2YWscGkbzf/5BWntG4UfZtLaJpFbDCZ5pQyhwM/h1HO6xAts4gNJtM86iGtOYlug5yb - RWwwmWVzJcW7uepR5k+o6TK/YTJ0gMTIGbyH+3odwn+ACAR8R2bMjsYlL79ACP+RKRAKvSSEbY1Lfjca - cpLsJSEQrKDvkSd91NJjVtsmg4LufwjEUNj9T58YGsjhv4HPGEIyki1qeX5o9v3zVt7DL6pcd/7ztkdn - KBQ+AXKzDriBiJioAAAAAElFTkSuQmCC - - - - 63, 20 - - - Help - iVBORw0KGgoAAAANSUhEUgAAAtAAAALQCAYAAAC5V0ecAAAABGdBTUEAALGPC/xhBQAAazFJREFUeF7t @@ -23432,20 +23401,6 @@ Binka Conversion - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAKdJREFUOE+1 - jzEKwzAQBNUEXKQIBOwifcgTUvkDbt2p9qP0Ev1E31FYkVXOx2FLRRYWi7NnTnZ/z/MxZPY7aguhbZlq - myQafL+ubRINshCwnO0kFqi3HkpwWOf7DkC1RBfvx9slV4ElscqbxBiz9/4nwOBIQjCEUL7FswhwDYAp - JVMiN0oYs/ILiCXRIGHOwVQBoiXsKSgjJdzaBMpQ0g3KEOoG++PcBx9PFJGNjU4vAAAAAElFTkSuQmCC - - - - 198, 22 - - - Tutorials - iVBORw0KGgoAAAANSUhEUgAACOAAAAaoCAYAAAAgNTafAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m @@ -44131,6 +44086,20 @@ How PCKs work + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAKdJREFUOE+1 + jzEKwzAQBNUEXKQIBOwifcgTUvkDbt2p9qP0Ev1E31FYkVXOx2FLRRYWi7NnTnZ/z/MxZPY7aguhbZlq + myQafL+ubRINshCwnO0kFqi3HkpwWOf7DkC1RBfvx9slV4ElscqbxBiz9/4nwOBIQjCEUL7FswhwDYAp + JVMiN0oYs/ILiCXRIGHOwVQBoiXsKSgjJdzaBMpQ0g3KEOoG++PcBx9PFJGNjU4vAAAAAElFTkSuQmCC + + + + 198, 22 + + + Tutorials + iVBORw0KGgoAAAANSUhEUgAABkAAAAZACAYAAAAhDI6nAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -46134,12 +46103,6 @@ FAQ - - 198, 22 - - - Buy a coffee - 278, 22 @@ -46158,6 +46121,12 @@ For MattNL (Other Developer) + + 198, 22 + + + Buy a coffee + 198, 22 @@ -48005,18 +47974,24 @@ Administrative Tools - + - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAADxJREFUWEft - 0yEOAEAQwkD+/+k7U4skWdHRJFVE0jlvjEzHboaMpI63zJDp2M2QkdTxlhkyHbsZMpKuSD77Lj3fujth - aQAAAABJRU5ErkJggg== + iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAABGdBTUEAALGPC/xhBQAAAa9JREFUSEvt + lt0qRFEYhucGJBoxohzMfThGagxJ7mA0Ra7CPThw4i8XIM5dAyIyHDqaIT+F8Xxrf1ti/eyfMTmYp57s + vdb7fYtttfYu9Ph3tNvtEq7gMZ7ivSrXR1jDEY3nh2ZlPMB3DCEZyZa1PBs0mMdHTMsDVrRNOihcxw/p + khH569e0XTIoWMI8i8ZIj0Vt64fgGLakykEDq1hU5/ASXTSxpO3dENoycTuy6IBGv2BsEO8k4GBTo3YI + TKBv91Y1N4PXeIXTOraALt5wXHJWmFw1MTd9mruNbg03OtYf3TqpS84Kk3IQpKWhtfL/9nFoFrHB5EWU + ScwTTmrtshlxc2YWscGkbzf/5BWntG4UfZtLaJpFbDCZ5pQyhwM/h1HO6xAts4gNJtM86iGtOYlug5yb + RWwwmWVzJcW7uepR5k+o6TK/YTJ0gMTIGbyH+3odwn+ACAR8R2bMjsYlL79ACP+RKRAKvSSEbY1Lfjca + cpLsJSEQrKDvkSd91NJjVtsmg4LufwjEUNj9T58YGsjhv4HPGEIyki1qeX5o9v3zVt7DL6pcd/7ztkdn + KBQ+AXKzDriBiJioAAAAAElFTkSuQmCC - - 68, 20 + + 63, 20 - - More + + Help @@ -48874,18 +48849,52 @@ Join Development Discord + + 229, 22 + + + Trello Board + + + + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAADxJREFUWEft + 0yEOAEAQwkD+/+k7U4skWdHRJFVE0jlvjEzHboaMpI63zJDp2M2QkdTxlhkyHbsZMpKuSD77Lj3fujth + aQAAAABJRU5ErkJggg== + + + + 68, 20 + + + More + + + 0, 10 + + + 1064, 24 + + + 2 + + + menuStrip1 + + + 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 @@ -48935,305 +48944,14 @@ Edit All Entries - - labelVersion + + 182, 92 - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + contextMenuMetaTree - - openTab - - - 2 - - - pckOpen - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - openTab - - - 3 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - openTab - - - 4 - - - 4, 38 - - - 18, 30, 20, 5 - - - 1056, 608 - - - 1 - - - openTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - tabControl - - - 0 - - - None - - - pictureBoxImagePreview - - - PckStudio.ToolboxItems.PictureBoxWithInterpolationMode, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null - - - panel2 - - - 0 - - - fileEntryCountLabel - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - panel2 - - - 1 - - - labelImageSize - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - panel2 - - - 2 - - - Fill - - - 335, 58 - - - 716, 271 - - - 20 - - - panel2 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - editorTab - - - 2 - - - MetaTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - PropertiesTabControl - - - 0 - - - Bottom - - - 335, 329 - - - 716, 272 - - - 11 - - - PropertiesTabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 3 - - - True - - - True - - - 433, 79 - - - 0, 0 - - - 3 - - - label11 - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 4 - - - 8, 35 - - - 321, 23 - - - 21 - - - pckFileLabel - - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - editorTab - - - 5 - - - Left - - - False - - - 0 - - - 467, 14 - - - 32, 32 - - - 5, 58 - - - 0, 0, 0, 0 - - - 0 - - - 330, 543 - - - 10 - - - treeViewMain - - - System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - editorTab - - - 6 - - - 4, 38 - - - 5, 58, 5, 7 - - - 1056, 608 - - - 0 - - - editorTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - tabControl - - - 1 - - - Fill - - - 0, 10 - - - 0, 0, 0, 0 - - - 1064, 650 - - - 0 - - - tabControl - - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 4 + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Bottom, Left @@ -49501,78 +49219,6 @@ 3 - - crEaTiiOn_Ultimate_GradientButton2 - - - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panel1 - - - 0 - - - crEaTiiOn_Ultimate_GradientButton1 - - - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panel1 - - - 1 - - - pictureBox1 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panel1 - - - 2 - - - crEaTiiOn_Ultimate_GradientButton3 - - - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - panel1 - - - 3 - - - Right - - - 590, 30 - - - 446, 573 - - - 25 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - openTab - - - 4 - Left @@ -49632,7 +49278,7 @@ crEaTiiOn_Ultimate_GradientButton2 - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-WinForm-Theme-Library, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null panel1 @@ -49690,7 +49336,7 @@ crEaTiiOn_Ultimate_GradientButton1 - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-WinForm-Theme-Library, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null panel1 @@ -71918,7 +71564,7 @@ crEaTiiOn_Ultimate_GradientButton3 - CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-Ultimate-Theme-Library-NET-Framework, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + CBH.Ultimate.Controls.CrEaTiiOn_Ultimate_GradientButton, CBH-WinForm-Theme-Library, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null panel1 @@ -71926,6 +71572,57 @@ 3 + + Right + + + 590, 30 + + + 446, 573 + + + 25 + + + panel1 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + openTab + + + 4 + + + 4, 38 + + + 18, 30, 20, 5 + + + 1056, 608 + + + 1 + + + openTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 0 + + + None + Top, Right @@ -71936,7 +71633,7 @@ NoControl - 345, 50 + 7, 3 231, 218 @@ -72019,105 +71716,30 @@ 2 - - metroLabel2 + + Fill - - MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + 335, 58 - - MetaTab + + 716, 271 - + + 20 + + + panel2 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + editorTab + + 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 - - - 708, 230 - - - 0 - - - Properties - - - MetaTab - - - MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - PropertiesTabControl - - - 0 - Top, Right @@ -72319,6 +71941,198 @@ 7 + + 4, 38 + + + 3, 3, 3, 3 + + + 708, 230 + + + 0 + + + Properties + + + MetaTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + PropertiesTabControl + + + 0 + + + Bottom + + + 335, 329 + + + 716, 272 + + + 11 + + + PropertiesTabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 3 + + + True + + + True + + + 433, 79 + + + 0, 0 + + + 3 + + + label11 + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 4 + + + 8, 35 + + + 321, 23 + + + 21 + + + pckFileLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + editorTab + + + 5 + + + Left + + + False + + + 0 + + + 467, 14 + + + 32, 32 + + + 5, 58 + + + 0, 0, 0, 0 + + + 0 + + + 330, 543 + + + 10 + + + treeViewMain + + + System.Windows.Forms.TreeView, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + editorTab + + + 6 + + + 4, 38 + + + 5, 58, 5, 7 + + + 1056, 608 + + + 0 + + + editorTab + + + MetroFramework.Controls.MetroTabPage, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + tabControl + + + 1 + + + Fill + + + 0, 10 + + + 0, 0, 0, 0 + + + 1064, 650 + + + 0 + + + tabControl + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 4 + Top, Right @@ -75149,12 +74963,6 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - convertPCTextrurePackToolStripMenuItem - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - closeToolStripMenuItem @@ -75191,6 +74999,24 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + convertMusicFilesToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + wavBinkaToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + binkaWavToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + helpToolStripMenuItem @@ -75335,6 +75161,12 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + trelloBoardToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + addEntryToolStripMenuItem diff --git a/PCK-Studio/PckNodeSorter.cs b/PCK-Studio/PckNodeSorter.cs new file mode 100644 index 00000000..67ff8d37 --- /dev/null +++ b/PCK-Studio/PckNodeSorter.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Windows.Forms; + +using OMI.Formats.Pck; + +namespace PckStudio +{ + public class PckNodeSorter : System.Collections.IComparer, IComparer + { + private bool CheckForSkinAndCapeFiles(TreeNode node) + { + if (node.Tag is PckFile.FileData file) + { + return file.Filetype == PckFile.FileData.FileType.SkinFile || + file.Filetype == PckFile.FileData.FileType.CapeFile; + } + return false; + } + + public int Compare(TreeNode first, TreeNode second) + { + // ignore these files in order to preserve skin(and cape) files + if (CheckForSkinAndCapeFiles(first)) + { + return 0; + } + if (CheckForSkinAndCapeFiles(second)) + { + return 0; + } + + int result = first.Text.CompareTo(second.Text); + if (result != 0) return result; + return first.ImageIndex.CompareTo(second.ImageIndex); + } + + int System.Collections.IComparer.Compare(object x, object y) + { + return x is TreeNode NodeX && y is TreeNode NodeY ? Compare(NodeX, NodeY) : 0; + } + } +} \ No newline at end of file diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index d71679a8..bfa67cc3 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -18,23 +18,20 @@ false true - + + + + + + + + - - $(IntermediateOutputPath)gitver - - - - - - - - - - @(GitVersion) + $(GitHash) + $(GitBranch) - + $(IntermediateOutputPath)GitAssemblyInfo.cs @@ -49,6 +46,10 @@ <_Parameter1>GitHash <_Parameter2>$(BuildHash) + + <_Parameter1>GitBranch + <_Parameter2>$(BuildBranch) + @@ -82,14 +83,24 @@ AnyCPU - pdbonly - false + none + true bin\Release\ TRACE prompt 4 true + + AnyCPU + pdbonly + false + bin\Beta\ + BETA;TRACE + prompt + 4 + true + Resources\PCK-Studio_Logo.ico @@ -124,16 +135,6 @@ - - bin\ReleasePortable\ - TRACE - true - pdbonly - AnyCPU - preview - prompt - true - Properties\app.manifest @@ -166,31 +167,37 @@ + + - - + + + + - + - + + - - + + + Form - + - - + + @@ -226,12 +233,7 @@ creditsEditor.cs - - Form - - - PleaseWaitPrompt.cs - + Form @@ -360,6 +362,12 @@ AddParameter.cs + + Form + + + InProgressPrompt.cs + @@ -436,7 +444,7 @@ InstallWiiU.cs - + Form @@ -470,15 +478,13 @@ Component + - creditsEditor.cs - - PleaseWaitPrompt.cs - + AddEntry.cs @@ -537,6 +543,7 @@ ItemSelectionPopUp.cs + Designer AddMeta.cs @@ -564,6 +571,9 @@ AddParameter.cs + + InProgressPrompt.cs + BoxEditor.cs Designer @@ -660,13 +670,11 @@ - - - + @@ -789,6 +797,10 @@ {693AEBC1-293D-4DF0-BCAE-26A1099FE7BB} OMI Filetype Library + + {e8d0b671-3ab1-48b6-a767-58df67bd5d11} + SharpMss32 +