예제 #1
0
        public OrderedFiles ClasssifiesAndLoadsFiles()
        {
            /// <summary>method <c>draw</c> renders the point.</summary>
            OrderedFiles myOrderedFiles = new OrderedFiles();

            myOrderedFiles = LanguageRecognizion.classifierProgLang(FilesTool.filesToCheck);
            // label4NumCfiles.Text = Convert.ToString(myOrderedFiles.cFiles.Count);
            return(myOrderedFiles);
        }
        /// <summary>method <c>classifierProgLang</c> orders by extension.</summary>


        public static OrderedFiles classifierProgLang(string[] myFilesToOrder)
        {
            OrderedFiles orderedFilesByLang = new OrderedFiles();

            orderedFilesByLang.cFiles = new List <string>();
            foreach (string item in myFilesToOrder)
            {
                if (Path.GetExtension(item).Equals(".c"))
                {
                    orderedFilesByLang.cFiles.Add(item);
                }
                if (Path.GetExtension(item).Equals(".py"))
                {
                    orderedFilesByLang.pythonFiles.Add(item);
                }
                if (Path.GetExtension(item).Equals(".java"))
                {
                    orderedFilesByLang.javaFiles.Add(item);
                }
            }


            return(orderedFilesByLang);
        }
예제 #3
0
        public void NextPanelBehav()
        {
            switch (PanelIndex)
            {
            //Login Panel
            case 0:
                NextPanel();
                buttonExitProgramEND.Visible = false;
                buttonNextPanel.Visible      = true;

                break;

            //Drag Files panel
            case 1:

                if (listBox1DragFiles.Items.Count == 0)
                {
                    MessageBox.Show("Please Drag files before continuing.", "Alert",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
                else
                {
                    NextPanel();

                    buttonExitPro.Visible = false;
                    buttonBackSFW.Visible = true;
                    MyOF = ClasssifiesAndLoadsFiles();
                    checkBoxCfiles.Text      = $" {Convert.ToString(MyOF.cFiles.Count)} C-Files";
                    checkBoxPythonFiles.Text = $" {Convert.ToString(MyOF.pythonFiles.Count)} Python Files";
                    checkBoxJavaFiles.Text   = $" {Convert.ToString(MyOF.javaFiles.Count)} Java Files";
                    // checkBoxCMakeFiles.Text = $" {Convert.ToString(MyOF.javaFiles.Count)} Java Files";
                }

                break;

            //Select files to be Checked panel.
            case 2:
                if (checkBoxCfiles.Checked == false && checkBoxJavaFiles.Checked == false && checkBoxPythonFiles.Checked == false)
                {
                    MessageBox.Show("Please select files before continuing.", "Alert",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
                else
                {
                    NextPanel();
                    //PopulateResultsPreview();
                    buttonNextPanel.Visible = false;
                }


                break;

            //Select HEST1 OR HEST2
            case 3:
                NextPanel();
                PopulateResultsPreview();

                buttonExitProgramEND.Visible = true;

                break;

            //Generate report to excel.
            case 4:
                break;

            default:
                break;
            }
        }
예제 #4
0
        private void executeGivenFiles(int caseSwitch)
        {
            /// <summary>method <c>draw</c> renders the point.</summary>

            OrderedFiles myOrderedFiles = new OrderedFiles();

            myOrderedFiles = LanguageRecognizion.classifierProgLang(FilesTool.filesToCheck);
            int counterIDSstudensHest1 = 0;

            switch (caseSwitch)
            {
            case 1:
                foreach (string item in myOrderedFiles.cFiles)
                {
                    string lastFolderNameStudenID = Path.GetFileName(Path.GetDirectoryName(item.ToString()));
                    string IdNumberStuden         = Path.GetFileNameWithoutExtension(item);

                    if (isHest1)
                    {
                        (string compilerOutPutComp, bool compiledOk, string compiledFileToCheck) = FilesExecuterHest1.compileFile(item);

                        if (compiledOk)
                        {
                            (string compilerOutPutExec, string execFileOutput, bool compiledSuccsesfully) = FilesExecuterHest1.executeFile(compiledFileToCheck);
                            RevisionResultCfilesHest1.Add(new FileResultHest1(execFileOutput, compiledSuccsesfully, compilerOutPutExec, item, FilesTool.studentIDS[counterIDSstudensHest1], "Kinneret Computer Science"));
                            counterIDSstudensHest1++;
                        }
                        else
                        {
                            RevisionResultCfilesHest1.Add(new FileResultHest1("None", compiledOk, compilerOutPutComp, item, FilesTool.studentIDS[counterIDSstudensHest1], "CS Kinneret"));
                            counterIDSstudensHest1++;
                        }
                    }
                    else    //HEST2
                    {
                        //(string compilerOutPut, string execFileOutput) = FilesExecuterHest2.executeFile(item, textBox1InputParameters.Text);
                        //.executeFile(item);
                        // MessageBox.Show($"Compiler out put:{compilerOutPut}   \n\n   exeFileOutPut:{execFileOutput}");
                        //RevisionResultCfilesHest1.Add(new FileResultHest1(compilerOutPut, execFileOutput, textBoxHEST2ExpectedOutPut.Text));
                        (string OutputFromFile, bool wasSuccessfull, string CompiledFilePath) = FilesExecuterHest2.compileFile(item);
                        if (wasSuccessfull)
                        {
                            foreach (string inputCheck in FilesTool.inputToBeCheckedHest2)
                            {
                                //string s = FilesTool.processFileOutPut(inputCheck);

                                (string execOutput, bool hasErrors, string ErrorsOnExec) = FilesExecuterHest2.executeFile(CompiledFilePath, inputCheck);

                                (bool PassedTEstHest2, string ExpectedTestOutPut) = FilesTool.PassedHest2Test(execOutput, inputCheck);
                                //bool PassedTEstHest2
                                RevisionResultCfilesHest2.Add(new FileResultHest2(execOutput, hasErrors, ErrorsOnExec, PassedTEstHest2, Path.GetFileName(inputCheck), item, FilesTool.studentIDS[counterIDSstudensHest1], ExpectedTestOutPut, "Computer Science"));
                                counterIDSstudensHest1++;
                            }
                        }
                        else
                        {
                            RevisionResultCfilesHest2.Add(new FileResultHest2("none", wasSuccessfull, OutputFromFile, false, "none", item, FilesTool.studentIDS[counterIDSstudensHest1], "None", "Computer Science"));
                            counterIDSstudensHest1++;
                        }
                    }
                }
                break;

            case 2:
                foreach (string item in myOrderedFiles.javaFiles)
                {
                    string lastFolderNameStudenID = Path.GetFileName(Path.GetDirectoryName(item.ToString()));
                    string IdNumberStuden         = Path.GetFileNameWithoutExtension(item);

                    if (isHest1)
                    {
                        (string compilerOutPutComp, bool compiledOk, string compiledFileToCheck) = FilesExecuterHest1.compileFile(item);

                        if (compiledOk)
                        {
                            (string compilerOutPutExec, string execFileOutput, bool compiledSuccsesfully) = FilesExecuterHest1.executeFile(compiledFileToCheck);
                            RevisionResultJavaFilesHest1.Add(new FileResultHest1(execFileOutput, compiledSuccsesfully, compilerOutPutExec, item, FilesTool.studentIDS[counterIDSstudensHest1], "Kinneret Computer Science"));
                            counterIDSstudensHest1++;
                        }
                        else
                        {
                            RevisionResultJavaFilesHest1.Add(new FileResultHest1("None", compiledOk, compilerOutPutComp, item, FilesTool.studentIDS[counterIDSstudensHest1], "CS Kinneret"));
                            counterIDSstudensHest1++;
                        }
                    }
                    else
                    {
                        //(string compilerOutPut, string execFileOutput) = FilesExecuterHest2.executeFile(item, textBox1InputParameters.Text);
                        //.executeFile(item);
                        // MessageBox.Show($"Compiler out put:{compilerOutPut}   \n\n   exeFileOutPut:{execFileOutput}");
                        //RevisionResultCfilesHest1.Add(new FileResultHest1(compilerOutPut, execFileOutput, textBoxHEST2ExpectedOutPut.Text));
                        (string OutputFromFile, bool wasSuccessfull, string CompiledFilePath) = FilesExecuterHest2.compileFile(item);
                        //(string OutputFromFile, bool wasSuccessfull, string CompiledFilePath) = FilesExecuterHest2.compileFile(itemToComp);

                        if (wasSuccessfull)
                        {
                            foreach (string inputCheck in FilesTool.inputToBeCheckedHest2)
                            {
                                //string s = FilesTool.processFileOutPut(inputCheck);

                                (string execOutput, bool HasNoErrors, string ErrorsOnExec) = FilesExecuterHest2.executeFile(CompiledFilePath, inputCheck);

                                (bool PassedTEstHest2, string ExpectedTestOutPut) = FilesTool.PassedHest2Test(execOutput, inputCheck);
                                RevisionResultJavaFilesHest2.Add(new FileResultHest2(execOutput, HasNoErrors, ErrorsOnExec, PassedTEstHest2, Path.GetFileName(inputCheck), item, FilesTool.studentIDS[counterIDSstudensHest1], ExpectedTestOutPut, "Computer Science"));
                            }
                            counterIDSstudensHest1++;
                        }
                        else
                        {
                            RevisionResultJavaFilesHest2.Add(new FileResultHest2("none", wasSuccessfull, OutputFromFile, false, "none", item, FilesTool.studentIDS[counterIDSstudensHest1], "None", "Computer Science"));
                            counterIDSstudensHest1++;
                        }
                    }
                }
                break;

            case 3:
                foreach (string item in myOrderedFiles.pythonFiles)
                {
                    string lastFolderNameStudenID = Path.GetFileName(Path.GetDirectoryName(item.ToString()));
                    string IdNumberStuden         = Path.GetFileNameWithoutExtension(item);


                    if (isHest1)
                    {
                        //(string compilerOutPutExec, string execFileOutput, bool compiledSuccsesfully) = FilesExecuterHest1.executeFile(item);
                        //RevisionResultPythonFilesHest1.Add(new FileResultHest1(execFileOutput, compiledSuccsesfully, compilerOutPutExec, item, FilesTool.studentIDS[counterIDSstudensHest1], "Cs Kinneret"));
                        //counterIDSstudensHest1++;


                        (string compilerOutPutComp, bool compiledOk, string compiledFileToCheck) = FilesExecuterHest1.compileFile(item);

                        if (compiledOk)
                        {
                            (string compilerOutPutExec, string execFileOutput, bool compiledSuccsesfully) = FilesExecuterHest1.executeFile(compiledFileToCheck);
                            RevisionResultPythonFilesHest1.Add(new FileResultHest1(execFileOutput, compiledSuccsesfully, compilerOutPutExec, item, FilesTool.studentIDS[counterIDSstudensHest1], "Cs Kinneret"));
                            counterIDSstudensHest1++;
                        }
                        else
                        {
                            RevisionResultPythonFilesHest1.Add(new FileResultHest1("None", compiledOk, compilerOutPutComp, item, FilesTool.studentIDS[counterIDSstudensHest1], "CS kinneret"));
                            counterIDSstudensHest1++;
                        }
                    }
                    else
                    {
                        (string OutputFromFile, bool wasSuccessfull, string CompiledFilePath) = FilesExecuterHest2.compileFile(item);
                        if (wasSuccessfull)
                        {
                            foreach (string inputCheck in FilesTool.inputToBeCheckedHest2)
                            {
                                (string execOutput, bool hasErrors, string ErrorsOnExec) = FilesExecuterHest2.executeFile(CompiledFilePath, inputCheck);

                                (bool PassedTEstHest2, string ExpectedTestOutPut) = FilesTool.PassedHest2Test(execOutput, inputCheck);
                                RevisionResultPythonFilesHest2.Add(new FileResultHest2(execOutput, hasErrors, ErrorsOnExec, PassedTEstHest2, Path.GetFileName(inputCheck), item, FilesTool.studentIDS[counterIDSstudensHest1], ExpectedTestOutPut, "Computer Science"));
                                counterIDSstudensHest1++;
                            }
                        }
                        else
                        {
                            RevisionResultPythonFilesHest2.Add(new FileResultHest2("none", wasSuccessfull, OutputFromFile, false, "none", item, FilesTool.studentIDS[counterIDSstudensHest1], "None", "Computer Science"));
                            counterIDSstudensHest1++;
                        }
                    }
                }
                break;

            default:
                Console.WriteLine("Error, contact support");
                break;
            }
        }