Ejemplo n.º 1
0
        /// <summary>
        /// Get all of the code generators for a repository IE: (Graph, or Project)
        /// </summary>
        /// <param name="settings">Obsolete pass null</param>
        /// <param name="project">Project or graph</param>
        /// <param name="generator"></param>
        /// <param name="diagramItemGenerator"></param>
        /// <param name="includeDisabled"></param>
        /// <returns></returns>
        private static IEnumerable <OutputGenerator> GetCodeGeneratorsForNodes(GeneratorSettings settings,
                                                                               IRepository project,
                                                                               DesignerGeneratorFactory generator, DesignerGeneratorFactory diagramItemGenerator,
                                                                               bool includeDisabled = false)
        {
            yield break;
            // TODO 2.0 IMPORANT: Figure out code generators

            //var diagrams = project.AllOf<IGraphData>();


            //foreach (var diagram in diagrams)
            //{
            //    if (diagram.Precompiled) continue;
            //    if (diagram.Settings.CodeGenDisabled && !includeDisabled) continue;
            //    var items = diagram.AllGraphItems.OfType<IDiagramNodeItem>().Where(p => p.GetType() == generator.DiagramItemType);

            //    foreach (var item in items)
            //    {
            //        if (item.Precompiled) continue;
            //        var codeGenerators = generator.GetGenerators(settings, null, project, item);
            //        foreach (var codeGenerator in codeGenerators)
            //        {
            //            // TODO had to remove this?
            //            //if (!codeGenerator.IsEnabled(project)) continue;
            //            codeGenerator.AssetDirectory = diagram.Project.SystemDirectory;
            //            codeGenerator.Settings = settings;
            //            if (codeGenerator.ObjectData == null)
            //                codeGenerator.ObjectData = item;
            //            codeGenerator.GeneratorFor = diagramItemGenerator.DiagramItemType;
            //            yield return codeGenerator;
            //        }
            //    }
            //}
        }
Ejemplo n.º 2
0
        private static IEnumerable <OutputGenerator> GetAllCodeGeneratorsForItems(IGraphConfiguration graphConfiguration,
                                                                                  DesignerGeneratorFactory[] graphItemGenerators, IDataRecord[] items, bool includeDisabled = false)
        {
            foreach (var graphItemGenerator in graphItemGenerators)
            {
                DesignerGeneratorFactory generator = graphItemGenerator;
                // If its a generator for the entire diagram
                foreach (var item in items)
                {
                    if (generator.DiagramItemType.IsAssignableFrom(item.GetType()))
                    {
                        var codeGenerators = generator.GetGenerators(graphConfiguration, item);
                        foreach (var codeGenerator in codeGenerators)
                        {
                            if (!includeDisabled && !codeGenerator.IsValid())
                            {
                                continue;
                            }
                            // TODO Had to remove this?
                            //if (!codeGenerator.IsEnabled(prsteroject)) continue;

                            codeGenerator.AssetDirectory = graphConfiguration.CodeOutputPath;
                            //codeGenerator.Settings = settings;
                            if (codeGenerator.ObjectData == null)
                            {
                                codeGenerator.ObjectData = item;
                            }
                            codeGenerator.GeneratorFor = graphItemGenerator.DiagramItemType;
                            yield return(codeGenerator);
                        }
                    }
                }
            }
        }