Misc clean

no functional change
This commit is contained in:
Kurt 2019-02-15 11:46:46 -08:00
parent 9c521919e5
commit d1f6a5a3ff
8 changed files with 13 additions and 20 deletions

View File

@ -1,6 +1,6 @@
namespace PKHeX.Core
{
public enum RegionID
public enum RegionID : byte
{
None = 0,
Japan = 1,

View File

@ -1,6 +1,4 @@
using System;
namespace PKHeX.Core
namespace PKHeX.Core
{
/// <summary>
/// Object that can be fed to a <see cref="IEncounterable"/> converter to ensure that the resulting <see cref="PKM"/> meets rough specifications.

View File

@ -183,7 +183,7 @@ public static int GetFormatHeldItemID(int item, int srcFormat, int destFormat)
if (destFormat != srcFormat && srcFormat <= 3) // past gen items
{
if (destFormat > 3) // try remapping
return item = srcFormat == 2 ? GetG4Item((byte)item) : GetG4Item((ushort)item);
return srcFormat == 2 ? GetG4Item((byte)item) : GetG4Item((ushort)item);
if (destFormat > srcFormat) // can't set past gen items
return 0;

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace PKHeX.Core
namespace PKHeX.Core
{
public enum RotateDirection
{

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using System.Linq;

View File

@ -276,11 +276,11 @@ private string CreateDragDropPKM(PictureBox pb, bool encrypt, out bool external)
Array.Resize(ref dragdata, SAV.SIZE_STORED);
// Make File
PKM pkx = SAV.GetPKM(dragdata);
string newfile = FileUtil.GetPKMTempFileName(pkx, encrypt);
PKM pk = SAV.GetPKM(dragdata);
string newfile = FileUtil.GetPKMTempFileName(pk, encrypt);
try
{
TryMakeDragDropPKM(pb, encrypt, pkx, newfile, out external);
TryMakeDragDropPKM(pb, encrypt, pk, newfile, out external);
}
catch (Exception x)
{
@ -291,9 +291,9 @@ private string CreateDragDropPKM(PictureBox pb, bool encrypt, out bool external)
return newfile;
}
private bool TryMakeDragDropPKM(PictureBox pb, bool encrypt, PKM pkx, string newfile, out bool external)
private bool TryMakeDragDropPKM(PictureBox pb, bool encrypt, PKM pk, string newfile, out bool external)
{
File.WriteAllBytes(newfile, encrypt ? pkx.EncryptedBoxData : pkx.DecryptedBoxData);
File.WriteAllBytes(newfile, encrypt ? pk.EncryptedBoxData : pk.DecryptedBoxData);
var img = (Bitmap)pb.Image;
SetCursor(new Cursor(img.GetHicon()), pb);
HoverCancel();

View File

@ -10,7 +10,7 @@ public static class PluginLoader
{
public static IEnumerable<T> LoadPlugins<T>(string pluginPath)
{
IEnumerable<string> dllFileNames = !Directory.Exists(pluginPath)
var dllFileNames = !Directory.Exists(pluginPath)
? Enumerable.Empty<string>()
: Directory.EnumerateFiles(pluginPath, "*.dll", SearchOption.AllDirectories);
var assemblies = GetAssemblies(dllFileNames);

View File

@ -48,13 +48,13 @@ public void EncodesNicknameCorrectly()
private static void CheckStringGetSet(string check, string instr, string outstr, byte[] indata, byte[] outdata)
{
Assert.Equal(instr, outstr);
outdata = outdata.Take(indata.Length).ToArray();
Assert.True(indata.SequenceEqual(outdata),
$"{check} did not set properly."
+ Environment.NewLine + string.Join(", ", outdata.Select(z => $"{z:X2}")));
Assert.Equal(instr, outstr);
}
}