Skip to content

Commit

Permalink
Fix CDK validation
Browse files Browse the repository at this point in the history
  • Loading branch information
zeng-github01 committed Dec 14, 2022
1 parent a48d907 commit 72b2ce9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions CDK/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ private bool KeyVailed(CDKData cdk)
{
if(cdk.Amount == string.Empty && cdk.Items != string.Empty)
{
var list = cdk.Items.Split(',').ToList();
for (int i = 0; i < list.Count; i++)
{
if (!ushort.TryParse(list[i], out ushort res))
{
Logger.LogError(String.Format("CDK:{0} has id in Items not a ushort!", cdk.CDK));
return false;
}
}
return true;
}
List<string> listitem = cdk.Items.Split(',').ToList();
Expand All @@ -56,7 +65,7 @@ private bool KeyVailed(CDKData cdk)

for (int i = 0; i < listitem.Count; i++)
{
if (!ushort.TryParse(cdk.Items[i].ToString(), out ushort id))
if (!ushort.TryParse(listitem[i], out ushort id))
{
Logger.LogError(String.Format("CDK:{0} has id in Items not a ushort!", cdk.CDK));
return false;
Expand All @@ -65,7 +74,7 @@ private bool KeyVailed(CDKData cdk)

for (int i = 0; i < listamount.Count; i++)
{
if (!byte.TryParse(cdk.Amount[i].ToString(), out byte am))
if (!byte.TryParse(listamount[i], out byte am))
{
Logger.LogError(String.Format("CDK:{0} has amount in Amount not a byte. MAX 255!", cdk.CDK));
return false;
Expand Down
4 changes: 2 additions & 2 deletions CDK/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3.1.2")]
[assembly: AssemblyFileVersion("3.3.1.2")]
[assembly: AssemblyVersion("3.3.1.3")]
[assembly: AssemblyFileVersion("3.3.1.3")]

0 comments on commit 72b2ce9

Please sign in to comment.