Skip to content
Merged
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
3 changes: 3 additions & 0 deletions UoFiddler.Controls/Forms/AnimationEditForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public partial class AnimationEditForm : Form
private bool _showOnlyValid;
private static bool _drawEmpty;
private static bool _drawFull;
private static int _lastAddFilterIndex = 1;
private static readonly Color _whiteConvert = Color.FromArgb(255, 255, 255, 255);

private static readonly Pen _blackUnDrawTransparent = new Pen(Color.FromArgb(0, 0, 0, 0), 1);
Expand Down Expand Up @@ -846,9 +847,11 @@ private void OnClickAdd(object sender, EventArgs e)
dialog.Title = "Choose image file to add";
dialog.CheckFileExists = true;
dialog.Filter = "Gif files (*.gif;)|*.gif; |Bitmap files (*.bmp;)|*.bmp; |Tiff files (*.tif;*.tiff)|*.tif;*.tiff; |Png files (*.png;)|*.png; |Jpeg files (*.jpeg;*.jpg;)|*.jpeg;*.jpg;";
dialog.FilterIndex = _lastAddFilterIndex;

if (dialog.ShowDialog() == DialogResult.OK)
{
_lastAddFilterIndex = dialog.FilterIndex;
FramesListView.BeginUpdate();
try
{
Expand Down
2 changes: 1 addition & 1 deletion UoFiddler.Controls/Forms/MapDiffInsertForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ private void OnClickCopy(object sender, EventArgs e)
mStaticsReader.Close();
}

MessageBox.Show($"Files saved to {Options.OutputPath}", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
FileSavedDialog.Show(FindForm(), Options.OutputPath, "Files saved successfully.");
}
}
}
64 changes: 20 additions & 44 deletions UoFiddler.Controls/Forms/MapReplaceForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,32 +157,27 @@ private void OnClickCopy(object sender, EventArgs e)

if (checkBoxMap.Checked)
{
string copyMap = Path.Combine(path, $"map{replaceMap.Id}.mul");
if (!File.Exists(copyMap))
string copyMapMul = Path.Combine(path, $"map{replaceMap.Id}.mul");
string copyMapUop = Path.Combine(path, $"map{replaceMap.Id}LegacyMUL.uop");
if (!File.Exists(copyMapMul) && !File.Exists(copyMapUop))
{
MessageBox.Show("Map file not found!", "Map Replace", MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1);
return;
}

FileStream mMapCopy = new FileStream(copyMap, FileMode.Open, FileAccess.Read, FileShare.Read);
BinaryReader mMapReaderCopy = new BinaryReader(mMapCopy);
string mapPath = Files.GetFilePath($"map{_workingMap.FileIndex}.mul");

BinaryReader mMapReader;

if (mapPath != null)
{
FileStream mMap = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.Read);
mMapReader = new BinaryReader(mMap);
}
else
string workingMapMul = Files.GetFilePath($"map{_workingMap.FileIndex}.mul");
string workingMapUop = Files.GetFilePath($"map{_workingMap.FileIndex}LegacyMUL.uop");
if (workingMapMul == null && workingMapUop == null)
{
MessageBox.Show("Map file not found!", "Map Replace", MessageBoxButtons.OK, MessageBoxIcon.Error,
MessageBoxDefaultButton.Button1);
return;
}

var copyTileMatrix = new TileMatrix(replaceMap.Id, replaceMap.Id, replaceMap.Width, replaceMap.Height, path);
var workTileMatrix = new TileMatrix(_workingMap.FileIndex, _workingMap.FileIndex, _workingMap.Width, _workingMap.Height, null);

string mul = Path.Combine(Options.OutputPath, $"map{_workingMap.FileIndex}.mul");
using (FileStream fsMul = new FileStream(mul, FileMode.Create, FileAccess.Write, FileShare.Write))
{
Expand All @@ -192,35 +187,16 @@ private void OnClickCopy(object sender, EventArgs e)
{
for (int y = 0; y < blockY; ++y)
{
if (tox <= x && x <= tox2 && toy <= y && y <= toy2)
{
mMapReaderCopy.BaseStream.Seek((((x - tox + x1) * blockYReplace) + (y - toy) + y1) * 196, SeekOrigin.Begin);
int header = mMapReaderCopy.ReadInt32();
binMul.Write(header);
}
else
{
mMapReader.BaseStream.Seek(((x * blockY) + y) * 196, SeekOrigin.Begin);
int header = mMapReader.ReadInt32();
binMul.Write(header);
}
for (int i = 0; i < 64; ++i)
{
ushort tileId;
sbyte z;

if (tox <= x && x <= tox2 && toy <= y && y <= toy2)
{
tileId = mMapReaderCopy.ReadUInt16();
z = mMapReaderCopy.ReadSByte();
}
else
{
tileId = mMapReader.ReadUInt16();
z = mMapReader.ReadSByte();
}
bool inRegion = tox <= x && x <= tox2 && toy <= y && y <= toy2;
Tile[] tiles = inRegion
? copyTileMatrix.GetLandBlock(x - tox + x1, y - toy + y1, false)
: workTileMatrix.GetLandBlock(x, y, false);

tileId = Art.GetLegalItemId(tileId);
binMul.Write(0); // 4-byte block header
foreach (Tile tile in tiles)
{
ushort tileId = Art.GetLegalItemId(tile.Id);
sbyte z = tile.Z;

if (z < -128)
{
Expand All @@ -241,8 +217,8 @@ private void OnClickCopy(object sender, EventArgs e)
}
}

mMapReader.Close();
mMapReaderCopy.Close();
copyTileMatrix.CloseStreams();
workTileMatrix.CloseStreams();
}

if (checkBoxStatics.Checked)
Expand Down
86 changes: 86 additions & 0 deletions UoFiddler.Controls/Forms/ReplaceFromFolderResultForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions UoFiddler.Controls/Forms/ReplaceFromFolderResultForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/***************************************************************************
*
* $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.Windows.Forms;

namespace UoFiddler.Controls.Forms
{
public sealed partial class ReplaceFromFolderResultForm : Form
{
public ReplaceFromFolderResultForm(string report)
{
InitializeComponent();
reportTextBox.Text = report;
}
}
}
120 changes: 120 additions & 0 deletions UoFiddler.Controls/Forms/ReplaceFromFolderResultForm.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 2.0

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
7 changes: 3 additions & 4 deletions UoFiddler.Controls/UserControls/AnimationListControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -944,8 +944,7 @@ private void ExportAnimationFrames(ImageFormat imageFormat)
}
}

MessageBox.Show($"{what} saved to '{fileName}-X.{fileExtension}'", "Saved", MessageBoxButtons.OK,
MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
FileSavedDialog.Show(FindForm(), Options.OutputPath, $"Files with following format {fileName}-X.{fileExtension} saved successfully.");
}

private void OnClickExportFrameBmp(object sender, EventArgs e)
Expand Down Expand Up @@ -1007,8 +1006,8 @@ private void ExportAnimatedGif(bool looping)

var outputFile = Path.Combine(Options.OutputPath, $"{(_displayType == 1 ? "Equipment" : "Mob")} {_currentSelect}.gif");
MainPictureBox.Frames.ToGif(outputFile, looping: looping, delay: 150, showFrameBounds: MainPictureBox.ShowFrameBounds);
MessageBox.Show($"InGame Anim saved to {outputFile}", "Saved", MessageBoxButtons.OK,
MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);

FileSavedDialog.Show(FindForm(), outputFile, "InGame Anim saved successfully.");
}

private void OnClickExtractAnimGifLooping(object sender, EventArgs e)
Expand Down
3 changes: 1 addition & 2 deletions UoFiddler.Controls/UserControls/FontsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ private void OnClickExport(object sender, EventArgs e)
bmp.Save(fileName, ImageFormat.Tiff);
}

MessageBox.Show($"Character saved to {fileName}", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1);
FileSavedDialog.Show(FindForm(), fileName, "Character saved successfully.");
}

private static int AsciiFontOffset => 32;
Expand Down
Loading