Commit graph

181 commits

Author SHA1 Message Date
Kurt
01fb233e48 Minor tweaks
Extract some interfaces
Suppress some warning messages with commented reasons if appropriate
2020-09-09 12:47:24 -07:00
Jonathan Herbert
6eb348848d
Handle Exception When Adding Font File (#2977) 2020-08-25 11:42:08 -07:00
Kurt
993673f0de Minor clean
no functional change
2020-06-27 23:36:53 -05:00
Kurt
6fb2ebe039 Minor clean
add some xmldoc
2020-06-21 19:46:06 -05:00
Kurt
546412e410 Rename class/method name 2020-04-14 10:59:16 -07:00
Kermalis
5bdfd74862
Fix sav path after exporting to new name (#2791) 2020-03-18 22:15:34 -07:00
Kurt
1520210e68 Revert overload usage
yay core/framework enhancements
2020-01-25 18:12:58 -08:00
Kurt
38759be662 Update gui translations with latest
For dev update utility, move them to the new location in PKHeX.WinForms project
2020-01-25 18:06:04 -08:00
Kurt
852bd2af20 Relocate gui-only text files to WinForms project
Split up the DataUtil method to load text files so that the caching
functionality can be reused
2020-01-03 15:53:48 -08:00
Kurt
24412a2812 Add setting to disable sound on legality/sav load
Closes #2615
2020-01-03 15:29:12 -08:00
Kurt
166f8d82e5 Misc clean
Refactor out some logic, make "en" literals reference one spot (where
appropriate)
2020-01-01 19:07:21 -08:00
Kurt
827a7649c1 Export PCD/PGT as encrypted format
add Write method for writing the data outside the program; only use Data
if you know what you're doing!
2019-12-24 23:24:28 -08:00
Kurt
9e997f1613 Trycatch all clipboard set-text operations
Closes #2486
redirect to a common method in the event that setting to the clipboard
fails; the handling is now the same for all usages (trycatched and a
shared error message).
2019-11-22 21:23:00 -08:00
Kurt
025cf69eeb Switch pkm export formats to party format
Now dumps party format bytes
Cons: more space
Pros: stats are retained, especially when users drag-drop.

Closes #2419
2019-11-16 14:03:25 -08:00
Kurt
39d11f5f2f Simplify font logic
dont bother trycatching stuff that shouldn't fail
2019-10-26 23:14:00 -07:00
Kurt
02420d3e93
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases

Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization

* Handle bits more obviously without null

* Make SaveFile.BAK explicitly readonly again

* merge constructor methods to have readonly fields

* Inline some properties

* More nullable handling

* Rearrange box actions

define straightforward classes to not have any null properties

* Make extrabyte reference array immutable

* Move tooltip creation to designer

* Rearrange some logic to reduce nesting

* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum

* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case

* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable

* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator

* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever

* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)

* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-16 18:47:31 -07:00
Kurt
4baf745af8 Use some c#8 sugar
static local functions
switch expressions
using usings :)

nullable next?
2019-10-07 18:40:09 -07:00
Kurt
8d8adde2b1 sealed
sealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealedsealed
2019-10-03 19:09:02 -07:00
Kurt
43e8b08ba8 Dynamically generate slot grids
Gen1/2 INT: 20 slots => 4 wide x 5 high
Gen7lgpe: 25 slots => 5x5
otherwise: 6x5
(maintain 5 rows)

Database(s): 6x11

Could probably wrap the initialization logic (grabbing savefile, etc)
but works for now

This is all in prep for box sprite resizing (56x68 as evident by lgpe
sprites); figured I'd add some display flexibility to handle prior games
with non-30/box layouts.

shave off a couple pixels for popup box view to make the edges of the
box directly at the edge (-2 bot, -1 right side)
2019-10-02 20:04:12 -07:00
Kurt
94baab1c45
Split off image generation to separate project (#2395)
With the approaching games, PKM sprites are a different size from the 3DS era (as already hinted by LGPE, which has 56x68). It'll be a little easier to manage with this portion of the library walled off from the rest of the codebase.

Eventually the net46 target will use fody or something to merge in these extra dependency dll's automatically to not disturb the usual exe/dll experience.
2019-09-29 09:47:06 -07:00
Kurt
f47382e34f Fix GetUnderlyingControl call from ContextMenuStrip
https://projectpokemon.org/home/forums/topic/55096-unhandled-exception-error-pkmdb/?tab=comments#comment-249235
had recently moved the contextmenu to the designer, event handler has
sender as the ContextMenuStrip

use recursion -> while loop so that the input can be any of the 3 cases;
it'll drill down until it gets a picturebox or none.
make generic for giggles, update usages so Array.IndexOf uses
picturebox[] instead of object[]
2019-09-24 18:14:15 -07:00
Kurt
c5ebbbbe15 Minor clean
Magic number -> const usage
default(T) -> default (c#7.x feature)
remove some unused stuff
fix indentation in some spots
2019-09-10 22:07:50 -07:00
Kurt
a608e0b252 Minor clean
Remove some unnecessary properties from SaveFile
Enumerate checksum flag results for GC memcard checking
Remove unnecessary checks on savefile type
Add some documentation
Decapitalize some method parameters
2019-07-14 15:06:45 -07:00
Kurt
52bfa50641 Simplify font loading
Don't care about operating system; use the AddFontFile method instead.
Add fallback for font load failure.

This should be easier to maintain in the future, if multiple char->glyph
mappings are to be supported (gen6 is already different from gen7 with
some swapped glyphs).
2019-05-19 14:37:15 -07:00
Kurt
56eeca0cbc Use custom savefile extension detection for err msg
#2305
Catches the following as SaveFiles:
"srm", // RetroArch save files
"fla", // flashcard
"SaveRAM", // BizHawk
and whatever else is added by the init
2019-05-13 15:58:36 -07:00
Kurt
04cd0da2ac Use generic pattern match
>7.0 c#
2019-05-13 15:53:27 -07:00
Kurt
300ef4d60a Minor simplifications
Use "SetData" method to automatically apply the Edited flag
Use appropriate method for CopyTo
simplify expressions a tad
2019-04-29 17:21:19 -07:00
Kurt
9861128b63 Minor img processing update
Extract magic pixel shifting numbers for layering imgs -- SWSH will
likely use the large boxsprites, as hinted by LGPE's upsizing.
Remove new[] color array creation, just pass byte values
break up glowedges into steps
2019-04-22 22:25:14 -07:00
Kurt
5b29e71954 Misc tweaks
no functional change, just rewrite some logic for better flow
fix subform popup count restriction (OwnedForms requires forms to be
added/removed manually; it doesn't automatically update)

sanitize box names when dumping boxes with separate folders (and bad box
names)
2019-02-23 14:58:48 -08:00
Kurt
5e242833ba Sync missing change
oops
2019-02-23 09:14:23 -08:00
Kurt
60e05f181b Allow disabling of savefile path detection on fopen 2019-02-22 23:04:10 -08:00
Kurt
a385a8481d Misc tweak to savefile export
Use flags to request header/footer in the output
gets rid of the DSV/GCI bool arguments
2019-02-18 21:59:57 -08:00
Kurt
4aa103a320 Misc clean
lowercase input parameters
2019-02-16 19:53:14 -08:00
Kurt
e82b4de657 Misc clean
replace Friendship control click to match shortcut description (used to
do nothing)
Remove some duplicate translation strings
fix gameselect string formatting
apparently systemsounds changed in a recent win10 update, Question is
now silent?? Exclamation is now the same as Asterisk (same as Beep?) Use
hand instead of Exclamation.
only use asterisk for notifications
2019-02-11 22:39:12 -08:00
Kurt
ec1d3069a5 Remove SaveFile dependency for wallpaper data fetch
reusability++
2019-02-09 20:05:32 -08:00
Kurt
383d4b7700 "" -> string.Empty
be explicit that the string is empty rather than possibly missing
disallow encrypted export for BK4 (they're not encrypted), removes type
check
simplify replaceall in showdownset (don't call ReplaceAll 4x, just get
valid chars and rebuild)
simplify get ribbon sprite name (precompute ToLower and appended values
2019-02-07 21:40:20 -08:00
Kurt
59b41937e1 Misc variable name changes
readability++
2019-02-06 23:28:02 -08:00
Kurt
29253ed636 More cleaning 2019-02-03 20:28:03 -08:00
Kurt
2eef523475 Misc clean
meh
2019-02-02 15:20:08 -08:00
Kurt
f481404503 Misc clean 2019-02-02 10:19:41 -08:00
Kurt
a7323ef484 Misc updates
Reuse some code in netutil for fetching stream (provide useragent for
all uses)
make sav4ranch use dynamicly read offsets to handle both variants
(quicker) #2248
2019-01-25 16:51:58 -08:00
Kurt
9fd6d86b1d Merge game selection alert & prompt to 1 popup
https://projectpokemon.org/home/forums/topic/49080-multiple-exceptions-when-selecting-gen-3-blank-saves/

ty BlackShark :)
2019-01-15 22:26:45 -08:00
Kurt
9a4f12c279 Misc updates
rearrange pkm version groups for clear break between
twins/siblings/family
clear pokelist for sav7b on non-exportable saves (prevents b1s1 from
showing markings)
rename horohoro (pgo) to non romaji lol, hide daycare/party tabs on
nonexportable save
remove some unnecessary operations
rewrite getallcontrolsoftype to remove ToList() and make generic
2019-01-05 15:40:25 -08:00
Kurt
1b50e97934 Remove cgse fixed path
can restore behavior by adding it as a custom user path; cgse isn't very
prevalent nowadays

now the only registry key checks are for checking net framework version
2019-01-02 18:18:24 -08:00
Kurt
b5f82f6535 Update translations with latest 2019-01-01 20:27:00 -08:00
Kurt
6140c973ae Account for wr7 deviance from gen7 format extension 2018-12-29 22:10:33 -08:00
Kurt
fb10a1f983 add size rating indications when viewing pkm data 2018-12-13 21:10:38 -08:00
Evan Dixon
34f4fb176c Use assembly version as the current version (#2164)
* Put assembly version in window title
* Treat version.txt as a Version
* Cache current version
* Don't use resources anymore for version
* Re-add version.txt, for backwards compatibility
* Set old version.txt's build action to None
* Use GitHub API for version checking
2018-12-10 20:36:18 -08:00
Kurt
efb9b7eba2 Misc cleanup
removes clickonce logic/reference
2018-12-10 20:32:08 -08:00
Kurt
8a0b9cd88c Add indication for party/starter slots 2018-12-09 23:18:37 -08:00