Ejemplo n.º 1
0
        /// <summary>
        /// 解析未经处理的原代码
        /// </summary>
        private void ParseRawContext(string[] rawContext)
        {
            List <string> variableContext = new List <string>();
            List <string> codeContext     = new List <string>();

            int indexOfBEGIN = BlockCipherUtil.FindFirstOf(rawContext, "BEGIN");
            int indexOfEND   = BlockCipherUtil.FindLastOf(rawContext, "END");

            for (int i = 0; i < indexOfBEGIN; i++)
            {
                if (!string.IsNullOrEmpty(rawContext[i]))
                {
                    variableContext.Add(rawContext[i]);
                }
            }
            for (int i = indexOfBEGIN; i <= indexOfEND; i++)
            {
                if (!string.IsNullOrEmpty(rawContext[i]))
                {
                    codeContext.Add(rawContext[i]);
                }
            }

            VariableContext = variableContext.ToArray();
            CodeContext     = codeContext.ToArray();

            RawContext = rawContext;
        }
Ejemplo n.º 2
0
        private int HandleLoopContext(string code, string[] codeContext)
        {
            string[]    loopContext = BlockCipherUtil.GetLoopCodeContext(codeContext);
            LoopHandler handler     = new LoopHandler(this, code, loopContext);

            handler.Run();
            return(BlockCipherUtil.FindLastOf(codeContext, "ENDLOOP"));
        }