Example #1
0
		// Copy constructor required by BusyDialog
		public CompileError(CompileError cloneFrom)
			: base(cloneFrom)
		{
		}
Example #2
0
        /// <summary>
        /// Preprocesses and then compiles the script using the supplied headers.
        /// </summary>
        public void CompileScript(Script script, List<Script> headers, CompileMessages errors, bool isRoomScript)
        {
            IPreprocessor preprocessor = CompilerFactory.CreatePreprocessor(AGS.Types.Version.AGS_EDITOR_VERSION);
            DefineMacrosAccordingToGameSettings(preprocessor);

            List<string> preProcessedCode = new List<string>();
            foreach (Script header in headers)
            {
                preProcessedCode.Add(preprocessor.Preprocess(header.Text, header.FileName));
            }

            preProcessedCode.Add(preprocessor.Preprocess(script.Text, script.FileName));

            #if DEBUG
            // TODO: REMOVE BEFORE DISTRIBUTION
            /*			if (true)
            {
                string wholeScript = string.Join("\n", preProcessedCode.ToArray());
                IScriptCompiler compiler = CompilerFactory.CreateScriptCompiler();
                CompileResults output = compiler.CompileScript(wholeScript);
                preprocessor.Results.AddRange(output);
            }*/
            #endif

            if (preprocessor.Results.Count > 0)
            {
                foreach (AGS.CScript.Compiler.Error error in preprocessor.Results)
                {
                    CompileError newError = new CompileError(error.Message, error.ScriptName, error.LineNumber);
                    if (errors == null)
                    {
                        throw newError;
                    }
                    errors.Add(newError);
                }
            }
            else
            {
                Factory.NativeProxy.CompileScript(script, preProcessedCode.ToArray(), _game, isRoomScript);
            }
        }
Example #3
0
 // Copy constructor required by BusyDialog
 public CompileError(CompileError cloneFrom)
     : base(cloneFrom)
 {
 }