Skip to content

Commit 412df96

Browse files
committed
Cleanup: minor code changes; readme update; .gitignore update.
1 parent 67e47e2 commit 412df96

File tree

5 files changed

+87
-14
lines changed

5 files changed

+87
-14
lines changed

.gitignore

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Ignore Visual Studio temporary files, build results, and
22
## files generated by popular Visual Studio add-ons.
33
##
4-
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
4+
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
55

66
# User-specific files
77
*.rsuser
@@ -23,6 +23,7 @@ mono_crash.*
2323
[Rr]eleases/
2424
x64/
2525
x86/
26+
[Ww][Ii][Nn]32/
2627
[Aa][Rr][Mm]/
2728
[Aa][Rr][Mm]64/
2829
bld/
@@ -61,6 +62,9 @@ project.lock.json
6162
project.fragment.lock.json
6263
artifacts/
6364

65+
# ASP.NET Scaffolding
66+
ScaffoldingReadMe.txt
67+
6468
# StyleCop
6569
StyleCopReport.xml
6670

@@ -86,6 +90,7 @@ StyleCopReport.xml
8690
*.tmp_proj
8791
*_wpftmp.csproj
8892
*.log
93+
*.tlog
8994
*.vspscc
9095
*.vssscc
9196
.builds
@@ -137,6 +142,11 @@ _TeamCity*
137142
.axoCover/*
138143
!.axoCover/settings.json
139144

145+
# Coverlet is a free, cross platform Code Coverage Tool
146+
coverage*.json
147+
coverage*.xml
148+
coverage*.info
149+
140150
# Visual Studio code coverage results
141151
*.coverage
142152
*.coveragexml
@@ -284,6 +294,17 @@ node_modules/
284294
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
285295
*.vbw
286296

297+
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
298+
*.vbp
299+
300+
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
301+
*.dsw
302+
*.dsp
303+
304+
# Visual Studio 6 technical files
305+
*.ncb
306+
*.aps
307+
287308
# Visual Studio LightSwitch build output
288309
**/*.HTMLClient/GeneratedArtifacts
289310
**/*.DesktopClient/GeneratedArtifacts
@@ -340,6 +361,9 @@ ASALocalRun/
340361
# Local History for Visual Studio
341362
.localhistory/
342363

364+
# Visual Studio History (VSHistory) files
365+
.vshistory/
366+
343367
# BeatPulse healthcheck temp database
344368
healthchecksdb
345369

@@ -349,8 +373,28 @@ MigrationBackup/
349373
# Ionide (cross platform F# VS Code tools) working folder
350374
.ionide/
351375

352-
# SonarQube
353-
.sonarqube/
354-
376+
# Fody - auto-generated XML schema
377+
FodyWeavers.xsd
378+
379+
# VS Code files for those working on multiple tools
380+
.vscode/*
381+
!.vscode/settings.json
382+
!.vscode/tasks.json
383+
!.vscode/launch.json
384+
!.vscode/extensions.json
385+
*.code-workspace
386+
387+
# Local History for Visual Studio Code
388+
.history/
389+
390+
# Windows Installer files from build outputs
391+
*.cab
392+
*.msi
393+
*.msix
394+
*.msm
395+
*.msp
396+
397+
# JetBrains Rider
398+
*.sln.iml
355399
# Jetbrains Rider IDE
356400
.idea/

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
## UO Fiddler
1+
# UO Fiddler
2+
3+
## About
4+
5+
UOFiddler based on Ultima SDK it's a tool to view and alter almost every UO 2D client file. Source code is released under the Beerware license.
6+
7+
## Requirements
28

39
Requires .NET Framework 4.8
410
You can download it at: <https://dotnet.microsoft.com/download/dotnet-framework>
511

612
Minimum supported Windows version is 7.
713

14+
## Reporting bugs and issues
15+
816
Please report bugs or problems on [issues](https://github.com/polserver/UOFiddler/issues) page.

UoFiddler.Controls/Forms/AnimationEditForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public AnimationEditForm()
5959
_loaded = false;
6060
}
6161

62-
private string[][] AnimNames =
62+
private readonly string[][] _animNames =
6363
{
6464
new string[]
6565
{
@@ -170,7 +170,7 @@ private void OnLoad(object sender, EventArgs e)
170170
TreeNode treeNode = new TreeNode
171171
{
172172
Tag = j,
173-
Text = string.Format("{0:D2} {1}", j, AnimNames[animLength == 22 ? 1 : animLength == 13 ? 0 : 2][j])
173+
Text = string.Format("{0:D2} {1}", j, _animNames[animLength == 22 ? 1 : animLength == 13 ? 0 : 2][j])
174174
};
175175

176176
if (AnimationEdit.IsActionDefined(_fileType, i, j))

UoFiddler.Controls/Forms/HueEditForm.cs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@
1414
using System.Windows.Forms;
1515
using Ultima;
1616
using UoFiddler.Controls.Classes;
17-
using UoFiddler.Controls.UserControls;
1817

1918
namespace UoFiddler.Controls.Forms
2019
{
2120
public partial class HueEditForm : Form
2221
{
23-
//private readonly HuesControl _refMarker; // TODO: unused?
2422
private readonly Hue _hue;
2523
private readonly short[] _colors;
2624
private int _selected;
@@ -52,12 +50,11 @@ private int SecondSelected
5250
}
5351
}
5452

55-
public HueEditForm(int index, HuesControl mRefMarker)
53+
public HueEditForm(int index)
5654
{
5755
InitializeComponent();
5856
Icon = Options.GetFiddlerIcon();
5957

60-
//_refMarker = mRefMarker;
6158
Text = $"HueEdit {index} / 0x{index:X}";
6259

6360
_hue = Hues.GetHue(index);
@@ -177,7 +174,9 @@ private void OnClickSpread(object sender, EventArgs e)
177174

178175
_colors[start + i] = Hues.ColorToHue(newC);
179176
}
177+
180178
pictureBox.Invalidate();
179+
181180
RefreshPreview();
182181
}
183182

@@ -190,6 +189,7 @@ private void OnClickEpxGradient(object sender, EventArgs e)
190189

191190
int start = Math.Min(SecondSelected, Selected);
192191
int end = Math.Max(SecondSelected, Selected);
192+
193193
int diff = end - start;
194194
if (diff <= 1)
195195
{
@@ -198,9 +198,11 @@ private void OnClickEpxGradient(object sender, EventArgs e)
198198

199199
Color startColor = Hues.HueToColor(_colors[start]);
200200
Color endColor = Hues.HueToColor(_colors[end]);
201+
201202
double redDiv = Math.Log(Math.Abs(endColor.R - startColor.R), Math.E) / Math.Log(diff, Math.E);
202203
double greenDiv = Math.Log(Math.Abs(endColor.G - startColor.G), Math.E) / Math.Log(diff, Math.E);
203204
double blueDiv = Math.Log(Math.Abs(endColor.B - startColor.B), Math.E) / Math.Log(diff, Math.E);
205+
204206
int redFac = 1;
205207
if (endColor.R - startColor.R < 0)
206208
{
@@ -225,9 +227,12 @@ private void OnClickEpxGradient(object sender, EventArgs e)
225227
(int)(startColor.R + (redFac * Math.Pow(i, redDiv))),
226228
(int)(startColor.G + (greenFac * Math.Pow(i, greenDiv))),
227229
(int)(startColor.B + (blueFac * Math.Pow(i, blueDiv))));
230+
228231
_colors[start + i] = Hues.ColorToHue(newColor);
229232
}
233+
230234
pictureBox.Invalidate();
235+
231236
RefreshPreview();
232237
}
233238

@@ -240,6 +245,7 @@ private void OnClickInverse(object sender, EventArgs e)
240245

241246
int start = Math.Min(SecondSelected, Selected);
242247
int end = Math.Max(SecondSelected, Selected);
248+
243249
while (start < end)
244250
{
245251
short temp = _colors[start];
@@ -248,7 +254,9 @@ private void OnClickInverse(object sender, EventArgs e)
248254
++start;
249255
--end;
250256
}
257+
251258
Selected = _selected;
259+
252260
RefreshPreview();
253261
}
254262

@@ -261,6 +269,7 @@ private void OnClickModifyRange(object sender, EventArgs e)
261269

262270
int start = Math.Min(SecondSelected, Selected);
263271
int end = Math.Max(SecondSelected, Selected);
272+
264273
for (int i = start; i <= end; ++i)
265274
{
266275
Color color = Hues.HueToColor(_colors[i]);
@@ -273,7 +282,9 @@ private void OnClickModifyRange(object sender, EventArgs e)
273282
Math.Max(0, Math.Min(255, b)));
274283
_colors[i] = Hues.ColorToHue(newColor);
275284
}
285+
276286
Selected = _selected;
287+
277288
RefreshPreview();
278289
}
279290

@@ -307,7 +318,9 @@ private void OnKeyDownArt(object sender, KeyEventArgs e)
307318
}
308319

309320
contextMenuStrip1.Close();
321+
310322
_preview = Art.GetStatic(index);
323+
311324
RefreshPreview();
312325
}
313326

@@ -336,14 +349,18 @@ private void OnKeyDownAnim(object sender, KeyEventArgs e)
336349
}
337350

338351
contextMenuStrip1.Close();
352+
339353
int hueRef = 0;
354+
340355
AnimationFrame[] frames = Animations.GetAnimation(index, 0, 1, ref hueRef, false, true);
356+
341357
if (frames == null)
342358
{
343359
return;
344360
}
345361

346362
_preview = frames[0].Bitmap;
363+
347364
RefreshPreview();
348365
}
349366

@@ -377,7 +394,9 @@ private void OnKeyDownGump(object sender, KeyEventArgs e)
377394
}
378395

379396
contextMenuStrip1.Close();
397+
380398
_preview = Gumps.GetGump(index);
399+
381400
RefreshPreview();
382401
}
383402

@@ -399,13 +418,15 @@ private void RefreshPreview()
399418
g.DrawImage(bmp, x, y);
400419
}
401420
}
421+
402422
pictureBoxPreview.Invalidate();
403423
}
404424

405425
private void SetColorButton_Click(object sender, EventArgs e)
406426
{
407-
_colors[_selected] = Hues.ColorToHue(Color.FromArgb((int)numericUpDownR.Value, (int)numericUpDownG.Value,
408-
(int)numericUpDownB.Value));
427+
_colors[_selected] = Hues.ColorToHue(Color.FromArgb((int)numericUpDownR.Value,
428+
(int)numericUpDownG.Value,
429+
(int)numericUpDownB.Value));
409430

410431
pictureBox.Invalidate();
411432
pictureBoxIndex.Invalidate();

UoFiddler.Controls/UserControls/HuesControl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ private void OnMouseDoubleClick(object sender, MouseEventArgs e)
228228

229229
if (Selected >= 0)
230230
{
231-
new HueEditForm(Selected, _refMarker).Show();
231+
new HueEditForm(Selected).Show();
232232
}
233233
}
234234

0 commit comments

Comments
 (0)