コード例 #1
0
ファイル: BeginsWith.cs プロジェクト: rtezli/Blitzableiter
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code"></param>
        /// <param name="instructionIndex"></param>
        /// <param name="mStack"></param>
        /// <returns></returns>
        public override bool Execute( AVM1.AVM1Code code, int instructionIndex, CheckMachine.MachineStack mStack )
        {
            if ( mStack.Count < 1 )
                return false;

            CheckMachine.MachineStackEntry e = mStack.Pop();

            if ( e.Type != CheckMachine.MachineStackType.String )
                return false;

            string testValue = (string)e.Value;

            CheckMachine.MachineStackEntry res = new CheckMachine.MachineStackEntry();
            res.Type = CheckMachine.MachineStackType.Boolean;

            if ( testValue.StartsWith( _Match, ( _CaseSensitive ? StringComparison.InvariantCulture : StringComparison.InvariantCultureIgnoreCase ) ) )
            {
                res.Value = ( bool )true;
            }
            else
            {
                res.Value = ( bool )false;
            }
            mStack.Push( res );

            return true;
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code"></param>
        /// <param name="instructionIndex"></param>
        /// <param name="mStack"></param>
        /// <returns></returns>
        public override bool Execute( AVM1.AVM1Code code, int instructionIndex, CheckMachine.MachineStack mStack )
        {
            if ( mStack.Count < 1 )
                return false;

            CheckMachine.MachineStackEntry e = mStack.Pop();

            if ( e.Type != CheckMachine.MachineStackType.Boolean )
                return false;

            bool condition = ( bool )e.Value;

            CheckMachine.MachineStackEntry res = new CheckMachine.MachineStackEntry();
            res.Value = instructionIndex;

            if ( condition )
            {
                res.Type = CheckMachine.MachineStackType.RemoveInstruction;
            }
            else
            {
                res.Type = CheckMachine.MachineStackType.KeepInstruction;
            }
            mStack.Push( res );

            return true;
        }
コード例 #3
0
ファイル: ArgN.cs プロジェクト: rtezli/Blitzableiter
        /// <summary>
        /// 
        /// </summary>
        /// <param name="code"></param>
        /// <param name="instructionIndex"></param>
        /// <param name="mStack"></param>
        /// <returns></returns>
        public override bool Execute( AVM1Code code, int instructionIndex, CheckMachine.MachineStack mStack )
        {
            AVM1DataElement e = new AVM1DataElement();
            // check if we can resolve the argument within the basic block of the instruction
            if ( AVM1.Stack.Trace.TraceArgument( code, instructionIndex, null, _ArgumentNumber, out e ) )
            {
                if ( e.DataType != AVM1DataTypes.AVM_String )
                {
                    return false;
                }
                else
                {
                    CheckMachine.MachineStackEntry se = new CheckMachine.MachineStackEntry();
                    se.Type = CheckMachine.MachineStackType.String;
                    se.Value = e.Value;
                    mStack.Push( se );
                    return true;
                }
            }

            return false;
        }
コード例 #4
0
ファイル: GetVariable.cs プロジェクト: rtezli/Blitzableiter
 /// <summary>
 /// 
 /// </summary>
 /// <param name="code"></param>
 /// <param name="instructionIndex"></param>
 /// <param name="mStack"></param>
 /// <returns></returns>
 public override bool Execute( AVM1.AVM1Code code, int instructionIndex, CheckMachine.MachineStack mStack )
 {
     return true;
 }