コード例 #1
0
        public static bool openTest()
        {
            OpenFileDialog open = new OpenFileDialog()
            {
                Filter = "MEGA test file|*.mgt",
                Title  = "Select test file"
            };

            if (open.ShowDialog() == DialogResult.OK)
            {
                if ((open.FileName != "") && (open.FileName.Contains(".mgt")))
                {
                    testData.clearItems();
                    tmpTest = TmpFile();
                    Crpyt.decrpyt(open.FileName, tmpTest);
                    ReadTestData(tmpTest);
                    openfile = open.FileName;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public static bool LoadQuestions()
        {
            OpenFileDialog open = new OpenFileDialog()
            {
                Filter      = "MEGA question file|*.mgq",
                Title       = "Select question file(s)",
                Multiselect = true
            };

            if (open.ShowDialog() == DialogResult.OK)
            {
                strData.clearItems();
                foreach (string file in open.FileNames)
                {
                    string temp = TmpFile();
                    Crpyt.decrpyt(file, temp);
                    ReadTmpFile(temp);
                    DeleteTmpFile(temp);
                }
                test.max = strData.strQuestion.Count;
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public static bool openQuestion()
        {
            OpenFileDialog open = new OpenFileDialog()
            {
                Filter = "MEGA question file|*.mgq",
                Title  = "Select test file"
            };

            open.ShowDialog();
            if ((open.FileName != "") && (open.FileName.EndsWith(".mgq")))
            {
                string temp = TmpFile();
                Crpyt.decrpyt(open.FileName, temp);
                strData.clearItems();
                ReadTmpFile(temp);

                DeleteTmpFile(temp);
                return(true);
            }
            else
            {
                return(false);
            }
        }