Ejemplo n.º 1
0
        /// <summary>
        /// Collects all controls that represent a function call, and stores their processed
        /// output in a list of FunctionCall objects.
        /// </summary>
        /// <param name="controls"></param>
        /// <returns></returns>
        public FunctionCallsCollection CompileFunctioCallsList(List <IFunctionControl> controls)
        {
            FunctionCallsCollection collection = new FunctionCallsCollection();

            foreach (IFunctionControl control in controls)
            {
                try
                {
                    //only collect if enabled and it represents an actual function call
                    if (control.Enabled && control.ParameterType != FuncParamType.Inherit)
                    {
                        string parameters = control.PullEntry();
                        collection.DefineCall(control.FunctionName, parameters);
                        if (parameters.Length > 0 && parameters != null && parameters != "({})" && parameters != "([])" && parameters != "\"\"")
                        {
                            collection.AddHeaderFile(control.RequiredHeader);
                        }
                    }
                }
                catch (FunctionControlException e)
                {
                    MessageBox.Show(e.Message, Globals.ErrorStrings.FunctionControlErrorTitle);
                }
                catch (ParserException e)
                {
                    MessageBox.Show(e.Message, Globals.ErrorStrings.FunctionControlErrorTitle);
                }
            }

            return(collection);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Collects all controls that represent an inherit command, and stores their processed
        /// output in a list of FunctionCall objects. (yeah, I know. It should probably not be
        /// called a 'FunctionCall' object anymore. Sue me.)
        /// </summary>
        /// <param name="controls"></param>
        /// <returns></returns>
        public FunctionCallsCollection CompileIheritList(List <IFunctionControl> controls)
        {
            FunctionCallsCollection collection = new FunctionCallsCollection();

            foreach (IFunctionControl control in controls)
            {
                try
                {
                    //only collect if it represents an inherit command
                    //control enabled state does not matter
                    if (control.ParameterType == FuncParamType.Inherit)
                    {
                        collection.DefineCall(control.FunctionName, control.PullEntry());
                        if (control.PullEntry() == "0" && !collection.RemoveFlag.ContainsKey(control.FunctionName))
                        {
                            collection.RemoveFlag.Add(control.FunctionName, true);
                        }
                        if (control.PullEntry() == "1" && collection.RemoveFlag.ContainsKey(control.FunctionName))
                        {
                            collection.RemoveFlag.Remove(control.FunctionName);
                            //collection.AddHeaderFile(control.RequiredHeader);
                        }
                    }
                }
                catch (FunctionControlException e)
                {
                    MessageBox.Show(e.Message, Globals.ErrorStrings.FunctionControlErrorTitle);
                }
                catch (ParserException e)
                {
                    MessageBox.Show(e.Message, Globals.ErrorStrings.FunctionControlErrorTitle);
                }
            }

            return(collection);
        }