WHUTSdk 1.0.0

dotnet add package WHUTSdk --version 1.0.0
                    
NuGet\Install-Package WHUTSdk -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WHUTSdk" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WHUTSdk" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="WHUTSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WHUTSdk --version 1.0.0
                    
#r "nuget: WHUTSdk, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WHUTSdk@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WHUTSdk&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=WHUTSdk&version=1.0.0
                    
Install as a Cake Tool

武汉理工大学教务处 SDK .Net core版

功能

  • 查课表 (√)
  • 查成绩 (√)
  • 自动评教 (开发中)
  • 自动抢课 (开发中)

依赖

  • .Net core SDK 2.1

用法

由于教务处服务器很垃圾,HTTP请求会花去很长的时间,所以建议使用异步方法,SDK提供的API也全部采用了异步。

1. 登陆
var student = new WhutStudent("学号", "密码");
var status = await student.LoginAsync();
/*
    status = Status.Ok        登陆成功
    status = Status.PwdWrong  密码错误 
    status = Status.Failed    请求错误,可能是教务处已经崩了
*/
2. 查课表
 var timeTable = await student.GetTimeTableAsync();

TimeTable是一个5×7的数组,与一天五节课,一周七天对应

3.查分数
var (scores, rinks) = await student.GetScoresAsync();

只需要分数信息:

var (scores, _) = await student.GetScoresAsync();

只需要排名信息:

var (_ , rinks) = await student.GetScoresAsync();

ScoreInfo定义

public class ScoreInfo
{
    /// <summary>
    /// 学年学期
    /// </summary>
    /// <value></value>
    public string SchoolYear { get; set; }

    /// <summary>
    /// 课程代码
    /// </summary>
    /// <value></value>
    public string CourseCode { get; set; }

    /// <summary>
    /// 课程名称
    /// </summary>
    /// <value></value>
    public string CourseName { get; set; }

    /// <summary>
    /// 课程类型
    /// </summary>
    /// <value></value>
    public string CourseType { get; set; }

    /// <summary>
    /// 学分
    /// </summary>
    /// <value></value>
    public string CourseCredit { get; set; }

    /// <summary>
    /// 总评成绩
    /// </summary>
    /// <value></value>
    public string TotalMark { get; set; }

    /// <summary>
    /// 最高成绩
    /// </summary>
    /// <value></value>
    public string BestScore { get; set; }

    /// <summary>
    /// 首次成绩
    /// </summary>
    /// <value></value>
    public string FirstScore { get; set; }

    /// <summary>
    /// 是否重修
    /// </summary>
    /// <value></value>
    public string IsRetrain { get; set; }

    /// <summary>
    /// 学分绩点
    /// </summary>
    /// <value></value>
    public string GPA { get; set; }
}

GPARinks定义

public class GPARinks
{
    /// <summary>
    /// 必修课绩点
    /// </summary>
    public string PureGPA { get; set; }

    /*---其他信息---*/
    /// <summary>
    /// 所有课程的绩点
    /// </summary>
    public string TotalGPA { get; set; }

    /// <summary>
    /// 班级排名
    /// </summary>
    public string ClassRink { get; set; }

    /// <summary>
    /// 年纪排名
    /// </summary>
    public string GradeRink { get; set; }
}
4. 自动评教

(开学可以评教时再开发)

5. 自动抢课

(开学可以选课时再开发)

6. 用于ASP.Net core

可以用于构建个人网站实现自动选课

  1. 首先将WhutStudent注入容器
 public void ConfigureServices(IServiceCollection services)
{
    //添加这一行代码
    services.TryAddScoped<WhutStudent>(); 
}
  1. 在生命周期内设置WhutStudent的账号、密码

Warning:在进行请求之前必须设置账号密码,否则会报错

如果仅供个人使用,也可以使用单例:

 public void ConfigureServices(IServiceCollection services)
{
    //添加这一行代码
    services.TryAddSingleton(new WhutStudent("学号", "密码"));    
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 1,130 8/11/2018