Пример #1
0
 private void SaveAll()
 {
     for (int i = 0; i < listBox1.Items.Count; i++)
     {
         FileHandler.CreateFileAbsolute(OpenedFilesHandles.GetFullName(i), OpenedFilesHandles.GetText(i));
     }
     toolStripStatusLabel1.Text = "Saved all changes successfully";
 }
Пример #2
0
        /// <summary>
        /// This will compile all the files found in OpenedFiles list.
        /// You must open all the files you want to compile before using this.
        /// </summary>
        public static void CompileAll(out int exitCode, out string errorsOutput)
        {
            //This is the object used to start the process
            ProcessStartInfo startInfo = new ProcessStartInfo();

            //Constructing compiler arguments
            string Arguments = "-o " + FullCompilerOutputPath + FullCompilerOutputName;

            for (int i = 0; i < OpenedFilesHandles.OpenedFilesCount; i++)
            {
                Arguments += " " + OpenedFilesHandles.GetFullName(i);
            }

            //Put in the object arguments as a full string
            startInfo.Arguments = Arguments;

            //The excutable to run, including the comlpete path
            startInfo.FileName = FullCompilerPath;

            //No window for compilation
            startInfo.WindowStyle    = ProcessWindowStyle.Hidden;
            startInfo.CreateNoWindow = true;

            //Redirect errors to me
            startInfo.RedirectStandardError = true;
            startInfo.UseShellExecute       = false;

            using (Process process = Process.Start(startInfo))
            {
                StreamReader errors = process.StandardError;

                process.WaitForExit();

                errorsOutput = errors.ReadToEnd();
                exitCode     = process.ExitCode;
            }
        }