Skip to content

Commit 930f188

Browse files
author
尧杰 曾
committed
Fix KeyVaild method
1 parent ebc7598 commit 930f188

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

CDK/CDK.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
<Reference Include="MySql.Data, Version=8.0.30.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
6060
<HintPath>..\packages\MySql.Data.8.0.30\lib\net48\MySql.Data.dll</HintPath>
6161
</Reference>
62-
<Reference Include="PermissionSync, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
62+
<Reference Include="PermissionSync, Version=1.0.1.2, Culture=neutral, processorArchitecture=MSIL">
6363
<SpecificVersion>False</SpecificVersion>
64-
<HintPath>..\..\PermissionSync\PermissionSync\bin\Debug\PermissionSync.dll</HintPath>
64+
<HintPath>..\..\PermissionSync\PermissionSync\bin\Release\PermissionSync.dll</HintPath>
6565
</Reference>
6666
<Reference Include="Rocket.API, Version=4.9.3.4, Culture=neutral, processorArchitecture=MSIL">
6767
<SpecificVersion>False</SpecificVersion>

CDK/DatabaseManager.cs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,28 @@ internal DatabaseManager()
3131

3232
private bool KeyVailed(CDKData cdk)
3333
{
34-
if(cdk.Items.Length != cdk.Amount.Length)
34+
if (cdk.Items != string.Empty && cdk.Amount != string.Empty)
3535
{
36-
Logger.LogError(String.Format("CDK:{0} Items and Amount Column length not equal! ",cdk.CDK));
37-
return false;
38-
}
39-
for(int i= 0; i<cdk.Items.Length;i++)
40-
{
41-
if (!ushort.TryParse(cdk.Items[i].ToString(),out ushort id))
36+
if (cdk.Items.Split(',').Length != cdk.Amount.Split(',').Length)
4237
{
43-
Logger.LogError(String.Format("CDK:{0} has id in Items not a ushort!",cdk.CDK));
38+
Logger.LogError(String.Format("CDK:{0} Items and Amount Column length not equal! ", cdk.CDK));
4439
return false;
4540
}
46-
}
47-
for(int i =0;i<cdk.Amount.Length;i++)
48-
{
49-
if (!byte.TryParse(cdk.Amount[i].ToString(),out byte am))
41+
for (int i = 0; i < cdk.Items.Split(',').Length; i++)
5042
{
51-
Logger.LogError(String.Format("CDK:{0} has amount in Amount not a byte. MAX 255!", cdk.CDK));
52-
return false;
43+
if (!ushort.TryParse(cdk.Items[i].ToString(), out ushort id))
44+
{
45+
Logger.LogError(String.Format("CDK:{0} has id in Items not a ushort!", cdk.CDK));
46+
return false;
47+
}
48+
}
49+
for (int i = 0; i < cdk.Amount.Split(',').Length; i++)
50+
{
51+
if (!byte.TryParse(cdk.Amount[i].ToString(), out byte am))
52+
{
53+
Logger.LogError(String.Format("CDK:{0} has amount in Amount not a byte. MAX 255!", cdk.CDK));
54+
return false;
55+
}
5356
}
5457
}
5558

CDK/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
3333
//通过使用 "*",如下所示:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.2.2.1")]
36-
[assembly: AssemblyFileVersion("3.2.2.1")]
35+
[assembly: AssemblyVersion("3.2.2.2")]
36+
[assembly: AssemblyFileVersion("3.2.2.2")]

0 commit comments

Comments
 (0)