Beispiel #1
0
        protected virtual bool ExecutePerInterface(InterfaceWithAttributeResult a)
        {
            // Load Macro
            var macroname = GetMacroName(a.TypeName, a.Attribute, out var args, out var outputname);
            var macro     = MacroFactory.GetMacro <MacroTypeVariables>(macroname, a.FsPath, out var errores);

            // Check for errors in macro
            if (macro == null)
            {
                OutputEngine.LogConsoleErrorWrite($"{a.TypeName} : {macroname}");
                foreach (var e in errores)
                {
                    OutputEngine.LogConsoleErrorWrite(e);
                }
                return(false);
            }

            // Execute macro
            var refinterface = args[0].StartsWith("I") ? args[0] : "";
            var refdata      = Engine.GetRecordForSymbol(refinterface);
            var variables    = CreateVariables(a, outputname, a.AttributeList, refdata);
            var res          = macro.Execute(variables, out var error);

            // Check for errors
            if (!res)
            {
                OutputEngine.LogConsoleErrorWrite(error);
            }

            // Write Results

            CurrentProject.WriteResults(variables);
            return(res);
        }
Beispiel #2
0
        private bool ExecutePerClass(ClassWithAttributeResult a)
        {
            // Load Macro
            var macroname = GetMacroName(a.ClassName, a.Attribute, out var args, out var outputname);
            var macro     = MacroFactory.GetMacro <MacroTypeVariables>(macroname, a.FsPath, out var errores);

            // Check for errors in macro
            if (macro == null)
            {
                OutputEngine.LogConsoleErrorWrite($"{a.ClassName} : {macroname}");
                foreach (var e in errores)
                {
                    OutputEngine.LogConsoleErrorWrite(e);
                }
                return(false);
            }

            // Execute macro
            //var refinterface = args[0].StartsWith("I") ? args[0] : "";
            var reftype = args[0] ?? "";
            var refdata = Engine.GetRecordForSymbol(reftype);

            if (refdata == null)
            {
                OutputEngine.ConsoleWrite($"{reftype} is defined outside project. @REFINTERFACE/@REFCLASS will be null.");
            }
            var variables = CreateVariables(a, outputname, a.AttributeList, refdata);
            var res       = macro.Execute(variables, out var error);

            // Check for errors
            if (!res)
            {
                OutputEngine.LogConsoleErrorWrite(error);
            }

            // Write Results

            CurrentProject.WriteResults(variables);
            return(res);
        }