Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Commit

Permalink
修正错误代码输出
Browse files Browse the repository at this point in the history
  • Loading branch information
MonoLogueChi committed Feb 25, 2018
1 parent fe67c36 commit 72fa0f4
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Drcom/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.2")]
[assembly: AssemblyFileVersion("0.0.0.2")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
78 changes: 66 additions & 12 deletions Drcom/net/CsuNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;


namespace Drcom.net
Expand Down Expand Up @@ -39,20 +40,12 @@ public static string LoginCsuNet(string nip, string uid, string pwd)
using (StreamReader reader = new StreamReader(stream, Encoding.ASCII))
{
result = reader.ReadToEnd();
return LoginCaes(result);
}
if (result.Contains("您已经成功登录"))
{
return "您已成功登陆";
}
else
{
return "请检查账号密码及IP是否正确\r\n并确认为未登录状态";
}

}
catch (Exception e)
{
return "发生未知错误";
return "发生未知错误\r\n请检查登陆IP是否填写正确";
}
}
}
Expand All @@ -70,14 +63,75 @@ public static string LogoutCsuNet(string nip)
using (StreamReader reader = new StreamReader(stream, Encoding.ASCII))
{
var result = reader.ReadToEnd();
return "我也不知道有没有注销成功\r\n下个版本尝试解决";
return LoginCaes(result);
}
}
catch (Exception e)
{
return "发生未知错误";
}


}

//错误代码
public static string LoginCaes(string result)
{
if (result.Contains("Msg="))
{
string[] FMsg = Regex.Split(result, "Msg=", RegexOptions.IgnoreCase);
int Msg = Convert.ToInt32(FMsg[1].Substring(0, 2));

switch (Msg)
{
case 0:
return "未知错误";
case 1:
string[] Fmsga = Regex.Split(FMsg[1], "msga=", RegexOptions.IgnoreCase);
string msga = Fmsga[1].Substring(1, 1);
if (msga != "\'")
{
return "错误代码:" + msga;
}
else
{
return "账号或密码错误";
}
case 2:
return "该账号正在使用中,请您与网管联系";
case 3:
return "本账号只能在指定地址使用";
case 4:
return "本账号费用超支或时长流量超过限制";
case 5:
return "本账号暂停使用";
case 6:
return "System buffer full";
case 8:
return "本账号正在使用,不能修改";
case 7:
return "未知错误";
case 9:
return "新密码与确认新密码不匹配,不能修改";
case 10:
return "密码修改成功";
case 11:
return "本账号只能在指定地址使用";
case 12:
return "未知错误";
case 13:
return "未知错误";
case 14:
return "注销成功";
case 15:
return "登录成功";
}

return "未知错误";
}
else
{
return "您应该大概也许可能已经成功登陆了";
}
}
}
}

0 comments on commit 72fa0f4

Please sign in to comment.