示例#1
0
        /// <summary>
        /// 退出程序方法
        /// </summary>
        public void CheckResult()
        {
            String examName = "";

            CFileA.Read(DataCenter.GetAppPath() + "\\WriteYourName.txt", ref examName);
            while (true)
            {
                if (m_isOver)
                {
                    String url        = "http://" + m_ip + ":10009/getresult?name=" + examName;
                    String examResult = HttpGetService.Get(url);
                    if (examResult.StartsWith("tongguo"))
                    {
                        m_txtAnswer.Text = "机试成绩合格,等待进一步面谈!";
                        for (int i = 0; i < 5; i++)
                        {
                            AddBarrage("机试成绩合格,等待进一步面谈!", 0, 4 + i);
                        }
                        break;
                    }
                    else if (examResult.StartsWith("butongguo"))
                    {
                        m_txtAnswer.Text = "非常抱歉,机试成绩不合格,谢谢参与!";
                        for (int i = 0; i < 5; i++)
                        {
                            AddBarrage("非常抱歉,机试成绩不合格,谢谢参与!", 0, 4 + i);
                        }
                        break;
                    }
                }
                Thread.Sleep(1000);
            }
        }
示例#2
0
        /// <summary>
        /// 获取通达信的历史数据的字符串
        /// </summary>
        /// <param name="code">股票代码</param>
        /// <param name="path">本地文件路径</param>
        /// <returns>数据字符串</returns>
        public static String GetTdxHistoryDatasStrByCode(String code, String path)
        {
            String fileName = CStrA.ConvertDBCodeToFileName(code);
            String result   = "";
            String filePath = path + fileName;

            if (CFileA.IsFileExist(filePath))
            {
                CFileA.Read(filePath, ref result);
            }
            return(result);
        }
示例#3
0
        /// <summary>
        /// Json到组列表对象
        /// </summary>
        /// <param name="json">Json字符串</param>
        /// <returns>组列表</returns>
        public static List <ChatGroup> ReadGroups()
        {
            String file    = DataCenter.GetAppPath() + "\\groups.txt";
            String content = "";

            if (CFileA.IsFileExist(file))
            {
                CFileA.Read(file, ref content);
                return(JsonConvert.DeserializeObject <List <ChatGroup> >(content));
            }
            else
            {
                return(new List <ChatGroup>());
            }
        }
示例#4
0
        /// <summary>
        /// 获取分时数据
        /// </summary>
        public static void GetMinuteDatas()
        {
            if (m_minuteDatas.Count > 0)
            {
                return;
            }
            String appPath = DataCenter.GetAppPath();

            foreach (String code in m_codedMap.Keys)
            {
                String fileName = m_newFileDir + CStrA.ConvertDBCodeToFileName(code);
                if (!CFileA.IsFileExist(fileName))
                {
                    fileName = m_newFileDir + CStrA.ConvertDBCodeToSinaCode(code).ToUpper() + ".txt";
                }
                if (CFileA.IsFileExist(fileName))
                {
                    String text = "";
                    CFileA.Read(fileName, ref text);
                    List <SecurityData> datas = new List <SecurityData>();
                    StockService.GetHistoryDatasByMinuteStr(text, datas);
                    if (datas.Count > 0)
                    {
                        int rindex   = 0;
                        int dataSize = datas.Count;
                        while (rindex < dataSize)
                        {
                            SecurityData d = datas[rindex];
                            if (rindex == 0)
                            {
                                d.m_avgPrice = d.m_close;
                            }
                            else
                            {
                                SecurityData ld = datas[rindex - 1];
                                d.m_avgPrice = (ld.m_avgPrice * rindex + d.m_close) / (rindex + 1);
                            }
                            rindex++;
                        }
                        m_minuteDatas[code] = datas;
                    }
                }
            }
        }
示例#5
0
        /// <summary>
        /// 创建窗体
        /// </summary>
        /// <param name="native">方法库</param>
        public JidianWindow(INativeBase native)
        {
            Load(native, "JidianWindow", "jidianWindow");
            RegisterEvents(m_window);
            String codeDirCachePath = DataCenter.GetAppPath() + "\\CODEDIR.txt";

            if (CFileA.IsFileExist(codeDirCachePath))
            {
                String content = "";
                CFileA.Read(codeDirCachePath, ref content);
                GetTextBox("txtCodeDir").Text = content;
            }
            String dataDirCacheDir = DataCenter.GetAppPath() + "\\DATADIR.txt";

            if (CFileA.IsFileExist(dataDirCacheDir))
            {
                String content = "";
                CFileA.Read(dataDirCacheDir, ref content);
                GetTextBox("txtDataDir").Text = content;
            }
        }
示例#6
0
        /// <summary>
        /// 分析基点
        /// </summary>
        /// <param name="dir">目录</param>
        private void Analysis(String dir, ref ProjectJidian projectJidian)
        {
            List <String> dirs = new List <String>();

            CFileA.GetDirectories(dir, dirs);
            int dirsSize = dirs.Count;

            for (int i = 0; i < dirsSize; i++)
            {
                Analysis(dirs[i], ref projectJidian);
            }
            List <String> files = new List <String>();

            CFileA.GetFiles(dir, files);
            int filesSize = files.Count;

            for (int i = 0; i < filesSize; i++)
            {
                String file    = files[i];
                String content = "";
                CFileA.Read(file, ref content);
                String[] strs     = content.Split(new String[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                int      strsSize = strs.Length;
                if (strsSize > 0)
                {
                    String fline = strs[0];
                    if (fline.StartsWith("//GAIA"))
                    {
                        FileJidian fileJidian = new FileJidian();
                        fileJidian.Lines     = strsSize;
                        projectJidian.Lines += strsSize;
                        fileJidian.Path      = file.Replace(m_dir + "\\", "");
                        String[] subStrs  = fline.Split(new String[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
                        String[] subStrs2 = subStrs[0].Split(new String[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
                        fileJidian.PID         = subStrs2[1];
                        fileJidian.CodeType    = subStrs2[2];
                        fileJidian.Level       = Convert.ToInt32(subStrs2[3].Replace("S", ""));
                        fileJidian.Scores      = fileJidian.Lines * fileJidian.Level;
                        projectJidian.Scores  += fileJidian.Scores;
                        projectJidian.AvgLevel = (double)(projectJidian.Files * projectJidian.AvgLevel + fileJidian.Level) / (projectJidian.Files + 1);
                        projectJidian.Files++;
                        String[] sunStrs = subStrs[1].Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                        for (int j = 0; j < sunStrs.Length; j++)
                        {
                            String[] csunStrs = sunStrs[j].Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            if (csunStrs.Length >= 2)
                            {
                                MemberJidian memberJidian = new MemberJidian();
                                memberJidian.Name  = csunStrs[0];
                                memberJidian.Rates = (double)Convert.ToInt32(csunStrs[1].Replace("%", "")) / 100;
                                memberJidian.Lines = (int)(strsSize * memberJidian.Rates);
                                fileJidian.MemberJidians.Add(memberJidian);
                            }
                        }
                        projectJidian.FileJidians.Add(fileJidian);
                    }
                }
            }
            dirs.Clear();
            files.Clear();
        }
示例#7
0
        /// <summary>
        /// 新的计划
        /// </summary>
        /// <param name="var">变量</param>
        /// <returns>状态</returns>
        private double PLAN_CREATE(CVariable var)
        {
            //拼装行对象
            CPlan  plan           = new CPlan();
            String id             = System.Guid.NewGuid().ToString();
            String name           = "";
            String sTime          = "";
            String command        = "";
            String member         = "";
            int    timeSpan       = 60;
            String runImmediately = "否";

            if (var.m_parameters.Length == 1)
            {
                String fileName = Application.StartupPath + "\\" + var.m_parameters[0].m_expression.Replace("'", "");
                String text     = "";
                CFileA.Read(fileName, ref text);
                int index = text.IndexOf("\r\n");
                name    = text.Substring(0, index);
                text    = text.Substring(index + 2);
                index   = text.IndexOf("\r\n");
                sTime   = text.Substring(index + 2);
                index   = text.IndexOf("\r\n");
                member  = text.Substring(0, index);
                text    = text.Substring(index + 2);
                index   = text.IndexOf("\r\n");
                command = text.Substring(index + 2);
            }
            else
            {
                name    = m_indicator.GetText(var.m_parameters[0]);
                sTime   = m_indicator.GetText(var.m_parameters[1]);
                member  = m_indicator.GetText(var.m_parameters[2]);
                command = m_indicator.GetText(var.m_parameters[3]);
            }
            plan.m_id     = id;
            plan.m_name   = name;
            plan.m_member = member;
            plan.m_status = "启动";
            if (command != null && command.Length > 0)
            {
                plan.m_command = command;
            }
            plan.m_createTime = DateTime.Now.Ticks;
            plan.m_timeSpan   = timeSpan;
            DateTime startTime = new DateTime(new TimeSpan(DateTime.Now.Ticks + (long)plan.m_timeSpan * 1000 * 10000).Ticks);

            if (sTime != null && sTime.Length > 0)
            {
                startTime = Convert.ToDateTime(sTime);
            }
            plan.m_startTime      = startTime.Ticks;
            plan.m_runImmediately = runImmediately == "是";
            if (plan.m_runImmediately)
            {
                plan.m_startTime = DateTime.Now.Ticks;
            }
            else
            {
                if (startTime < DateTime.Now)
                {
                    plan.m_runImmediately = true;
                    plan.m_startTime      = DateTime.Now.Ticks;
                }
                else
                {
                    plan.m_nextTime = plan.m_startTime;
                }
            }
            DataCenter.PlanService.NewService(plan);
            return(0);
        }
示例#8
0
        /// <summary>
        /// 开始工作
        /// </summary>
        private static void StartWork()
        {
            Dictionary <String, String> m_codesMap = new Dictionary <String, String>();
            String codes = "";

            while (true)
            {
                if (m_securities.Count == 0)
                {
                    String codesStr = "";
                    CFileA.Read(DataCenter.GetAppPath() + "\\codes.txt", ref codesStr);
                    String[]      strs = codesStr.Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                    StringBuilder sb   = new StringBuilder();
                    for (int i = 0; i < strs.Length; i++)
                    {
                        String[] subStrs  = strs[i].Split(',');
                        Security security = new Security();
                        security.m_code = subStrs[0];
                        security.m_name = subStrs[1];
                        lock (m_securities)
                        {
                            m_securities.Add(security);
                        }
                        m_codesMap[security.m_code] = security.m_name;
                        codes += security.m_code;
                        codes += ",";
                        if (!security.m_code.StartsWith("A"))
                        {
                            sb.Append(security.m_code + "," + security.m_name + "\r\n");
                        }
                    }
                    CFileA.Write(DataCenter.GetAppPath() + "\\codes.txt", sb.ToString());
                }
                if (codes != null && codes.Length > 0)
                {
                    if (codes.EndsWith(","))
                    {
                        codes.Remove(codes.Length - 1);
                    }
                    String[] strCodes    = codes.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                    int      codesSize   = strCodes.Length;
                    String   latestCodes = "";
                    for (int i = 0; i < codesSize; i++)
                    {
                        latestCodes += strCodes[i];
                        if (i == codesSize - 1 || (i > 0 && i % 50 == 0))
                        {
                            String latestDatasResult = GetSinaLatestDatasStrByCodes(latestCodes);
                            if (latestDatasResult != null && latestDatasResult.Length > 0)
                            {
                                List <SecurityLatestData> latestDatas = new List <SecurityLatestData>();
                                GetLatestDatasBySinaStr(latestDatasResult, 0, latestDatas);
                                int latestDatasSize = latestDatas.Count;
                                for (int j = 0; j < latestDatasSize; j++)
                                {
                                    SecurityLatestData latestData = latestDatas[j];
                                    if (latestData.m_close == 0)
                                    {
                                        latestData.m_close = latestData.m_buyPrice1;
                                    }
                                    if (latestData.m_close == 0)
                                    {
                                        latestData.m_close = latestData.m_sellPrice1;
                                    }
                                    lock (m_latestDatas)
                                    {
                                        m_latestDatas[latestData.m_securityCode] = latestData;
                                    }
                                }
                                latestDatas.Clear();
                            }
                            latestCodes = "";
                        }
                        else
                        {
                            latestCodes += ",";
                        }
                    }
                }
                Thread.Sleep(1);
            }
        }
示例#9
0
        /// <summary>
        /// 切换问题
        /// </summary>
        public void ChangeQuestion()
        {
            if (m_currentQuestion != null)
            {
                m_answers[m_currentQuestion.m_title] = m_txtAnswer.Text;
            }
            if (m_currentQuestion != null && (m_currentQuestion.m_type == "记忆" || m_currentQuestion.m_type == "算数"))
            {
                if (m_currentQuestion.m_answer != m_txtAnswer.Text)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        AddBarrage("回答错误", 0, 4 + i);
                    }
                }
            }
            m_txtAnswer.ReadOnly = false;
            if (m_btnStart.Text == "开始")
            {
                Thread thread = new Thread(new ThreadStart(CheckResult));
                thread.Start();
                //加载问题
                String file = DataCenter.GetAppPath() + "\\Exam.txt";
                if (GetRadioButton("rbExamC").Checked)
                {
                    file = DataCenter.GetAppPath() + "\\Exam_cplusplus.txt";
                }
                else if (GetRadioButton("rbExamJava").Checked)
                {
                    file = DataCenter.GetAppPath() + "\\Exam_Java.txt";
                }
                String content = "";
                CFileA.Read(file, ref content);
                String[] strs     = content.Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                int      strsSize = strs.Length;
                for (int i = 0; i < strsSize; i++)
                {
                    String       str      = strs[i];
                    QuestionInfo question = new QuestionInfo();
                    int          idx      = str.IndexOf(",");
                    question.m_type = str.Substring(0, idx);
                    int nIdx = str.IndexOf(",", idx + 1);
                    question.m_interval = Convert.ToInt32(str.Substring(idx + 1, nIdx - idx - 1));
                    question.m_title    = str.Substring(nIdx + 1);
                    m_oldQuestions.Add(question);
                }
                m_bulletTime = DateTime.Now;
                for (int i = 0; i < 10; i++)
                {
                    AddBarrage("开始答题", 0, 4 + i);
                }
                GetDiv("divMode").Enabled  = false;
                GetDiv("divMode").CanFocus = false;
                switch (m_lblMode.Text)
                {
                case "初级":
                    m_mode = 0;
                    break;

                case "中级":
                    m_mode = 1;
                    break;

                case "高级":
                    m_mode = 2;
                    break;

                case "英雄":
                    m_mode = 3;
                    break;

                case "史诗":
                    m_mode = 4;
                    break;

                case "传说":
                    m_mode = 5;
                    break;
                }
                if (m_mode == 5)
                {
                    GetButton("btnTimer").BackImage    = "skull.jpg";
                    GetButton("btnAnswer").BackImage   = "me.jpg";
                    GetButton("btnQuestion").BackImage = "you.jpg";
                    ButtonA choose1 = GetButton("choose1");
                    ButtonA choose2 = GetButton("choose2");
                    ButtonA choose3 = GetButton("choose3");
                    ButtonA choose4 = GetButton("choose4");
                    ButtonA choose5 = GetButton("choose5");
                    ButtonA choose6 = GetButton("choose6");
                    choose1.BackImage = "a1.jpg";
                    choose2.BackImage = "a2.jpg";
                    choose3.BackImage = "a3.jpg";
                    choose4.BackImage = "a4.jpg";
                    choose5.BackImage = "a5.jpg";
                    choose6.BackImage = "a6.jpg";
                    for (int i = 0; i < 20; i++)
                    {
                        CometA comet = new CometA();
                        Native.AddControl(comet);
                    }
                    m_txtAnswer.BorderColor   = COLOR.ARGB(200, 0, 0);
                    m_txtQuestion.BorderColor = COLOR.ARGB(200, 0, 0);
                }
                m_firstTime = DateTime.Now;
                bool lastState = true;
                if (m_isMatch)
                {
                    for (int i = 0; i < 100; i++)
                    {
                        QuestionInfo codingQuestion = new QuestionInfo();
                        codingQuestion.m_type     = "极限";
                        codingQuestion.m_interval = 180;
                        codingQuestion.m_title    = "以你最快的速度连续输出for(int i = 0; i < 100; i++)(前任select * from冠军是吴思杰,目前30次为合格)";
                        m_questions.Add(codingQuestion);
                    }
                }
                else
                {
                    while (m_oldQuestions.Count > 0)
                    {
                        QuestionInfo question = m_oldQuestions[m_rd.Next(0, m_oldQuestions.Count)];
                        if (lastState)
                        {
                            if (question.m_type == "打字")
                            {
                                m_questions.Add(question);
                                m_oldQuestions.Remove(question);
                                int random = m_rd.Next(0, 5);
                                //加减运算
                                //if (random == 0)
                                //{
                                //    QuestionInfo addSubQuestion = new QuestionInfo();
                                //    addSubQuestion.m_type = "算数";
                                //    addSubQuestion.m_interval = 30;
                                //    int count = 5;
                                //    String num1 = GetRandomNum(count);
                                //    String num2 = GetRandomNum(count);
                                //    String op = "+";
                                //    addSubQuestion.m_title = num1 + op + num2;
                                //    addSubQuestion.m_answer = (CStr.ConvertStrToInt(num1) + CStr.ConvertStrToInt(num2)).ToString();
                                //    m_questions.Add(addSubQuestion);
                                //}
                                ////记忆考察
                                //else if (m_mode != 5 && random == 1)
                                //{
                                //    QuestionInfo memoryQuestion = new QuestionInfo();
                                //    memoryQuestion.m_type = "记忆";
                                //    memoryQuestion.m_interval = 30;
                                //    int count = 11;
                                //    String num = GetRandomNum(count);
                                //    memoryQuestion.m_title = num;
                                //    memoryQuestion.m_answer = num;
                                //    m_questions.Add(memoryQuestion);
                                //}
                                //if (m_questions.Count >= 6 && coding)
                                //{
                                //    QuestionInfo codingQuestion = new QuestionInfo();
                                //    codingQuestion.m_type = "极限";
                                //    codingQuestion.m_interval = 180;
                                //    codingQuestion.m_title = "以你最快的速度连续输出for(int i = 0; i < 100; i++)(前任select * from冠军是吴思杰,目前30次为合格)";
                                //    m_questions.Add(codingQuestion);
                                //    coding = false;
                                //}
                                lastState = false;
                            }
                        }
                        else
                        {
                            if (question.m_type == "口述")
                            {
                                m_questions.Add(question);
                                m_oldQuestions.Remove(question);
                                lastState = true;
                            }
                        }
                        bool noDZ = true, noKS = true;
                        int  oldQuestionsSize = m_oldQuestions.Count;
                        for (int i = 0; i < oldQuestionsSize; i++)
                        {
                            if (m_oldQuestions[i].m_type == "口述")
                            {
                                noKS = false;
                            }
                            else if (m_oldQuestions[i].m_type == "打字")
                            {
                                noDZ = false;
                            }
                        }
                        if (noDZ || noKS)
                        {
                            break;
                        }
                    }
                }
            }
            m_btnStart.Text = "下一题";
            if (m_questions.Count > 0)
            {
                m_currentQuestion = m_questions[0];
                if (m_currentQuestion.m_type != "口述")
                {
                    m_txtAnswer.Text = "";
                }
                else
                {
                    m_txtAnswer.Text = "请口述";
                    m_txtAnswer.Text = "";
                }
                m_currentTick = m_currentQuestion.m_interval;
                if (m_currentQuestion.m_type == "口述")
                {
                    switch (m_mode)
                    {
                    case 0:
                        m_currentTick *= 2;
                        break;

                    case 1:
                        break;

                    case 2:
                        m_currentTick = m_currentQuestion.m_interval * 2 / 3;
                        break;

                    case 3:
                        m_currentTick = m_currentQuestion.m_interval / 2;
                        break;

                    case 4:
                        m_currentTick = m_currentQuestion.m_interval / 3;
                        break;

                    case 5:
                        m_currentTick    = 2;
                        m_txtAnswer.Text = "请在打字题中回答";
                        break;
                    }
                }
                else if (m_currentQuestion.m_type == "打字")
                {
                    switch (m_mode)
                    {
                    case 0:
                        m_currentTick *= 2;
                        break;

                    case 1:
                        break;

                    case 2:
                        m_currentTick = m_currentQuestion.m_interval * 2 / 3;
                        break;

                    case 3:
                        m_currentTick = m_currentQuestion.m_interval / 2;
                        break;

                    case 4:
                        m_currentTick = m_currentQuestion.m_interval / 3;
                        break;

                    case 5:
                        m_currentTick = m_currentQuestion.m_interval / 3;
                        break;
                    }
                }
                else if (m_currentQuestion.m_type == "算数")
                {
                    switch (m_mode)
                    {
                    case 2:
                        m_currentTick = 25;
                        break;

                    case 3:
                        m_currentTick = 20;
                        break;

                    case 4:
                        m_currentTick = 15;
                        break;

                    case 5:
                        m_currentTick = 10;
                        break;
                    }
                }
                else if (m_currentQuestion.m_type == "记忆")
                {
                    m_txtAnswer.Text     = "请迅速记忆上面这串数字,在此文字消失时打出刚才那串数字";
                    m_txtAnswer.ReadOnly = true;
                    switch (m_mode)
                    {
                    case 0:
                        m_currentTick = 40;
                        break;

                    case 1:
                        m_currentTick = 30;
                        break;

                    case 2:
                        m_currentTick = 28;
                        break;

                    case 3:
                        m_currentTick = 26;
                        break;

                    case 4:
                        m_currentTick = 24;
                        break;

                    case 5:
                        m_currentTick = 20;
                        break;
                    }
                }
                m_count++;
                m_lblAlarm.Text = "已做" + m_count.ToString() + "题";
                m_totalTick     = m_currentTick;
                double finishTime = (double)((TimeSpan)(DateTime.Now - m_firstTime)).TotalMilliseconds / 1000;
                m_lblTime.Text = "还剩" + m_totalTick.ToString("0.00") + "秒 已用时" + finishTime.ToString("0.00") + "秒";
                m_questions.Remove(m_currentQuestion);
                m_txtQuestion.Text = m_currentQuestion.m_title;
                if (m_currentQuestion.m_type == "口述")
                {
                    m_lblType.Text = "题型:打字,限时" + m_currentTick.ToString() + "秒";
                }
                else
                {
                    m_lblType.Text = "题型:" + m_currentQuestion.m_type + ",限时" + m_currentTick.ToString() + "秒";
                }
            }
        }
示例#10
0
        /// <summary>
        /// 触发秒表事件
        /// </summary>
        /// <param name="sender">调用者</param>
        /// <param name="timerID">秒表ID</param>
        private void CallTimerEvent(object sender, int timerID)
        {
            if (m_isOver)
            {
                return;
            }
            if (m_sky != null)
            {
                if (m_currentQuestion != null && m_mode >= 5 && m_currentQuestion.m_type != "极限")
                {
                    TimeSpan ts = DateTime.Now - m_bulletTime;
                    int      bollSeconds = 30, totalSeconds = (int)ts.TotalSeconds;
                    m_sky.Text = "";
                    if (totalSeconds >= bollSeconds)
                    {
                        Sound.Play("sound\\attbomb.wav");
                        m_sky.CreateBullets(6);
                        m_bulletTime = DateTime.Now;
                    }
                    else if (totalSeconds == bollSeconds - 1)
                    {
                        Sound.Play("sound\\1.wav");
                        m_sky.Text = "1";
                    }
                    else if (totalSeconds == bollSeconds - 2)
                    {
                        Sound.Play("sound\\2.wav");
                        m_sky.Text = "2";
                    }
                    else if (totalSeconds == bollSeconds - 3)
                    {
                        Sound.Play("sound\\3.wav");
                        m_sky.Text = "3";
                    }
                    else if (totalSeconds == bollSeconds - 4)
                    {
                        Sound.Play("sound\\bomb.wav");
                        m_sky.Text = "准备炸弹";
                    }
                    TimeSpan ts2 = DateTime.Now - m_shadowTime;
                    int      shadownTime = 1, totalSeconds2 = (int)ts2.TotalSeconds;
                    if (totalSeconds2 >= shadownTime)
                    {
                        m_shadowTime = DateTime.Now;
                    }
                    m_sky.OnTimer(timerID);
                }
                if (m_currentQuestion != null && (m_currentQuestion.m_type == "记忆" || m_currentQuestion.m_type == "算数"))
                {
                    if (m_currentQuestion.m_answer == m_txtAnswer.Text)
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            AddBarrage("回答正确", 0, 4 + i);
                        }
                        ChangeQuestion();
                    }
                }
            }
            double m_oldCurrentTick = m_currentTick;

            if (m_currentTick > 0)
            {
                TimeSpan ts            = DateTime.Now - m_lastTime;
                bool     bulletIsClick = true;
                foreach (Bullet bullet in m_sky.m_bullets)
                {
                    if (!bullet.IsClick)
                    {
                        bulletIsClick = false;
                    }
                }
                if (bulletIsClick)
                {
                    m_currentTick -= (double)ts.Milliseconds / 1000;
                }
                if (m_currentTick <= 0)
                {
                    if (m_questions != null)
                    {
                        m_answers[m_currentQuestion.m_title] = m_txtAnswer.Text;
                    }
                    if (m_currentQuestion != null && m_currentQuestion.m_type == "极限")
                    {
                        Native.ExportToImage(DataCenter.GetAppPath() + "\\成绩截图.jpg");
                    }
                    m_lblTime.Text   = "时间到了";
                    m_txtAnswer.Text = m_currentQuestion.m_type;
                    m_currentTick    = 0;
                    ChangeQuestion();
                }
                else
                {
                    if (m_currentQuestion.m_type == "记忆")
                    {
                        if (m_totalTick - m_currentTick > m_totalTick / 2)
                        {
                            m_txtQuestion.Text   = "不可见";
                            m_txtAnswer.ReadOnly = false;
                            if (m_txtAnswer.Text == "请迅速记忆上面这串数字,在此文字消失时打出刚才那串数字")
                            {
                                m_txtAnswer.Text = "";
                            }
                        }
                        if (m_currentTick <= 2)
                        {
                            m_txtQuestion.Text = m_currentQuestion.m_answer;
                        }
                    }
                    double finishTime = (double)((TimeSpan)(DateTime.Now - m_firstTime)).TotalMilliseconds / 1000;
                    m_lblTime.Text = "还剩" + m_currentTick.ToString("0.00") + "秒 已用时" + finishTime.ToString("0.00") + "秒";
                    if (finishTime > 60 * m_examMinute)
                    {
                        m_answers[m_currentQuestion.m_title] = m_txtAnswer.Text;
                        String        file  = DataCenter.GetAppPath() + "\\Result.txt";
                        StringBuilder sb    = new StringBuilder();
                        int           index = 1;
                        foreach (String question in m_answers.Keys)
                        {
                            sb.AppendLine(index.ToString() + "." + question);
                            sb.AppendLine(m_answers[question]);
                            index++;
                        }
                        CFileA.Write(file, sb.ToString());
                        String examName = "";
                        CFileA.Read(DataCenter.GetAppPath() + "\\WriteYourName.txt", ref examName);
                        String          url         = "http://" + m_ip + ":10009/sendresult?name=" + examName;
                        HttpPostService postService = new HttpPostService();
                        postService.Post(url, sb.ToString());
                        m_txtAnswer.Text = "考试时间到,请等待考试结果!";
                        Native.Invalidate();
                        m_isOver = true;
                    }
                }
            }
            if (m_mode == 5)
            {
                if (m_currentQuestion.m_type == "打字" || m_currentQuestion.m_type == "极限")
                {
                    if (m_tick % 5 == 0)
                    {
                        AddBarrage(m_rd.Next(0, 2) == 0 ? "111" : "222", 2, m_rd.Next(3, 20));
                    }
                }
            }
            m_lastTime = DateTime.Now;
            m_tick++;
            if (m_tick > 10000)
            {
                m_tick = 0;
            }
            Native.Invalidate();
        }