├── 21310421.ico ├── 35-1.gif ├── Bean ├── GPAInfo.cs ├── Lesson.cs └── ScoreDistributionItem.cs ├── CHANGELOG ├── DevComponents.DotNetBar.dll ├── Form1.Designer.cs ├── Form1.cs ├── Form1.resx ├── GPATool.csproj ├── GPATool.csproj.user ├── Program.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs └── Settings.settings ├── README ├── RSSSpider.dll ├── ScoreDistribution.Designer.cs ├── ScoreDistribution.cs ├── ScoreDistribution.resx ├── ScoreDistributionChartPanel.Designer.cs ├── ScoreDistributionChartPanel.cs ├── ScoreDistributionChartPanel.resx ├── ScoreListView.Designer.cs ├── ScoreListView.cs ├── ScoreListView.resx ├── System.Data.SQLite.DLL ├── UserConfigView.Designer.cs ├── UserConfigView.cs ├── UserConfigView.resx ├── Util ├── AdminUtil.cs ├── Config.cs ├── HTTPUtil.cs ├── ListViewItemComparer.cs ├── ListViewStripMenuHelper.cs ├── ParseHTML.cs ├── RC2Util.cs ├── ScoreDistributionHelper.cs ├── ScoreHTMLUtil.cs ├── UpdateUtil.cs └── XMLConfig.cs ├── app.config └── data.s3db /21310421.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerzhou/GPATool/21f7dc643f64b2d32ebaf77cc0dcd1c6536a8053/21310421.ico -------------------------------------------------------------------------------- /35-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerzhou/GPATool/21f7dc643f64b2d32ebaf77cc0dcd1c6536a8053/35-1.gif -------------------------------------------------------------------------------- /Bean/GPAInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GPATool.Bean 4 | { 5 | public class GPAInfo 6 | { 7 | private String name; 8 | 9 | public String Name 10 | { 11 | get { return name; } 12 | set { name = value; } 13 | } 14 | private String gpa; 15 | 16 | public String Gpa 17 | { 18 | get { return gpa; } 19 | set { gpa = value; } 20 | } 21 | private String major; 22 | 23 | public String Major 24 | { 25 | get { return major; } 26 | set { major = value; } 27 | } 28 | private String totalCredit; 29 | 30 | public String TotalCredit 31 | { 32 | get { return totalCredit; } 33 | set { totalCredit = value; } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Bean/Lesson.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace GPATool.Bean 5 | { 6 | public class LessonScore 7 | { 8 | public String DisplayScore { get; set; } 9 | public double Value { get; set; } 10 | public LessonScore(String d, double v) 11 | { 12 | DisplayScore = d; 13 | Value = v; 14 | } 15 | } 16 | 17 | public class Lesson 18 | { 19 | private static LessonScore[] lessonScoreTypes = new LessonScore[] { 20 | new LessonScore("A",4.0), 21 | new LessonScore("A-",3.7), 22 | new LessonScore("B+",3.3), 23 | new LessonScore("B",3.0), 24 | new LessonScore("B-",2.7), 25 | new LessonScore("C+",2.3), 26 | new LessonScore("C",2.0), 27 | new LessonScore("C-",1.7), 28 | new LessonScore("D",1.3), 29 | new LessonScore("D-",1.0), 30 | new LessonScore("F",0.0) 31 | }; 32 | public bool IsStar { get; set; } 33 | public String DetailCode { get; set; } 34 | public int Id { get; set; } 35 | public double Score { get; set; } 36 | public String Name { get; set; } 37 | public double Credit { get; set; } 38 | public String Code { get; set; } 39 | public String ScoreString { get; set; } 40 | public String Semester { get; set; } 41 | 42 | public override string ToString() 43 | { 44 | return Id + "\t" + Semester + "\t" + Code + "\t" + Name + "\t" + Credit + "\t" + ScoreString; 45 | } 46 | 47 | public double GetScoreValue() 48 | { 49 | return GetScoreValue(this.ScoreString); 50 | } 51 | 52 | public double CalculateGPA(List list) 53 | { 54 | double sum = 0; 55 | double creditPointsSum = 0; 56 | foreach (Lesson l in list) 57 | { 58 | if (!l.IsStar) 59 | { 60 | sum = sum + (l.Credit * l.Score); 61 | creditPointsSum += l.Credit; 62 | } 63 | } 64 | return (double)(sum / creditPointsSum); 65 | } 66 | 67 | public static String GetScoreDetailString(double score, double delta = 0.05) 68 | { 69 | String result = null; 70 | double lowerBoundDelta = double.MaxValue; 71 | String lowerBound = null; 72 | double upperBoundDelta = double.MaxValue; 73 | String upperBound = null; 74 | foreach (LessonScore ls in lessonScoreTypes) 75 | { 76 | if (Math.Abs(score - ls.Value) < delta) 77 | { 78 | return ls.DisplayScore; 79 | } 80 | if (score > ls.Value && score - ls.Value < lowerBoundDelta) 81 | { 82 | lowerBound = ls.DisplayScore; 83 | lowerBoundDelta = score - ls.Value; 84 | } 85 | if (score < ls.Value && ls.Value - score < upperBoundDelta) 86 | { 87 | upperBound = ls.DisplayScore; 88 | upperBoundDelta = ls.Value - score; 89 | } 90 | } 91 | result = lowerBound + "到" + upperBound; 92 | return result; 93 | } 94 | 95 | public static double GetScoreValue(String scoreString) 96 | { 97 | foreach (LessonScore ls in lessonScoreTypes) 98 | { 99 | if (ls.DisplayScore.Equals(scoreString)) 100 | { 101 | return ls.Value; 102 | } 103 | } 104 | return 0; 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Bean/ScoreDistributionItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections; 4 | 5 | namespace GPATool.Bean 6 | { 7 | public class ScoreDistributionItem : Comparer 8 | { 9 | public int Id { get; set; } 10 | public int CourseId { get; set; } 11 | public String Semester { get; set; } 12 | public String LessonCode { get; set; } 13 | public String LessonName { get; set; } 14 | public String Teacher { get; set; } 15 | public double Credits { get; set; } 16 | public int StudentCount { get; set; } 17 | public List Scores { get; set; } 18 | public double AverageScore { get; set; } 19 | public String Remark { get; set; } 20 | 21 | public void CalculateBenchMark() 22 | { 23 | AverageScore = CalculateAverageScore(Scores); 24 | Remark = GetScoreRemark(this); 25 | } 26 | 27 | public static double CalculateAverageScore(ICollection scores) 28 | { 29 | double stuCount = 0; 30 | double sum = 0; 31 | foreach (ScoreItem s in scores) 32 | { 33 | if (!s.DisplayValue.Contains("*")) 34 | { 35 | stuCount += s.StudentCount; 36 | sum += s.StudentCount * Lesson.GetScoreValue(s.DisplayValue); 37 | } 38 | } 39 | return (double)(sum / stuCount); 40 | } 41 | 42 | public static String GetScoreRemark(ScoreDistributionItem sd) 43 | { 44 | ScoreItem[] tempArray = new ScoreItem[sd.Scores.Count]; 45 | sd.Scores.CopyTo(tempArray, 0); 46 | Array.Sort(tempArray, new ScoreItemStudentComparer()); 47 | String result = ""; 48 | for (int i = 0; i < Math.Min(2, tempArray.Length); i++) 49 | { 50 | if (!string.IsNullOrEmpty(result)) 51 | { 52 | result += "; "; 53 | } 54 | result += tempArray[i].DisplayValue 55 | + " (" + ((double)tempArray[i].StudentCount / (double)sd.StudentCount).ToString("P") + ")"; 56 | } 57 | return result; 58 | } 59 | 60 | public static List MergeSameTeacherSemester(List list) 61 | { 62 | Hashtable ht = new Hashtable(); 63 | List removeList = new List(); 64 | foreach (ScoreDistributionItem sdi in list) 65 | { 66 | String key = sdi.Teacher + "@" + sdi.LessonName + "@" + sdi.Semester; 67 | if (!ht.ContainsKey(key)) 68 | { 69 | ht.Add(key, sdi); 70 | } 71 | else 72 | { 73 | ScoreDistributionItem temp = ht[key] as ScoreDistributionItem; 74 | temp.LessonCode += ";" + sdi.LessonCode; 75 | temp.Scores.AddRange(sdi.Scores); 76 | temp.StudentCount += sdi.StudentCount; 77 | removeList.Add(sdi); 78 | } 79 | } 80 | foreach (ScoreDistributionItem sdi in removeList) 81 | { 82 | list.Remove(sdi); 83 | } 84 | return list; 85 | } 86 | 87 | public override int Compare(ScoreDistributionItem x, ScoreDistributionItem y) 88 | { 89 | return x.Teacher.CompareTo(y.Teacher); 90 | } 91 | } 92 | 93 | public class ScoreItemStudentComparer : Comparer 94 | { 95 | public override int Compare(ScoreItem x, ScoreItem y) 96 | { 97 | return -1 * x.StudentCount.CompareTo(y.StudentCount); 98 | } 99 | } 100 | 101 | public class ScoreItem : Comparer 102 | { 103 | public String DisplayValue { get; set; } 104 | public int StudentCount { get; set; } 105 | 106 | public override int Compare(ScoreItem x, ScoreItem y) 107 | { 108 | if (string.IsNullOrEmpty(x.DisplayValue) || string.IsNullOrEmpty(y.DisplayValue) || (x.DisplayValue[0] != y.DisplayValue[0] && Char.IsLetter(x.DisplayValue[0]) && Char.IsLetter(y.DisplayValue[0]))) 109 | { 110 | return x.DisplayValue.CompareTo(y.DisplayValue); 111 | } 112 | else 113 | { 114 | return getOrder(x.DisplayValue) - getOrder(y.DisplayValue); 115 | } 116 | } 117 | 118 | private int getOrder(String value) 119 | { 120 | if(string.IsNullOrEmpty(value)) 121 | { 122 | return -2; 123 | } 124 | else if(!Char.IsLetter(value[0])) 125 | { 126 | return 10; 127 | } 128 | else if (value.Length == 1) 129 | { 130 | return 1; 131 | } 132 | switch (value[1]) 133 | { 134 | case '+': return 0; 135 | case '-': return 3; 136 | default: return 2; 137 | } 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | GPATool 20110924 2 | 1.修改了Pro版本的接口 3 | 4 | GPATool v1.10: 5 | 1.数据库更新至2010-2011学年第二学期,变更数据库密码 6 | 2.?成绩的排列顺序 7 | 3.给分分布增加柱状图 8 | 4.新功能:查询某一老师各个学期某一门课的给分情况 9 | 5.新功能:查询某学期某门课程不同老师给分情况 10 | 6.重构类结构,使得更加紧凑,高内聚低耦合 11 | 7.4和5两个新功能由于比较耗时,使用单独的线程来完成 12 | 8.为新功能采取同教师同学期同课程名称的课程数据合并统计的方法 13 | 9.尝试使用.NET 4.0重新编译SQLite驱动,遇到性能问题,放弃升级 14 | 10.增加自动更新功能,需要用户自行解压覆盖升级,以后可能做成自动覆盖升级 15 | 16 | GPATool v1.01: 17 | 1.将Pro功能剥离出标准版,使用反射动态调用函数,并将标准版开源 18 | 2.Fix当成绩是P时的学分计算错误问题 19 | 3.Fix在高分屏幕下使用125%字体放大的时候碰到的问题 20 | 4.不使用代码混淆,尽可能兼容旧版操作系统 21 | 22 | GPATool v1.0: 23 | 1.抛弃原先COM调用Flash来显示图标,使用.NET 4.0的Chart组件 24 | 2.使用本地数据库作为搜索数据来提供课程给分信息查询 25 | 3.支持按照学期、课程名称关键字、课程代码关键字以及教师姓名关键字来查询课程 26 | 4.右击ListView可以选择以不同方式导出数据 27 | 5.重新设计UI,将查询绩点和给分情况剥离开 28 | 6.参数配置页面增加博客RSS Feed Update功能,点击可访问我的博客 29 | 7.优化代码以及架构,异步和线程操作更加清晰明了 30 | 8.给分信息升级只需要替换data.s3db文件 31 | 32 | GPATool v0.5: 33 | 1.可以使用HTTP代理进行绩点查询,方便在公司实习需要设置代理的同学 34 | 2.修复了原来负学分的bug 35 | 3.单击“获取成绩”按钮时显示类似ajax loading的效果 36 | 4.使用硬盘序列号进行标准版和专业版的验证,防止被滥用,上次有人用我的程序把妹让我觉得压力很大 37 | 5.使用控制流混淆和字符串加密,防止反向工程(可能导致在部分系统上无法运行,出现此类情况的可以联系我) 38 | 6.通过调用COM接口显示Flash -------------------------------------------------------------------------------- /DevComponents.DotNetBar.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerzhou/GPATool/21f7dc643f64b2d32ebaf77cc0dcd1c6536a8053/DevComponents.DotNetBar.dll -------------------------------------------------------------------------------- /Form1.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace GPATool 3 | { 4 | partial class Form1 5 | { 6 | /// 7 | /// 必需的设计器变量。 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// 清理所有正在使用的资源。 13 | /// 14 | /// 如果应释放托管资源,为 true;否则为 false。 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows 窗体设计器生成的代码 25 | 26 | /// 27 | /// 设计器支持所需的方法 - 不要 28 | /// 使用代码编辑器修改此方法的内容。 29 | /// 30 | private void InitializeComponent() 31 | { 32 | GPATool.Bean.GPAInfo gpaInfo1 = new GPATool.Bean.GPAInfo(); 33 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); 34 | this.office2007StartButton1 = new DevComponents.DotNetBar.Office2007StartButton(); 35 | this.itemContainer1 = new DevComponents.DotNetBar.ItemContainer(); 36 | this.itemContainer2 = new DevComponents.DotNetBar.ItemContainer(); 37 | this.itemContainer3 = new DevComponents.DotNetBar.ItemContainer(); 38 | this.buttonItem2 = new DevComponents.DotNetBar.ButtonItem(); 39 | this.buttonItem3 = new DevComponents.DotNetBar.ButtonItem(); 40 | this.buttonItem4 = new DevComponents.DotNetBar.ButtonItem(); 41 | this.buttonItem5 = new DevComponents.DotNetBar.ButtonItem(); 42 | this.buttonItem6 = new DevComponents.DotNetBar.ButtonItem(); 43 | this.buttonItem7 = new DevComponents.DotNetBar.ButtonItem(); 44 | this.galleryContainer1 = new DevComponents.DotNetBar.GalleryContainer(); 45 | this.labelItem8 = new DevComponents.DotNetBar.LabelItem(); 46 | this.buttonItem8 = new DevComponents.DotNetBar.ButtonItem(); 47 | this.buttonItem9 = new DevComponents.DotNetBar.ButtonItem(); 48 | this.buttonItem10 = new DevComponents.DotNetBar.ButtonItem(); 49 | this.buttonItem11 = new DevComponents.DotNetBar.ButtonItem(); 50 | this.itemContainer4 = new DevComponents.DotNetBar.ItemContainer(); 51 | this.buttonItem12 = new DevComponents.DotNetBar.ButtonItem(); 52 | this.buttonItem13 = new DevComponents.DotNetBar.ButtonItem(); 53 | this.ribbonControl1 = new DevComponents.DotNetBar.RibbonControl(); 54 | this.ribbonPanel4 = new DevComponents.DotNetBar.RibbonPanel(); 55 | this.scoreListView1 = new GPATool.ScoreListView(); 56 | this.ribbonPanel2 = new DevComponents.DotNetBar.RibbonPanel(); 57 | this.userConfigView1 = new GPATool.UserConfigView(); 58 | this.ribbonPanel1 = new DevComponents.DotNetBar.RibbonPanel(); 59 | this.scoreDistribution2 = new GPATool.ScoreDistribution(); 60 | this.ribbonTabItem4 = new DevComponents.DotNetBar.RibbonTabItem(); 61 | this.ribbonTabItem1 = new DevComponents.DotNetBar.RibbonTabItem(); 62 | this.ribbonTabItem2 = new DevComponents.DotNetBar.RibbonTabItem(); 63 | this.tabControlPanel2 = new DevComponents.DotNetBar.TabControlPanel(); 64 | this.styleManager1 = new DevComponents.DotNetBar.StyleManager(); 65 | this.ribbonControl1.SuspendLayout(); 66 | this.ribbonPanel4.SuspendLayout(); 67 | this.ribbonPanel2.SuspendLayout(); 68 | this.ribbonPanel1.SuspendLayout(); 69 | this.SuspendLayout(); 70 | // 71 | // office2007StartButton1 72 | // 73 | this.office2007StartButton1.AutoExpandOnClick = true; 74 | this.office2007StartButton1.CanCustomize = false; 75 | this.office2007StartButton1.HotTrackingStyle = DevComponents.DotNetBar.eHotTrackingStyle.Image; 76 | this.office2007StartButton1.ImageFixedSize = new System.Drawing.Size(16, 16); 77 | this.office2007StartButton1.ImagePaddingHorizontal = 0; 78 | this.office2007StartButton1.ImagePaddingVertical = 0; 79 | this.office2007StartButton1.Name = "office2007StartButton1"; 80 | this.office2007StartButton1.ShowSubItems = false; 81 | this.office2007StartButton1.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { 82 | this.itemContainer1}); 83 | this.office2007StartButton1.Text = "&File"; 84 | // 85 | // itemContainer1 86 | // 87 | // 88 | // 89 | // 90 | this.itemContainer1.BackgroundStyle.Class = "RibbonFileMenuContainer"; 91 | this.itemContainer1.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical; 92 | this.itemContainer1.Name = "itemContainer1"; 93 | this.itemContainer1.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { 94 | this.itemContainer2, 95 | this.itemContainer4}); 96 | // 97 | // itemContainer2 98 | // 99 | // 100 | // 101 | // 102 | this.itemContainer2.BackgroundStyle.Class = "RibbonFileMenuTwoColumnContainer"; 103 | this.itemContainer2.ItemSpacing = 0; 104 | this.itemContainer2.Name = "itemContainer2"; 105 | this.itemContainer2.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { 106 | this.itemContainer3, 107 | this.galleryContainer1}); 108 | // 109 | // itemContainer3 110 | // 111 | // 112 | // 113 | // 114 | this.itemContainer3.BackgroundStyle.Class = "RibbonFileMenuColumnOneContainer"; 115 | this.itemContainer3.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical; 116 | this.itemContainer3.MinimumSize = new System.Drawing.Size(120, 0); 117 | this.itemContainer3.Name = "itemContainer3"; 118 | this.itemContainer3.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { 119 | this.buttonItem2, 120 | this.buttonItem3, 121 | this.buttonItem4, 122 | this.buttonItem5, 123 | this.buttonItem6, 124 | this.buttonItem7}); 125 | // 126 | // buttonItem2 127 | // 128 | this.buttonItem2.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 129 | this.buttonItem2.Name = "buttonItem2"; 130 | this.buttonItem2.SubItemsExpandWidth = 24; 131 | this.buttonItem2.Text = "&New"; 132 | // 133 | // buttonItem3 134 | // 135 | this.buttonItem3.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 136 | this.buttonItem3.Name = "buttonItem3"; 137 | this.buttonItem3.SubItemsExpandWidth = 24; 138 | this.buttonItem3.Text = "&Open..."; 139 | // 140 | // buttonItem4 141 | // 142 | this.buttonItem4.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 143 | this.buttonItem4.Name = "buttonItem4"; 144 | this.buttonItem4.SubItemsExpandWidth = 24; 145 | this.buttonItem4.Text = "&Save..."; 146 | // 147 | // buttonItem5 148 | // 149 | this.buttonItem5.BeginGroup = true; 150 | this.buttonItem5.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 151 | this.buttonItem5.Name = "buttonItem5"; 152 | this.buttonItem5.SubItemsExpandWidth = 24; 153 | this.buttonItem5.Text = "S&hare..."; 154 | // 155 | // buttonItem6 156 | // 157 | this.buttonItem6.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 158 | this.buttonItem6.Name = "buttonItem6"; 159 | this.buttonItem6.SubItemsExpandWidth = 24; 160 | this.buttonItem6.Text = "&Print..."; 161 | // 162 | // buttonItem7 163 | // 164 | this.buttonItem7.BeginGroup = true; 165 | this.buttonItem7.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 166 | this.buttonItem7.Name = "buttonItem7"; 167 | this.buttonItem7.SubItemsExpandWidth = 24; 168 | this.buttonItem7.Text = "&Close"; 169 | // 170 | // galleryContainer1 171 | // 172 | // 173 | // 174 | // 175 | this.galleryContainer1.BackgroundStyle.Class = "RibbonFileMenuColumnTwoContainer"; 176 | this.galleryContainer1.EnableGalleryPopup = false; 177 | this.galleryContainer1.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical; 178 | this.galleryContainer1.MinimumSize = new System.Drawing.Size(180, 240); 179 | this.galleryContainer1.MultiLine = false; 180 | this.galleryContainer1.Name = "galleryContainer1"; 181 | this.galleryContainer1.PopupUsesStandardScrollbars = false; 182 | this.galleryContainer1.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { 183 | this.labelItem8, 184 | this.buttonItem8, 185 | this.buttonItem9, 186 | this.buttonItem10, 187 | this.buttonItem11}); 188 | // 189 | // labelItem8 190 | // 191 | this.labelItem8.BorderSide = DevComponents.DotNetBar.eBorderSide.Bottom; 192 | this.labelItem8.BorderType = DevComponents.DotNetBar.eBorderType.Etched; 193 | this.labelItem8.CanCustomize = false; 194 | this.labelItem8.Name = "labelItem8"; 195 | this.labelItem8.PaddingBottom = 2; 196 | this.labelItem8.PaddingTop = 2; 197 | this.labelItem8.Stretch = true; 198 | this.labelItem8.Text = "Recent Documents"; 199 | // 200 | // buttonItem8 201 | // 202 | this.buttonItem8.Name = "buttonItem8"; 203 | this.buttonItem8.Text = "&1. Short News 5-7.rtf"; 204 | // 205 | // buttonItem9 206 | // 207 | this.buttonItem9.Name = "buttonItem9"; 208 | this.buttonItem9.Text = "&2. Prospect Email.rtf"; 209 | // 210 | // buttonItem10 211 | // 212 | this.buttonItem10.Name = "buttonItem10"; 213 | this.buttonItem10.Text = "&3. Customer Email.rtf"; 214 | // 215 | // buttonItem11 216 | // 217 | this.buttonItem11.Name = "buttonItem11"; 218 | this.buttonItem11.Text = "&4. example.rtf"; 219 | // 220 | // itemContainer4 221 | // 222 | // 223 | // 224 | // 225 | this.itemContainer4.BackgroundStyle.Class = "RibbonFileMenuBottomContainer"; 226 | this.itemContainer4.HorizontalItemAlignment = DevComponents.DotNetBar.eHorizontalItemsAlignment.Right; 227 | this.itemContainer4.Name = "itemContainer4"; 228 | this.itemContainer4.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { 229 | this.buttonItem12, 230 | this.buttonItem13}); 231 | // 232 | // buttonItem12 233 | // 234 | this.buttonItem12.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 235 | this.buttonItem12.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 236 | this.buttonItem12.Name = "buttonItem12"; 237 | this.buttonItem12.SubItemsExpandWidth = 24; 238 | this.buttonItem12.Text = "Opt&ions"; 239 | // 240 | // buttonItem13 241 | // 242 | this.buttonItem13.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText; 243 | this.buttonItem13.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; 244 | this.buttonItem13.Name = "buttonItem13"; 245 | this.buttonItem13.SubItemsExpandWidth = 24; 246 | this.buttonItem13.Text = "E&xit"; 247 | // 248 | // ribbonControl1 249 | // 250 | // 251 | // 252 | // 253 | this.ribbonControl1.BackgroundStyle.Class = ""; 254 | this.ribbonControl1.CaptionVisible = true; 255 | this.ribbonControl1.Controls.Add(this.ribbonPanel4); 256 | this.ribbonControl1.Controls.Add(this.ribbonPanel2); 257 | this.ribbonControl1.Controls.Add(this.ribbonPanel1); 258 | this.ribbonControl1.Dock = System.Windows.Forms.DockStyle.Fill; 259 | this.ribbonControl1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { 260 | this.ribbonTabItem4, 261 | this.ribbonTabItem1, 262 | this.ribbonTabItem2}); 263 | this.ribbonControl1.KeyTipsFont = new System.Drawing.Font("Tahoma", 7F); 264 | this.ribbonControl1.Location = new System.Drawing.Point(4, 1); 265 | this.ribbonControl1.Name = "ribbonControl1"; 266 | this.ribbonControl1.Padding = new System.Windows.Forms.Padding(0, 0, 0, 2); 267 | this.ribbonControl1.Size = new System.Drawing.Size(2000, 2000); 268 | this.ribbonControl1.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; 269 | this.ribbonControl1.TabGroupHeight = 14; 270 | this.ribbonControl1.TabIndex = 20; 271 | this.ribbonControl1.Text = "ribbonControl1"; 272 | // 273 | // ribbonPanel4 274 | // 275 | this.ribbonPanel4.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; 276 | this.ribbonPanel4.Controls.Add(this.scoreListView1); 277 | this.ribbonPanel4.Dock = System.Windows.Forms.DockStyle.Fill; 278 | this.ribbonPanel4.Location = new System.Drawing.Point(0, 53); 279 | this.ribbonPanel4.Name = "ribbonPanel4"; 280 | this.ribbonPanel4.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3); 281 | this.ribbonPanel4.Size = new System.Drawing.Size(648, 592); 282 | // 283 | // 284 | // 285 | this.ribbonPanel4.Style.Class = ""; 286 | // 287 | // 288 | // 289 | this.ribbonPanel4.StyleMouseDown.Class = ""; 290 | // 291 | // 292 | // 293 | this.ribbonPanel4.StyleMouseOver.Class = ""; 294 | this.ribbonPanel4.TabIndex = 4; 295 | // 296 | // scoreListView1 297 | // 298 | this.scoreListView1.BackColor = System.Drawing.Color.Transparent; 299 | this.scoreListView1.Dock = System.Windows.Forms.DockStyle.Fill; 300 | gpaInfo1.Gpa = null; 301 | gpaInfo1.Major = null; 302 | gpaInfo1.Name = null; 303 | gpaInfo1.TotalCredit = null; 304 | this.scoreListView1.GpaInfo = gpaInfo1; 305 | this.scoreListView1.IsNormal = true; 306 | this.scoreListView1.Location = new System.Drawing.Point(3, 0); 307 | this.scoreListView1.Margin = new System.Windows.Forms.Padding(4); 308 | this.scoreListView1.Name = "scoreListView1"; 309 | this.scoreListView1.Size = new System.Drawing.Size(642, 589); 310 | this.scoreListView1.TabIndex = 0; 311 | // 312 | // ribbonPanel2 313 | // 314 | this.ribbonPanel2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; 315 | this.ribbonPanel2.Controls.Add(this.userConfigView1); 316 | this.ribbonPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 317 | this.ribbonPanel2.Location = new System.Drawing.Point(0, 53); 318 | this.ribbonPanel2.Name = "ribbonPanel2"; 319 | this.ribbonPanel2.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3); 320 | this.ribbonPanel2.Size = new System.Drawing.Size(648, 592); 321 | // 322 | // 323 | // 324 | this.ribbonPanel2.Style.Class = ""; 325 | // 326 | // 327 | // 328 | this.ribbonPanel2.StyleMouseDown.Class = ""; 329 | // 330 | // 331 | // 332 | this.ribbonPanel2.StyleMouseOver.Class = ""; 333 | this.ribbonPanel2.TabIndex = 2; 334 | this.ribbonPanel2.Visible = false; 335 | // 336 | // userConfigView1 337 | // 338 | this.userConfigView1.BackColor = System.Drawing.Color.Transparent; 339 | this.userConfigView1.ForeColor = System.Drawing.SystemColors.ControlText; 340 | this.userConfigView1.Location = new System.Drawing.Point(2, 1); 341 | this.userConfigView1.Margin = new System.Windows.Forms.Padding(4); 342 | this.userConfigView1.Name = "userConfigView1"; 343 | this.userConfigView1.Size = new System.Drawing.Size(649, 556); 344 | this.userConfigView1.TabIndex = 0; 345 | // 346 | // ribbonPanel1 347 | // 348 | this.ribbonPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; 349 | this.ribbonPanel1.Controls.Add(this.scoreDistribution2); 350 | this.ribbonPanel1.Dock = System.Windows.Forms.DockStyle.Fill; 351 | this.ribbonPanel1.Location = new System.Drawing.Point(0, 53); 352 | this.ribbonPanel1.Name = "ribbonPanel1"; 353 | this.ribbonPanel1.Padding = new System.Windows.Forms.Padding(3, 0, 3, 3); 354 | this.ribbonPanel1.Size = new System.Drawing.Size(638, 568); 355 | // 356 | // 357 | // 358 | this.ribbonPanel1.Style.Class = ""; 359 | // 360 | // 361 | // 362 | this.ribbonPanel1.StyleMouseDown.Class = ""; 363 | // 364 | // 365 | // 366 | this.ribbonPanel1.StyleMouseOver.Class = ""; 367 | this.ribbonPanel1.TabIndex = 5; 368 | this.ribbonPanel1.Visible = false; 369 | // 370 | // scoreDistribution2 371 | // 372 | this.scoreDistribution2.BackColor = System.Drawing.Color.Transparent; 373 | this.scoreDistribution2.Dock = System.Windows.Forms.DockStyle.Fill; 374 | this.scoreDistribution2.Location = new System.Drawing.Point(2, 1); 375 | this.scoreDistribution2.Margin = new System.Windows.Forms.Padding(4); 376 | this.scoreDistribution2.Name = "scoreDistribution2"; 377 | this.scoreDistribution2.Size = new System.Drawing.Size(649, 556); 378 | this.scoreDistribution2.TabIndex = 0; 379 | // 380 | // ribbonTabItem4 381 | // 382 | this.ribbonTabItem4.Checked = true; 383 | this.ribbonTabItem4.Name = "ribbonTabItem4"; 384 | this.ribbonTabItem4.Panel = this.ribbonPanel4; 385 | this.ribbonTabItem4.Text = "成绩查询"; 386 | // 387 | // ribbonTabItem1 388 | // 389 | this.ribbonTabItem1.Name = "ribbonTabItem1"; 390 | this.ribbonTabItem1.Panel = this.ribbonPanel1; 391 | this.ribbonTabItem1.Text = "给分查询"; 392 | // 393 | // ribbonTabItem2 394 | // 395 | this.ribbonTabItem2.Name = "ribbonTabItem2"; 396 | this.ribbonTabItem2.Panel = this.ribbonPanel2; 397 | this.ribbonTabItem2.Text = "参数配置"; 398 | // 399 | // tabControlPanel2 400 | // 401 | this.tabControlPanel2.Dock = System.Windows.Forms.DockStyle.Fill; 402 | this.tabControlPanel2.Location = new System.Drawing.Point(0, 25); 403 | this.tabControlPanel2.Name = "tabControlPanel2"; 404 | this.tabControlPanel2.Padding = new System.Windows.Forms.Padding(1); 405 | this.tabControlPanel2.Size = new System.Drawing.Size(629, 450); 406 | this.tabControlPanel2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); 407 | this.tabControlPanel2.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; 408 | this.tabControlPanel2.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(83)))), ((int)(((byte)(89))))); 409 | this.tabControlPanel2.Style.BorderSide = ((DevComponents.DotNetBar.eBorderSide)(((DevComponents.DotNetBar.eBorderSide.Left | DevComponents.DotNetBar.eBorderSide.Right) 410 | | DevComponents.DotNetBar.eBorderSide.Bottom))); 411 | this.tabControlPanel2.Style.GradientAngle = 90; 412 | this.tabControlPanel2.TabIndex = 2; 413 | // 414 | // styleManager1 415 | // 416 | this.styleManager1.ManagerStyle = DevComponents.DotNetBar.eStyle.Office2010Silver; 417 | // 418 | // Form1 419 | // 420 | this.AccessibleRole = System.Windows.Forms.AccessibleRole.None; 421 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; 422 | if (this.CurrentAutoScaleDimensions.Width != 96) 423 | { 424 | this.AutoScaleDimensions = new System.Drawing.SizeF(90F, 90F); 425 | } 426 | else 427 | { 428 | this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); 429 | } 430 | this.Dock = System.Windows.Forms.DockStyle.Fill; 431 | this.ClientSize = new System.Drawing.Size(656, 650); 432 | this.Controls.Add(this.ribbonControl1); 433 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; 434 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 435 | this.MaximizeBox = false; 436 | this.Name = "Form1"; 437 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 438 | this.Text = "复旦大学绩点查询工具 v1.10 标准版 by hackerzhou"; 439 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); 440 | this.Load += new System.EventHandler(this.Form1_Load); 441 | this.ribbonControl1.ResumeLayout(false); 442 | this.ribbonControl1.PerformLayout(); 443 | this.ribbonPanel4.ResumeLayout(false); 444 | this.ribbonPanel2.ResumeLayout(false); 445 | this.ribbonPanel1.ResumeLayout(false); 446 | this.ResumeLayout(false); 447 | 448 | } 449 | 450 | #endregion 451 | 452 | private DevComponents.DotNetBar.Office2007StartButton office2007StartButton1; 453 | private DevComponents.DotNetBar.ItemContainer itemContainer1; 454 | private DevComponents.DotNetBar.ItemContainer itemContainer2; 455 | private DevComponents.DotNetBar.ItemContainer itemContainer3; 456 | private DevComponents.DotNetBar.ButtonItem buttonItem2; 457 | private DevComponents.DotNetBar.ButtonItem buttonItem3; 458 | private DevComponents.DotNetBar.ButtonItem buttonItem4; 459 | private DevComponents.DotNetBar.ButtonItem buttonItem5; 460 | private DevComponents.DotNetBar.ButtonItem buttonItem6; 461 | private DevComponents.DotNetBar.ButtonItem buttonItem7; 462 | private DevComponents.DotNetBar.GalleryContainer galleryContainer1; 463 | private DevComponents.DotNetBar.LabelItem labelItem8; 464 | private DevComponents.DotNetBar.ButtonItem buttonItem8; 465 | private DevComponents.DotNetBar.ButtonItem buttonItem9; 466 | private DevComponents.DotNetBar.ButtonItem buttonItem10; 467 | private DevComponents.DotNetBar.ButtonItem buttonItem11; 468 | private DevComponents.DotNetBar.ItemContainer itemContainer4; 469 | private DevComponents.DotNetBar.ButtonItem buttonItem12; 470 | private DevComponents.DotNetBar.ButtonItem buttonItem13; 471 | private DevComponents.DotNetBar.RibbonControl ribbonControl1; 472 | private DevComponents.DotNetBar.RibbonPanel ribbonPanel2; 473 | private DevComponents.DotNetBar.RibbonTabItem ribbonTabItem2; 474 | private DevComponents.DotNetBar.TabControlPanel tabControlPanel2; 475 | private DevComponents.DotNetBar.RibbonPanel ribbonPanel4; 476 | private DevComponents.DotNetBar.RibbonTabItem ribbonTabItem4; 477 | private DevComponents.DotNetBar.StyleManager styleManager1; 478 | private DevComponents.DotNetBar.RibbonPanel ribbonPanel1; 479 | private DevComponents.DotNetBar.RibbonTabItem ribbonTabItem1; 480 | private ScoreDistribution scoreDistribution2; 481 | private UserConfigView userConfigView1; 482 | private ScoreListView scoreListView1; 483 | } 484 | } 485 | 486 | -------------------------------------------------------------------------------- /Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using DevComponents.DotNetBar; 3 | using GPATool.Util; 4 | using System.Threading; 5 | using System.Net; 6 | using System.Text; 7 | using System.Xml; 8 | using System.Windows.Forms; 9 | using System.Web; 10 | using System.IO; 11 | 12 | namespace GPATool 13 | { 14 | public partial class Form1 :DevComponents.DotNetBar.Office2007RibbonForm 15 | { 16 | private static Form1 instance = null; 17 | private static bool isAdmin = false; 18 | private static Thread updateThread; 19 | 20 | public static Form1 getInstance() 21 | { 22 | return instance; 23 | } 24 | 25 | public Form1() 26 | { 27 | instance = this; 28 | InitializeComponent(); 29 | } 30 | 31 | private void Form1_Load(object sender, EventArgs e) 32 | { 33 | XMLConfig.LoadConfig(); 34 | isAdmin = XMLConfig.isAdmin; 35 | if (isAdmin) 36 | { 37 | this.Text = "复旦大学绩点查询工具 v1.10 专业版 by hackerzhou"; 38 | } 39 | ribbonTabItem4.Checked = ribbonTabItem1.Checked = ribbonTabItem2.Checked = true; 40 | updateThread = new Thread(new ThreadStart(UpdateUtil.CheckUpdate)); 41 | updateThread.Start(); 42 | } 43 | 44 | public void ChangeStyle(eStyle style) 45 | { 46 | styleManager1.ManagerStyle = style; 47 | } 48 | 49 | void Form1_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e) 50 | { 51 | StopAllThreads(); 52 | scoreListView1.StopAllThreads(); 53 | userConfigView1.StopAllThreads(); 54 | scoreDistribution2.StopAllThreads(); 55 | } 56 | 57 | 58 | 59 | public void StopAllThreads() 60 | { 61 | try 62 | { 63 | if (updateThread != null && updateThread.ThreadState != ThreadState.Stopped) 64 | { 65 | updateThread.Interrupt(); 66 | } 67 | } 68 | catch 69 | { 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /GPATool.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {8F19C217-D491-42DC-92FC-DB085D072457} 9 | WinExe 10 | Properties 11 | GPATool 12 | GPATool 13 | v4.0 14 | 512 15 | GPATool.Program 16 | 21310421.ico 17 | false 18 | 19 | 20 | 21 | 22 | 23 | 24 | 3.5 25 | publish\ 26 | true 27 | Disk 28 | false 29 | Foreground 30 | 7 31 | Days 32 | false 33 | false 34 | true 35 | 0 36 | 1.0.0.%2a 37 | false 38 | true 39 | 40 | 41 | 42 | true 43 | full 44 | false 45 | bin\Debug\ 46 | DEBUG;TRACE 47 | prompt 48 | 4 49 | AllRules.ruleset 50 | x86 51 | 52 | 53 | pdbonly 54 | true 55 | bin\Release\ 56 | TRACE 57 | prompt 58 | 4 59 | AllRules.ruleset 60 | x86 61 | 62 | 63 | 64 | False 65 | ..\..\DevComponents.DotNetBar.dll 66 | 67 | 68 | .\RSSSpider.dll 69 | 70 | 71 | 72 | 73 | False 74 | .\System.Data.SQLite.DLL 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | UserControl 87 | 88 | 89 | ScoreDistribution.cs 90 | 91 | 92 | UserControl 93 | 94 | 95 | ScoreDistributionChartPanel.cs 96 | 97 | 98 | UserControl 99 | 100 | 101 | UserConfigView.cs 102 | 103 | 104 | 105 | 106 | 107 | UserControl 108 | 109 | 110 | ScoreListView.cs 111 | 112 | 113 | Form 114 | 115 | 116 | Form1.cs 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | ScoreDistribution.cs 126 | 127 | 128 | ScoreDistributionChartPanel.cs 129 | 130 | 131 | ScoreListView.cs 132 | 133 | 134 | Form1.cs 135 | Designer 136 | 137 | 138 | ResXFileCodeGenerator 139 | Resources.Designer.cs 140 | Designer 141 | 142 | 143 | True 144 | Resources.resx 145 | True 146 | 147 | 148 | UserConfigView.cs 149 | 150 | 151 | Designer 152 | 153 | 154 | 155 | SettingsSingleFileGenerator 156 | Settings.Designer.cs 157 | 158 | 159 | True 160 | Settings.settings 161 | True 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | False 176 | .NET Framework 3.5 SP1 Client Profile 177 | false 178 | 179 | 180 | False 181 | .NET Framework 2.0 %28x86%29 182 | true 183 | 184 | 185 | False 186 | .NET Framework 3.0 %28x86%29 187 | false 188 | 189 | 190 | False 191 | .NET Framework 3.5 192 | false 193 | 194 | 195 | False 196 | .NET Framework 3.5 SP1 197 | false 198 | 199 | 200 | 201 | 202 | copy "$(ProjectDir)data.s3db" "$(TargetDir)data.s3db" 203 | 204 | 211 | -------------------------------------------------------------------------------- /GPATool.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | publish\ 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | zh-CN 14 | false 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace GPATool 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// 应用程序的主入口点。 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new Form1()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Resources; 5 | 6 | // 有关程序集的常规信息通过下列属性集 7 | // 控制。更改这些属性值可修改 8 | // 与程序集关联的信息。 9 | [assembly: AssemblyTitle("GPATool")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("hackerzhou")] 13 | [assembly: AssemblyProduct("GPATool")] 14 | [assembly: AssemblyCopyright("Copyright © hackerzhou 2011")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // 将 ComVisible 设置为 false 使此程序集中的类型 19 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 20 | // 则将该类型上的 ComVisible 属性设置为 true。 21 | [assembly: ComVisible(false)] 22 | 23 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 24 | [assembly: Guid("256ebd72-14bf-4740-a823-bba0ca8b305d")] 25 | 26 | // 程序集的版本信息由下面四个值组成: 27 | // 28 | // 主版本 29 | // 次版本 30 | // 内部版本号 31 | // 修订号 32 | // 33 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 34 | // 方法是按如下所示使用“*”: 35 | // [assembly: AssemblyVersion("1.0.*")] 36 | [assembly: AssemblyVersion("1.1.0.0")] 37 | [assembly: AssemblyFileVersion("1.1.0.0")] 38 | [assembly: NeutralResourcesLanguageAttribute("zh-CHS")] 39 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.235 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GPATool.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GPATool.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.235 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GPATool.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 本程序可以查询成绩(支持HTTP代理访问),支持按照学期、课程名称、课程代码以及教师姓名来查询课程给分信息。v1.10版增加了查询某一老师各个学期某一门课/某学期某门课程不同老师给分情况。 -------------------------------------------------------------------------------- /RSSSpider.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerzhou/GPATool/21f7dc643f64b2d32ebaf77cc0dcd1c6536a8053/RSSSpider.dll -------------------------------------------------------------------------------- /ScoreDistribution.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.ComponentModel; 5 | using System.Windows.Forms; 6 | using System.Windows.Forms.DataVisualization.Charting; 7 | using GPATool.Bean; 8 | using GPATool.Util; 9 | using System.Threading; 10 | 11 | namespace GPATool 12 | { 13 | public partial class ScoreDistribution : UserControl 14 | { 15 | private List courseList = null; 16 | private Thread tSDThread; 17 | private Thread sSDThread; 18 | public ScoreDistribution() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | private void ScoreDistribution_Load(object sender, EventArgs e) 24 | { 25 | comboBox1.DataBindings.Add("Enabled", checkBox1, "Checked"); 26 | textBox1.DataBindings.Add("Enabled", checkBox2, "Checked"); 27 | textBox2.DataBindings.Add("Enabled", checkBox3, "Checked"); 28 | textBox3.DataBindings.Add("Enabled", checkBox4, "Checked"); 29 | numericUpDown1.DataBindings.Add("Enabled", checkBox6, "Checked"); 30 | numericUpDown2.DataBindings.Add("Enabled", checkBox5, "Checked"); 31 | listView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize); 32 | listView1.AutoResizeColumn(5, ColumnHeaderAutoResizeStyle.HeaderSize); 33 | listView1.AutoResizeColumn(6, ColumnHeaderAutoResizeStyle.HeaderSize); 34 | scoreDistributionChartPanel1.Visible = false; 35 | this.BeginInvoke(new LoadData(LoadDataHandler)); 36 | } 37 | 38 | private delegate void LoadData(); 39 | private void LoadDataHandler() 40 | { 41 | if (File.Exists("data.s3db")) 42 | { 43 | this.comboBox1.Items.AddRange(ScoreDistributionHelper.LoadAllSemesters().ToArray()); 44 | if (this.comboBox1.Items.Count > 0) 45 | { 46 | this.comboBox1.SelectedIndex = 0; 47 | } 48 | } 49 | } 50 | 51 | private void listView1_ColumnClick(object sender, ColumnClickEventArgs e) 52 | { 53 | ColumnHeader ch = listView1.Columns[e.Column]; 54 | String orderBy = null; 55 | if (((String)ch.Tag).Equals("semester")) 56 | { 57 | ch.Tag = "semesterDesc"; 58 | orderBy = "order by s.name desc"; 59 | } 60 | else if (((String)ch.Tag).Equals("semesterDesc")) 61 | { 62 | ch.Tag = "semester"; 63 | orderBy = "order by s.name"; 64 | } 65 | else if (((String)ch.Tag).Equals("lessonCode")) 66 | { 67 | ch.Tag = "lessonCodeDesc"; 68 | orderBy = "order by l.lessonCode desc"; 69 | } 70 | else if (((String)ch.Tag).Equals("lessonCodeDesc")) 71 | { 72 | ch.Tag = "lessonCode"; 73 | orderBy = "order by l.lessonCode"; 74 | } 75 | else if (((String)ch.Tag).Equals("lessonName")) 76 | { 77 | ch.Tag = "lessonNameDesc"; 78 | orderBy = "order by l.lessonName desc"; 79 | } 80 | else if (((String)ch.Tag).Equals("lessonNameDesc")) 81 | { 82 | ch.Tag = "lessonName"; 83 | orderBy = "order by l.lessonName"; 84 | } 85 | else if (((String)ch.Tag).Equals("teacher")) 86 | { 87 | ch.Tag = "teacherDesc"; 88 | orderBy = "order by t.name desc"; 89 | } 90 | else if (((String)ch.Tag).Equals("teacherDesc")) 91 | { 92 | ch.Tag = "teacher"; 93 | orderBy = "order by t.name"; 94 | } 95 | else if (((String)ch.Tag).Equals("credit")) 96 | { 97 | ch.Tag = "creditDesc"; 98 | orderBy = "order by l.creditPoint desc"; 99 | } 100 | else if (((String)ch.Tag).Equals("creditDesc")) 101 | { 102 | ch.Tag = "credit"; 103 | orderBy = "order by l.creditPoint"; 104 | } 105 | else if (((String)ch.Tag).Equals("stuCount")) 106 | { 107 | ch.Tag = "stuCountDesc"; 108 | orderBy = "order by c.totalStudentNumber desc"; 109 | } 110 | else if (((String)ch.Tag).Equals("stuCountDesc")) 111 | { 112 | ch.Tag = "stuCount"; 113 | orderBy = "order by c.totalStudentNumber"; 114 | } 115 | button1_Click(orderBy, null); 116 | } 117 | 118 | private void button1_Click(object sender, EventArgs e) 119 | { 120 | if (!File.Exists("data.s3db")) 121 | { 122 | MessageBox.Show("找不到给分数据库文件data.s3db!", "数据文件丢失"); 123 | return; 124 | } 125 | listView1.Height = 449; 126 | Object para = (e == null) ? getQueryParameter(sender.ToString()) : getQueryParameter(); 127 | this.BeginInvoke(new QueryCourseDelegate(queryCourse), para); 128 | } 129 | 130 | private Object getQueryParameter(String orderBy = null) 131 | { 132 | Object[] para = new Object[8]; 133 | if (checkBox1.Checked && comboBox1.SelectedItem != null && !string.IsNullOrEmpty(comboBox1.SelectedItem.ToString())) 134 | { 135 | para[0] = comboBox1.SelectedItem.ToString(); 136 | } 137 | else 138 | { 139 | para[0] = null; 140 | } 141 | para[1] = (checkBox2.Checked && textBox1.Text.Length > 1) ? textBox1.Text : null; 142 | para[2] = (checkBox4.Checked && textBox3.Text.Length > 1) ? textBox3.Text : null; 143 | para[3] = (checkBox3.Checked && textBox2.Text.Length > 1) ? textBox2.Text : null; 144 | para[4] = (checkBox5.Checked) ? (int)numericUpDown2.Value : -1; 145 | para[5] = (checkBox6.Checked) ? (int)numericUpDown1.Value : -1; 146 | para[6] = checkBox7.Checked; 147 | para[7] = orderBy; 148 | for (int i = 0; i < para.Length; i++) 149 | { 150 | if (para[i] is String) 151 | { 152 | String s = (String)para[i]; 153 | s = s.Replace("'", ""); 154 | para[i] = s; 155 | } 156 | } 157 | return para; 158 | } 159 | private delegate void QueryCourseDelegate(Object args); 160 | 161 | private void queryCourse(Object args) 162 | { 163 | disableView(); 164 | Object[] o = (Object[])args; 165 | String semester = (String)o[0]; 166 | String lessonCodeContains = (String)o[1]; 167 | String lessonNameContains = (String)o[2]; 168 | String teacherNameContains = (String)o[3]; 169 | int ignoreLessThan = (int)o[4]; 170 | int limit = (int)o[5]; 171 | bool ignoreImcompleteInfo = (bool)o[6]; 172 | String orderBy = (String)o[7]; 173 | List list = null; 174 | try 175 | { 176 | list = ScoreDistributionHelper.Query(semester, lessonCodeContains, lessonNameContains 177 | , teacherNameContains, ignoreLessThan, limit, ignoreImcompleteInfo, orderBy); 178 | loadCourseListViewHandler(list); 179 | } 180 | catch(Exception e) 181 | { 182 | MessageBox.Show("请检查数据文件data.s3db是否被破坏或删除!\n详细信息:" + e.Message, "数据查询出错"); 183 | } 184 | finally 185 | { 186 | enableView(); 187 | } 188 | } 189 | 190 | delegate void LoadCourseListViewDelegate(List para); 191 | private void loadCourseListViewHandler(List para) 192 | { 193 | courseList = para; 194 | listView1.Items.Clear(); 195 | foreach (ScoreDistributionItem s in para) 196 | { 197 | listView1.Items.Add(new ListViewItem(new String[] { s.Id.ToString(), s.Semester, s.LessonCode, s.LessonName, s.Teacher, s.Credits.ToString(), s.StudentCount.ToString() })); 198 | } 199 | listView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize); 200 | listView1.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.ColumnContent); 201 | listView1.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent); 202 | listView1.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.ColumnContent); 203 | listView1.AutoResizeColumn(4, ColumnHeaderAutoResizeStyle.ColumnContent); 204 | listView1.AutoResizeColumn(5, ColumnHeaderAutoResizeStyle.HeaderSize); 205 | listView1.AutoResizeColumn(6, ColumnHeaderAutoResizeStyle.HeaderSize); 206 | } 207 | 208 | delegate void SetViewDelegate(); 209 | 210 | private void disableView() 211 | { 212 | if (this.InvokeRequired) 213 | { 214 | SetViewDelegate cb = new SetViewDelegate(disableView); 215 | this.Invoke(cb); 216 | } 217 | else 218 | { 219 | scoreDistributionChartPanel1.HidePanel(); 220 | button1.Visible = listView1.Enabled = groupBox1.Enabled = false; 221 | panel1.Show(); 222 | pictureBox1.Refresh(); 223 | } 224 | } 225 | 226 | private void enableView() 227 | { 228 | if (this.InvokeRequired) 229 | { 230 | SetViewDelegate cb = new SetViewDelegate(enableView); 231 | this.Invoke(cb); 232 | } 233 | else 234 | { 235 | panel1.Hide(); 236 | button1.Visible = groupBox1.Enabled = listView1.Enabled = true; 237 | } 238 | } 239 | 240 | private void busyAnalysticView() 241 | { 242 | if (this.InvokeRequired) 243 | { 244 | SetViewDelegate cb = new SetViewDelegate(busyAnalysticView); 245 | this.Invoke(cb); 246 | } 247 | else 248 | { 249 | button1.Enabled = listView1.Enabled = false; 250 | pictureBox2.Visible = true; 251 | pictureBox2.Refresh(); 252 | scoreDistributionChartPanel1.HidePanel(); 253 | } 254 | } 255 | 256 | private void unBusyAnalysticView() 257 | { 258 | if (this.InvokeRequired) 259 | { 260 | SetViewDelegate cb = new SetViewDelegate(unBusyAnalysticView); 261 | this.Invoke(cb); 262 | } 263 | else 264 | { 265 | button1.Enabled = listView1.Enabled = true; 266 | pictureBox2.Visible = false; 267 | scoreDistributionChartPanel1.ShowPanel(); 268 | } 269 | } 270 | 271 | private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) 272 | { 273 | if (e.IsSelected && e.ItemIndex != -1 && courseList.Count > e.ItemIndex) 274 | { 275 | listView1.Height = 200; 276 | this.BeginInvoke(new QueryDistributionDelegate(queryDistribution), courseList[e.ItemIndex]); 277 | } 278 | } 279 | private delegate void QueryDistributionDelegate(ScoreDistributionItem args); 280 | private void queryDistribution(ScoreDistributionItem args) 281 | { 282 | if (args.Scores == null || args.Scores.Count == 0) 283 | { 284 | try 285 | { 286 | ScoreDistributionHelper.QueryScoreDistribution(args); 287 | } 288 | catch (Exception e) 289 | { 290 | MessageBox.Show("数据查询出错!\n详细信息:" + e.Message); 291 | } 292 | } 293 | String[][] listViewItems = new String[args.Scores.Count][]; 294 | DataPoint[] dps = new DataPoint[args.Scores.Count]; 295 | for (int i = 0;i 0) 323 | { 324 | ScoreDistributionItem i = courseList[listView1.SelectedIndices[0]]; 325 | if (i != null && !string.IsNullOrEmpty(i.Teacher) && !string.IsNullOrEmpty(i.LessonName)) 326 | { 327 | sSDThread = new Thread(new ParameterizedThreadStart(queryAnalyticsSD)); 328 | sSDThread.Start(new object[] { i, "Semester" }); 329 | } 330 | else 331 | { 332 | MessageBox.Show("该课程信息不完整,无法进行继续查询!", "无法查询"); 333 | } 334 | } 335 | } 336 | 337 | private void queryAnalyticsSD(Object o) 338 | { 339 | ScoreDistributionItem args = (ScoreDistributionItem)((Object[])o)[0]; 340 | String analyticsType= (String)((Object[])o)[1]; 341 | bool isSemesterAnalytics = "Semester".Equals(analyticsType); 342 | busyAnalysticView(); 343 | List list = null; 344 | try 345 | { 346 | if (isSemesterAnalytics) 347 | { 348 | list = ScoreDistributionHelper.QueryTeacherSDChangeBySemester(args); 349 | } 350 | else 351 | { 352 | list = ScoreDistributionHelper.QueryLessonSDChangeByTeacher(args); 353 | } 354 | } 355 | catch (Exception e) 356 | { 357 | unBusyAnalysticView(); 358 | MessageBox.Show("数据查询出错!\n详细信息:" + e.Message); 359 | return; 360 | } 361 | String[][] listViewItems = new String[list.Count][]; 362 | DataPoint[] dps = new DataPoint[list.Count]; 363 | for (int i = 0; i < list.Count; i++) 364 | { 365 | ScoreDistributionItem sdi = list[i]; 366 | dps[i] = new DataPoint(0, sdi.AverageScore); 367 | dps[i].AxisLabel = " "; 368 | listViewItems[i] = new String[] { isSemesterAnalytics ? sdi.Semester : sdi.Teacher, sdi.AverageScore.ToString("0.00"), sdi.Remark }; 369 | dps[i].ToolTip = (isSemesterAnalytics ? "学期:" + sdi.Semester : "教师:" + sdi.Teacher) + "\n平均成绩:" + sdi.AverageScore.ToString("0.00") + " (" + Lesson.GetScoreDetailString(sdi.AverageScore) + ")\n比例最大的成绩:" + sdi.Remark; 370 | dps[i].MarkerStyle = MarkerStyle.Circle; 371 | dps[i].MarkerSize = 10; 372 | } 373 | this.setSDChartPanelHandler(isSemesterAnalytics ? ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_SEMESTER : ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_TEACHER 374 | , listViewItems, dps); 375 | unBusyAnalysticView(); 376 | } 377 | 378 | delegate void SetSDChartPanelDelegate(ScoreDistributionChartPanelType t, String[][] s, DataPoint[] d); 379 | private void setSDChartPanelHandler(ScoreDistributionChartPanelType t, String[][] s, DataPoint[] d) 380 | { 381 | if (this.InvokeRequired) 382 | { 383 | SetSDChartPanelDelegate cb = new SetSDChartPanelDelegate(setSDChartPanelHandler); 384 | this.Invoke(cb, t, s, d); 385 | } 386 | else 387 | { 388 | scoreDistributionChartPanel1.SetPanelType(t); 389 | scoreDistributionChartPanel1.RefreshData(s, d); 390 | } 391 | } 392 | 393 | private void toolStripMenuItem5_Click(object sender, EventArgs e) 394 | { 395 | if (listView1.SelectedIndices.Count > 0) 396 | { 397 | ScoreDistributionItem i = courseList[listView1.SelectedIndices[0]]; 398 | if (i != null && !string.IsNullOrEmpty(i.Teacher) && !string.IsNullOrEmpty(i.LessonName)) 399 | { 400 | tSDThread = new Thread(new ParameterizedThreadStart(queryAnalyticsSD)); 401 | tSDThread.Start(new object[] { i, "Teacher" }); 402 | } 403 | else 404 | { 405 | MessageBox.Show("该课程信息不完整,无法进行继续查询!", "无法查询"); 406 | } 407 | } 408 | } 409 | 410 | public void StopAllThreads() 411 | { 412 | try 413 | { 414 | if (tSDThread != null && tSDThread.ThreadState != ThreadState.Stopped) 415 | { 416 | tSDThread.Interrupt(); 417 | } 418 | } 419 | catch 420 | { 421 | } 422 | try 423 | { 424 | if (sSDThread != null && sSDThread.ThreadState != ThreadState.Stopped) 425 | { 426 | sSDThread.Interrupt(); 427 | } 428 | } 429 | catch 430 | { 431 | } 432 | } 433 | } 434 | } 435 | -------------------------------------------------------------------------------- /ScoreDistributionChartPanel.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GPATool 2 | { 3 | partial class ScoreDistributionChartPanel 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 33 | System.Windows.Forms.DataVisualization.Charting.Legend legend6 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 34 | System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series(); 35 | this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); 36 | this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 37 | this.panel1 = new System.Windows.Forms.Panel(); 38 | this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); 39 | this.label3 = new System.Windows.Forms.Label(); 40 | this.comboBox2 = new System.Windows.Forms.ComboBox(); 41 | this.listView2 = new System.Windows.Forms.ListView(); 42 | this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 43 | this.columnHeader8 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 44 | this.columnHeader9 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 45 | this.contextMenuStrip1.SuspendLayout(); 46 | this.panel1.SuspendLayout(); 47 | ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); 48 | this.SuspendLayout(); 49 | // 50 | // contextMenuStrip1 51 | // 52 | this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 53 | this.toolStripMenuItem1}); 54 | this.contextMenuStrip1.Name = "contextMenuStrip1"; 55 | this.contextMenuStrip1.Size = new System.Drawing.Size(149, 26); 56 | // 57 | // toolStripMenuItem1 58 | // 59 | this.toolStripMenuItem1.Name = "toolStripMenuItem1"; 60 | this.toolStripMenuItem1.Size = new System.Drawing.Size(148, 22); 61 | this.toolStripMenuItem1.Text = "拷贝到粘贴板"; 62 | this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); 63 | // 64 | // panel1 65 | // 66 | this.panel1.Controls.Add(this.chart1); 67 | this.panel1.Controls.Add(this.label3); 68 | this.panel1.Controls.Add(this.comboBox2); 69 | this.panel1.Controls.Add(this.listView2); 70 | this.panel1.Location = new System.Drawing.Point(0, 0); 71 | this.panel1.Name = "panel1"; 72 | this.panel1.Size = new System.Drawing.Size(647, 241); 73 | this.panel1.TabIndex = 29; 74 | // 75 | // chart1 76 | // 77 | this.chart1.BackColor = System.Drawing.Color.Transparent; 78 | chartArea6.BackColor = System.Drawing.Color.Transparent; 79 | chartArea6.Name = "ChartArea1"; 80 | this.chart1.ChartAreas.Add(chartArea6); 81 | legend6.BackColor = System.Drawing.Color.Transparent; 82 | legend6.Name = "Legend1"; 83 | this.chart1.Legends.Add(legend6); 84 | this.chart1.Location = new System.Drawing.Point(228, 3); 85 | this.chart1.Name = "chart1"; 86 | this.chart1.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.None; 87 | series6.ChartArea = "ChartArea1"; 88 | series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie; 89 | series6.Legend = "Legend1"; 90 | series6.Name = "Series1"; 91 | this.chart1.Series.Add(series6); 92 | this.chart1.Size = new System.Drawing.Size(402, 235); 93 | this.chart1.TabIndex = 28; 94 | this.chart1.Text = "chart1"; 95 | // 96 | // label3 97 | // 98 | this.label3.AutoSize = true; 99 | this.label3.Location = new System.Drawing.Point(9, 217); 100 | this.label3.Name = "label3"; 101 | this.label3.Size = new System.Drawing.Size(41, 12); 102 | this.label3.TabIndex = 31; 103 | this.label3.Text = "显示:"; 104 | // 105 | // comboBox2 106 | // 107 | this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 108 | this.comboBox2.FormattingEnabled = true; 109 | this.comboBox2.Items.AddRange(new object[] { 110 | "饼状图", 111 | "柱状图"}); 112 | this.comboBox2.Location = new System.Drawing.Point(50, 214); 113 | this.comboBox2.Name = "comboBox2"; 114 | this.comboBox2.Size = new System.Drawing.Size(65, 20); 115 | this.comboBox2.TabIndex = 30; 116 | this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); 117 | // 118 | // listView2 119 | // 120 | this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 121 | this.columnHeader4, 122 | this.columnHeader8, 123 | this.columnHeader9}); 124 | this.listView2.ContextMenuStrip = this.contextMenuStrip1; 125 | this.listView2.ForeColor = System.Drawing.SystemColors.ControlText; 126 | this.listView2.FullRowSelect = true; 127 | this.listView2.GridLines = true; 128 | this.listView2.Location = new System.Drawing.Point(9, 19); 129 | this.listView2.MultiSelect = false; 130 | this.listView2.Name = "listView2"; 131 | this.listView2.Size = new System.Drawing.Size(204, 189); 132 | this.listView2.TabIndex = 29; 133 | this.listView2.UseCompatibleStateImageBehavior = false; 134 | this.listView2.View = System.Windows.Forms.View.Details; 135 | this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged); 136 | // 137 | // columnHeader4 138 | // 139 | this.columnHeader4.Tag = "Score"; 140 | this.columnHeader4.Text = "成绩"; 141 | // 142 | // columnHeader8 143 | // 144 | this.columnHeader8.Tag = "int"; 145 | this.columnHeader8.Text = "人数"; 146 | this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; 147 | // 148 | // columnHeader9 149 | // 150 | this.columnHeader9.Tag = "double"; 151 | this.columnHeader9.Text = "百分比"; 152 | // 153 | // ScoreDistributionChartPanel 154 | // 155 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 156 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 157 | this.BackColor = System.Drawing.Color.Transparent; 158 | this.Controls.Add(this.panel1); 159 | this.Name = "ScoreDistributionChartPanel"; 160 | this.Size = new System.Drawing.Size(630, 241); 161 | this.Load += new System.EventHandler(this.ScoreDistributionChartPanel_Load); 162 | this.contextMenuStrip1.ResumeLayout(false); 163 | this.panel1.ResumeLayout(false); 164 | this.panel1.PerformLayout(); 165 | ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); 166 | this.ResumeLayout(false); 167 | 168 | } 169 | 170 | #endregion 171 | 172 | private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; 173 | private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; 174 | private System.Windows.Forms.Panel panel1; 175 | private System.Windows.Forms.Label label3; 176 | private System.Windows.Forms.ComboBox comboBox2; 177 | private System.Windows.Forms.ListView listView2; 178 | private System.Windows.Forms.ColumnHeader columnHeader4; 179 | private System.Windows.Forms.ColumnHeader columnHeader8; 180 | private System.Windows.Forms.ColumnHeader columnHeader9; 181 | private System.Windows.Forms.DataVisualization.Charting.Chart chart1; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /ScoreDistributionChartPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.Data; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Windows.Forms; 9 | using System.Windows.Forms.DataVisualization.Charting; 10 | using GPATool.Util; 11 | 12 | namespace GPATool 13 | { 14 | public enum ScoreDistributionChartPanelType 15 | { 16 | SCORE_DISTRIBUTION_COURSE, 17 | SCORE_DISTRIBUTION_SEMESTER, 18 | SCORE_DISTRIBUTION_TEACHER, 19 | NOT_SET 20 | } 21 | public partial class ScoreDistributionChartPanel : UserControl 22 | { 23 | private ScoreDistributionChartPanelType panelType = ScoreDistributionChartPanelType.NOT_SET; 24 | private Color savedDataPointColor; 25 | 26 | public ScoreDistributionChartPanel() 27 | { 28 | InitializeComponent(); 29 | } 30 | 31 | public void SetPanelType(ScoreDistributionChartPanelType type) 32 | { 33 | if (this.panelType != type) 34 | { 35 | this.HidePanel(); 36 | this.panelType = type; 37 | comboBox2.Items.Clear(); 38 | if (type == ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_COURSE) 39 | { 40 | comboBox2.Items.AddRange(new String[] { "饼状图", "柱状图" }); 41 | chart1.Series[0].ChartType = SeriesChartType.Pie; 42 | listView2.Columns[0].Text = "成绩"; 43 | listView2.Columns[1].Text = "人数"; 44 | listView2.Columns[2].Text = "百分比"; 45 | chart1.ChartAreas[0].AxisY.Maximum = double.NaN; 46 | chart1.ChartAreas[0].AxisY.MajorTickMark.Interval = 0; 47 | chart1.ChartAreas[0].AxisY.Interval = 0; 48 | chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = true; 49 | } 50 | else if (type == ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_SEMESTER 51 | || type == ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_TEACHER) 52 | { 53 | if (type == ScoreDistributionChartPanelType.SCORE_DISTRIBUTION_SEMESTER) 54 | { 55 | comboBox2.Items.AddRange(new String[] { "折线图", "柱状图" }); 56 | chart1.Series[0].ChartType = SeriesChartType.Line; 57 | listView2.Columns[0].Text = "学期"; 58 | } 59 | else 60 | { 61 | comboBox2.Items.AddRange(new String[] { "柱状图", "条状图" }); 62 | chart1.Series[0].ChartType = SeriesChartType.Column; 63 | listView2.Columns[0].Text = "老师"; 64 | } 65 | listView2.Columns[1].Text = "平均成绩"; 66 | listView2.Columns[2].Text = "Top 2 比例成绩"; 67 | chart1.ChartAreas[0].AxisY.Maximum = 4.0; 68 | chart1.ChartAreas[0].AxisY.MajorTickMark.Interval = 0.5; 69 | chart1.ChartAreas[0].AxisY.Interval = 0.5; 70 | chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = false; 71 | } 72 | comboBox2.SelectedIndex = 0; 73 | } 74 | } 75 | 76 | public void RefreshData(String[][] listViewItemStr, DataPoint[] chartPoint) 77 | { 78 | chart1.Series[0].Points.Clear(); 79 | listView2.Items.Clear(); 80 | foreach (String[] listItem in listViewItemStr) 81 | { 82 | listView2.Items.Add(new ListViewItem(listItem)); 83 | } 84 | listView2.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); 85 | foreach (DataPoint dp in chartPoint) 86 | { 87 | chart1.Series[0].Points.Add(dp); 88 | } 89 | comboBox2_SelectedIndexChanged(null, null); 90 | this.ShowPanel(); 91 | } 92 | 93 | [System.Runtime.InteropServices.DllImport("user32.dll")] 94 | static extern bool AnimateWindow(IntPtr hwnd, uint dwTime, uint dwFlags); 95 | public const Int32 AW_HOR_POSITIVE = 0x00000001; 96 | public const Int32 AW_HOR_NEGATIVE = 0x00000002; 97 | public const Int32 AW_VER_POSITIVE = 0x00000004; 98 | public const Int32 AW_VER_NEGATIVE = 0x00000008; 99 | public const Int32 AW_CENTER = 0x00000010; 100 | public const Int32 AW_HIDE = 0x00010000; 101 | public const Int32 AW_ACTIVATE = 0x00020000; 102 | public const Int32 AW_SLIDE = 0x00040000; 103 | public const Int32 AW_BLEND = 0x00080000; 104 | private delegate void SetPanelOperation(); 105 | public void ShowPanel() 106 | { 107 | if (this.InvokeRequired) 108 | { 109 | SetPanelOperation cb = new SetPanelOperation(ShowPanel); 110 | this.Invoke(cb); 111 | } 112 | else 113 | { 114 | AnimateWindow(Handle, 300, AW_VER_POSITIVE | AW_SLIDE); 115 | this.Show(); 116 | this.chart1.Visible = true; 117 | } 118 | } 119 | 120 | public void HidePanel() 121 | { 122 | if (this.InvokeRequired) 123 | { 124 | SetPanelOperation cb = new SetPanelOperation(HidePanel); 125 | this.Invoke(cb); 126 | } 127 | else 128 | { 129 | AnimateWindow(Handle, 300, AW_VER_NEGATIVE | AW_HIDE | AW_SLIDE); 130 | this.Hide(); 131 | this.chart1.Visible = false; 132 | } 133 | } 134 | 135 | private void ScoreDistributionChartPanel_Load(object sender, EventArgs e) 136 | { 137 | } 138 | 139 | private void toolStripMenuItem1_Click(object sender, EventArgs e) 140 | { 141 | ListViewStripMenuHelper.CopyAllItemsToClipBoard(listView2); 142 | } 143 | 144 | private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) 145 | { 146 | if (listView2.SelectedIndices.Count > 0) 147 | { 148 | chart1.Series[0].Points[listView2.SelectedIndices[0]].BorderWidth = 0; 149 | listView2.SelectedIndices.Clear(); 150 | } 151 | if ("饼状图".Equals(comboBox2.SelectedItem)) 152 | { 153 | chart1.Series[0].ChartType = SeriesChartType.Pie; 154 | chart1.Series[0].IsVisibleInLegend = true; 155 | } 156 | else 157 | { 158 | chart1.Series[0].IsVisibleInLegend = false; 159 | chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = false; 160 | chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = false; 161 | chart1.ChartAreas[0].AxisX.ArrowStyle = AxisArrowStyle.Triangle; 162 | chart1.ChartAreas[0].AxisY.ArrowStyle = AxisArrowStyle.Triangle; 163 | if ("柱状图".Equals(comboBox2.SelectedItem)) 164 | { 165 | chart1.Series[0].ChartType = SeriesChartType.Column; 166 | foreach (DataPoint dp in chart1.Series[0].Points) 167 | { 168 | dp.MarkerStyle = MarkerStyle.None; 169 | } 170 | } 171 | else if ("折线图".Equals(comboBox2.SelectedItem)) 172 | { 173 | chart1.Series[0].ChartType = SeriesChartType.Line; 174 | foreach (DataPoint dp in chart1.Series[0].Points) 175 | { 176 | dp.MarkerStyle = MarkerStyle.Circle; 177 | dp.MarkerSize = 10; 178 | } 179 | } 180 | else if ("条状图".Equals(comboBox2.SelectedItem)) 181 | { 182 | chart1.Series[0].ChartType = SeriesChartType.Bar; 183 | foreach (DataPoint dp in chart1.Series[0].Points) 184 | { 185 | dp.MarkerStyle = MarkerStyle.None; 186 | } 187 | } 188 | } 189 | } 190 | 191 | private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) 192 | { 193 | if (e.IsSelected) 194 | { 195 | int index = e.ItemIndex; 196 | if (index >= 0 && index < chart1.Series[0].Points.Count) 197 | { 198 | Color highlightColor = Color.Orange; 199 | if ("柱状图".Equals(comboBox2.SelectedItem)) 200 | { 201 | savedDataPointColor = chart1.Series[0].Points[index].Color; 202 | chart1.Series[0].Points[index].Color = highlightColor; 203 | } 204 | else if ("饼状图".Equals(comboBox2.SelectedItem)) 205 | { 206 | savedDataPointColor = chart1.Series[0].Points[index].BorderColor; 207 | chart1.Series[0].Points[index].BorderColor = Color.OrangeRed; 208 | chart1.Series[0].Points[index].BorderWidth = 3; 209 | chart1.Series[0].Points[index].BorderDashStyle = ChartDashStyle.Solid; 210 | } 211 | else 212 | { 213 | savedDataPointColor = chart1.Series[0].Points[index].MarkerColor; 214 | chart1.Series[0].Points[index].MarkerColor = highlightColor; 215 | } 216 | } 217 | } 218 | else 219 | { 220 | if ("柱状图".Equals(comboBox2.SelectedItem)) 221 | { 222 | chart1.Series[0].Points[e.ItemIndex].Color = savedDataPointColor; 223 | } 224 | else if ("饼状图".Equals(comboBox2.SelectedItem)) 225 | { 226 | chart1.Series[0].Points[e.ItemIndex].BorderColor = savedDataPointColor; 227 | chart1.Series[0].Points[e.ItemIndex].BorderWidth = 0; 228 | } 229 | else 230 | { 231 | chart1.Series[0].Points[e.ItemIndex].MarkerColor = savedDataPointColor; 232 | } 233 | } 234 | } 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /ScoreDistributionChartPanel.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /ScoreListView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Net; 6 | using System.Threading; 7 | using System.Windows.Forms; 8 | using GPATool.Bean; 9 | using GPATool.Util; 10 | 11 | namespace GPATool 12 | { 13 | public partial class ScoreListView : UserControl 14 | { 15 | public bool IsNormal { get; set; } 16 | private Thread thread = null; 17 | private Hashtable lessonsTable = new Hashtable(); 18 | private List lessonBak = null; 19 | public GPAInfo GpaInfo { get; set; } 20 | private double majorCreditsDouble = 0; 21 | private double majorCreditsMultiScore = 0; 22 | private double majorFailCredits = 0; 23 | 24 | public ScoreListView() 25 | { 26 | InitializeComponent(); 27 | } 28 | 29 | private void CourseListView_Load(object sender, EventArgs e) 30 | { 31 | XMLConfig.LoadConfig(); 32 | numericUpDown1.DataBindings.Add("Enabled", checkBox1, "Checked"); 33 | GpaInfo = new GPAInfo(); 34 | label4.DataBindings.Add("Visible", this, "IsNormal"); 35 | textBox2.DataBindings.Add("Visible", this, "IsNormal"); 36 | checkBox2.DataBindings.Add("Visible", this, "IsNormal"); 37 | textBox1.Text = XMLConfig.urpUsername; 38 | textBox2.Text = XMLConfig.urpPassword; 39 | checkBox1.Checked = XMLConfig.useAutoRefresh; 40 | numericUpDown1.Value = XMLConfig.autoRefreshInterval; 41 | IsNormal = !XMLConfig.isAdmin; 42 | listView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize); 43 | listView1.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.HeaderSize); 44 | } 45 | 46 | private void button1_Click(object sender, EventArgs e) 47 | { 48 | if (String.IsNullOrEmpty(textBox1.Text) || (IsNormal && String.IsNullOrEmpty(textBox2.Text))) 49 | { 50 | MessageBox.Show("学号和密码不能为空!", "检查输入" + IsNormal); 51 | return; 52 | } 53 | else 54 | { 55 | button1.Visible = false; 56 | panel1.Visible = true; 57 | thread = new Thread(refresh); 58 | thread.Start((Object)new String[] { textBox1.Text, textBox2.Text }); 59 | } 60 | } 61 | 62 | private void filterSemester(ArrayList semester) 63 | { 64 | bool noFilter = false; 65 | if (semester.Count == 0) 66 | { 67 | noFilter = true; 68 | } 69 | listView1.Items.Clear(); 70 | majorFailCredits = majorCreditsMultiScore = majorCreditsDouble = 0; 71 | majorGPA.Text = "0.00"; 72 | majorCredits.Text = "0"; 73 | foreach (Lesson l in lessonBak) 74 | { 75 | bool isNeed = (semester.BinarySearch(l.Semester) >= 0) ? true : false; 76 | isNeed |= noFilter; 77 | if (isNeed) 78 | { 79 | listView1.Items.Add(new ListViewItem(new String[] { "否", l.Id + "", l.Semester, l.DetailCode, l.Name, l.Credit + "", l.ScoreString })); 80 | } 81 | } 82 | } 83 | 84 | private void listView1_ColumnClick(object sender, System.Windows.Forms.ColumnClickEventArgs e) 85 | { 86 | listView1.ListViewItemSorter = new ListViewItemComparer(e.Column, listView1.Columns[e.Column]); 87 | } 88 | 89 | delegate void SetViewCallBack(); 90 | public void enableView() 91 | { 92 | if (this.InvokeRequired) 93 | { 94 | SetViewCallBack cb = new SetViewCallBack(enableView); 95 | this.Invoke(cb); 96 | } 97 | else 98 | { 99 | listView1.Enabled = button1.Visible = button1.Enabled = true; 100 | panel1.Visible = false; 101 | } 102 | } 103 | 104 | private void listView1_ItemCheck(object sender, ItemCheckEventArgs e) 105 | { 106 | int step = (e.NewValue == CheckState.Checked) ? 1 : -1; 107 | listView1.Items[e.Index].SubItems[0].Text = (e.NewValue == CheckState.Checked) ? "是" : "否"; 108 | listView1.Items[e.Index].BackColor = (e.NewValue == CheckState.Checked) ? Color.YellowGreen : Color.White; 109 | Lesson l = (Lesson)lessonsTable[listView1.Items[e.Index].SubItems[1].Text]; 110 | if (!l.IsStar) 111 | { 112 | majorCreditsDouble += step * l.Credit; 113 | majorCreditsMultiScore += step * l.Credit * l.Score; 114 | if (l.Score == 0) 115 | { 116 | majorFailCredits += step * l.Credit; 117 | } 118 | } 119 | majorCredits.Text = (majorCreditsDouble - majorFailCredits).ToString("#0.0"); 120 | majorGPA.Text = (majorCreditsDouble == 0) ? "0.00" : (majorCreditsMultiScore / majorCreditsDouble).ToString("#0.00"); 121 | } 122 | 123 | public void disableView() 124 | { 125 | if (this.InvokeRequired) 126 | { 127 | SetViewCallBack cb = new SetViewCallBack(disableView); 128 | this.Invoke(cb); 129 | } 130 | else 131 | { 132 | majorFailCredits = majorCreditsMultiScore = majorCreditsDouble = 0; 133 | majorCredits.Text = "0.0"; 134 | majorGPA.Text = "0.00"; 135 | comboBox1.Items.Clear(); 136 | listBox1.Items.Clear(); 137 | listView1.Items.Clear(); 138 | listView1.Enabled = button1.Visible = groupBox4.Enabled = groupBox3.Enabled = groupBox2.Enabled = groupBox1.Enabled = false; 139 | panel1.Visible = true; 140 | } 141 | } 142 | 143 | private void refresh(Object o) 144 | { 145 | disableView(); 146 | Object[] login = (Object[])o; 147 | bool showMsg = (login.Length == 3) ? (bool)login[2] : true; 148 | String html = null; 149 | WebProxy proxy = XMLConfig.GetProxy(); 150 | try 151 | { 152 | html = ScoreHTMLUtil.TryGetHTMLString((String)login[0], (String)login[1], "9999", proxy, IsNormal); 153 | if (string.IsNullOrEmpty(html)) 154 | { 155 | throwError("无法抓取成绩信息,可能是服务器正忙或者是网络连接出错。", "网络错误", showMsg); 156 | } 157 | if (html.Contains("Course.jsp")) 158 | { 159 | throwError("由于使用错误密码请求多次,请求被URP拒绝。\n请用浏览器重新登录URP输入正确的验证码后再使用本工具", "URP登录错误", showMsg); 160 | } 161 | else if (html.Contains("复旦大学统一身份认证服务")) 162 | { 163 | throwError("学号密码不正确", "URP登录错误", showMsg); 164 | } 165 | List lessons = ParseHTML.TryParseHTML(html, GpaInfo, IsNormal); 166 | if (lessons == null) 167 | { 168 | throwError("抓取的网页无法解析", "解析数据错误", showMsg); 169 | } 170 | refreshListView(lessons); 171 | } 172 | catch (Exception e) 173 | { 174 | MessageBox.Show(e.Message, e.HelpLink); 175 | } 176 | enableView(); 177 | } 178 | 179 | private void throwError(String msg, String title, bool showMsg) 180 | { 181 | if (showMsg) 182 | { 183 | Exception e = new Exception(msg); 184 | e.HelpLink = title; 185 | throw e; 186 | } 187 | } 188 | 189 | delegate void SetListViewCallBack(List list); 190 | public void refreshListView(List list) 191 | { 192 | if (this.InvokeRequired) 193 | { 194 | SetListViewCallBack cb = new SetListViewCallBack(refreshListView); 195 | this.Invoke(cb, new object[] { list }); 196 | } 197 | else 198 | { 199 | lessonsTable.Clear(); 200 | listView1.Items.Clear(); 201 | listBox1.Items.Clear(); 202 | lessonBak = list; 203 | Hashtable hash = new Hashtable(); 204 | Hashtable codeHash = new Hashtable(); 205 | foreach (Lesson l in list) 206 | { 207 | listView1.Items.Add(new ListViewItem(new String[] { "否", l.Id.ToString() , l.Semester, l.DetailCode, l.Name, l.Credit.ToString(), l.ScoreString })); 208 | if (!hash.ContainsKey(l.Semester)) 209 | { 210 | hash.Add(l.Semester, null); 211 | } 212 | if (!lessonsTable.ContainsKey(l.Id + "")) 213 | { 214 | lessonsTable.Add(l.Id + "", l); 215 | } 216 | String temp = null; 217 | if ((temp = getEnglishCode(l.Code)) != null) 218 | { 219 | if (!codeHash.Contains(temp)) 220 | { 221 | codeHash.Add(temp, 1); 222 | } 223 | else 224 | { 225 | codeHash[temp] = (int)codeHash[temp] + 1; 226 | } 227 | } 228 | } 229 | listView1.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize); 230 | listView1.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.HeaderSize); 231 | listView1.AutoResizeColumn(2, ColumnHeaderAutoResizeStyle.ColumnContent); 232 | listView1.AutoResizeColumn(3, ColumnHeaderAutoResizeStyle.ColumnContent); 233 | listView1.AutoResizeColumn(4, ColumnHeaderAutoResizeStyle.ColumnContent); 234 | listView1.AutoResizeColumn(5, ColumnHeaderAutoResizeStyle.HeaderSize); 235 | listView1.AutoResizeColumn(6, ColumnHeaderAutoResizeStyle.HeaderSize); 236 | ArrayList semestersList = new ArrayList(hash.Keys); 237 | semestersList.Sort(); 238 | listBox1.Items.AddRange(semestersList.ToArray()); 239 | List codeList = new List(); 240 | IDictionaryEnumerator e = codeHash.GetEnumerator(); 241 | int maxCount = 0; 242 | String maxCountCode = ""; 243 | while (e.MoveNext()) 244 | { 245 | codeList.Add((String)e.Key); 246 | if (maxCount <= (int)e.Value) 247 | { 248 | maxCountCode = (String)e.Key; 249 | maxCount = (int)e.Value; 250 | } 251 | } 252 | codeList.Sort(); 253 | comboBox1.Items.AddRange(codeList.ToArray()); 254 | if (!string.IsNullOrEmpty(maxCountCode)) 255 | { 256 | comboBox1.Text = maxCountCode; 257 | } 258 | label10.Text = GpaInfo.Name; 259 | label11.Text = GpaInfo.Major; 260 | label12.Text = GpaInfo.Gpa; 261 | label13.Text = GpaInfo.TotalCredit; 262 | groupBox4.Enabled = groupBox3.Enabled = groupBox2.Enabled = groupBox1.Enabled = listView1.Enabled = true; 263 | } 264 | } 265 | 266 | private String getEnglishCode(String code) 267 | { 268 | String buf = ""; 269 | for (int i = 0; i < code.Length; i++) 270 | { 271 | if (char.IsLetter(code, i)) 272 | { 273 | buf += code[i]; 274 | } 275 | } 276 | return string.IsNullOrEmpty(buf) ? null : buf; 277 | } 278 | 279 | private void button3_Click(object sender, EventArgs e) 280 | { 281 | saveSettings(); 282 | } 283 | 284 | private void saveSettings() 285 | { 286 | XMLConfig.urpPassword = checkBox2.Checked ? RC2Util.Encrypt("hackerzhou", textBox2.Text) : ""; 287 | XMLConfig.urpUsername = textBox1.Text; 288 | XMLConfig.isSavePassword = checkBox2.Checked; 289 | XMLConfig.useAutoRefresh = checkBox1.Checked; 290 | XMLConfig.autoRefreshInterval = (int)numericUpDown1.Value; 291 | XMLConfig.WriteConfig(); 292 | } 293 | 294 | private void button10_Click(object sender, EventArgs e) 295 | { 296 | textBox1.Text = textBox2.Text = ""; 297 | checkBox1.Checked = false; 298 | checkBox2.Checked = true; 299 | numericUpDown1.Value = 30; 300 | saveSettings(); 301 | } 302 | 303 | public void StopAllThreads() 304 | { 305 | try 306 | { 307 | if (thread != null && thread.ThreadState != ThreadState.Stopped) 308 | { 309 | thread.Interrupt(); 310 | } 311 | } 312 | catch 313 | { 314 | } 315 | } 316 | 317 | private void button2_Click(object sender, EventArgs e) 318 | { 319 | ListBox.SelectedObjectCollection c = listBox1.SelectedItems; 320 | ArrayList para = new ArrayList(c); 321 | filterSemester(para); 322 | } 323 | 324 | private void button6_Click(object sender, EventArgs e) 325 | { 326 | if (!string.IsNullOrEmpty(comboBox1.Text)) 327 | { 328 | foreach (ListViewItem item in listView1.Items) 329 | { 330 | if (item.SubItems[3].Text.StartsWith(comboBox1.Text)) 331 | { 332 | item.Checked = true; 333 | } 334 | } 335 | } 336 | } 337 | 338 | private void button4_Click(object sender, EventArgs e) 339 | { 340 | foreach (ListViewItem item in listView1.Items) 341 | { 342 | item.Checked = true; 343 | } 344 | } 345 | 346 | private void button5_Click(object sender, EventArgs e) 347 | { 348 | foreach (ListViewItem item in listView1.Items) 349 | { 350 | item.Checked = false; 351 | } 352 | } 353 | 354 | private void timer1_Tick(object sender, EventArgs e) 355 | { 356 | if (!String.IsNullOrEmpty(textBox1.Text) && !String.IsNullOrEmpty(textBox2.Text)) 357 | { 358 | button1.Visible = false; 359 | panel1.Visible = true; 360 | thread = new Thread(refresh); 361 | thread.Start((Object)new Object[] { textBox1.Text, textBox2.Text, true}); 362 | } 363 | } 364 | 365 | private void checkBox1_CheckedChanged(object sender, EventArgs e) 366 | { 367 | timer1.Stop(); 368 | if(checkBox1.Checked){ 369 | timer1.Interval = (int)numericUpDown1.Value * 60000; 370 | timer1.Start(); 371 | } 372 | } 373 | 374 | private void numericUpDown1_ValueChanged(object sender, EventArgs e) 375 | { 376 | timer1.Stop(); 377 | timer1.Interval = (int)numericUpDown1.Value * 60000; 378 | timer1.Start(); 379 | } 380 | 381 | private void toolStripMenuItem1_Click(object sender, EventArgs e) 382 | { 383 | ListViewStripMenuHelper.CopyAllItemsToClipBoard(listView1, 1); 384 | } 385 | 386 | private void toolStripMenuItem2_Click(object sender, EventArgs e) 387 | { 388 | ListViewStripMenuHelper.CopySelectedItemsToClipBoard(listView1, 1); 389 | } 390 | 391 | private void toolStripMenuItem3_Click(object sender, EventArgs e) 392 | { 393 | ListViewStripMenuHelper.CopySelectedItemColumnToClipBoard(listView1, 3); 394 | } 395 | } 396 | } 397 | -------------------------------------------------------------------------------- /ScoreListView.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 107, 17 122 | 123 | 124 | 125 | 126 | R0lGODlhQgBCAPMAAP///wAAAExMTHp6etzc3KCgoPj4+BwcHMLCwgAAAAAAAAAAAAAAAAAAAAAAAAAA 127 | ACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwA 128 | AAAAQgBCAAAE/xDISau9VBzMu/8VcRTWsVXFYYBsS4knZZYH4d6gYdpyLMErnBAwGFg0pF5lcBBYCMEh 129 | R3dAoJqVWWZUMRB4Uk5KEAUAlRMqGOCFhjsGjbFnnWgliLukXX5b8jUUTEkSWBNMc3tffVIEA4xyFAgC 130 | dRiTlWxfFl6MH0xkITthfF1fayxxTaeDo5oUbW44qaBpCJ0tBrmvprc5GgKnfqWLb7O9xQQIscUamMJp 131 | xC4pBYxezxi6w8ESKU3O1y5eyts/Gqrg4c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aLGpEiRwEx5N5m1J83OTK92v1+Q1ry6vwAIpgLg3dS6yhPbA+nmdqJBHwaZ3OYchtA3BNP2GJf9 234 | AD0YCggMlwRTAwqUIygJXwE6BUzBEDCgGsMtoh4+NFOAXpWLHP8y1oh3YZ9FkGlIolzJsqXLlzgkwpgI 235 | cwKCAjhzPhSApCcMVTBvCtV4sqbRo0iTshFak1WHfQN6WgmaM5+EiFWqUFxIMJROnDN4UuSX1E5OMVyP 236 | GlSKaF+7bqHenogqoKi9fQ/lponIk+zFUAkVthPHc9FLwGA58K17FO9DDBH9PguoMuXjFgSi2u2SWTKv 237 | wnpx0MIZ2h/ogLQSlq5QauuW1axJpvac4/QUAW+GKGo2G3ZEwxl4ws5QZE3qzSU9R80NIHO5fUsUMX82 238 | /II4drcjFXGR8EdxgPMYoyKHCmhmoM1V9/s9iyIait6x1+mIXEjrNeKmw59SMUSR6l5UE1EjM9txN104 239 | 9RUUlR771fFfUw1OEJUF38E0TzURJkLbUR31EwEAOwAAAAAAAAAAAA== 240 | 241 | 242 | 243 | 17, 17 244 | 245 | 246 | 52 247 | 248 | -------------------------------------------------------------------------------- /System.Data.SQLite.DLL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerzhou/GPATool/21f7dc643f64b2d32ebaf77cc0dcd1c6536a8053/System.Data.SQLite.DLL -------------------------------------------------------------------------------- /UserConfigView.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace GPATool 2 | { 3 | partial class UserConfigView 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region 组件设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("正在获取RSS Feed ..."); 32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(UserConfigView)); 33 | this.groupBox5 = new System.Windows.Forms.GroupBox(); 34 | this.panel2 = new System.Windows.Forms.Panel(); 35 | this.panel3 = new System.Windows.Forms.Panel(); 36 | this.label17 = new System.Windows.Forms.Label(); 37 | this.textBox6 = new System.Windows.Forms.TextBox(); 38 | this.textBox5 = new System.Windows.Forms.TextBox(); 39 | this.label16 = new System.Windows.Forms.Label(); 40 | this.label14 = new System.Windows.Forms.Label(); 41 | this.textBox3 = new System.Windows.Forms.TextBox(); 42 | this.label15 = new System.Windows.Forms.Label(); 43 | this.textBox4 = new System.Windows.Forms.TextBox(); 44 | this.checkBox4 = new System.Windows.Forms.CheckBox(); 45 | this.button8 = new System.Windows.Forms.Button(); 46 | this.checkBox3 = new System.Windows.Forms.CheckBox(); 47 | this.groupBox8 = new System.Windows.Forms.GroupBox(); 48 | this.linkLabel6 = new System.Windows.Forms.LinkLabel(); 49 | this.label1 = new System.Windows.Forms.Label(); 50 | this.listView2 = new System.Windows.Forms.ListView(); 51 | this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 52 | this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); 53 | this.label11 = new System.Windows.Forms.Label(); 54 | this.linkLabel5 = new System.Windows.Forms.LinkLabel(); 55 | this.pictureBox2 = new System.Windows.Forms.PictureBox(); 56 | this.label23 = new System.Windows.Forms.Label(); 57 | this.label24 = new System.Windows.Forms.Label(); 58 | this.label20 = new System.Windows.Forms.Label(); 59 | this.linkLabel4 = new System.Windows.Forms.LinkLabel(); 60 | this.linkLabel1 = new System.Windows.Forms.LinkLabel(); 61 | this.label21 = new System.Windows.Forms.Label(); 62 | this.linkLabel3 = new System.Windows.Forms.LinkLabel(); 63 | this.linkLabel2 = new System.Windows.Forms.LinkLabel(); 64 | this.label22 = new System.Windows.Forms.Label(); 65 | this.groupBox6 = new System.Windows.Forms.GroupBox(); 66 | this.comboBox2 = new System.Windows.Forms.ComboBox(); 67 | this.label5 = new System.Windows.Forms.Label(); 68 | this.button7 = new System.Windows.Forms.Button(); 69 | this.groupBox5.SuspendLayout(); 70 | this.panel2.SuspendLayout(); 71 | this.panel3.SuspendLayout(); 72 | this.groupBox8.SuspendLayout(); 73 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); 74 | this.groupBox6.SuspendLayout(); 75 | this.SuspendLayout(); 76 | // 77 | // groupBox5 78 | // 79 | this.groupBox5.BackColor = System.Drawing.Color.Transparent; 80 | this.groupBox5.Controls.Add(this.panel2); 81 | this.groupBox5.Controls.Add(this.button8); 82 | this.groupBox5.Controls.Add(this.checkBox3); 83 | this.groupBox5.Location = new System.Drawing.Point(10, 7); 84 | this.groupBox5.Name = "groupBox5"; 85 | this.groupBox5.Size = new System.Drawing.Size(631, 172); 86 | this.groupBox5.TabIndex = 35; 87 | this.groupBox5.TabStop = false; 88 | this.groupBox5.Text = "代理配置"; 89 | // 90 | // panel2 91 | // 92 | this.panel2.Controls.Add(this.panel3); 93 | this.panel2.Controls.Add(this.label14); 94 | this.panel2.Controls.Add(this.textBox3); 95 | this.panel2.Controls.Add(this.label15); 96 | this.panel2.Controls.Add(this.textBox4); 97 | this.panel2.Controls.Add(this.checkBox4); 98 | this.panel2.Enabled = false; 99 | this.panel2.Location = new System.Drawing.Point(54, 34); 100 | this.panel2.Name = "panel2"; 101 | this.panel2.Size = new System.Drawing.Size(264, 140); 102 | this.panel2.TabIndex = 35; 103 | // 104 | // panel3 105 | // 106 | this.panel3.Controls.Add(this.label17); 107 | this.panel3.Controls.Add(this.textBox6); 108 | this.panel3.Controls.Add(this.textBox5); 109 | this.panel3.Controls.Add(this.label16); 110 | this.panel3.Enabled = false; 111 | this.panel3.Location = new System.Drawing.Point(37, 73); 112 | this.panel3.Name = "panel3"; 113 | this.panel3.Size = new System.Drawing.Size(181, 65); 114 | this.panel3.TabIndex = 36; 115 | // 116 | // label17 117 | // 118 | this.label17.AutoSize = true; 119 | this.label17.Location = new System.Drawing.Point(10, 11); 120 | this.label17.Name = "label17"; 121 | this.label17.Size = new System.Drawing.Size(53, 12); 122 | this.label17.TabIndex = 6; 123 | this.label17.Text = "用户名:"; 124 | // 125 | // textBox6 126 | // 127 | this.textBox6.Location = new System.Drawing.Point(72, 8); 128 | this.textBox6.Name = "textBox6"; 129 | this.textBox6.Size = new System.Drawing.Size(97, 21); 130 | this.textBox6.TabIndex = 7; 131 | // 132 | // textBox5 133 | // 134 | this.textBox5.Location = new System.Drawing.Point(72, 35); 135 | this.textBox5.Name = "textBox5"; 136 | this.textBox5.PasswordChar = '*'; 137 | this.textBox5.Size = new System.Drawing.Size(97, 21); 138 | this.textBox5.TabIndex = 9; 139 | // 140 | // label16 141 | // 142 | this.label16.AutoSize = true; 143 | this.label16.Location = new System.Drawing.Point(10, 35); 144 | this.label16.Name = "label16"; 145 | this.label16.Size = new System.Drawing.Size(41, 12); 146 | this.label16.TabIndex = 8; 147 | this.label16.Text = "密码:"; 148 | // 149 | // label14 150 | // 151 | this.label14.AutoSize = true; 152 | this.label14.Location = new System.Drawing.Point(5, 11); 153 | this.label14.Name = "label14"; 154 | this.label14.Size = new System.Drawing.Size(89, 12); 155 | this.label14.TabIndex = 1; 156 | this.label14.Text = "主机或IP地址:"; 157 | // 158 | // textBox3 159 | // 160 | this.textBox3.Location = new System.Drawing.Point(100, 8); 161 | this.textBox3.Name = "textBox3"; 162 | this.textBox3.Size = new System.Drawing.Size(153, 21); 163 | this.textBox3.TabIndex = 2; 164 | // 165 | // label15 166 | // 167 | this.label15.AutoSize = true; 168 | this.label15.Location = new System.Drawing.Point(5, 35); 169 | this.label15.Name = "label15"; 170 | this.label15.Size = new System.Drawing.Size(41, 12); 171 | this.label15.TabIndex = 3; 172 | this.label15.Text = "端口:"; 173 | // 174 | // textBox4 175 | // 176 | this.textBox4.Location = new System.Drawing.Point(100, 32); 177 | this.textBox4.Name = "textBox4"; 178 | this.textBox4.Size = new System.Drawing.Size(153, 21); 179 | this.textBox4.TabIndex = 4; 180 | // 181 | // checkBox4 182 | // 183 | this.checkBox4.AutoSize = true; 184 | this.checkBox4.Location = new System.Drawing.Point(7, 59); 185 | this.checkBox4.Name = "checkBox4"; 186 | this.checkBox4.Size = new System.Drawing.Size(72, 16); 187 | this.checkBox4.TabIndex = 5; 188 | this.checkBox4.Text = "需要验证"; 189 | this.checkBox4.UseVisualStyleBackColor = true; 190 | // 191 | // button8 192 | // 193 | this.button8.Location = new System.Drawing.Point(540, 136); 194 | this.button8.Name = "button8"; 195 | this.button8.Size = new System.Drawing.Size(75, 23); 196 | this.button8.TabIndex = 34; 197 | this.button8.Text = "保存"; 198 | this.button8.UseVisualStyleBackColor = true; 199 | this.button8.Click += new System.EventHandler(this.button8_Click); 200 | // 201 | // checkBox3 202 | // 203 | this.checkBox3.AutoSize = true; 204 | this.checkBox3.Location = new System.Drawing.Point(20, 20); 205 | this.checkBox3.Name = "checkBox3"; 206 | this.checkBox3.Size = new System.Drawing.Size(96, 16); 207 | this.checkBox3.TabIndex = 0; 208 | this.checkBox3.Text = "使用HTTP代理"; 209 | this.checkBox3.UseVisualStyleBackColor = true; 210 | // 211 | // groupBox8 212 | // 213 | this.groupBox8.BackColor = System.Drawing.Color.Transparent; 214 | this.groupBox8.Controls.Add(this.linkLabel6); 215 | this.groupBox8.Controls.Add(this.label1); 216 | this.groupBox8.Controls.Add(this.listView2); 217 | this.groupBox8.Controls.Add(this.label11); 218 | this.groupBox8.Controls.Add(this.linkLabel5); 219 | this.groupBox8.Controls.Add(this.pictureBox2); 220 | this.groupBox8.Controls.Add(this.label23); 221 | this.groupBox8.Controls.Add(this.label24); 222 | this.groupBox8.Controls.Add(this.label20); 223 | this.groupBox8.Controls.Add(this.linkLabel4); 224 | this.groupBox8.Controls.Add(this.linkLabel1); 225 | this.groupBox8.Controls.Add(this.label21); 226 | this.groupBox8.Controls.Add(this.linkLabel3); 227 | this.groupBox8.Controls.Add(this.linkLabel2); 228 | this.groupBox8.Controls.Add(this.label22); 229 | this.groupBox8.Location = new System.Drawing.Point(10, 253); 230 | this.groupBox8.Name = "groupBox8"; 231 | this.groupBox8.Size = new System.Drawing.Size(632, 295); 232 | this.groupBox8.TabIndex = 39; 233 | this.groupBox8.TabStop = false; 234 | this.groupBox8.Text = "作者信息"; 235 | // 236 | // linkLabel6 237 | // 238 | this.linkLabel6.AutoSize = true; 239 | this.linkLabel6.Location = new System.Drawing.Point(234, 70); 240 | this.linkLabel6.Name = "linkLabel6"; 241 | this.linkLabel6.Size = new System.Drawing.Size(71, 12); 242 | this.linkLabel6.TabIndex = 27; 243 | this.linkLabel6.TabStop = true; 244 | this.linkLabel6.Text = "@hackerzhou"; 245 | this.linkLabel6.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel6_LinkClicked); 246 | // 247 | // label1 248 | // 249 | this.label1.AutoSize = true; 250 | this.label1.Location = new System.Drawing.Point(183, 69); 251 | this.label1.Name = "label1"; 252 | this.label1.Size = new System.Drawing.Size(41, 12); 253 | this.label1.TabIndex = 26; 254 | this.label1.Text = "WeiBo:"; 255 | // 256 | // listView2 257 | // 258 | this.listView2.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 259 | this.columnHeader3, 260 | this.columnHeader4}); 261 | this.listView2.FullRowSelect = true; 262 | this.listView2.GridLines = true; 263 | this.listView2.Items.AddRange(new System.Windows.Forms.ListViewItem[] { 264 | listViewItem1}); 265 | this.listView2.Location = new System.Drawing.Point(236, 125); 266 | this.listView2.MultiSelect = false; 267 | this.listView2.Name = "listView2"; 268 | this.listView2.Size = new System.Drawing.Size(379, 155); 269 | this.listView2.TabIndex = 25; 270 | this.listView2.UseCompatibleStateImageBehavior = false; 271 | this.listView2.View = System.Windows.Forms.View.Details; 272 | this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged); 273 | // 274 | // columnHeader3 275 | // 276 | this.columnHeader3.Text = "名称"; 277 | this.columnHeader3.Width = 270; 278 | // 279 | // columnHeader4 280 | // 281 | this.columnHeader4.Text = "更新日期"; 282 | this.columnHeader4.Width = 80; 283 | // 284 | // label11 285 | // 286 | this.label11.AutoSize = true; 287 | this.label11.Location = new System.Drawing.Point(142, 123); 288 | this.label11.Name = "label11"; 289 | this.label11.Size = new System.Drawing.Size(83, 12); 290 | this.label11.TabIndex = 24; 291 | this.label11.Text = "Blog Updates:"; 292 | // 293 | // linkLabel5 294 | // 295 | this.linkLabel5.AutoSize = true; 296 | this.linkLabel5.Location = new System.Drawing.Point(234, 104); 297 | this.linkLabel5.Name = "linkLabel5"; 298 | this.linkLabel5.Size = new System.Drawing.Size(179, 12); 299 | this.linkLabel5.TabIndex = 10; 300 | this.linkLabel5.TabStop = true; 301 | this.linkLabel5.Text = "code.google.com/p/hackerzhou/"; 302 | this.linkLabel5.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel5_LinkClicked); 303 | // 304 | // pictureBox2 305 | // 306 | this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); 307 | this.pictureBox2.Location = new System.Drawing.Point(10, 17); 308 | this.pictureBox2.Name = "pictureBox2"; 309 | this.pictureBox2.Size = new System.Drawing.Size(121, 118); 310 | this.pictureBox2.TabIndex = 0; 311 | this.pictureBox2.TabStop = false; 312 | // 313 | // label23 314 | // 315 | this.label23.AutoSize = true; 316 | this.label23.Location = new System.Drawing.Point(179, 17); 317 | this.label23.Name = "label23"; 318 | this.label23.Size = new System.Drawing.Size(47, 12); 319 | this.label23.TabIndex = 7; 320 | this.label23.Text = "BBS ID:"; 321 | // 322 | // label24 323 | // 324 | this.label24.AutoSize = true; 325 | this.label24.Location = new System.Drawing.Point(148, 104); 326 | this.label24.Name = "label24"; 327 | this.label24.Size = new System.Drawing.Size(77, 12); 328 | this.label24.TabIndex = 9; 329 | this.label24.Text = "Google Code:"; 330 | // 331 | // label20 332 | // 333 | this.label20.AutoSize = true; 334 | this.label20.Location = new System.Drawing.Point(184, 34); 335 | this.label20.Name = "label20"; 336 | this.label20.Size = new System.Drawing.Size(41, 12); 337 | this.label20.TabIndex = 1; 338 | this.label20.Text = "Email:"; 339 | // 340 | // linkLabel4 341 | // 342 | this.linkLabel4.AutoSize = true; 343 | this.linkLabel4.Location = new System.Drawing.Point(233, 17); 344 | this.linkLabel4.Name = "linkLabel4"; 345 | this.linkLabel4.Size = new System.Drawing.Size(65, 12); 346 | this.linkLabel4.TabIndex = 8; 347 | this.linkLabel4.TabStop = true; 348 | this.linkLabel4.Text = "hackerzhou"; 349 | this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked); 350 | // 351 | // linkLabel1 352 | // 353 | this.linkLabel1.AutoSize = true; 354 | this.linkLabel1.Location = new System.Drawing.Point(233, 34); 355 | this.linkLabel1.Name = "linkLabel1"; 356 | this.linkLabel1.Size = new System.Drawing.Size(149, 12); 357 | this.linkLabel1.TabIndex = 2; 358 | this.linkLabel1.TabStop = true; 359 | this.linkLabel1.Text = "hackerzhou@hackerzhou.me"; 360 | this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); 361 | // 362 | // label21 363 | // 364 | this.label21.AutoSize = true; 365 | this.label21.Location = new System.Drawing.Point(190, 51); 366 | this.label21.Name = "label21"; 367 | this.label21.Size = new System.Drawing.Size(35, 12); 368 | this.label21.TabIndex = 3; 369 | this.label21.Text = "Blog:"; 370 | // 371 | // linkLabel3 372 | // 373 | this.linkLabel3.AutoSize = true; 374 | this.linkLabel3.Location = new System.Drawing.Point(234, 88); 375 | this.linkLabel3.Name = "linkLabel3"; 376 | this.linkLabel3.Size = new System.Drawing.Size(71, 12); 377 | this.linkLabel3.TabIndex = 6; 378 | this.linkLabel3.TabStop = true; 379 | this.linkLabel3.Text = "@hackerzhou"; 380 | this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); 381 | // 382 | // linkLabel2 383 | // 384 | this.linkLabel2.AutoSize = true; 385 | this.linkLabel2.Location = new System.Drawing.Point(233, 51); 386 | this.linkLabel2.Name = "linkLabel2"; 387 | this.linkLabel2.Size = new System.Drawing.Size(83, 12); 388 | this.linkLabel2.TabIndex = 4; 389 | this.linkLabel2.TabStop = true; 390 | this.linkLabel2.Text = "hackerzhou.me"; 391 | this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked); 392 | // 393 | // label22 394 | // 395 | this.label22.AutoSize = true; 396 | this.label22.Location = new System.Drawing.Point(172, 87); 397 | this.label22.Name = "label22"; 398 | this.label22.Size = new System.Drawing.Size(53, 12); 399 | this.label22.TabIndex = 5; 400 | this.label22.Text = "Twitter:"; 401 | // 402 | // groupBox6 403 | // 404 | this.groupBox6.BackColor = System.Drawing.Color.Transparent; 405 | this.groupBox6.Controls.Add(this.comboBox2); 406 | this.groupBox6.Controls.Add(this.label5); 407 | this.groupBox6.Controls.Add(this.button7); 408 | this.groupBox6.Location = new System.Drawing.Point(10, 187); 409 | this.groupBox6.Name = "groupBox6"; 410 | this.groupBox6.Size = new System.Drawing.Size(631, 60); 411 | this.groupBox6.TabIndex = 38; 412 | this.groupBox6.TabStop = false; 413 | this.groupBox6.Text = "风格配置"; 414 | // 415 | // comboBox2 416 | // 417 | this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 418 | this.comboBox2.FormattingEnabled = true; 419 | this.comboBox2.Items.AddRange(new object[] { 420 | "Office2007Black", 421 | "Office2007Blue", 422 | "Office2007Silver", 423 | "Office2007VistaGlass", 424 | "Office2010Silver", 425 | "Windows7Blue"}); 426 | this.comboBox2.Location = new System.Drawing.Point(109, 23); 427 | this.comboBox2.Name = "comboBox2"; 428 | this.comboBox2.Size = new System.Drawing.Size(170, 20); 429 | this.comboBox2.TabIndex = 36; 430 | this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); 431 | // 432 | // label5 433 | // 434 | this.label5.AutoSize = true; 435 | this.label5.Location = new System.Drawing.Point(18, 26); 436 | this.label5.Name = "label5"; 437 | this.label5.Size = new System.Drawing.Size(77, 12); 438 | this.label5.TabIndex = 35; 439 | this.label5.Text = "自定义风格:"; 440 | // 441 | // button7 442 | // 443 | this.button7.Location = new System.Drawing.Point(540, 21); 444 | this.button7.Name = "button7"; 445 | this.button7.Size = new System.Drawing.Size(75, 23); 446 | this.button7.TabIndex = 34; 447 | this.button7.Text = "保存"; 448 | this.button7.UseVisualStyleBackColor = true; 449 | this.button7.Click += new System.EventHandler(this.button7_Click); 450 | // 451 | // UserConfigView 452 | // 453 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 454 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 455 | this.BackColor = System.Drawing.Color.Transparent; 456 | this.Controls.Add(this.groupBox8); 457 | this.Controls.Add(this.groupBox6); 458 | this.Controls.Add(this.groupBox5); 459 | this.ForeColor = System.Drawing.SystemColors.ControlText; 460 | this.Name = "UserConfigView"; 461 | this.Size = new System.Drawing.Size(649, 556); 462 | this.Load += new System.EventHandler(this.UserConfigView_Load); 463 | this.groupBox5.ResumeLayout(false); 464 | this.groupBox5.PerformLayout(); 465 | this.panel2.ResumeLayout(false); 466 | this.panel2.PerformLayout(); 467 | this.panel3.ResumeLayout(false); 468 | this.panel3.PerformLayout(); 469 | this.groupBox8.ResumeLayout(false); 470 | this.groupBox8.PerformLayout(); 471 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); 472 | this.groupBox6.ResumeLayout(false); 473 | this.groupBox6.PerformLayout(); 474 | this.ResumeLayout(false); 475 | 476 | } 477 | 478 | #endregion 479 | 480 | private System.Windows.Forms.GroupBox groupBox5; 481 | private System.Windows.Forms.Panel panel2; 482 | private System.Windows.Forms.Panel panel3; 483 | private System.Windows.Forms.Label label17; 484 | private System.Windows.Forms.TextBox textBox6; 485 | private System.Windows.Forms.TextBox textBox5; 486 | private System.Windows.Forms.Label label16; 487 | private System.Windows.Forms.Label label14; 488 | private System.Windows.Forms.TextBox textBox3; 489 | private System.Windows.Forms.Label label15; 490 | private System.Windows.Forms.TextBox textBox4; 491 | private System.Windows.Forms.CheckBox checkBox4; 492 | private System.Windows.Forms.Button button8; 493 | private System.Windows.Forms.CheckBox checkBox3; 494 | private System.Windows.Forms.GroupBox groupBox8; 495 | private System.Windows.Forms.LinkLabel linkLabel5; 496 | private System.Windows.Forms.PictureBox pictureBox2; 497 | private System.Windows.Forms.Label label23; 498 | private System.Windows.Forms.Label label24; 499 | private System.Windows.Forms.Label label20; 500 | private System.Windows.Forms.LinkLabel linkLabel4; 501 | private System.Windows.Forms.LinkLabel linkLabel1; 502 | private System.Windows.Forms.Label label21; 503 | private System.Windows.Forms.LinkLabel linkLabel3; 504 | private System.Windows.Forms.LinkLabel linkLabel2; 505 | private System.Windows.Forms.Label label22; 506 | private System.Windows.Forms.GroupBox groupBox6; 507 | private System.Windows.Forms.ComboBox comboBox2; 508 | private System.Windows.Forms.Label label5; 509 | private System.Windows.Forms.Button button7; 510 | private System.Windows.Forms.ListView listView2; 511 | private System.Windows.Forms.ColumnHeader columnHeader3; 512 | private System.Windows.Forms.ColumnHeader columnHeader4; 513 | private System.Windows.Forms.Label label11; 514 | private System.Windows.Forms.LinkLabel linkLabel6; 515 | private System.Windows.Forms.Label label1; 516 | } 517 | } 518 | -------------------------------------------------------------------------------- /UserConfigView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Windows.Forms; 5 | using System.ComponentModel; 6 | using DevComponents.DotNetBar; 7 | using GPATool.Util; 8 | 9 | namespace GPATool 10 | { 11 | public partial class UserConfigView : UserControl 12 | { 13 | private Thread fetchRSSThread = null; 14 | private int savedStyleIndex; 15 | 16 | public UserConfigView() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | public void StopAllThreads() 22 | { 23 | try 24 | { 25 | if (fetchRSSThread != null && fetchRSSThread.ThreadState != ThreadState.Stopped) 26 | { 27 | fetchRSSThread.Interrupt(); 28 | } 29 | } 30 | catch 31 | { 32 | } 33 | } 34 | 35 | private void UserConfigView_Load(object sender, EventArgs e) 36 | { 37 | XMLConfig.LoadConfig(); 38 | panel2.DataBindings.Add("Enabled", checkBox3, "Checked"); 39 | panel3.DataBindings.Add("Enabled", checkBox4, "Checked"); 40 | checkBox3.Checked = XMLConfig.useProxy; 41 | checkBox4.Checked = XMLConfig.proxyUseAuth; 42 | textBox3.Text = XMLConfig.proxyHost; 43 | textBox4.Text = XMLConfig.proxyPort.ToString(); 44 | textBox6.Text = XMLConfig.proxyUsername; 45 | textBox5.Text = XMLConfig.proxyPassword; 46 | savedStyleIndex = comboBox2.SelectedIndex = XMLConfig.styleIndex; 47 | fetchRSSThread = new Thread(new ThreadStart(updateRSSHandler)); 48 | fetchRSSThread.Start(); 49 | } 50 | 51 | private delegate void UpdateRSSListViewDelegate(List list); 52 | 53 | private void updateRSSListView(List list) 54 | { 55 | if (this.InvokeRequired) 56 | { 57 | UpdateRSSListViewDelegate cb = new UpdateRSSListViewDelegate(updateRSSListView); 58 | this.Invoke(cb, list); 59 | } 60 | else 61 | { 62 | listView2.Items.Clear(); 63 | foreach (RSSSpider.RSSItem i in list) 64 | { 65 | ListViewItem listItem = new ListViewItem(new String[] { i.Name, i.UpdateDate }); 66 | listItem.Tag = i.Url; 67 | listView2.Items.Add(listItem); 68 | } 69 | } 70 | } 71 | 72 | private void updateRSSHandler() 73 | { 74 | List list = RSSSpider.RSSUtil.GetRSSItemList("http://hackerzhou.me/feed"); 75 | updateRSSListView(list); 76 | } 77 | 78 | private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) 79 | { 80 | if (savedStyleIndex != comboBox2.SelectedIndex) 81 | { 82 | button7_Click(sender, null); 83 | } 84 | } 85 | 86 | private void button8_Click(object sender, EventArgs e) 87 | { 88 | XMLConfig.useProxy = checkBox3.Checked; 89 | XMLConfig.proxyUseAuth = checkBox4.Checked; 90 | XMLConfig.proxyHost = textBox3.Text; 91 | int port = 8080; 92 | int.TryParse(textBox4.Text, out port); 93 | XMLConfig.proxyPort = port; 94 | XMLConfig.proxyUsername = textBox6.Text; 95 | XMLConfig.proxyPassword = textBox5.Text; 96 | XMLConfig.WriteConfig(); 97 | } 98 | 99 | private void button7_Click(object sender, EventArgs e) 100 | { 101 | String style = comboBox2.SelectedItem.ToString(); 102 | Form1 f = Form1.getInstance(); 103 | if (f == null) 104 | { 105 | return; 106 | } 107 | if ("Office2007Black".Equals(style)) 108 | { 109 | f.ChangeStyle(eStyle.Office2007Black); 110 | } 111 | else if ("Office2007Blue".Equals(style)) 112 | { 113 | f.ChangeStyle(eStyle.Office2007Blue); 114 | } 115 | else if ("Office2007Silver".Equals(style)) 116 | { 117 | f.ChangeStyle(eStyle.Office2007Silver); 118 | } 119 | else if ("Office2007VistaGlass".Equals(style)) 120 | { 121 | f.ChangeStyle(eStyle.Office2007VistaGlass); 122 | } 123 | else if ("Office2010Silver".Equals(style)) 124 | { 125 | f.ChangeStyle(eStyle.Office2010Silver); 126 | } 127 | else if ("Windows7Blue".Equals(style)) 128 | { 129 | f.ChangeStyle(eStyle.Windows7Blue); 130 | } 131 | if (e != null) 132 | { 133 | XMLConfig.styleIndex = comboBox2.SelectedIndex; 134 | XMLConfig.WriteConfig(); 135 | } 136 | } 137 | 138 | private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 139 | { 140 | System.Diagnostics.Process.Start("http://bbs.fudan.sh.cn/bbs/qry?u=hackerzhou"); 141 | } 142 | 143 | private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 144 | { 145 | System.Diagnostics.Process.Start("http://hackerzhou.me"); 146 | } 147 | 148 | private void linkLabel5_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 149 | { 150 | System.Diagnostics.Process.Start("http://code.google.com/p/hackerzhou/"); 151 | } 152 | 153 | private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 154 | { 155 | System.Diagnostics.Process.Start("http://twitter.com/hackerzhou"); 156 | } 157 | 158 | private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 159 | { 160 | System.Diagnostics.Process.Start("mailto:hackerzhou@hackerzhou.me"); 161 | } 162 | 163 | private void linkLabel6_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) 164 | { 165 | System.Diagnostics.Process.Start("http://weibo.com/hackerzhou"); 166 | } 167 | 168 | private void listView2_SelectedIndexChanged(object sender, EventArgs e) 169 | { 170 | if (listView2.SelectedItems.Count > 0) 171 | { 172 | System.Diagnostics.Process.Start(listView2.SelectedItems[0].Tag.ToString()); 173 | } 174 | } 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /UserConfigView.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | 123 | /9j/4AAQSkZJRgABAQEAAAAAAAD/2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WB6EHbyKw5vFOtX 187 | kvmTatbWC/3bO23N/wB9OT/Ks3ofVQni5x1SR6BEth4TsmvL+6itYUGTJK2B+Hr9BXJ+LPFN54ytzbIJ 188 | tP0Jh87P8k94P7uOqIfU/MemAK56O8sY7z7TtkvLzORc3kpmdT/s54X8AKsT3/2gEk5Jo3Ip4NqaqVNW 189 | Zs4SJFjiRYoo1CoiDCqo6ADsKzJ2xWlckHNZF0aTPoKa0IzNtaiqMsvzUVnc6OS59lamqx2zM3TFfLOs 190 | ai3xq+IlxYWzBvA2g3Hl3jg5XVL1efKHrFEcbuxbjtRRXp1viUT8ewc5RcpLp+p7BbIEjVVAAAwAKkMO 191 | WB9KKKZ6m6PKJIPE3hXVdR8F+H43istVn+1WepN9zT4HObhR7g52j/ar2LRtNtPD2i2ulWif6JbxeUA/ 192 | Jcdy3qSSSfqaKKUNLobm5S5X6/M0oktl0v7FFbxRWu0r5CIFTB6jA45rx7wTpUmmjxJagobWDUpLeFSS 193 | ZERQAqNn+EKRt/GiireyOzCPl5kvI4fxJFL8Pria5ijeXw1I26WCMZNgx6ug7xnuB06jioZdRW5gjngk 194 | EkMqh0cdGU8g0UV5lTSVj7rD+/TU3uRQX5VxzW1a329RzzRRUpms4pll5Qy1mXneiiqMoGTKMmiiiszr 195 | R//Z 196 | 197 | 198 | -------------------------------------------------------------------------------- /Util/AdminUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Management; 3 | using System.Reflection; 4 | 5 | namespace GPATool.Util 6 | { 7 | public class AdminUtil 8 | { 9 | private static bool hasChecked = false; 10 | private static bool isAdmin = false; 11 | 12 | public static bool IsAdmin(String hardwareKey) 13 | { 14 | if (!hasChecked) 15 | { 16 | isAdmin = CheckAdmin(hardwareKey); 17 | hasChecked = true; 18 | } 19 | return isAdmin; 20 | } 21 | 22 | private static bool CheckAdmin(String hardwareKey) 23 | { 24 | bool isAdmin = false; 25 | Type checker = null; 26 | try 27 | { 28 | Assembly asm = Assembly.Load("GPAToolPro"); 29 | checker = asm.GetType("GPAToolPro.AdminAuthUtil"); 30 | if (checker != null) 31 | { 32 | object result = null; 33 | result = checker.InvokeMember("IsAdmin", BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, new object[] { hardwareKey }); 34 | if (result != null && result is bool) 35 | { 36 | isAdmin = (bool)result; 37 | } 38 | } 39 | } 40 | catch 41 | { 42 | } 43 | return isAdmin; 44 | } 45 | 46 | public static String GetHardwareId() 47 | { 48 | string result = string.Empty; 49 | ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_PhysicalMedia"); 50 | foreach (ManagementObject mo in mos.Get()) 51 | { 52 | result = mo["SerialNumber"].ToString().Trim(); 53 | break; 54 | } 55 | return result; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Util/Config.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | using System.IO; 6 | using System.Net; 7 | 8 | namespace GPATool.Util 9 | { 10 | class Config 11 | { 12 | [DllImport("kernel32")] 13 | private static extern long WritePrivateProfileString(string section, string key, 14 | string val, string filePath); 15 | 16 | [DllImport("kernel32.dll")] 17 | static extern uint GetPrivateProfileString( 18 | string lpAppName, 19 | string lpKeyName, 20 | string lpDefault, 21 | StringBuilder lpReturnedString, 22 | uint nSize, 23 | string lpFileName); 24 | 25 | private const String configFile = "Config.ini"; 26 | public static void CheckConfigFile() 27 | { 28 | if (!File.Exists(configFile)) 29 | { 30 | StreamWriter writer = new StreamWriter(configFile, false, Encoding.GetEncoding("GBK")); 31 | writer.WriteLine("[Login]"); 32 | writer.WriteLine("Username="); 33 | writer.WriteLine("Password="); 34 | writer.WriteLine("IsSavePassword=true"); 35 | writer.WriteLine("[AutoRefresh]"); 36 | writer.WriteLine("UseAutoRefresh=false"); 37 | writer.WriteLine("AutoRefreshInterval=30"); 38 | writer.WriteLine("[Proxy]"); 39 | writer.WriteLine("UseProxy="); 40 | writer.WriteLine("Host="); 41 | writer.WriteLine("Port="); 42 | writer.WriteLine("UseAuth="); 43 | writer.WriteLine("Username="); 44 | writer.WriteLine("Password="); 45 | writer.WriteLine("[Admin]"); 46 | writer.WriteLine("HardwareKey="); 47 | writer.WriteLine("HardwareId="+Admin.AdminAuth.getHardwareId()); 48 | writer.Flush(); 49 | writer.Close(); 50 | } 51 | } 52 | public static String getUsername() 53 | { 54 | return ReadConfig("Login", "Username", ""); 55 | } 56 | public static String getPassword() 57 | { 58 | return RC2Util.Decrypt("hackerzhou", ReadConfig("Login", "Password", "")); 59 | } 60 | public static String getHardwareKey() 61 | { 62 | return ReadConfig("Admin", "HardwareKey", ""); 63 | } 64 | public static bool getIsSavePassword() 65 | { 66 | bool result = false; 67 | bool.TryParse(ReadConfig("Login", "IsSavePassword", "true"), out result); 68 | return result; 69 | } 70 | public static WebProxy getConfigedProxy() 71 | { 72 | if (!getUseProxy()) 73 | { 74 | return null; 75 | } 76 | WebProxy proxy = new WebProxy(getProxyHost(), getProxyPort()); 77 | if (getUseAuth()) 78 | { 79 | proxy.Credentials = new NetworkCredential(ReadConfig("Proxy", "Username", ""), ReadConfig("Proxy", "Password", "")); 80 | } 81 | return proxy; 82 | } 83 | public static bool getUseProxy() 84 | { 85 | bool result = false; 86 | bool.TryParse(ReadConfig("Proxy", "UseProxy", "false"), out result); 87 | return result; 88 | } 89 | public static bool getUseAutoRefresh() 90 | { 91 | bool result = false; 92 | bool.TryParse(ReadConfig("AutoRefresh", "UseAutoRefresh", "false"), out result); 93 | return result; 94 | } 95 | public static int getAutoRefreshInterval() 96 | { 97 | int result = 30; 98 | int.TryParse(ReadConfig("AutoRefresh", "AutoRefreshInterval", "30"), out result); 99 | return result; 100 | } 101 | public static String getProxyHost() 102 | { 103 | return ReadConfig("Proxy", "Host", ""); 104 | } 105 | public static bool getUseAuth() 106 | { 107 | bool result = false; 108 | bool.TryParse(ReadConfig("Proxy", "UseAuth", "false"), out result); 109 | return result; 110 | } 111 | public static String getProxyUsername() 112 | { 113 | return ReadConfig("Proxy", "Username", ""); 114 | } 115 | public static String getProxyPassword() 116 | { 117 | return ReadConfig("Proxy", "Password", ""); 118 | } 119 | public static int getProxyPort() 120 | { 121 | int port = 8080; 122 | try 123 | { 124 | port=int.Parse(ReadConfig("Proxy", "Port", "808")); 125 | if (port <= 0 || port >= 65535) 126 | { 127 | port = 8080; 128 | } 129 | } 130 | catch 131 | { 132 | } 133 | return port; 134 | } 135 | public static void updateStyleIndex(int styleIndex) 136 | { 137 | WriteConfig("Style", "Index", styleIndex.ToString()); 138 | } 139 | public static int getStyleIndex() 140 | { 141 | int index = 4; 142 | if (!int.TryParse(ReadConfig("Style", "Index", "4"), out index)) 143 | { 144 | index = 4; 145 | } 146 | return index; 147 | } 148 | public static void updateLogin(String username,String password,bool isSavePassword) 149 | { 150 | WriteConfig("Login", "Username", username); 151 | WriteConfig("Login", "Password", RC2Util.Encrypt("hackerzhou",password)); 152 | WriteConfig("Login", "IsSavePassword", isSavePassword.ToString()); 153 | } 154 | public static void updateProxy(bool useProxy, String host, int port, bool useAuth, String username, String password) 155 | { 156 | WriteConfig("Proxy", "UseProxy", useProxy.ToString()); 157 | WriteConfig("Proxy", "Host", host); 158 | WriteConfig("Proxy", "Port", port.ToString()); 159 | WriteConfig("Proxy", "UseAuth", useAuth.ToString()); 160 | WriteConfig("Proxy", "Username", username); 161 | WriteConfig("Proxy", "Password", password); 162 | } 163 | public static void updateAutoRefresh(bool useAutoRefresh, int autoRefreshInterval) 164 | { 165 | WriteConfig("AutoRefresh", "UseAutoRefresh", useAutoRefresh.ToString()); 166 | WriteConfig("AutoRefresh", "AutoRefreshInterval", autoRefreshInterval.ToString()); 167 | } 168 | 169 | private static string ReadConfig(string Section, string Key, string NoText) 170 | { 171 | CheckConfigFile(); 172 | if (File.Exists(configFile)) 173 | { 174 | StringBuilder temp = new StringBuilder(1024); 175 | GetPrivateProfileString(Section, Key, NoText, temp, 1024, new FileInfo(configFile).FullName); 176 | return temp.ToString(); 177 | } 178 | else 179 | { 180 | return String.Empty; 181 | } 182 | } 183 | 184 | private static bool WriteConfig(string Section, string Key, string Value) 185 | { 186 | CheckConfigFile(); 187 | if (File.Exists(configFile)) 188 | { 189 | long OpStation = WritePrivateProfileString(Section, Key, Value, new FileInfo(configFile).FullName); 190 | if (OpStation == 0) 191 | { 192 | return false; 193 | } 194 | else 195 | { 196 | return true; 197 | } 198 | } 199 | else 200 | { 201 | return false; 202 | } 203 | } 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /Util/HTTPUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Text; 5 | 6 | namespace GPATool.Util 7 | { 8 | public class HTTPUtil 9 | { 10 | public static HttpWebRequest GetHttpRequest(String url, String method, CookieContainer cc, int timeout, int readTimeout, WebProxy proxy, bool keepalive, bool allowAutoRedirect = false) 11 | { 12 | HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(Uri.EscapeUriString(url)); 13 | if (proxy != null) 14 | { 15 | req.Proxy = proxy; 16 | if (proxy.Credentials != null) 17 | { 18 | req.UseDefaultCredentials = true; 19 | } 20 | } 21 | else 22 | { 23 | req.Proxy = null; 24 | } 25 | req.AllowAutoRedirect = allowAutoRedirect; 26 | req.Timeout = timeout; 27 | req.ReadWriteTimeout = readTimeout; 28 | req.KeepAlive = keepalive; 29 | req.CookieContainer = cc; 30 | return req; 31 | } 32 | 33 | public static String GetStringFromStream(Stream s,Encoding enc) 34 | { 35 | StreamReader streamReader = new StreamReader(s, enc); 36 | string content = streamReader.ReadToEnd(); 37 | streamReader.Close(); 38 | return content; 39 | } 40 | 41 | public static void WriteStreamToFile(Stream s, String path) 42 | { 43 | FileStream fs = new FileStream(path, FileMode.Create); 44 | byte[] buf = new byte[10240]; 45 | int readCount = 0; 46 | while ((readCount = s.Read(buf, 0, buf.Length)) > 0) 47 | { 48 | fs.Write(buf, 0, readCount); 49 | } 50 | fs.Flush(); 51 | fs.Close(); 52 | } 53 | 54 | public static bool SaveUrlContentToFile(String url, String path) 55 | { 56 | try 57 | { 58 | String tempPath = path + ".part"; 59 | HttpWebRequest req = GetHttpRequest(url, "GET", null, 60000, 60000, XMLConfig.GetProxy(), true); 60 | using (WebResponse wr = req.GetResponse()) 61 | { 62 | WriteStreamToFile(wr.GetResponseStream(), tempPath); 63 | } 64 | FileInfo info = new FileInfo(tempPath); 65 | info.MoveTo(path); 66 | return true; 67 | } 68 | catch 69 | { 70 | return false; 71 | } 72 | } 73 | 74 | public static String GetFileNameFromUrl(String url) 75 | { 76 | return url.LastIndexOf('/') > 0 && url.LastIndexOf('/') + 1 < url.Length ? url.Substring(url.LastIndexOf('/') + 1) : url; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /Util/ListViewItemComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Windows.Forms; 4 | using GPATool.Bean; 5 | 6 | namespace GPATool.Util 7 | { 8 | class ListViewItemComparer : IComparer 9 | { 10 | private int col; 11 | private ColumnHeader header; 12 | public ListViewItemComparer(int column, ColumnHeader h) 13 | { 14 | col = column; 15 | header = h; 16 | String tag = (String)header.Tag; 17 | if (tag.EndsWith("Desc")) 18 | { 19 | header.Tag = tag.Replace("Desc", ""); 20 | } 21 | else 22 | { 23 | header.Tag = tag + "Desc"; 24 | } 25 | } 26 | public int Compare(object x, object y) 27 | { 28 | String tag = (String)header.Tag; 29 | String xValue = ((ListViewItem)x).SubItems[col].Text; 30 | String yValue = ((ListViewItem)y).SubItems[col].Text; 31 | if (tag.Equals("double")) 32 | { 33 | double d1 = double.Parse(xValue); 34 | double d2 = double.Parse(yValue); 35 | return d1.CompareTo(d2); 36 | } 37 | else if (tag.Equals("doubleDesc")) 38 | { 39 | double d1 = double.Parse(xValue); 40 | double d2 = double.Parse(yValue); 41 | return d2.CompareTo(d1); 42 | } 43 | else if (tag.Equals("StringDesc")) 44 | { 45 | return String.Compare(yValue, xValue); 46 | } 47 | else if (tag.Equals("String")) 48 | { 49 | return String.Compare(xValue, yValue); 50 | } 51 | else if (tag.Equals("Score")) 52 | { 53 | return Lesson.GetScoreValue(xValue).CompareTo(Lesson.GetScoreValue(yValue)); 54 | } 55 | else 56 | { 57 | return Lesson.GetScoreValue(yValue).CompareTo(Lesson.GetScoreValue(xValue)); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Util/ListViewStripMenuHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.Windows.Forms; 3 | 4 | namespace GPATool.Util 5 | { 6 | class ListViewStripMenuHelper 7 | { 8 | public static void CopyAllItemsToClipBoard(ListView listView, int colStart = 0) 9 | { 10 | StringBuilder buf = new StringBuilder(); 11 | foreach (ListViewItem i in listView.Items) 12 | { 13 | for (int j = colStart; j < i.SubItems.Count; j++) 14 | { 15 | buf.Append(listView.Columns[j].Text + ":" + i.SubItems[j].Text + ";"); 16 | } 17 | buf.AppendLine(); 18 | } 19 | Clipboard.SetDataObject(buf.ToString()); 20 | } 21 | 22 | public static void CopySelectedItemsToClipBoard(ListView listView, int colStart = 0) 23 | { 24 | StringBuilder buf = new StringBuilder(); 25 | foreach (ListViewItem i in listView.SelectedItems) 26 | { 27 | for (int j = 0; j < i.SubItems.Count; j++) 28 | { 29 | buf.Append(listView.Columns[j].Text + ":" + i.SubItems[j].Text + ";"); 30 | } 31 | buf.AppendLine(); 32 | } 33 | Clipboard.SetDataObject(buf.ToString()); 34 | } 35 | public static void CopySelectedItemColumnToClipBoard(ListView listView, int columnIndex) 36 | { 37 | Clipboard.SetDataObject(listView.SelectedItems[0].SubItems[columnIndex].Text); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Util/ParseHTML.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Text.RegularExpressions; 5 | using GPATool.Bean; 6 | 7 | namespace GPATool.Util 8 | { 9 | public class ParseHTML 10 | { 11 | public static List TryParseHTML(String html, GPAInfo info, bool isNormal) 12 | { 13 | try 14 | { 15 | if (isNormal) 16 | { 17 | return Parse(html, info); 18 | } 19 | else 20 | { 21 | Assembly asm = Assembly.Load("GPAToolPro"); 22 | Type util = asm.GetType("GPAToolPro.AdminFunctionLib"); 23 | Object result = util.InvokeMember("ParseAdminHTMLString", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod 24 | , null, null, new object[] { html, info }); 25 | return (result == null && result is List) ? null : (List)result; 26 | } 27 | } 28 | catch 29 | { 30 | return null; 31 | } 32 | } 33 | 34 | private static List Parse(String html, GPAInfo info) 35 | { 36 | List lessons = new List(); 37 | Regex nameReg = new Regex(@"姓名:.+\s+.+nowrap>(?'name'\w+.+)<", RegexOptions.IgnoreCase); 38 | Match nameMatch = nameReg.Match(html); 39 | if (nameMatch.Success) 40 | { 41 | info.Name = nameMatch.Groups["name"].Captures[0].Value; 42 | } 43 | Regex majorReg = new Regex(@"专业:.+\s+.+nowrap>(?'major'\w+.+)<", RegexOptions.IgnoreCase); 44 | Match majorMatch = majorReg.Match(html); 45 | if (majorMatch.Success) 46 | { 47 | info.Major = majorMatch.Groups["major"].Captures[0].Value; 48 | } 49 | Regex creditReg = new Regex(@"总学分:.+\s+.+nowrap>(?'credit'\w+.+)<", RegexOptions.IgnoreCase); 50 | Match creditMatch = creditReg.Match(html); 51 | if (creditMatch.Success) 52 | { 53 | info.TotalCredit = creditMatch.Groups["credit"].Captures[0].Value; 54 | } 55 | Regex gpaReg = new Regex(@"绩点:.+\s+.+nowrap>(?'gpa'\w+.+)<", RegexOptions.IgnoreCase); 56 | Match gpaMatch = gpaReg.Match(html); 57 | if (gpaMatch.Success) 58 | { 59 | info.Gpa = gpaMatch.Groups["gpa"].Captures[0].Value; 60 | } 61 | Regex lessonReg = new Regex(@"scoreMouseOut.+\s+ 128) 14 | { 15 | key = key.Substring(0, 128); 16 | } 17 | else if (String.IsNullOrEmpty(key)) 18 | { 19 | key = "default"; 20 | } 21 | else if (key.Length < 8) 22 | { 23 | key = key.PadRight(8, ' '); 24 | } 25 | byte[] PrivateKey1 = Encoding.UTF8.GetBytes(key); 26 | byte[] PrivateKey2 = Encoding.UTF8.GetBytes(key); 27 | byte[] Data = Encoding.UTF8.GetBytes(text); 28 | MemoryStream ms = new MemoryStream(); 29 | CryptoStream cs = new CryptoStream(ms, rc2.CreateEncryptor(PrivateKey1, PrivateKey2), CryptoStreamMode.Write); 30 | cs.Write(Data, 0, Data.Length); 31 | cs.FlushFinalBlock(); 32 | return Convert.ToBase64String(ms.ToArray()); 33 | } 34 | 35 | public static String Decrypt(String key, String value) 36 | { 37 | if (string.IsNullOrEmpty(value)) 38 | { 39 | return null; 40 | } 41 | try 42 | { 43 | RC2CryptoServiceProvider rc2 = new RC2CryptoServiceProvider(); 44 | if (key.Length > 128) 45 | { 46 | key = key.Substring(0, 128); 47 | } 48 | else if (String.IsNullOrEmpty(key)) 49 | { 50 | key = "default"; 51 | } 52 | else if (key.Length < 8) 53 | { 54 | key = key.PadRight(8, ' '); 55 | } 56 | byte[] PrivateKey1 = Encoding.UTF8.GetBytes(key); 57 | byte[] PrivateKey2 = Encoding.UTF8.GetBytes(key); 58 | byte[] data = Convert.FromBase64String(value); 59 | MemoryStream ms = new MemoryStream(); 60 | CryptoStream cs = new CryptoStream(ms, rc2.CreateDecryptor(PrivateKey1, PrivateKey2), CryptoStreamMode.Write); 61 | cs.Write(data, 0, data.Length); 62 | cs.FlushFinalBlock(); 63 | return Encoding.UTF8.GetString(ms.ToArray()); 64 | } 65 | catch (Exception) 66 | { 67 | return null; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Util/ScoreDistributionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Data.SQLite; 5 | using GPATool.Bean; 6 | using System.Text.RegularExpressions; 7 | 8 | namespace GPATool.Util 9 | { 10 | public class ScoreDistributionHelper 11 | { 12 | private static SQLiteConnection conn; 13 | 14 | public static SQLiteConnection GetSqliteConnection() 15 | { 16 | if (conn == null || conn.State != ConnectionState.Open) 17 | { 18 | SQLiteConnectionStringBuilder connStr = new SQLiteConnectionStringBuilder(); 19 | connStr.DataSource = "data.s3db"; 20 | connStr.Password = "GPAToolScoreDistributionDb2011"; 21 | conn = new SQLiteConnection(connStr.ConnectionString); 22 | conn.Open(); 23 | } 24 | return conn; 25 | } 26 | 27 | public static List LoadAllSemesters() 28 | { 29 | List result = new List(); 30 | try 31 | { 32 | SQLiteConnection conn = GetSqliteConnection(); 33 | SQLiteCommand cmd = conn.CreateCommand(); 34 | cmd.CommandText = "select name from Semester order by name desc;"; 35 | SQLiteDataReader reader = cmd.ExecuteReader(); 36 | while (reader.Read()) 37 | { 38 | result.Add(reader.GetString(0)); 39 | } 40 | } 41 | catch 42 | { 43 | } 44 | return result; 45 | } 46 | 47 | public static void QueryScoreDistribution(ScoreDistributionItem item) 48 | { 49 | int courseId = item.CourseId; 50 | SQLiteConnection conn = GetSqliteConnection(); 51 | SQLiteCommand cmd = conn.CreateCommand(); 52 | cmd.CommandText = "select scoreValue, studentCount from score where course_id = " + courseId + " order by scoreValue"; 53 | SQLiteDataReader reader = cmd.ExecuteReader(); 54 | if (item.Scores == null) 55 | { 56 | item.Scores = new List(); 57 | } 58 | else 59 | { 60 | item.Scores.Clear(); 61 | } 62 | 63 | while (reader.Read()) 64 | { 65 | ScoreItem si = new ScoreItem(); 66 | si.DisplayValue = reader.GetString(0); 67 | si.StudentCount = reader.GetInt32(1); 68 | item.Scores.Add(si); 69 | } 70 | item.Scores.Sort(new ScoreItem()); 71 | } 72 | 73 | public static List QueryTeacherSDChangeBySemester(ScoreDistributionItem item) 74 | { 75 | String sql = @"select 76 | c.id, 77 | s.name, 78 | l.lessonCode, 79 | l.lessonName, 80 | t.name, 81 | l.creditPoint, 82 | c.totalStudentNumber 83 | from 84 | course c, lesson l, semester s, teacher t 85 | where 86 | c.lesson_id = l.id 87 | and c.semester_id = s.id 88 | and c.teacher_id = t.id 89 | and t.name = '" + item.Teacher + "'" 90 | + @" and l.lessonName = '" + item.LessonName + "'" 91 | + @" and t.name != 'Unknown' 92 | order by s.name"; 93 | List result = new List(); 94 | SQLiteConnection conn = GetSqliteConnection(); 95 | SQLiteCommand cmd = conn.CreateCommand(); 96 | cmd.CommandText = sql; 97 | SQLiteDataReader reader = cmd.ExecuteReader(); 98 | int i = 1; 99 | while (reader.Read()) 100 | { 101 | ScoreDistributionItem sdItem = new ScoreDistributionItem(); 102 | sdItem.Id = i++; 103 | sdItem.CourseId = reader.GetInt32(0); 104 | sdItem.Semester = reader.GetString(1); 105 | sdItem.LessonCode = reader.GetString(2); 106 | sdItem.LessonName = reader.GetString(3); 107 | sdItem.Teacher = reader.GetString(4); 108 | sdItem.Credits = reader.GetDouble(5); 109 | sdItem.StudentCount = reader.GetInt32(6); 110 | QueryScoreDistribution(sdItem); 111 | result.Add(sdItem); 112 | } 113 | result = ScoreDistributionItem.MergeSameTeacherSemester(result); 114 | foreach (ScoreDistributionItem sdi in result) 115 | { 116 | sdi.CalculateBenchMark(); 117 | } 118 | return result; 119 | } 120 | 121 | public static List QueryLessonSDChangeByTeacher(ScoreDistributionItem item) 122 | { 123 | String sql = @"select 124 | c.id, 125 | s.name, 126 | l.lessonCode, 127 | l.lessonName, 128 | t.name, 129 | l.creditPoint, 130 | c.totalStudentNumber 131 | from 132 | course c, lesson l, semester s, teacher t 133 | where 134 | c.lesson_id = l.id 135 | and c.semester_id = s.id 136 | and c.teacher_id = t.id 137 | and l.lessonName = '" + item.LessonName + "'" 138 | + @" and s.name = '" + item.Semester + "'" 139 | + @" and t.name != 'Unknown' 140 | order by t.name"; 141 | List result = new List(); 142 | SQLiteConnection conn = GetSqliteConnection(); 143 | SQLiteCommand cmd = conn.CreateCommand(); 144 | cmd.CommandText = sql; 145 | SQLiteDataReader reader = cmd.ExecuteReader(); 146 | int i = 1; 147 | while (reader.Read()) 148 | { 149 | ScoreDistributionItem sdItem = new ScoreDistributionItem(); 150 | sdItem.Id = i++; 151 | sdItem.CourseId = reader.GetInt32(0); 152 | sdItem.Semester = reader.GetString(1); 153 | sdItem.LessonCode = reader.GetString(2); 154 | sdItem.LessonName = reader.GetString(3); 155 | sdItem.Teacher = reader.GetString(4); 156 | sdItem.Credits = reader.GetDouble(5); 157 | sdItem.StudentCount = reader.GetInt32(6); 158 | QueryScoreDistribution(sdItem); 159 | result.Add(sdItem); 160 | } 161 | result = ScoreDistributionItem.MergeSameTeacherSemester(result); 162 | foreach (ScoreDistributionItem sdi in result) 163 | { 164 | sdi.CalculateBenchMark(); 165 | } 166 | result.Sort(new ScoreDistributionItem()); 167 | return result; 168 | } 169 | 170 | public static List Query(String semester, String lessonCodeContains 171 | , String lessonNameContains, String teacherNameContains, int ignoreLessThan, int limit 172 | , bool ignoreImcompleteInfo, String orderBy) 173 | { 174 | List result = new List(); 175 | SQLiteConnection conn = GetSqliteConnection(); 176 | SQLiteCommand cmd = conn.CreateCommand(); 177 | cmd.CommandText = createSql(semester, lessonCodeContains, lessonNameContains 178 | , teacherNameContains, ignoreLessThan, limit, ignoreImcompleteInfo, orderBy); 179 | SQLiteDataReader reader = cmd.ExecuteReader(); 180 | int i = 1; 181 | while (reader.Read()) 182 | { 183 | ScoreDistributionItem item = new ScoreDistributionItem(); 184 | item.Id = i++; 185 | item.CourseId = reader.GetInt32(0); 186 | item.Semester = reader.GetString(1); 187 | item.LessonCode = reader.GetString(2); 188 | item.LessonName = reader.GetString(3); 189 | item.Teacher = reader.GetString(4); 190 | item.Credits = reader.GetDouble(5); 191 | item.StudentCount = reader.GetInt32(6); 192 | result.Add(item); 193 | } 194 | return result; 195 | } 196 | 197 | private static String createSql(String semester, String lessonCodeContains 198 | , String lessonNameContains, String teacherNameContains, int ignoreLessThan, int limit, bool ignoreImcompleteInfo, String orderBy) 199 | { 200 | String sql = @"select 201 | c.id, 202 | s.name, 203 | l.lessonCode, 204 | l.lessonName, 205 | t.name, 206 | l.creditPoint, 207 | c.totalStudentNumber 208 | from 209 | course c, lesson l, semester s, teacher t 210 | where 211 | c.lesson_id = l.id 212 | and c.semester_id = s.id 213 | and c.teacher_id = t.id"; 214 | if (!string.IsNullOrEmpty(semester)) 215 | { 216 | sql += " and s.name = '" + semester + "'"; 217 | } 218 | if (!string.IsNullOrEmpty(lessonCodeContains)) 219 | { 220 | sql += " and l.lessonCode like '%" + lessonCodeContains + "%'"; 221 | } 222 | if (!string.IsNullOrEmpty(lessonNameContains)) 223 | { 224 | sql += " and l.lessonName like '%" + lessonNameContains + "%'"; 225 | } 226 | if (!string.IsNullOrEmpty(teacherNameContains)) 227 | { 228 | sql += " and t.name like '%" + teacherNameContains + "%'"; 229 | } 230 | if (ignoreLessThan > 0) 231 | { 232 | sql += " and c.totalStudentNumber >= " + ignoreLessThan; 233 | } 234 | if (ignoreImcompleteInfo) 235 | { 236 | sql += @" and t.name != 'Unknown'"; 237 | } 238 | sql += string.IsNullOrEmpty(orderBy) ? " order by lessonCode" : " " + orderBy; 239 | if (limit > 0) 240 | { 241 | sql += " limit " + limit; 242 | } 243 | return sql; 244 | } 245 | } 246 | } 247 | -------------------------------------------------------------------------------- /Util/ScoreHTMLUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Reflection; 4 | using System.Text; 5 | 6 | namespace GPATool.Util 7 | { 8 | public class ScoreHTMLUtil 9 | { 10 | public static String TryGetHTMLString(String username, String password, String code 11 | , WebProxy proxy, bool isNormal) 12 | { 13 | String resultStr = null; 14 | int maxTry = 3; 15 | while (resultStr == null && maxTry-- > 0) 16 | { 17 | try 18 | { 19 | if (isNormal) 20 | { 21 | resultStr = GetHTMLString(username, password, code, proxy); 22 | } 23 | else 24 | { 25 | Assembly asm = Assembly.Load("GPAToolPro"); 26 | Type util = asm.GetType("GPAToolPro.AdminFunctionLib"); 27 | Object result = util.InvokeMember("GetAdminScoreHTMLString", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod 28 | , null, null, new object[] { username, XMLConfig.adminUsername, XMLConfig.adminPassword, code, proxy }); 29 | resultStr = (result == null && result is String) ? null : (String)result; 30 | } 31 | } 32 | catch 33 | { 34 | resultStr = null; 35 | } 36 | } 37 | return resultStr; 38 | } 39 | 40 | private static String GetHTMLString(String username, String password, String code, WebProxy proxy) 41 | { 42 | String result = ""; 43 | CookieContainer Cc = new CookieContainer(); 44 | HttpWebRequest req = HTTPUtil.GetHttpRequest("http://uis2.fudan.edu.cn:82/amserver/UI/Login?Login.Token2=" + password + "&Login.code=" + code + "&Login.Token1=" + username, "GET", Cc, 15000, 15000, proxy, true); 45 | using (WebResponse wr = req.GetResponse()) 46 | { 47 | } 48 | req = HTTPUtil.GetHttpRequest("http://www.urp.fudan.edu.cn:84/epstar/app/fudan/ScoreManger/ScoreViewer/Student/Course.jsp", "GET", Cc, 15000, 15000, proxy, true); 49 | using (WebResponse wr = req.GetResponse()) 50 | { 51 | result = HTTPUtil.GetStringFromStream(wr.GetResponseStream(),Encoding.GetEncoding("GB2312")); 52 | } 53 | req = HTTPUtil.GetHttpRequest("http://www.urp.fudan.edu.cn/logout.jsp", "GET", Cc, 15000, 15000, proxy, true); 54 | using (WebResponse wr = req.GetResponse()) 55 | { 56 | } 57 | return result; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Util/UpdateUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml; 6 | using System.Web; 7 | using System.IO; 8 | using System.Windows.Forms; 9 | using System.IO.Compression; 10 | 11 | namespace GPATool.Util 12 | { 13 | class UpdateUtil 14 | { 15 | private const double currentVersion = 1.1; 16 | public static void CheckUpdate() 17 | { 18 | try 19 | { 20 | XmlDocument doc = new XmlDocument(); 21 | doc.XmlResolver = null; 22 | doc.Load("http://wiki.hackerzhou.me/GPATool"); 23 | XmlNodeList list = doc.SelectNodes("//table[@id='updateData']/tr"); 24 | double versionValue = 0; 25 | String downloadUrl = null; 26 | foreach (XmlNode n in list) 27 | { 28 | String version = n.ChildNodes[0].InnerText.Replace("v", ""); 29 | String downloadTemp = n.ChildNodes[1].InnerText; 30 | double versionTemp = 0; 31 | double.TryParse(version, out versionTemp); 32 | if (versionTemp > versionValue) 33 | { 34 | versionValue = versionTemp; 35 | downloadUrl = HttpUtility.UrlDecode(downloadTemp); 36 | } 37 | } 38 | if (versionValue > currentVersion && downloadUrl != null && downloadUrl.StartsWith("http://hackerzhou.googlecode.com")) 39 | { 40 | String upgradeFile = HTTPUtil.GetFileNameFromUrl(downloadUrl); 41 | String filePath = Environment.CurrentDirectory + "\\" + upgradeFile; 42 | bool success = HTTPUtil.SaveUrlContentToFile(downloadUrl, filePath); 43 | if (success) 44 | { 45 | MessageBox.Show("已下载更新版 v" + versionValue.ToString("0.00") + " 到 " + upgradeFile + "\n请解压覆盖旧版本应用更新", "更新"); 46 | } 47 | } 48 | } 49 | catch 50 | { 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Util/XMLConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using System.Xml; 4 | 5 | namespace GPATool.Util 6 | { 7 | class XMLConfig 8 | { 9 | public static String urpUsername; 10 | public static String urpPassword; 11 | public static bool isSavePassword = true; 12 | public static bool useProxy; 13 | public static String proxyHost; 14 | public static int proxyPort = 8080; 15 | public static bool proxyUseAuth; 16 | public static String proxyUsername; 17 | public static String proxyPassword; 18 | public static String adminHardwareKey; 19 | public static String adminHardwareId; 20 | public static int styleIndex = 4; 21 | public static bool useAutoRefresh; 22 | public static int autoRefreshInterval = 30; 23 | public static bool isAdmin; 24 | public static String adminUsername; 25 | public static String adminPassword; 26 | public static bool dirty = true; 27 | 28 | public static void WriteConfig() 29 | { 30 | try 31 | { 32 | XmlDocument doc = GetDocument(); 33 | doc.Save("Config.xml"); 34 | } 35 | catch 36 | { 37 | } 38 | } 39 | 40 | public static void LoadConfig() 41 | { 42 | if (dirty) 43 | { 44 | try 45 | { 46 | adminHardwareId = AdminUtil.GetHardwareId(); 47 | XmlDocument doc = new XmlDocument(); 48 | doc.Load("Config.xml"); 49 | urpUsername = doc.SelectSingleNode("//Config/ScoreQuery/@urpUsername").InnerText; 50 | urpPassword = RC2Util.Decrypt("hackerzhou", doc.SelectSingleNode("//Config/ScoreQuery/@urpPassword").InnerText); 51 | isSavePassword = bool.Parse(doc.SelectSingleNode("//Config/ScoreQuery/@isSavePassword").InnerText); 52 | useAutoRefresh = bool.Parse(doc.SelectSingleNode("//Config/ScoreQuery/@useAutoRefresh").InnerText); 53 | useProxy = bool.Parse(doc.SelectSingleNode("//Config/Proxy/@useProxy").InnerText); 54 | proxyHost = doc.SelectSingleNode("//Config/Proxy/@proxyHost").InnerText; 55 | proxyPort = int.Parse(doc.SelectSingleNode("//Config/Proxy/@proxyPort").InnerText); 56 | proxyUseAuth = bool.Parse(doc.SelectSingleNode("//Config/Proxy/@proxyUseAuth").InnerText); 57 | proxyUsername = doc.SelectSingleNode("//Config/Proxy/@proxyUsername").InnerText; 58 | proxyPassword = doc.SelectSingleNode("//Config/Proxy/@proxyPassword").InnerText; 59 | adminHardwareKey = doc.SelectSingleNode("//Config/Admin/@adminHardwareKey").InnerText; 60 | adminUsername = doc.SelectSingleNode("//Config/Admin/@adminUsername").InnerText; 61 | adminPassword = doc.SelectSingleNode("//Config/Admin/@adminPassword").InnerText; 62 | styleIndex = int.Parse(doc.SelectSingleNode("//Config/Style/@styleIndex").InnerText); 63 | isAdmin = AdminUtil.IsAdmin(adminHardwareKey); 64 | } 65 | catch 66 | { 67 | WriteConfig(); 68 | } 69 | dirty = false; 70 | } 71 | } 72 | 73 | public static XmlDocument GetDocument() 74 | { 75 | XmlDocument doc = new XmlDocument(); 76 | XmlElement root = doc.CreateElement("Config"); 77 | doc.AppendChild(root); 78 | XmlElement scoreQuery = doc.CreateElement("ScoreQuery"); 79 | scoreQuery.SetAttribute("urpUsername", urpUsername); 80 | scoreQuery.SetAttribute("urpPassword", urpPassword); 81 | scoreQuery.SetAttribute("isSavePassword", isSavePassword.ToString()); 82 | scoreQuery.SetAttribute("useAutoRefresh", useAutoRefresh.ToString()); 83 | scoreQuery.SetAttribute("autoRefreshInterval", autoRefreshInterval.ToString()); 84 | root.AppendChild(scoreQuery); 85 | XmlElement proxy = doc.CreateElement("Proxy"); 86 | proxy.SetAttribute("useProxy", useProxy.ToString()); 87 | proxy.SetAttribute("proxyHost", proxyHost); 88 | proxy.SetAttribute("proxyPort", proxyPort.ToString()); 89 | proxy.SetAttribute("proxyUseAuth", proxyUseAuth.ToString()); 90 | proxy.SetAttribute("proxyUsername", proxyUsername); 91 | proxy.SetAttribute("proxyPassword", proxyPassword); 92 | root.AppendChild(proxy); 93 | XmlElement admin = doc.CreateElement("Admin"); 94 | admin.SetAttribute("adminHardwareKey", adminHardwareKey); 95 | admin.SetAttribute("adminHardwareId", adminHardwareId); 96 | admin.SetAttribute("adminUsername", adminUsername); 97 | admin.SetAttribute("adminPassword", adminPassword); 98 | root.AppendChild(admin); 99 | XmlElement style = doc.CreateElement("Style"); 100 | style.SetAttribute("styleIndex", styleIndex.ToString()); 101 | root.AppendChild(style); 102 | return doc; 103 | } 104 | 105 | public static WebProxy GetProxy() 106 | { 107 | WebProxy proxy = XMLConfig.useProxy ? new WebProxy(XMLConfig.proxyHost, XMLConfig.proxyPort) : null; 108 | if (proxyUseAuth) 109 | { 110 | proxy.Credentials = new NetworkCredential(proxyUsername, proxyPassword); 111 | } 112 | return proxy; 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /data.s3db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hackerzhou/GPATool/21f7dc643f64b2d32ebaf77cc0dcd1c6536a8053/data.s3db --------------------------------------------------------------------------------