/// <summary>
        /// Returns a TDIL directive that represents the given action <paramref name="instruction"/> string based on the given
        /// associated <paramref name="translationInstruction"/>.
        /// </summary>
        /// <param name="instruction">Instruction string to convert</param>
        /// <param name="translationInstruction">Translation instruction to convert the instruction</param>
        /// <returns>TDIL directive</returns>
        /// <exception cref="ArgumentNullException">If any argument is NULL</exception>
        public string ToDirective(string instruction, IBuddyTranslationInstruction translationInstruction)
        {
            if (string.IsNullOrEmpty(instruction))
            {
                throw new ArgumentNullException(nameof(instruction));
            }
            if (translationInstruction == null)
            {
                throw new ArgumentNullException(nameof(translationInstruction));
            }

            using (ParameterAdjustmentTable pat = ParameterAdjustmentTable.Create()) {
                string processedInstruction = pat.Process(instruction);

                Dictionary <string, IPatternParameter> paramCache = new Dictionary <string, IPatternParameter>();
                IInstructionEvaluationResult           evaRslt    = _instructionEvaluator.Evaluate(processedInstruction, _instructionTable[translationInstruction], paramCache);
                if (evaRslt.IsError)
                {
                    // TODO
                }

                string result = _instructionFormatter.ToString(translationInstruction, paramCache);
                return(result);
            }
        }
Exemplo n.º 2
0
            private string SelectAdjustmentValue(string adjustmentReference)
            {
                if (string.IsNullOrEmpty(adjustmentReference))
                {
                    return(null);
                }

                ParameterAdjustmentTable pat = ParameterAdjustmentTable.Current;

                if (pat == null)
                {
                    return(null);
                }

                string adjustmentValue = pat.GetValue(adjustmentReference);

                return(adjustmentValue);
            }