Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions UoFiddler.Controls/Classes/PackedFrameEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Text.Json.Serialization;

namespace UoFiddler.Controls.Classes
{
public class PackedFrameEntry
{
[JsonPropertyName("direction")] public int Direction { get; set; }
[JsonPropertyName("index")] public int Index { get; set; }
[JsonPropertyName("frame")] public Rect Frame { get; set; }
[JsonPropertyName("center")] public PointStruct Center { get; set; }
}
}
20 changes: 20 additions & 0 deletions UoFiddler.Controls/Classes/PackedItemEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

namespace UoFiddler.Controls.Classes
{
public class PackedItemEntry
{
public int Index { get; set; }
public Rect Frame { get; set; }
public PointStruct Center { get; set; }
}
}
21 changes: 21 additions & 0 deletions UoFiddler.Controls/Classes/PackedItemOutput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Collections.Generic;

namespace UoFiddler.Controls.Classes
{
public class PackedItemOutput
{
public PackedMeta Meta { get; set; }
public List<PackedItemEntry> Items { get; set; }
}
}
22 changes: 22 additions & 0 deletions UoFiddler.Controls/Classes/PackedMeta.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Text.Json.Serialization;

namespace UoFiddler.Controls.Classes
{
public class PackedMeta
{
[JsonPropertyName("image")] public string Image { get; set; }
[JsonPropertyName("size")] public SizeStruct Size { get; set; }
[JsonPropertyName("format")] public string Format { get; set; }
}
}
22 changes: 22 additions & 0 deletions UoFiddler.Controls/Classes/PackedOutput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace UoFiddler.Controls.Classes
{
public class PackedOutput
{
[JsonPropertyName("meta")] public PackedMeta Meta { get; set; }
[JsonPropertyName("frames")] public List<PackedFrameEntry> Frames { get; set; }
}
}
21 changes: 21 additions & 0 deletions UoFiddler.Controls/Classes/PointStruct.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Text.Json.Serialization;

namespace UoFiddler.Controls.Classes
{
public class PointStruct
{
[JsonPropertyName("x")] public int X { get; set; }
[JsonPropertyName("y")] public int Y { get; set; }
}
}
23 changes: 23 additions & 0 deletions UoFiddler.Controls/Classes/Rect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Text.Json.Serialization;

namespace UoFiddler.Controls.Classes
{
public class Rect
{
[JsonPropertyName("x")] public int X { get; set; }
[JsonPropertyName("y")] public int Y { get; set; }
[JsonPropertyName("w")] public int W { get; set; }
[JsonPropertyName("h")] public int H { get; set; }
}
}
21 changes: 21 additions & 0 deletions UoFiddler.Controls/Classes/SizeStruct.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/***************************************************************************
*
* $Author: Turley
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System.Text.Json.Serialization;

namespace UoFiddler.Controls.Classes
{
public class SizeStruct
{
[JsonPropertyName("w")] public int W { get; set; }
[JsonPropertyName("h")] public int H { get; set; }
}
}
124 changes: 124 additions & 0 deletions UoFiddler.Controls/Forms/ItemRangeInputForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
using System;
using System.Windows.Forms;

namespace UoFiddler.Controls.Forms
{
public partial class ItemRangeInputForm : Form
{
private TextBox _rangeTextBox;
private Button _okButton;
private Button _cancelButton;
private Label _instructionLabel;

public int StartIndex { get; private set; }
public int EndIndex { get; private set; }

public ItemRangeInputForm()
{
InitializeComponent();
}

private void InitializeComponent()
{
_rangeTextBox = new TextBox();
_okButton = new Button();
_cancelButton = new Button();
_instructionLabel = new Label();
SuspendLayout();
//
// _rangeTextBox
//
_rangeTextBox.Location = new System.Drawing.Point(12, 29);
_rangeTextBox.Name = "_rangeTextBox";
_rangeTextBox.Size = new System.Drawing.Size(260, 31);
_rangeTextBox.TabIndex = 0;
//
// _okButton
//
_okButton.DialogResult = DialogResult.OK;
_okButton.Location = new System.Drawing.Point(116, 66);
_okButton.Name = "_okButton";
_okButton.Size = new System.Drawing.Size(75, 40);
_okButton.TabIndex = 1;
_okButton.Text = "OK";
_okButton.UseVisualStyleBackColor = true;
_okButton.Click += OkButton_Click;
//
// _cancelButton
//
_cancelButton.DialogResult = DialogResult.Cancel;
_cancelButton.Location = new System.Drawing.Point(197, 66);
_cancelButton.Name = "_cancelButton";
_cancelButton.Size = new System.Drawing.Size(75, 40);
_cancelButton.TabIndex = 2;
_cancelButton.Text = "Cancel";
_cancelButton.UseVisualStyleBackColor = true;
//
// _instructionLabel
//
_instructionLabel.AutoSize = true;
_instructionLabel.Location = new System.Drawing.Point(12, 9);
_instructionLabel.Name = "_instructionLabel";
_instructionLabel.Size = new System.Drawing.Size(230, 25);
_instructionLabel.TabIndex = 3;
_instructionLabel.Text = "Enter Range (e.g., 100-200):";
//
// ItemRangeInputForm
//
AcceptButton = _okButton;
CancelButton = _cancelButton;
ClientSize = new System.Drawing.Size(307, 117);
Controls.Add(_instructionLabel);
Controls.Add(_cancelButton);
Controls.Add(_okButton);
Controls.Add(_rangeTextBox);
FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false;
MinimizeBox = false;
Name = "ItemRangeInputForm";
StartPosition = FormStartPosition.CenterParent;
Text = "Export Items Range";
ResumeLayout(false);
PerformLayout();

}

private void OkButton_Click(object sender, EventArgs e)
{
string input = _rangeTextBox.Text.Trim();
string[] parts = input.Split('-');

if (parts.Length != 2)
{
MessageBox.Show("Invalid format. Please use 'Start-End' (e.g., 100-200).", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.None;
return;
}

if (int.TryParse(parts[0], out int start) && int.TryParse(parts[1], out int end))
{
if (start > end)
{
MessageBox.Show("Start index cannot be greater than end index.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.None;
return;
}

if (end - start + 1 > 100)
{
MessageBox.Show("Range cannot exceed 100 items.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.None;
return;
}

StartIndex = start;
EndIndex = end;
}
else
{
MessageBox.Show("Invalid numbers.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
this.DialogResult = DialogResult.None;
}
}
}
}
Loading