void OnUploadDone(UnityEngine.Networking.UnityWebRequest uwr)
 {
     if (uwr.isHttpError || uwr.isNetworkError)
     {
         GlobalUIManager.guim.CreateNewSelectBox("上传失败!是否重试?", delegate(bool isR) {
             if (isR)
             {
                 StartCoroutine(CheakPaper());
             }
             else
             {
                 uploadHandle.gradeObj.SetActive(true);
                 uploadHandle.gradeText.text = "文件上传失败!";
             }
         });
     }
     else
     {
         tempPaper.isUpload = true;
         PaperManager.SaveFile(tempPath, JsonUtility.ToJson(tempPaper));
         // PlayerPrefs.DeleteKey("tempPaper");
         //PlayerPrefs.Save();
         uploadHandle.gradeObj.SetActive(true);
         uploadHandle.gradeText.text = "文件上传成功!请点击关闭回到大厅->成绩处进行改卷!";
         Debug.Log(uwr.downloadHandler.text);
     }
 }
Exemplo n.º 2
0
    void Start()
    {
        theDB     = FindObjectOfType <DatabaseManager>();
        theOrder  = FindObjectOfType <OrderManager>();
        theMap    = FindObjectOfType <MapManager>();
        thePlayer = FindObjectOfType <PlayerManager>();
        //thePlayer = FindObjectOfType<PlayerManager>();
        theSet    = FindObjectOfType <SettingManager>();
        theAudio  = AudioManager.instance;
        thePaper  = PaperManager.instance;
        thePuzzle = PuzzleManager.instance;



        //uiList.Add(paper,paperbutton,item,itembutton,map,mapbutton,setting,settingbutton);
        uiList.Add(paper);
        uiList.Add(item);
        uiList.Add(map);
        uiList.Add(setting);
        uiButtonList.Add(paperbutton);
        uiButtonList.Add(itembutton);
        uiButtonList.Add(mapbutton);
        uiButtonList.Add(settingbutton);

        //if(theDB.firstOpen) firstOpen = true;
    }
Exemplo n.º 3
0
        /*
         * 开始查重
         */
        private void ButtonStartChecking(object sender, EventArgs e)
        {
            //判断参数合法性
            if (int.Parse(txtCheckThreshold.Text) <= 0 ||
                int.Parse(txtCheckThreadCnt.Text) <= 0 ||
                int.Parse(txtConvertThreadCnt.Text) <= 0 ||
                int.Parse(txtMinBytes.Text) < 0 ||
                int.Parse(txtMinWords.Text) < 0)
            {
                MessageBox.Show(this, "线程数和查重阈值必须大于0,论文限制不可小于0!", "提示");
                return;
            }

            //判断所需文件夹是否已选择
            if (txtFinalReportPath.Text == "" || txtToCheckPaperPath.Text == "" ||
                !Directory.Exists(txtFinalReportPath.Text) || !Directory.Exists(txtToCheckPaperPath.Text))
            {
                MessageBox.Show(this, "待查论文文件夹或查重报告保存的文件夹不存在!", "提示");
                return;
            }

            //启动查重任务
            PaperManager paperManager = new PaperManager(GetRunningEnv());
            Thread       checkThread  = new Thread(new ThreadStart(paperManager.StartCheckPaper));

            checkThread.Start();
            btnForceStop.Focus();//重新设置焦点
        }
Exemplo n.º 4
0
 void Start()
 {
     if (!Main)
     {
         Main = this;
     }
     OpenStartText();
 }
Exemplo n.º 5
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string javasc = @"window.onload=function(){alert('删除成功')}";
        int    ID     = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); //取出要删除记录的主键值

        if (PaperManager.DeletePaper(ID) || PaperManager.DeletePaperDetail(ID))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "ddd", javasc, true);
        }
        Response.Redirect("PaperLists.aspx");
    }
Exemplo n.º 6
0
        /*
         * 导出上一次查重报告按钮
         */
        private void ButtonExportReport(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                PaperManager paperManager = new PaperManager(GetRunningEnv());
                paperManager.ExportReport();
            }
            dialog.Dispose();
        }
Exemplo n.º 7
0
 public HomeController(
     PaperManager paperManager,
     TopicManager topicManager,
     SuccessManager successManager,
     IMapper mapper)
 {
     this.paperManager   = paperManager;
     this.topicManager   = topicManager;
     this.successManager = successManager;
     this.mapper         = mapper;
 }
Exemplo n.º 8
0
 private void Awake()
 {
     if (instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 9
0
        /*
         * 添加论文库
         */
        private void ButtonAddLibrary(object sender, EventArgs e)
        {
            //判断文件夹是否存在
            if (!Directory.Exists(txtPaperSourcePath.Text))
            {
                MessageBox.Show(this, "待添加的文件夹不存在!", "提示");
                return;
            }
            //启动添加任务
            PaperManager paperManager      = new PaperManager(GetRunningEnv());
            Thread       fileConvertThread = new Thread(new ThreadStart(paperManager.StartFileConvertStandalone));

            fileConvertThread.Start();
        }
Exemplo n.º 10
0
    protected void InitData()
    {
        PaperManager paper = new PaperManager();
        DataSet      ds    = paper.QueryAllPaper();

        if (ds.Tables[0].Rows.Count > 0)
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        else
        {
            lblMessage.Text = "没有试卷!";
        }
    }
Exemplo n.º 11
0
    private void InitData()
    {
        DataSet ds = PaperManager.QueryPaper();  //查询所有可用试卷

        if (ds.Tables[0].Rows.Count >= 1)
        {
            ddlPaper.DataSource     = ds;          //指名考试科目列表框数据源
            ddlPaper.DataTextField  = "PaperName"; //DataTextField显示Name字段值
            ddlPaper.DataValueField = "PaperID";   //DataValueField显示ID字段值
            ddlPaper.DataBind();                   //绑定数据
        }
        else
        {
            ddlPaper.Enabled = false;
            Button1.Enabled  = false;
            lblMessage.Text  = "没有试卷!";
        }
    }
    private void PutContent()
    {
        for (int i = 0; i < content.childCount; i++)
        {
            Destroy(content.GetChild(i).gameObject);
        }
        PaperManager.GetFileList();//取得文件列表
        List <int> allDownloadedID = PaperManager.GetAllDownloadID();

        for (int i = allPaper.data.Count - 1; i >= 0; i--)
        {
            ClassPaper   cp  = allPaper.data[i];
            GameObject   gm  = Instantiate(buttonPerfab, content);
            ExamItemCtrl eic = gm.GetComponentInChildren <ExamItemCtrl>();

            string pj = cp.SoeAllow ? "<Color=Green>支持机器评卷</Color>" : "<Color=Red>不支持机器评卷</Color>";
            //Debug.Log(cp.SoeAllow);
            eic.textItem.text =
                string.Format(
                    "{0}\n<Color=Red>{1}<Color=Grey>_</Color>{2}</Color>",
                    cp.name,
                    cp.type,
                    pj
                    );


            if (allDownloadedID.Contains(cp.id))
            {
                LuoHaoExamPaper lhep = PaperManager.allDownloadedPaperFile[allPaper.data[i].id];
                eic.isDownloaded         = true;
                eic.classPaper           = lhep.paper;
                eic.textItem.text       += "\n<Color=Green>已下载</Color> <Color=Orange>大小:" + lhep.size + "</Color>\n<Color=Grey>时间:" + lhep.time + "</Color>";
                eic.downloadBtnText.text = "删除";
                eic.filePath             = PaperManager.allDownloadedPath[lhep.id];
            }
            else
            {
                eic.isDownloaded         = false;
                eic.classPaper           = allPaper.data[i];
                eic.textItem.text       += "\n<Color=Orange>未下载</Color>";
                eic.downloadBtnText.text = "下载";
            }
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// 加载列表
    /// </summary>
    public void LoadList()
    {
        CommonTools.ClearObjectChilds(content);


        PaperManager.GetFileList();//取得文件列表

        UserMemoryList uml = UserMemoryManager.ReadList();

        if (uml == null)
        {
        }
        else
        {
            for (int i = uml.allMemorys.Count - 1; i >= 0; i--)
            {
                MemoryInfoItemCtrl miic = CommonTools.NewAnObjectA(infoPrefab, content.transform).GetComponent <MemoryInfoItemCtrl>();

                UserMemoryList.Common common = uml.allMemorys[i]; //读取

                miic.common   = common;                           //文件
                miic.memoryID = i;                                //储存ID

                string endText = "";
                switch (common.type)
                {
                case UserMemoryList.MemoryType.GD_CELST:    //CELST
                    endText = "<Color='Orange'>#广东高考口语#" + i + "</Color>\n";


                    break;

                case UserMemoryList.MemoryType.CETB4B6:    //CETB4B6
                    endText = "<Color='Orange'>#英语四六级#" + i + "</Color>\n";


                    break;
                }
                endText           += "时间:" + common.time;
                miic.mainText.text = endText;
            }
        }
    }
    /// <summary>
    /// 下载视频
    /// </summary>
    /// <param name="url"></param>
    /// <param name="vname"></param>
    /// <param name="okCallback"></param>
    /// <returns></returns>
    IEnumerator DownloadVideo(string url, string vname, System.Action okCallback)
    {
        processing = true;
        RestUI();
        processing    = true;
        textLog.text += "\n开始下载视频:" + vname;
        textInfo.text = "下载视频:" + vname;

        UnityWebRequest uwr = UnityWebRequest.Get(url);

        uwr.SendWebRequest();

        while (true)
        {
            textProcess.text = "(" +
                               GetFileSize(uwr.downloadedBytes) +
                               "/" + GetFileSize((ulong)(float.Parse(uwr.downloadedBytes.ToString()) / uwr.downloadProgress)) +
                               ")" +
                               GetProcess(uwr.downloadProgress);
            imgProcess.fillAmount = uwr.downloadProgress;
            //  Debug.Log(123);
            if (uwr.isDone)
            {
                break;
            }
            yield return(new WaitForSeconds(0.02f));
        }
        if (uwr.error == "" || uwr.error == null)
        {
            PaperManager.CreateFile(apaper.data.id.ToString() + "EP", vname, uwr.downloadHandler.data);
            textLog.text += "\n视频:" + vname + " 下载成功!";
            tempSize     += uwr.downloadedBytes;
            okCallback?.Invoke();
        }
        else
        {
            textLog.text += "\n视频:" + vname + " 下载失败!";
            ShowCloseUI();
        }
    }
Exemplo n.º 15
0
    public void GetParperAll()
    {
        int paperID = Convert.ToInt32(Request.QueryString["PaperID"].ToString());

        string  type = "单选题";
        DataSet ds1  = PaperManager.GetAllPaperSing(paperID, type); //单选题绑定

        GridView1.DataSource = ds1;
        GridView1.DataBind();



        type = "多选题";
        DataSet ds2 = PaperManager.GetAllPaperMult(paperID, type);//多选题绑定

        GridView2.DataSource = ds2;
        GridView2.DataBind();



        type = "判断题";
        DataSet ds3 = PaperManager.GetAllPaperJudg(paperID, type);//判断题绑定

        GridView3.DataSource = ds3;
        GridView3.DataBind();

        type = "填空题";
        DataSet ds4 = PaperManager.GetAllPaperFill(paperID, type);//填空题绑定

        GridView4.DataSource = ds4;
        GridView4.DataBind();

        type = "问答题";
        DataSet ds5 = PaperManager.GetAllPaperQues(paperID, type);//问答题绑定

        GridView5.DataSource = ds5;
        GridView5.DataBind();
    }
Exemplo n.º 16
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string javasc   = @"window.onload=function(){alert('更新修改成功')}";
        int    ID       = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString()); //取出要修改记录的主键值
        byte   ddlpaper = byte.Parse(((DropDownList)GridView1.Rows[e.RowIndex].FindControl("ddlPaperState")).SelectedValue);

        if (ddlpaper == 0)
        {
            if (PaperManager.UpdatePate(ID))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ddd", javasc, true);
                Response.Redirect("PaperLists.aspx");
            }
        }
        if (ddlpaper == 1)
        {
            if (PaperManager.UpdatePate1(ID))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "ddd", javasc, true);
                Response.Redirect("PaperLists.aspx");
            }
        }
    }
Exemplo n.º 17
0
 public PaperController(PaperManager paperManager, TopicManager topicManager)
 {
     this.paperManager = paperManager;
     this.topicManager = topicManager;
 }
    IEnumerator SavePaper()
    {
        tempPaper.id = classPaper.id;
        uploadHandle.infoText.text = "正在处理录音数据...";
        string rootPath = classPaper.path + "/Memory";

        PaperManager.CreatePath(rootPath);
        string fileName = "TempPaperCELSTWhen" + System.DateTime.Now.ToString("TyyyyMMddhhmmss") + "Random" + Random.Range(-23333, 23333) + ".lhirin";

        tempPath = rootPath + "/" + fileName;


        string partA_b64 = "";

        if (pac.scucess)
        {
            uploadHandle.infoText.text = "正在处理-PartA";
            yield return(new WaitForEndOfFrame());

            partA_b64       = CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PA));
            tempPaper.partA = partA_b64;
        }

        string partBA_b64 = "";
        string partBB_b64 = "";

        if (pbc.scucess)
        {
            for (int i = 0; i < PB_P1.Count; i++)
            {
                uploadHandle.infoText.text = "正在处理-PartB问题" + (i + 1).ToString();
                yield return(new WaitForEndOfFrame());

                partBA_b64 += CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PB_P1[i]));
                if (i != PB_P1.Count - 1)
                {
                    partBA_b64 += "|";
                }
            }
            tempPaper.partBA = partBA_b64;


            for (int i = 0; i < PB_P2.Count; i++)
            {
                uploadHandle.infoText.text = "正在处理-PartB回答" + (i + 1).ToString();
                yield return(new WaitForEndOfFrame());

                partBB_b64 += CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PB_P2[i]));
                if (i != PB_P2.Count - 1)
                {
                    partBB_b64 += "|";
                }
            }
            tempPaper.partBB = partBB_b64;
        }
        string partC_b64 = "";

        if (pcc.scucess)
        {
            uploadHandle.infoText.text = "正在处理-PartC";
            yield return(new WaitForEndOfFrame());

            partC_b64       = CheakerTools.Base64_Encode(WavUtility.FromAudioClip(PA));
            tempPaper.partC = partC_b64;
        }

        tempPaper.isUpload = false;


        uploadHandle.infoText.text = "正在创建缓存...";
        yield return(new WaitForEndOfFrame());

        PaperManager.SaveFile(tempPath, JsonUtility.ToJson(tempPaper));
        UserMemoryManager.InsertIntoList(new UserMemoryList.Common {
            dataPath = tempPath,
            time     = System.DateTime.Now.ToString(),
            type     = UserMemoryList.MemoryType.GD_CELST
        });
        uploadHandle.infoText.text = "缓存创建完毕!";

        GlobalUIManager.guim.CreateNewSelectBox("缓存完毕,是否上传音频呢?\n如果需要机器改卷或他人协助必须上传到服务器.", delegate(bool ok) {
            if (ok)
            {
                StartCoroutine(CheakPaper());
            }
            else
            {
                uploadHandle.gradeObj.SetActive(true);
                uploadHandle.gradeText.text = "用户取消上传!请点击关闭回到大厅进行自评或进行其他操作!";
            }
        });
        //PlayerPrefs.SetString("tempPaper", JsonUtility.ToJson(tempPaper));
        //PlayerPrefs.Save();
    }
    IEnumerator GetAPaperInfo(ClassPaper classPaper)
    {
        string url = GetPermisson.GetServerAddress +
                     "/Paper/GetAPaper.php?token=" +
                     UnityWebRequest.EscapeURL(LoginToKaoShi.userLoginCallback.data.token) +
                     "&paperID=" + classPaper.id;
        UnityWebRequest uwr = UnityWebRequest.Get(url);

        //Debug.Log(LoginToKaoShi.userLoginCallback.data.token);
        //Debug.Log(url);
        textLog.text += "\n请求试卷信息...";
        textInfo.text = "正在寻找试卷信息...";
        uwr.SendWebRequest();
        while (true)
        {
            textProcess.text      = GetProcess(uwr.downloadProgress);
            imgProcess.fillAmount = uwr.downloadProgress;
            if (uwr.isDone)
            {
                break;
            }
            yield return(new WaitForSeconds(0.02f));
        }

        if (uwr.error == "" || uwr.error == null)
        {
            try
            {
                apaper = JsonUtility.FromJson <APaper>(uwr.downloadHandler.text);
                // Debug.Log(uwr.downloadHandler.text);
                switch (apaper.code)
                {
                case 0:
                    textLog.text += "\n试卷信息请求成功!";



                    /*创建文件夹*/

                    PaperManager.CreateBaseDir(apaper.data.id.ToString() + "EP");
                    textLog.text += "\n创建基文件夹成功!";
                    StartCoroutine(FileDownloadManager());

                    break;

                default:
                    GlobalUIManager.guim.CreateNewDialogBox(apaper.msg);
                    ShowCloseUI();
                    break;
                }
            }
            catch (System.Exception e)
            {
                textLog.text += "\n试卷信息请求失败!" + e.Message;
                GlobalUIManager.guim.CreateNewDialogBox("发生异常!请联系开发者!" + e.Message);
                ShowCloseUI();
            }
        }
        else
        {
            GlobalUIManager.guim.CreateNewDialogBox(uwr.error);
            textLog.text += "\n发生异常!" + uwr.error;
            ShowCloseUI();
        }
    }
    IEnumerator FileDownloadManager()
    {
        allAudiosFiles.Clear();
        processCount = 0;
        tempSize     = 0;
        string basePath = GetPermisson.GetServerAddress + "/Paper/PerperFiles/" + apaper.data.path;

        string[] strs  = apaper.data.partb_audio_anser.Split('/');
        string[] strs1 = apaper.data.partb_audio_ask.Split('/');
        for (int i = 0; i < strs.Length; i++)
        {
            string str = strs[i].Trim();
            // Debug.Log(str);
            if (!string.IsNullOrEmpty(str))
            {
                allAudiosFiles.Add(new KeyValuePair <string, string>(basePath + str, str));
            }
        }
        for (int i = 0; i < strs1.Length; i++)
        {
            string str = strs1[i].Trim();
            if (!string.IsNullOrEmpty(str))
            {
                allAudiosFiles.Add(new KeyValuePair <string, string>(basePath + str, str));
            }
        }
        if (!string.IsNullOrEmpty(apaper.data.partc_audio_name.Trim()))
        {
            allAudiosFiles.Add(new KeyValuePair <string, string>(basePath + apaper.data.partc_audio_name.Trim(), apaper.data.partc_audio_name.Trim()));
        }
        textLog.text += "\n开始下载关键文件...";


        processing = false;
        bool ok = false;

        while (true)
        {
            if (processing)
            {
                yield return(null);
            }

            else
            {
                switch (processCount)
                {
                case 0:
                    if (string.IsNullOrEmpty(apaper.data.parta_video_name.Trim()))
                    {
                        processCount += 1;
                    }
                    else
                    {
                        StartCoroutine(DownloadVideo(
                                           basePath + apaper.data.parta_video_name,
                                           apaper.data.parta_video_name,
                                           delegate() {
                            processing    = false;
                            processCount += 1;
                        }));
                    }
                    break;

                case 1:

                    if (string.IsNullOrEmpty(apaper.data.partb_video_name.Trim()))
                    {
                        processCount += 1;
                    }
                    else
                    {
                        StartCoroutine(DownloadVideo(
                                           basePath + apaper.data.partb_video_name,
                                           apaper.data.partb_video_name,
                                           delegate() {
                            processing    = false;
                            processCount += 1;
                        }));
                    }

                    break;

                case 2:



                    if (allAudiosFiles.Count == 0)
                    {
                        /*创建文件*/
                        textLog.text += "\n创建基础文件...";


                        LuoHaoExamPaper lhep = new LuoHaoExamPaper()
                        {
                            id    = apaper.data.id,
                            time  = System.DateTime.Now.ToString(),
                            paper = apaper.data,
                            size  = GetFileSize(tempSize)
                        };

                        PaperManager.CreateBaseFile(apaper.data.id.ToString() + "EP", lhep);


                        textLog.text += "\n文件写入成功!";
                        textLog.text += "\n试卷已就绪!";
                        textInfo.text = "试卷下载完毕!祝您答题愉快!";
                        ShowCloseUI();
                        ok = true;
                    }

                    else
                    {
                        StartCoroutine(DownloadAudio(allAudiosFiles[0].Key, allAudiosFiles[0].Value, delegate() {
                            processing = false;
                            allAudiosFiles.RemoveAt(0);
                        }));
                    }

                    break;
                }
            }
            if (ok)
            {
                break;
            }
            yield return(null);
        }
    }
 private void Awake()
 {
     pm = this;
 }