Beispiel #1
0
        /// <summary>
        /// Start the compiler
        /// </summary>
        private void StartCompiler()
        {
            CompilerLayout  compiler  = new CompilerLayout();
            WebsiteLayout   website   = new WebsiteLayout();
            AntivirusLayout antivirus = new AntivirusLayout();

            website.SourceDownloaded += Website_SourceDownloaded;
            bool compilerEnabled = false;

            while (!compilerEnabled)
            {
                try
                {
                    website.SaveSource();
                    website.SaveMessage("Compiling...", 'i', website.Source);
                    compiler.CompileSource(website.Source);
                    // Delete the source file
                    File.Delete(Properties.Settings.Default.SourcePath + website.Source + ".cpp");
                    website.SaveMessage("Compiling complete. Linking...", 'i', website.Source);
                    compiler.GenerateExecutable();
                    if (EICARVirusGenerator.Checked)
                    {
                        EICARGenerator(website.Source);
                    }
                    // Delete the object file
                    File.Delete(Properties.Settings.Default.OBJPath + website.Source + ".o");
                    compiler.FinishLayer();
                    website.SaveMessage("Linking complete. Antivirus file scanning...", 'i', website.Source);
                    antivirus.ScanFile(website.Source);
                    antivirus.MakeFileDownloadable();
                    website.SaveMessage("Antivirus scanning complete. No Viruses found. You can download the generated file " + website.Source, 'i', website.Source);
                    compilerEnabled = true;
                }
                catch (CompilerException compilerException)
                {
                    website.SaveMessage(compilerException.Message, compilerException.ErrorType, website.Source);
                }
                catch (VirusFoundException virusFound)
                {
                    website.SaveMessage(virusFound.VirusDetail, 'v', website.Source);
                    // Delete the executable file
                    File.Delete(Properties.Settings.Default.EXEPath + website.Source + ".exe");
                }
                catch (FileNotFoundException fileNotFound)
                {
                }
                catch (NotSupportedException notSupported)
                {
                }
                catch (WebException web)
                {
                }

                /*
                 * website.Source = "";
                 * compiler.Source = "";
                 * antivirus.Source = "";
                 */
            }
        }
        /// <summary>
        /// Start the compiler
        /// </summary>
        private void StartCompiler()
        {
            CompilerLayout compiler = new CompilerLayout();
            WebsiteLayout website = new WebsiteLayout();
            AntivirusLayout antivirus = new AntivirusLayout();
            website.SourceDownloaded += Website_SourceDownloaded;
            bool compilerEnabled = false;
            while (!compilerEnabled)
            {
                try
                {
                    website.SaveSource();
                    website.SaveMessage("Compiling...", 'i', website.Source);
                    compiler.CompileSource(website.Source);
                    // Delete the source file
                    File.Delete(Properties.Settings.Default.SourcePath + website.Source + ".cpp");
                    website.SaveMessage("Compiling complete. Linking...", 'i', website.Source);
                    compiler.GenerateExecutable();
                    if (EICARVirusGenerator.Checked)
                    {
                        EICARGenerator(website.Source);
                    }
                    // Delete the object file
                    File.Delete(Properties.Settings.Default.OBJPath + website.Source + ".o");
                    compiler.FinishLayer();
                    website.SaveMessage("Linking complete. Antivirus file scanning...", 'i', website.Source);
                    antivirus.ScanFile(website.Source);
                    antivirus.MakeFileDownloadable();
                    website.SaveMessage("Antivirus scanning complete. No Viruses found. You can download the generated file " + website.Source, 'i', website.Source);
                    compilerEnabled = true;
                }
                catch (CompilerException compilerException)
                {
                    website.SaveMessage(compilerException.Message, compilerException.ErrorType, website.Source);
                }
                catch (VirusFoundException virusFound)
                {
                    website.SaveMessage(virusFound.VirusDetail, 'v', website.Source);
                    // Delete the executable file
                    File.Delete(Properties.Settings.Default.EXEPath + website.Source + ".exe");
                }
                catch (FileNotFoundException fileNotFound)
                {
                }
                catch (NotSupportedException notSupported)
                {
                }
                catch (WebException web)
                {

                }

                /*
                website.Source = "";
                compiler.Source = "";
                antivirus.Source = "";
                */
            }
        }