From da1f1297580364bc7bfd47b70b6b509ff7ba658d Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 30 Sep 2015 21:47:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E5=86=8CEmail?= =?UTF-8?q?=E9=80=89=E9=A1=B9...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Authentication/CTZAuthenticator.cs | 180 ++++----- CTZLauncher/MainWindow.xaml | 345 +++++++++--------- CTZLauncher/MainWindow.xaml.cs | 34 +- CTZLauncher/Properties/app.manifest | 2 +- CTZLauncher/RegisterWindow.xaml | 12 +- CTZLauncher/RegisterWindow.xaml.cs | 91 +++-- 6 files changed, 343 insertions(+), 321 deletions(-) diff --git a/CTZLauncher/Authentication/CTZAuthenticator.cs b/CTZLauncher/Authentication/CTZAuthenticator.cs index 51cae68..4787a64 100644 --- a/CTZLauncher/Authentication/CTZAuthenticator.cs +++ b/CTZLauncher/Authentication/CTZAuthenticator.cs @@ -1,85 +1,95 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Threading; -using KMCCC.Authentication; -using CityCraft; -using System.Threading.Tasks; -using System.Threading; - -namespace KMCCC.Authentication -{ - class CTZAuthenticator - { - /// - /// 玩家的名字 - /// - public readonly string Username; - public readonly string Password; - HttpHelper http = new HttpHelper(); - /// - /// 验证服务器地址 - /// - public readonly string Address; - /// - /// 验证服务器端口 - /// - public readonly int Port; - /// - /// 构造离线验证器 - /// - /// 玩家的名字 - public CTZAuthenticator(string username, string password, string address, int port = 25565) - { - Username = username; - Password = password; - Address = address.IndexOf("http") > 0 ? address : "http://" + address; - Port = port; - } - - /// - /// 标注外部登陆验证器 - /// - public string Type - { - get { return "KMCCC.CTZ"; } - } - - public bool isRegistered() - { - return getResult(Address + ":" + Port + "/isregistered?username=" + Username); - } - - public bool Register() - { - return getResult(Address + ":" + Port + "/register?username=" + Username + "&password=" + Password); - } - - public bool isLogin() - { - return getResult(Address + ":" + Port + "/islogin?username=" + Username); - } - - public bool Login() - { - return getResult(Address + ":" + Port + "/login?username=" + Username + "&password=" + Password); - } - - public string getServerList() - { - string sl = http.Send(HttpMethod.GET, Address + ":" + Port + "/serverlist"); - if (string.IsNullOrEmpty(sl)) - throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!"); - return sl; - } - - public bool getResult(string url) - { - string result = http.Send(HttpMethod.GET, url); - if (string.IsNullOrEmpty(result)) - throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!"); - return result.Contains("true") ? true : false; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Threading; +using KMCCC.Authentication; +using CityCraft; +using System.Threading.Tasks; +using System.Threading; + +namespace KMCCC.Authentication +{ + class CTZAuthenticator + { + /// + /// 玩家的名字 + /// + public readonly string Username; + public readonly string Password; + public readonly string Email; + HttpHelper http = new HttpHelper(); + /// + /// 验证服务器地址 + /// + public readonly string Address; + /// + /// 验证服务器端口 + /// + public readonly int Port; + /// + /// 构造离线验证器 + /// + /// 玩家的名字 + public CTZAuthenticator(string username, string password, string address, int port = 25565) + { + Username = username; + Password = password; + Address = address.IndexOf("http") > 0 ? address : "http://" + address; + Port = port; + Email = "mc@mc.com"; + } + public CTZAuthenticator(string username, string password, string email, string address, int port = 25565) + { + Username = username; + Password = password; + Address = address.IndexOf("http") > 0 ? address : "http://" + address; + Port = port; + Email = email; + } + + /// + /// 标注外部登陆验证器 + /// + public string Type + { + get { return "KMCCC.CTZ"; } + } + + public bool isRegistered() + { + return getResult(Address + ":" + Port + "/isregistered?username=" + Username); + } + + public bool Register() + { + return getResult(Address + ":" + Port + "/register?username=" + Username + "&password=" + Password); + } + + public bool isLogin() + { + return getResult(Address + ":" + Port + "/islogin?username=" + Username); + } + + public bool Login() + { + return getResult(Address + ":" + Port + "/login?username=" + Username + "&password=" + Password); + } + + public string getServerList() + { + string sl = http.Send(HttpMethod.GET, Address + ":" + Port + "/serverlist"); + if (string.IsNullOrEmpty(sl)) + throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!"); + return sl; + } + + public bool getResult(string url) + { + string result = http.Send(HttpMethod.GET, url); + if (string.IsNullOrEmpty(result)) + throw new ArgumentNullException("服务器返回了空的字符串或网络连接异常!"); + return result.Contains("true") ? true : false; + } + } +} diff --git a/CTZLauncher/MainWindow.xaml b/CTZLauncher/MainWindow.xaml index c7f4798..85c3890 100644 --- a/CTZLauncher/MainWindow.xaml +++ b/CTZLauncher/MainWindow.xaml @@ -1,172 +1,173 @@ - - - - - 32 - - - - - - - - - - - - - - - - - - - - - - - - - - - -