Ejemplo n.º 1
0
        public static void WriteToFile(string file, FileMode fileMode, ScriptSection section)
        {
            List <ScriptSection> sections = new List <ScriptSection>();

            sections.Add(section);
            WriteToFile(file, fileMode, sections);
        }
Ejemplo n.º 2
0
        public static ParserError New(string origText, string errMsg, Exception ex, ScriptSection scriptSection, CommandLine commandLine)
        {
            ParserError parserErr = new ParserError()
            {
                OriginalText  = origText,
                ErrorMessage  = errMsg,
                Exception     = ex,
                ScriptSection = scriptSection,
                CommandLine   = commandLine
            };

            return(parserErr);
        }
Ejemplo n.º 3
0
        public static ParserError New(string origText, string errMsg, Exception ex, ScriptSection scriptSection, CommandLine commandLine)
        {
            ParserError parserErr = new ParserError()
            {
                OriginalText = origText,
                ErrorMessage = errMsg,
                Exception = ex,
                ScriptSection = scriptSection,
                CommandLine = commandLine
            };

            return parserErr;
        }
Ejemplo n.º 4
0
        private static void ExecuteEngineScript(ScriptSection section)
        {
            // TODO: refactor
            throw new NotImplementedException();

            //int lineNumber = 0;

            //try
            //{
            //    foreach (CommandLine line in section.Lines)
            //    {
            //        // increment the line number regardless of the CommandLineType
            //        lineNumber++;

            //        if (line.CommandLineType == CommandLineTypes.Command)
            //        {
            //            switch (line.Command.ToUpper())
            //            {
            //                case "EXEC":
            //                    // arg 0 --> path of script file to execute
            //                    ExecuteScript(line.Arguments[0]);
            //                    break;

            //                case "WAV":
            //                    // arg 0 --> custom / friendly stream name
            //                    // arg 1 --> path to WAV file
            //                    WavSounds.LoadStream(line.Arguments[0], line.Arguments[1]);
            //                    break;

            //                case "CONFIG":
            //                    // arg 0 --> path of configuration file to load
            //                    Settings.LoadEngineSettingsFile(line.Arguments[0]);
            //                    break;

            //                case "RENDERMODE":
            //                    // arg 0 --> ToString() value of GridRenderMode to use
            //                    Engine.RenderMode = (GridRenderMode)Enum.Parse(
            //                        typeof(GridRenderMode), line.Arguments[0], true);
            //                    break;

            //                case "RESOLUTION":
            //                    // arg 0 --> width in pixels
            //                    // arg 1 --> height in pixels
            //                    ScreenResolution.SetScreenResolution(
            //                        new Size(int.Parse(line.Arguments[0]), int.Parse(line.Arguments[1])));
            //                    break;

            //                case "CURSOR":
            //                    // arg 0 --> path to cursor file
            //                    Cursors.SetCursor(line.Arguments[0]);
            //                    break;

            //                default:
            //                    throw new ArgumentException("Invalid [ENGINE] Command in statement: "
            //                        + line.ToString() + " at line " + lineNumber.ToString());
            //            }
            //        }
            //    }
            //}
            //catch (Exception e)
            //{
            //    throw new ParserException(lineNumber, section.ToString(),
            //        "Error executing [ENGINE] script", e);
            //}
        }
Ejemplo n.º 5
0
 public static void WriteToFile(string file, FileMode fileMode, ScriptSection section)
 {
     List<ScriptSection> sections = new List<ScriptSection>();
     sections.Add(section);
     WriteToFile(file, fileMode, sections);
 }
Ejemplo n.º 6
0
 public ScriptReadableBase(ScriptSection script)
 {
     _script = script;
 }
Ejemplo n.º 7
0
        private static void ExecuteEngineScript(ScriptSection section)
        {
            // TODO: refactor
            throw new NotImplementedException();

            //int lineNumber = 0;

            //try
            //{
            //    foreach (CommandLine line in section.Lines)
            //    {
            //        // increment the line number regardless of the CommandLineType
            //        lineNumber++;

            //        if (line.CommandLineType == CommandLineTypes.Command)
            //        {
            //            switch (line.Command.ToUpper())
            //            {
            //                case "EXEC":
            //                    // arg 0 --> path of script file to execute
            //                    ExecuteScript(line.Arguments[0]);
            //                    break;

            //                case "WAV":
            //                    // arg 0 --> custom / friendly stream name
            //                    // arg 1 --> path to WAV file
            //                    WavSounds.LoadStream(line.Arguments[0], line.Arguments[1]);
            //                    break;

            //                case "CONFIG":
            //                    // arg 0 --> path of configuration file to load
            //                    Settings.LoadEngineSettingsFile(line.Arguments[0]);
            //                    break;

            //                case "RENDERMODE":
            //                    // arg 0 --> ToString() value of GridRenderMode to use
            //                    Engine.RenderMode = (GridRenderMode)Enum.Parse(
            //                        typeof(GridRenderMode), line.Arguments[0], true);
            //                    break;

            //                case "RESOLUTION":
            //                    // arg 0 --> width in pixels
            //                    // arg 1 --> height in pixels
            //                    ScreenResolution.SetScreenResolution(
            //                        new Size(int.Parse(line.Arguments[0]), int.Parse(line.Arguments[1])));
            //                    break;

            //                case "CURSOR":
            //                    // arg 0 --> path to cursor file
            //                    Cursors.SetCursor(line.Arguments[0]);
            //                    break;

            //                default:
            //                    throw new ArgumentException("Invalid [ENGINE] Command in statement: "
            //                        + line.ToString() + " at line " + lineNumber.ToString());
            //            }
            //        }
            //    }
            //}
            //catch (Exception e)
            //{
            //    throw new ParserException(lineNumber, section.ToString(),
            //        "Error executing [ENGINE] script", e);
            //}
        }
Ejemplo n.º 8
0
 public ScriptReadableBase(ScriptSection script)
 {
     _script = script;
 }