Пример #1
0
        /// <summary>
        /// Builds the script.
        /// </summary>
        public void CompileScript()
        {
            dockOutput.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible;
            errorList1.Clear();

            BuildProgressBarItem.EditValue = 0;
            BuildProgressBar.Maximum = scriptBox1.Editor.Document.Lines.Length;

            Compiler = new ScriptParser(scriptBox1.Editor);
            Compiler.OnScriptError += new EventHandler<Keyrox.Scripting.Events.LineErrorEventArgs>(Compiler_OnScriptError);
            Compiler.OnOutputChange += Compiler_OnOutputChange;
            Compiler.OnProgressReport += Compiler_OnProgressReport;

            this.BeginInvoke(new Callback(delegate() {
                SetStatusText("Saving the script...");
                SaveScript();

                CompiledScript = Compiler.Parse();
                ScriptState = CompiledScript == null ? ScriptState.HasErrors : ScriptState.ValidScript;
                if (errorList1.CountErrors() > 0) { dockErrors.Visibility = DevExpress.XtraBars.Docking.DockVisibility.Visible; }
            }));
        }
Пример #2
0
        private void Compilation()
        {
            ScriptReadOnly = true;
            HideSuperTip();
            autoListBox1.Hide();
            ShowOutputWindow();
            lblErrors.Caption = "0"; lblWarnings.Caption = "0";

            ParseProgressBar.BeginUpdate();
            repositoryItemProgressBar1.Maximum = scriptBox1.Editor.Document.Lines.Length;
            ParseProgressBar.EditValue = 0;
            ParseProgressBar.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
            ParseProgressBar.EndUpdate();
            ParseProgressBar.Refresh();
            System.Threading.Thread.Sleep(500);

            errorList1.Clear();
            SetStatusText("Saving the script...");

            if (SaveScript()) {

                Compiler = new ScriptParser(scriptBox1.Editor, TibiaClient);
                Compiler.OnScriptError += Compiler_OnScriptError;
                Compiler.OnOutputChange += Compiler_OnOutputChange;
                Compiler.OnParseComplete += Compiler_OnParseComplete;
                Compiler.OnProgressReport += Compiler_OnProgressReport;

                Compiler.SupressWarnings = CompilerSupressWarnings;
                System.Threading.Thread.Sleep(1000);
                CompiledScript = null;
                Compiler.Parse();

            }
        }