public void Dispose() { if (Name == null) { return; } Name.Dispose(); Name = null; Away.Dispose(); Away = null; Modes.Dispose(); Modes = null; Network.Dispose(); Network = null; RealName.Dispose(); RealName = null; Identity.Dispose(); Identity = null; _knownChannels.Clear(); _knownChannels.Dispose(); _knownChannels = null; _channels.Clear(); _channels.Dispose(); _channels = null; }
public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager) { // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // Add custom user claims here userIdentity.AddClaim(new Claim("RealName", RealName.ToString())); return(userIdentity); }
/// <inheritdoc /> /// <summary> /// 命令轮询 /// </summary> /// <returns></returns> public sealed override bool Run() { lock (this) { if (RunState != StationState.Run) { RunState = StationState.Start; } if (_socket != null) { return(false); } } _inPoll = false; _socket = new SubscriberSocket(); try { _socket.Options.Identity = RealName.ToAsciiBytes(); _socket.Options.ReconnectInterval = new TimeSpan(0, 0, 0, 0, 200); _socket.Subscribe(Subscribe); _socket.Connect(Config.InnerAddress); } catch (Exception e) { LogRecorder.Exception(e); RunState = StationState.Failed; CloseSocket(); StationProgram.WriteLine($"【{StationName}】connect error =>{e.Message}"); return(false); } RunState = StationState.Run; _items = MulitToOneQueue <PublishItem> .Load(CacheFileName); Task.Factory.StartNew(CommandTask); var task1 = Task.Factory.StartNew(PollTask); task1.ContinueWith(OnTaskStop); while (!_inPoll) { Thread.Sleep(50); } StationProgram.WriteLine($"【{StationName}:{RealName}】runing..."); return(true); }
protected override async void Run(Session session, C2G_RealName message, Action <G2C_RealName> reply) { G2C_RealName response = new G2C_RealName(); try { DBProxyComponent proxyComponent = Game.Scene.GetComponent <DBProxyComponent>(); List <RealName> dailySigns = await proxyComponent.QueryJson <RealName>($"{{Uid:{message.Uid}}}"); if (dailySigns.Count > 0) { // 已经实名过 response.Error = ErrorCode.TodayHasSign; response.Message = "您已实名认证,请勿重复认证"; reply(response); return; } else { reply(response); RealName realName = ComponentFactory.CreateWithId <RealName>(IdGenerater.GenerateId()); realName.Uid = message.Uid; realName.Name = message.Name; realName.IDNumber = message.IDNumber; await proxyComponent.Save(realName); List <PlayerBaseInfo> playerBaseInfos = await proxyComponent.QueryJson <PlayerBaseInfo>($"{{_id:{message.Uid}}}"); if (playerBaseInfos.Count > 0) { playerBaseInfos[0].IsRealName = true; await proxyComponent.Save(playerBaseInfos[0]); // 发放实名奖励 { await DBCommonUtil.changeWealthWithStr(message.Uid, "1:3000", "实名认证奖励"); } } } } catch (Exception e) { ReplyError(response, e, reply); } }
// Кнопка Enter, перевірка внесених даних private void buttonEnter_Click(object sender, EventArgs e) { string nickname = RealName.Text; string password = RealPassword.Text; if (password == RealtPassword || nickname == RealtName) { this.Close(); Realtor user = new Realtor(nickname, password); UserChanged.Invoke(this, EventArgs.Empty); } else { MessageBox.Show(" Please, check your name and pass"); RealName.Clear(); RealPassword.Clear(); } }
public RealName FormatRealNameInputFromStringArray(string[] nameStrings, RealName name) { switch (nameStrings.Length) { case 1: name.FirstName = nameStrings[0]; break; case 2: name.FirstName = nameStrings[0]; name.SurName = nameStrings[1]; break; case 3: name.FirstName = nameStrings[0]; name.MiddleName = nameStrings[1]; name.SurName = nameStrings[2]; break; } return name; }
protected virtual async void OnPreRegister() { if (!Connected) { return; } if (!string.IsNullOrEmpty(Password)) { await Send("PASS {0}", Password); } SetNick(Nick); await Send("USER {0} 0 * {1}", Ident, RealName.Contains(" ")?string.Concat(":", RealName) : RealName); /* This causes a registration timeout. * if (EnableV3) * { * await Task.Delay(500); * await Send("CAP LS"); // Request capabilities from the IRC server. * }*/ }
public ComponentInfo Copy() { List <HelperRectangle> newRectangles = new List <HelperRectangle>(); foreach (HelperRectangle rect in HelperRectangles) { newRectangles.Add(rect.Copy()); } Dictionary <string, ComponentProperty> newProperties = new Dictionary <string, ComponentProperty>(); foreach (KeyValuePair <string, ComponentProperty> pair in Properties) { newProperties.Add((string)pair.Key.Clone(), pair.Value.Copy()); } var newComponent = new ComponentInfo((string)RealName.Clone(), (string)ClassName.Clone(), DefaultAnimation.Copy(), (string)AnimationProperty.Clone(), newRectangles, newProperties); newComponent.SetAnimKey = (string)SetAnimKey.Clone(); newComponent._CurrentAnimation = _CurrentAnimation; return(newComponent); }
public void ConnectTest() { textBox1.Text = "正在连接到NCUT,如果长时间没有反应,请检查网络连接!\r\n\r\n"; pictureBox1.Show(); pictureBox2.Hide(); pictureBox3.Hide(); string str; button1.Enabled = false; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button5.Enabled = false; button6.Enabled = false; str = GetHttpWebRequest("http://ip.ncut.edu.cn/"); //Console.WriteLine(str); //MessageBox.Show(str); textBox1.Text = "确保绿色指示灯闪烁一次,其它颜色指示灯关闭。\r\n\r\n\r\n" + str; // Regex r = new Regex("flow='"); string[] a = str.Split(';'); //string[] name = str.Split(';'); // Match m = r.Match(str); // if (m.Success) // { // Console.WriteLine("Found match at position " + m.Index); //输入匹配字符的位置 // } int res; //int idnum; try { string b = a[3]; string result2; string result1; result2 = GET(b); result1 = fanzhuan(result2); int.TryParse(result1, out res); string Usetime = a[2]; int time; result2 = GET(Usetime); Usetime = fanzhuan(result2); int.TryParse(Usetime, out time); TimeSpan ts = new TimeSpan(0, time, 0); //label8.Text = "有效使用时长*: " + ts.TotalMinutes + "小时 " ; label8.Text = "有效使用时长*: " + ts.Days + " 天 " + ts.Hours + " 小时 " + ts.Minutes + "分钟"; string name = a[27]; Regex reg = new Regex("[\u4e00-\u9fa5]+"); foreach (Match RealName in reg.Matches(name)) { name = RealName.ToString(); } //Console.WriteLine(RealName); string id = a[12]; string id1; string id2; id1 = GET(id); id2 = fanzhuan(id1); label7.Text = "ID: " + name + " (" + id2 + ")"; //res = int.Parse(b); //MessageBox.Show(b); int flow, flow1, flow0; flow = res; flow0 = flow % 1024; flow1 = flow - flow0; flow0 = flow0 * 1000; flow0 = flow0 - flow0 % 1024; string flow3 = "."; string detail; detail = "已使用流量 : " + flow1 / 1024 + flow3 + flow0 / 1024 + " M"; //MessageBox.Show(detail); //textBox2.Text = detail; label3.Text = detail; toolStripStatusLabel2.Text = "确保绿色指示灯闪烁一次,其它颜色指示灯关闭。"; string TextFlag = a[200]; if (res == 0 && name == "基本参数") { toolStripStatusLabel2.Text = "连接测试:连接失败请检查网络是否连接,或者是否登陆NCUT!"; pictureBox1.Hide(); pictureBox2.Hide(); pictureBox3.Show(); label8.Text = "ID"; label7.Text = "有效使用时长*:"; label3.Text = "已使用流量 :"; try { Ping usable = new Ping(); Console.WriteLine(usable.Send("192.168.254.251").Status); DialogResult dr = MessageBox.Show("Ping:" + usable.Send("192.168.254.251").Status + "!\r\n您可能并未登陆NCUT-AUTO,是否打开浏览器为您登陆?", "登陆提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { System.Diagnostics.Process.Start("http://ip.ncut.edu.cn/"); } } catch { DialogResult dr = MessageBox.Show("Ping:Fail" + "!\r\n您可能并未连接到NCUT-AUTO,请您打开网络和Internet设置。", "连接提示"); } } pictureBox1.Hide(); } catch (Exception ex) { toolStripStatusLabel2.Text = "连接测试:连接失败请检查网络是否连接,或者是否登陆NCUT!"; Console.WriteLine(ex.Message); label8.Text = "ID"; label7.Text = "有效使用时长*:"; label3.Text = "已使用流量 :"; pictureBox1.Hide(); pictureBox2.Hide(); pictureBox3.Show(); try { Ping usable = new Ping(); Console.WriteLine(usable.Send("192.168.254.251").Status); DialogResult dr = MessageBox.Show("Ping:" + usable.Send("192.168.254.251").Status + "!\r\n您可能并未登陆NCUT-AUTO,是否打开浏览器为您登陆?", "登陆提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { System.Diagnostics.Process.Start("http://ip.ncut.edu.cn/"); } } catch { DialogResult dr = MessageBox.Show("Ping:Fail" + "!\r\n您可能并未连接到NCUT-AUTO,请您打开网络和Internet设置。", "连接提示"); } } }
private void Fun() { string str; this.textBox1.Text = "正在连接到NCUT,如果长时间没有反应,请检查网络连接!"; str = GetHttpWebRequest("http://ip.ncut.edu.cn/"); this.textBox1.Text = "已经连接到NCUT(ip.ncut.edu.cn)!"; string[] a = str.Split(';'); int res; try { string b = a[3]; string result2; result2 = GET(b); result2 = fanzhuan(result2); int.TryParse(result2, out res); string Usetime = a[2]; int time; result2 = GET(Usetime); Usetime = fanzhuan(result2); int.TryParse(Usetime, out time); TimeSpan ts = new TimeSpan(0, time, 0); label8.Text = "有效使用时长*: " + ts.Days + " 天 " + ts.Hours + " 小时 " + ts.Minutes + "分钟"; string name = a[27]; Regex reg = new Regex("[\u4e00-\u9fa5]+"); foreach (Match RealName in reg.Matches(name)) { name = RealName.ToString(); } //Console.WriteLine(RealName); string id = a[12]; string id1; string id2; id1 = GET(id); id2 = fanzhuan(id1); label7.Text = "ID: " + name + " (" + id2 + ")"; int flow, flow1, flow0; flow = res; flow0 = flow % 1024; flow1 = flow - flow0; flow0 = flow0 * 1000; flow0 = flow0 - flow0 % 1024; string flow3 = "."; string detail; detail = "已使用流量 : " + flow1 / 1024 + flow3 + flow0 / 1024 + " M"; button1.Enabled = true; button2.Enabled = true; button3.Enabled = true; label3.Text = detail; string TextFlag = a[200];//未登录时数组会越界 //if (res == 0 && name == "基本参数") //{ // pictureBox1.Hide(); // pictureBox2.Hide(); // pictureBox3.Show(); // timer2.Stop(); // timer4.Stop(); // timer3.Stop(); // label7.Text = "-------------------"; // label8.Text = "-------------------"; // label3.Text = "-------------------"; // notifyIcon1.BalloonTipTitle = "注意"; // notifyIcon1.BalloonTipText = "您可能并未登陆NCUT-AUTO,请您打开浏览器重新登陆。"; // notifyIcon1.ShowBalloonTip(3000); //} } catch (Exception ex) { pictureBox1.Hide(); pictureBox2.Hide(); pictureBox3.Show(); timer2.Stop(); timer4.Stop(); timer3.Stop(); label7.Text = "-------------------"; label8.Text = "-------------------"; this.label3.Text = "-------------------"; notifyIcon1.BalloonTipTitle = "注意"; notifyIcon1.BalloonTipText = "您可能并未登陆NCUT-AUTO,请您打开浏览器重新登陆。"; notifyIcon1.ShowBalloonTip(3000); Console.WriteLine(ex.Message); } }
/// <inheritdoc /> /// <summary> /// 命令轮询 /// </summary> /// <returns></returns> public sealed override bool Run() { lock (this) { if (RunState != StationState.Run) { RunState = StationState.Start; } if (_socket != null) { return(false); } } _inPoll = false; _inHeart = false; _socket = new RequestSocket(); try { _socket.Options.Identity = RealName.ToAsciiBytes(); _socket.Options.ReconnectInterval = new TimeSpan(0, 0, 0, 0, 200); _socket.Connect(Config.InnerAddress); } catch (Exception e) { LogRecorder.Exception(e); RunState = StationState.Failed; CloseSocket(); StationProgram.WriteLine($"【{StationName}】connect error =>{e.Message}"); return(false); } try { var word = _socket.Request("@", JsonConvert.SerializeObject(Config)); if (word != "wecome") { CloseSocket(); RunState = StationState.Failed; StationProgram.WriteLine($"【{StationName}】proto error"); return(false); } } catch (Exception e) { LogRecorder.Exception(e); RunState = StationState.Failed; CloseSocket(); StationProgram.WriteLine($"【{StationName}】request error =>{e.Message}"); return(false); } RunState = StationState.Run; _items = MulitToOneQueue <List <string> > .Load(CacheFileName); Task.Factory.StartNew(CommandTask); var task1 = Task.Factory.StartNew(PollTask); task1.ContinueWith(OnTaskStop); var task2 = Task.Factory.StartNew(HeartbeatTask); task2.ContinueWith(OnTaskStop); while (!_inHeart || !_inPoll) { Thread.Sleep(50); } StationProgram.WriteLine($"【{StationName}:{RealName}】runing..."); return(true); }
// override object.GetHashCode public override int GetHashCode() { return(FileItemId ^ DisplayName.GetHashCode() ^ RealName.GetHashCode()); }