public void LintMsg(LinkNumbers linkNumber, String url, String path, String msg) { String lintLine = $"{((Int32)linkNumber).ToString()}-{url.LastUriPart()}-{path}"; bool Ignore() { foreach (Regex r in this.lintIgnore) { if (r.IsMatch(lintLine)) { return(true); } } return(false); } if (Ignore()) { return; } Msg(ConsoleColor.Green, lintLine); Msg(ConsoleColor.Green, msg); }
private LinkNumbers str2linknumbers(string str) { /* * // 实例化DataContractJsonSerializer对象,需要待序列化的对象类型 * DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(LinkNumbers)); * //把Json传入内存流中保存 * MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(str)); * // 使用ReadObject方法反序列化成对象 * object ob = serializer.ReadObject(stream); * LinkNumbers result = (LinkNumbers)ob; */ LinkNumbers result = JsonUtil.DeserializeObject <LinkNumbers>(str); return(result); }
private void copyright_panel_Paint(object sender, PaintEventArgs e) { string result = postApi("http://27953499sv.zicp.vip:28177/api/name/links", ""); if (result == "") { MessageBox.Show("连接服务器失败..."); return; } LinkNumbers links = str2linknumbers(result); string text = "工具仅供个人交流学习使用,如需导出更多名字或了解更多信息欢迎咨询:"; Label contentL = new Label(); contentL.Text = text; contentL.Location = new System.Drawing.Point(100, 6); contentL.Name = "copyright_year"; contentL.AutoSize = true; contentL.TabIndex = 3; contentL.Parent = this.copyright_panel; int widthpoint = 500; if (links.qqg != "") { Label qqglink = new Label(); qqglink.Text = "QQ群: " + links.qqg; qqglink.Location = new System.Drawing.Point(widthpoint, 6); //qqglink.Font = new System.Drawing.Font("微软雅黑", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); qqglink.AutoSize = true; qqglink.Parent = this.copyright_panel; widthpoint += 8 * links.qqg.Length + 20; } else if (links.qq != "") { Label qqlink = new Label(); qqlink.Text = "QQ: " + links.qq; qqlink.Location = new System.Drawing.Point(widthpoint, 6); //qqlink.Font = new System.Drawing.Font("微软雅黑", 8F); qqlink.AutoSize = true; qqlink.Parent = this.copyright_panel; widthpoint += 8 * links.qq.Length + 20; } if (links.weixing != "") { Label weixinglink = new Label(); weixinglink.Text = "微信群: " + links.weixing; weixinglink.Location = new System.Drawing.Point(widthpoint, 6); weixinglink.Font = new System.Drawing.Font("微软雅黑", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); weixinglink.AutoSize = true; weixinglink.Parent = this.copyright_panel; } else if (links.weixin != "") { Label weixinlink = new Label(); weixinlink.Text = "微信: " + links.weixin; weixinlink.Location = new System.Drawing.Point(widthpoint, 6); //weixinlink.Font = new System.Drawing.Font("微软雅黑", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); weixinlink.AutoSize = true; weixinlink.Parent = this.copyright_panel; } }