Convert IntHelpers to NumberExtensions and change namespace appropriately, remove StringHelpers.cs
This commit is contained in:
parent
467f8da2fb
commit
0eb37ad36d
|
@ -6,6 +6,7 @@ using BizHawk.Common;
|
|||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
|
@ -161,7 +163,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (_domain != null)
|
||||
{
|
||||
return "X" + IntHelpers.GetNumDigits(this._domain.Size - 1);
|
||||
return "X" + (_domain.Size - 1).NumHexDigits();
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Common.StringExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (_domain != null)
|
||||
{
|
||||
return "{0:X" + IntHelpers.GetNumDigits(this._domain.Size - 1) + "}";
|
||||
return "{0:X" + (_domain.Size - 1).NumHexDigits() + "}";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -30,7 +31,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void SetHexProperties(int domainSize)
|
||||
{
|
||||
_maxSize = domainSize - 1;
|
||||
MaxLength = IntHelpers.GetNumDigits(_maxSize.Value);
|
||||
MaxLength = _maxSize.Value.NumHexDigits();
|
||||
_addressFormatStr = "{0:X" + MaxLength + "}";
|
||||
|
||||
ResetText();
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -114,7 +115,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SpecificValueBox.Type = _settings.Type;
|
||||
|
||||
MessageLabel.Text = string.Empty;
|
||||
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Global.Emulator.MemoryDomains.MainMemory.Size);
|
||||
SpecificAddressBox.MaxLength = (Global.Emulator.MemoryDomains.MainMemory.Size - 1).NumHexDigits();
|
||||
HardSetSizeDropDown(_settings.Size);
|
||||
PopulateTypeDropDown();
|
||||
HardSetDisplayTypeDropDown(_settings.Type);
|
||||
|
@ -546,7 +547,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings.Domain = Global.Emulator.MemoryDomains[name];
|
||||
SetReboot(true);
|
||||
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(_settings.Domain.Size);
|
||||
SpecificAddressBox.MaxLength = (_settings.Domain.Size - 1).NumHexDigits();
|
||||
DoDomainSizeCheck();
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
<Compile Include="CustomCollections.cs" />
|
||||
<Compile Include="EnumHelper.cs" />
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="Extensions\NumberExtensions.cs" />
|
||||
<Compile Include="Extensions\StringExtensions.cs" />
|
||||
<Compile Include="HawkFile.cs" />
|
||||
<Compile Include="InputValidate.cs" />
|
||||
|
@ -67,7 +68,6 @@
|
|||
<Compile Include="ReflectionUtil.cs" />
|
||||
<Compile Include="Serializer.cs" />
|
||||
<Compile Include="SettingsUtil.cs" />
|
||||
<Compile Include="StringHelpers.cs" />
|
||||
<Compile Include="SwitcherStream.cs" />
|
||||
<Compile Include="UndoHistory.cs" />
|
||||
<Compile Include="Util.cs" />
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace BizHawk.Common
|
||||
{
|
||||
// TODO: put it in its own file
|
||||
public static class IntHelpers // TODO: a less lame name
|
||||
{
|
||||
public static int GetNumDigits(int i)
|
||||
{
|
||||
if (i < 0x100)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (i < 0x10000)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (i < 0x1000000)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue