用mono写的小玩意儿

#先说说我为什么写这些吧

  • 当程序猿太苦逼了,真的,时间久了,真没有搬砖的成就感高,好歹人家能盖栋楼(身材也能练得不错),咱们指不定哪天来个熊孩子把硬盘格了就啥也没了。

  • 这学期明显没把心放在前端上......汗啊,将来还想吃着口饭呢,但是这学期绝对没休息,只是忙了很多可能很多人认为无聊的事。

  • 因为这学期无聊事太多了,耽误了很多,也让导师很失望,自己也很自卑,整理一下调调心态。

  • 因为很多是针对作业的奇葩想法,所以,作业嘛,不糊弄就不是作业了,还希望大家多多批评。

  • 兴许因为哪篇文章能解决工作呢。

  • 我想试试Markdown。

#上靓照

截图

#代码(部分) ##工作记录的处理

 protected ListStore CreateModel(string name){			
    ListStore store = new ListStore (typeof(string));			
    try{			
        string reg = con.events [name];			
        string re = "<li>(.*?)</li>";			
        MatchCollection matches = Regex.Matches(reg,re);			
        foreach(Match m in matches){				
            string a = m.Groups [1].Value.ToString();				
            store.AppendValues (a);				
            Console.WriteLine (a);			
            }			
           }catch{}			
        return store;		
    }

##例会签到信息的处理 protected void OnCalendarDaySelectedDoubleClick (object sender, EventArgs e){ Console.WriteLine (calendar.Date); foreach (string time in con.Time(telEntry.Text)) { if (time == calendar.Date.ToString()) { statusbar.Push (0, "checked"); } else { statusbar.Push (0,"unchecked"); } } } ##添加成员的处理 protected void OnNameTreeCellEdited(object sender,EditedArgs args){ TreeIter iter; treestore.GetIter (out iter,new TreePath(args.Path)); if (treestore.GetValue(iter,0).ToString() == "new") { treestore.SetValue (iter,0,args.NewText); if (treestore.GetValue (iter, 0).ToString () == "new") { treestore.AppendValues (OfficeIter,"new"); } } } ##网络抓取 public string GetContent(string strUrl,Encoding e){ string strMsg = string.Empty; try{ WebRequest request = WebRequest.Create(strUrl); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream(),e); strMsg = reader.ReadToEnd(); reader.Close(); reader.Dispose(); response.Close(); }catch{} return strMsg; } public void initializer(){ string html = new User().GetContent ("http://jwc.sut.edu.cn/ACTIONQUERYCLASSSCHEDULE.APPPROCESS",Encoding.GetEncoding("GB2312")); string reg = @"(<option value=""(¥d{7})"">¥d{7}¥[(.)¥]</option>)"; MatchCollection matches = Regex.Matches(html,reg); foreach(Match m in matches){ string a = m.Groups [2].Value.ToString (); string b = m.Groups [3].Value.ToString (); school.Add (a, b); Console.WriteLine (m.Groups[2].Value); Console.WriteLine (m.Groups[3].Value); } string content = new User().GetContent ("http://sutnmc.sinaapp.com/nws/first.php",Encoding.Default); string re = @"(<h2>(.?)<¥/h2>(<ul>.*?<¥/ul>))"; matches = Regex.Matches(content,re); foreach(Match m in matches){ string a = m.Groups [2].Value.ToString (); string b = m.Groups [3].Value.ToString (); student.Add (a, b); Console.WriteLine (m.Groups[2].Value); Console.WriteLine (m.Groups[3].Value); } } ##数据库链接 public List<string> Time(string tel){ //Console.WriteLine("ok"); List<string> list = new List<string> (); string connectionString = "Server=localhost;"+"Database=youth;" +"User ID=root;"+"Password=192120;"+"Pooling=false;Connection Timeout=10;Protocol=socket;Port=3306;"; Console.WriteLine(connectionString); IDbConnection dbcon = new MySqlConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); dbcmd.CommandText = "select * from check where tel like '"+tel+"'"; Console.WriteLine (dbcmd.CommandText); IDataReader reader = dbcmd.ExecuteReader (); while (reader.Read ()) { list.Add(reader["time"].ToString()); Console.WriteLine (reader["time"].ToString()); } reader.Close (); reader = null; dbcmd.Dispose (); dbcon.Close (); dbcon = null; return list; } public void score(string tel,List<string> list){ string connectionString ="Server=localhost;"+"Database=youth;" +"User ID=root;"+"Password=********;"+"Pooling=false;Connection Timeout=10;Protocol=socket;Port=3306;"; Console.WriteLine(connectionString); IDbConnection dbcon = new MySqlConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); dbcmd.CommandText = "INSERT INTO score (tel, social, school, nws, web, tech, pic, video, news, act, lianson, media, manage, id) VALUES ('"+ tel+"','"+list[0]+"','"+list1+"','"+list[2]+"','"+list[3]+"','"+list[4]+"','"+list[5]+"','"+list[6]+"','"+list[7]+"','"+list[8]+"','"+list[9]+"','"+list[10]+"','"+list[11]+"','"+list[12]+"');"; IDataReader reader = dbcmd.ExecuteReader (); reader.Close (); reader = null; dbcmd.Dispose (); dbcon.Close (); dbcon = null; } protected void db(){ //Console.WriteLine("ok"); string connectionString = "Server=localhost;"+"Database=youth;" +"User ID=root;"+"Password=192120;"+"Pooling=false;Connection Timeout=10;Protocol=socket;Port=3306;"; Console.WriteLine(connectionString); IDbConnection dbcon = new MySqlConnection (connectionString); dbcon.Open (); IDbCommand dbcmd = dbcon.CreateCommand (); dbcmd.CommandText = queryMember; IDataReader reader = dbcmd.ExecuteReader (); while (reader.Read ()) { string a = (string)reader["name"]; string b = (string)reader["tel"]; resMember.Add (a,b); Console.WriteLine(a+"|"+b); } reader.Close (); reader = null; dbcmd.Dispose (); dbcon.Close (); dbcon = null; u.initializer (); student = u.Student; school = u.School; } TreeViewColumn languages = new TreeViewColumn(); languages.Title = "Names"; CellRendererText cell = new CellRendererText(); cell.Editable = true; cell.Edited += OnNameTreeCellEdited; languages.PackStart(cell, true); languages.AddAttribute(cell, "text", 0); DirectIter = treestore.AppendValues("Director"); OfficeIter = treestore.AppendValues("Officer"); foreach (string key in con.dict.Keys) { treestore.AppendValues (DirectIter, key); } treestore.AppendValues (OfficeIter,"new"); nameTree.AppendColumn(languages); nameTree.Model = treestore; nameTree.Selection.Changed += OnNameTreeSelectionChanged; 最近github突然不好使了,等好了上传一下

转载于:https://my.oschina.net/gongbaodd/blog/293218

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值