Clean up all

Remvoe TextBoxXP
This commit is contained in:
2022-11-27 16:51:47 +08:00
parent d169de9a9e
commit c7898401ce
52 changed files with 925 additions and 1102 deletions

View File

@ -1,186 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace GrasscutterTools.Controls
{
[ToolboxItem(true)]
public class TextBoxXP : TextBox
{
/// <summary>
/// 获得当前进程,以便重绘控件
/// </summary>
/// <param name="hWnd"></param>
/// <returns></returns>
[DllImport("user32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("user32.dll")]
private static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
private const int EM_SETCUEBANNER = 0x1501;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SendMessage
(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
/// <summary>
/// 水印文本
/// </summary>
private string _Watermark = "";
private float maximum;
private float minimum;
#region
/// <summary>
/// 是否启用热点效果
/// </summary>
[Category("外观")]
[Browsable(true)]
[Localizable(true)]
[Description("获取或设置输入框水印文本")]
[DefaultValue("")]
public string Watermark
{
get
{
return this._Watermark;
}
set
{
this._Watermark = value;
SendMessage(Handle, EM_SETCUEBANNER, 0, _Watermark);
this.Invalidate();
}
}
/// <summary>
/// 是否只能输入数字
/// </summary>
[Category("行为")]
[Browsable(true)]
[Description("获取或设置TextBox是否只允许输入数字")]
[DefaultValue(false)]
public bool DigitOnly { get; set; }
/// <summary>
/// 转为数值
/// </summary>
public float Number
{
get
{
if (float.TryParse(Text, out float value))
return value;
else
return 0f;
}
}
[Category("数据")]
[Browsable(true)]
[DefaultValue(0)]
[Description("指示小数点后位数")]
public int DecimalPlaces { get; set; }
[Category("数据")]
[Description("获取或设置限制的最大值")]
public float Maximum
{
get
{
return maximum;
}
set
{
maximum = value;
if (minimum > maximum)
{
minimum = maximum;
}
}
}
[Category("数据")]
[Browsable(true)]
[Description("获取或设置限制的最小值")]
public float Minimum
{
get
{
return minimum;
}
set
{
minimum = value;
if (minimum > maximum)
{
maximum = value;
}
}
}
#endregion
/// <summary>
///
/// </summary>
public TextBoxXP()
: base()
{
//BorderStyle = BorderStyle.FixedSingle;
//Font = Styles.StaticResources.DefaultFont;
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
// 如果只允许输入数字,则判断输入是否为退格或者数字
if (DigitOnly)
{
//IsNumber指定字符串中位于指定位置的字符是否属于数字类别
//IsPunctuation指定字符串中位于指定位置的字符是否属于标点符号类别
//IsControl指定字符串中位于指定位置的字符是否属于控制字符类别
if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true; //获取或设置一个值指示是否处理过System.Windows.Forms.Control.KeyPress事件
}
else if (Char.IsPunctuation(e.KeyChar) && DecimalPlaces > 0)
{
if (e.KeyChar == '.')
{
if (Text.LastIndexOf('.') != -1)
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
}
}
protected override void OnLeave(EventArgs e)
{
base.OnLeave(e);
if (DigitOnly)
{
if (!string.IsNullOrWhiteSpace(Text))
{
if (Number > Maximum)
Text = Maximum.ToString("F" + DecimalPlaces);
if (Number < Minimum)
Text = Minimum.ToString("F" + DecimalPlaces);
}
}
}
}
}

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Threading.Tasks;
using GrasscutterTools.DispatchServer.Model;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.DispatchServer.Model

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.IO;
@ -485,7 +486,6 @@ namespace GrasscutterTools.Forms
dropList[i] = data;
}
#endregion - -
#region - -

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -22,7 +22,6 @@ using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using GrasscutterTools.Game;
using GrasscutterTools.Game.Gacha;

View File

@ -24,10 +24,8 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using GrasscutterTools.Game;
using GrasscutterTools.Game.Drop;
using GrasscutterTools.Game.Gacha;
using GrasscutterTools.Properties;
@ -44,7 +42,7 @@ namespace GrasscutterTools.Forms
private List<GachaBanner3> Banners;
#endregion
#endregion - -
#region - -
@ -105,11 +103,10 @@ namespace GrasscutterTools.Forms
new FormGachaBannerEditor().ShowDialog();
}
#endregion
#endregion - -
#region - Banners.json -
/// <summary>
/// 加载按钮点击时触发
/// </summary>
@ -174,7 +171,7 @@ namespace GrasscutterTools.Forms
}
}
#endregion
#endregion - Banners.json -
#region - -
@ -254,7 +251,7 @@ namespace GrasscutterTools.Forms
}
}
#endregion
#endregion - -
#region - -
@ -497,8 +494,6 @@ namespace GrasscutterTools.Forms
return banner;
}
#endregion - -
}
}

View File

@ -163,7 +163,6 @@ namespace GrasscutterTools.Forms
}
throw firstEx;
//{
// try
// {

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.Linq;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.GOOD

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.GOOD

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using Newtonsoft.Json;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
@ -55,10 +56,8 @@ namespace GrasscutterTools.GOOD
Weapons = ToGOODMap(weapons);
}
public static Dictionary<string, int> ArtifactCats { get; private set; }
public static Dictionary<string, int> ArtifactSlotMap = new Dictionary<string, int> {
{"goblet", 1}, {"plume", 2}, {"circlet", 3}, {"flower", 4}, {"sands", 5}
};
@ -103,6 +102,5 @@ namespace GrasscutterTools.GOOD
public static Dictionary<string, int> Avatars { get; private set; }
public static Dictionary<string, int> Weapons { get; private set; }
}
}

View File

@ -16,7 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.ComponentModel;
using Newtonsoft.Json;
namespace GrasscutterTools.GOOD

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
namespace GrasscutterTools.Game

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Drop

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using Newtonsoft.Json;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Gacha
{
public enum BannerType

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.ComponentModel;
using Newtonsoft.Json;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.ComponentModel;
using System.Linq;
@ -215,7 +216,6 @@ namespace GrasscutterTools.Game.Gacha
[JsonProperty("bannerType"), JsonConverter(typeof(StringEnumConverter)), DefaultValue(BannerType.STANDARD)]
public BannerType BannerType { get; set; } = BannerType.STANDARD;
public override string ToString()
{
return $"[{GachaType}|{ScheduleId}] 5*:[{string.Join(",", RateUpItems5.Select(GetName))}] 4*:[{string.Join(",", RateUpItems4.Select(GetName))}]";

View File

@ -1,6 +1,6 @@

using System.Collections.Generic;
using System.Collections.Generic;
using System.Text;
/**
* Grasscutter Tools
* Copyright (C) 2022 jie65535
@ -19,6 +19,7 @@ using System.Text;
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game
{
public class GameCommand

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using GrasscutterTools.Properties;
namespace GrasscutterTools.Game
@ -43,7 +44,6 @@ namespace GrasscutterTools.Game
ShopType = new ItemMap(Resources.ShopType);
}
public static ItemMap Artifacts { get; private set; }
public static ItemMap ArtifactCats { get; private set; }

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using System.Linq;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Mail
{
/// <summary>

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Player
{
/// <summary>

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Text;
using GrasscutterTools.Properties;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Shop

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.Linq;
@ -29,7 +30,6 @@ namespace GrasscutterTools.Game.Shop
{
public ShopInfo()
{
}
public ShopInfo(ShopGoodsData sgd)
@ -115,7 +115,6 @@ namespace GrasscutterTools.Game.Shop
[JsonProperty("shopRefreshParam")]
public int ShopRefreshParam { get; set; }
public override string ToString()
{
return $"{GoodsId}:{GameData.Items[GoodsItem.Id]} x{GoodsItem.Count}";

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
namespace GrasscutterTools.Game.Shop
{
/// <summary>

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using Newtonsoft.Json;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using System.IO;
using System.Linq;

View File

@ -85,9 +85,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\TextBoxXP.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="DispatchServer\DispatchServerAPI.cs" />
<Compile Include="DispatchServer\Model\ServerStatus.cs" />
<Compile Include="Forms\FormDropEditor.cs">

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Windows.Forms;

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Threading.Tasks;

View File

@ -63,25 +63,28 @@ namespace GrasscutterTools.Pages
/// </summary>
public Func<string> GetCommand { get; set; }
#endregion
#endregion - -
#region - -
/// <summary>
/// 加载时触发(修改语言时会再次触发)
/// </summary>
public virtual void OnLoad() { }
public virtual void OnLoad()
{ }
/// <summary>
/// 进入页面时触发(可触发多次)
/// </summary>
public virtual void OnEnter() { }
public virtual void OnEnter()
{ }
/// <summary>
/// 关闭时触发(用于保存页面数据)
/// </summary>
public virtual void OnClosed() { }
public virtual void OnClosed()
{ }
#endregion
#endregion - -
}
}

View File

@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using GrasscutterTools.Game;
using GrasscutterTools.Properties;
@ -40,7 +41,6 @@ namespace GrasscutterTools.Pages
InitGiveItemRecord();
}
/// <summary>
/// 初始化游戏物品列表
/// </summary>
@ -185,6 +185,5 @@ namespace GrasscutterTools.Pages
}
#endregion -- --
}
}

View File

@ -18,14 +18,6 @@
**/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using GrasscutterTools.Game;
using GrasscutterTools.Utils;
@ -39,7 +31,6 @@ namespace GrasscutterTools.Pages
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

View File

@ -85,7 +85,6 @@ namespace GrasscutterTools.Pages
#region - Check update -
private ReleaseAPI.ReleaseInfo LastestInfo = null;
private Version lastestVersion = null;

View File

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Globalization;
using System.Reflection;
using System.Text;
using System.Threading;

View File

@ -16,13 +16,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Collections.Generic;
using System.Linq;
namespace GrasscutterTools.Utils
{
class SubstatSumEquality : IEqualityComparer<List<KeyValuePair<int, double>>>
internal class SubstatSumEquality : IEqualityComparer<List<KeyValuePair<int, double>>>
{
public bool Equals(List<KeyValuePair<int, double>> left, List<KeyValuePair<int, double>> right)
{
@ -48,7 +49,7 @@ namespace GrasscutterTools.Utils
}
}
class ArtifactUtils
internal class ArtifactUtils
{
public static Dictionary<string, double[][]> substats_rolls = new Dictionary<string, double[][]>
{
@ -179,6 +180,7 @@ namespace GrasscutterTools.Utils
// Default, should never happen
return last_stat_list;
}
private static void InitSubstats()
{
substats_dict = new Dictionary<string, Dictionary<int, List<KeyValuePair<double, int[]>>>>();

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System;
using System.Net;
using System.Net.Http;

View File

@ -45,7 +45,6 @@ namespace GrasscutterTools.Utils
listBox.EndUpdate();
}
/// <summary>
/// 使用浏览器打开网址
/// </summary>
@ -63,11 +62,10 @@ namespace GrasscutterTools.Utils
}
}
/// <summary>
/// 提示气泡对象
/// </summary>
private readonly static ToolTip TTip = new ToolTip();
private static readonly ToolTip TTip = new ToolTip();
/// <summary>
/// 在指定控件上显示提示气泡