Пример #1
0
        /// <summary>
        /// Enclose method first parameter with an encoder method
        /// </summary>
        public static void AddEncoderMethodToMethodFirstParameter(ref string jsCode, string methodFullName, string encoderMethodName)
        {
            string    encodingMethod = encoderMethodName + _JSMethodStart;
            int       index          = 0;
            TextRange position;

            do
            {
                // Find property position
                position = JSParser.FindMethodFirstParameterRange(ref jsCode, methodFullName, index);

                // There is no more property
                if (position.Start == -1)
                {
                    break;
                }

                // Next search
                index = position.Start;

                if (position.End >= 0)
                {
                    // Set next searching position
                    index = position.End + encodingMethod.Length;

                    // We should add method end then add method name
                    jsCode = jsCode.Insert(position.End, _JSMethodEnd);
                    jsCode = jsCode.Insert(position.Start, encodingMethod);
                }
            }while (index != -1);
        }