Client/examinationSystemClient/examinationsDAL/examinationDAL.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;
using dataModel;
using serializedData;
//using SerizalClass;
using System.Net.Sockets;
using System.Net;
using encryptionAndDecryption;

namespace examinationsDAL
{
    public class examinationDAL
    {
        //登录
        public static studentInformation GetStudent(studentInformation student, IPAddress ip, int port)
        {
            UdpClient udpClient = new UdpClient();
            IPEndPoint iep = new IPEndPoint(ip, port);//服务器
            //byte[] bData = new serializedData.seriClass().SerializeBinary(student).ToArray();
            byte[] bData = new seriClass().SerializeBinary(student).ToArray();
            udpClient.Send(bData, bData.Length, iep);
            while (true)
            {
                try
                {
                    byte[] bytes = udpClient.Receive(ref iep);//线程阻塞
                    studentInformation student1 = new seriClass().DeSerializeBinary(new MemoryStream(bytes)) as studentInformation;
                    return student1;
                }
                catch
                {
                    return null;
                }
                finally
                {
                    udpClient.Close();
                }
            }
        }

        //抽题
        public static List<questionBank> getTopic(string admissionTicket, int stat, IPAddress ip, int port,string key)
        {
            UdpClient udpClient = new UdpClient();
            IPEndPoint iep = new IPEndPoint(ip, port);
            admissionTicket = encryptionAndDecryption.Authcode.DiscuzAuthcodeEncode(admissionTicket, key);
            studentInformation student = new studentInformation(admissionTicket, "", "", "", stat,key);
            byte[] bData = new seriClass().SerializeBinary(student).ToArray();
            udpClient.Send(bData, bData.Length, iep);
            while (true)
            {
                try
                {
                    List<questionBank> rettopic = null;
                    byte[] bytes1 = udpClient.Receive(ref iep); //第一次
后面还有 65 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。