Inheritance: kOS.ExecutionContext
コード例 #1
0
ファイル: CommandFileIO.cs プロジェクト: itsbth/KOS
        public override void Evaluate()
        {
            String fileName = RegexMatch.Groups[1].Value;
            File   file     = SelectedVolume.GetByName(fileName);

            if (file != null)
            {
                ContextRunProgram runContext = new ContextRunProgram(this);
                Push(runContext);

                if (file.Count > 0)
                {
                    runContext.Run(file);
                    State = ExecutionState.WAIT;
                }
                else
                {
                    State = ExecutionState.DONE;
                }
            }
            else
            {
                throw new kOSException("File not found '" + fileName + "'.");
            }
        }
コード例 #2
0
ファイル: kOSException.cs プロジェクト: Nivekk/KOS
 public kOSException(String message, ExecutionContext context)
     : this(message)
 {
     this.LineNumber = context.Line;
     this.Context = context;
     this.Program = context.FindClosestParentOfType<ContextRunProgram>();
 }
コード例 #3
0
        public override void Evaluate()
        {
            String fileName   = RegexMatch.Groups[1].Value;
            File   file       = SelectedVolume.GetByName(fileName);
            var    parameters = new List <Expression>();

            if (RegexMatch.Groups.Count > 1)
            {
                String paramString = RegexMatch.Groups[3].Value;
                foreach (String param in Utils.ProcessParams(paramString))
                {
                    Expression subEx = new Expression(param, this);
                    parameters.Add(subEx);
                }
            }

            if (file != null)
            {
                ContextRunProgram runContext = new ContextRunProgram(this, parameters, fileName);
                Push(runContext);

                if (file.Count > 0)
                {
                    runContext.Run(file);
                    State = ExecutionState.WAIT;
                }
                else
                {
                    State = ExecutionState.DONE;
                }
            }
            else
            {
                throw new kOSException("File not found '" + fileName + "'.", this);
            }
        }
コード例 #4
0
ファイル: CommandFileIO.cs プロジェクト: BGog/KOS
        public override void Evaluate()
        {
            String fileName = RegexMatch.Groups[1].Value;
            File file = SelectedVolume.GetByName(fileName);

            if (file != null)
            {
                ContextRunProgram runContext = new ContextRunProgram(this);
                Push(runContext);

                if (file.Count > 0)
                {
                    runContext.Run(file);
                    State = ExecutionState.WAIT;
                }
                else
                {
                    State = ExecutionState.DONE;
                }
            }
            else
            {
                throw new kOSException("File not found '" + fileName + "'.");
            }
        }
コード例 #5
0
        public override void Evaluate()
        {
            String fileName = RegexMatch.Groups[1].Value;
            File file = SelectedVolume.GetByName(fileName);
            var parameters = new List<Expression>();

            if (RegexMatch.Groups.Count > 1)
            {
                String paramString = RegexMatch.Groups[3].Value;
                foreach (String param in Utils.ProcessParams(paramString))
                {
                    Expression subEx = new Expression(param, this);
                    parameters.Add(subEx);
                }
            }

            if (file != null)
            {
                ContextRunProgram runContext = new ContextRunProgram(this, parameters);
                Push(runContext);

                if (file.Count > 0)
                {
                    runContext.Run(file);
                    State = ExecutionState.WAIT;
                }
                else
                {
                    State = ExecutionState.DONE;
                }
            }
            else
            {
                throw new kOSException("File not found '" + fileName + "'.");
            }
        }
コード例 #6
0
 public kOSException(String message, ExecutionContext context) : this (message)
 {
     this.LineNumber = context.Line;
     this.Context = context;
     this.Program = context.FindClosestParentOfType<ContextRunProgram>();
 }