public static async Task <ReturnResult> IsLogOn(AsyncCalls async, string username) { if (UserList.Find(p => p.UserName == username) == null) { UserInfo user = new UserInfo() { UserName = username, token = async.AsyncUser }; async.UserToken = user; async.IsValidate = true; user.Nick = (await async.Get <ClientMethods>().GetNick())?.First?.Value <string>(); async.Get <ClientMethods>().SetUserList(UserList); foreach (var item in UserList) { item.token.Get <ClientMethods>().AddUser(user); } async.AsyncUser.UserDisconnect += AsyncUser_UserDisconnect; UserList.Add(user); return(async.RET(true)); } else { return(async.RET(false, "username not use")); } }
public static async Task <ReturnResult> StartDown(AsyncCalls async, string url) { var htmldata = (await async.Get <IClientPacker>().DownHtml(url))?[0]?.Value <byte[]>(); if (htmldata != null) { string html = Encoding.UTF8.GetString(htmldata); return(async.RET(html)); } return(async.RET());// or async.RET(null); }
public static async Task <ReturnResult> TestRec(AsyncCalls async, int count) { count--; if (count > 1) { var x = (await async.Get <IClientPacker>().TestRec(count))?[0]?.Value <int>(); if (x != null && x.HasValue) { count = x.Value; } } return(async.RET(count)); }
public async Task Message(AsyncCalls async, string msg) { msg += (await async.Get <IPacker>().GetTimeAsync())?.First?.Value <DateTime>(); Console.WriteLine(msg); }