Example #1
0
        private static RiverSystemProject LoadProject(string fn, Options arguments)
        {
            var callback = new CommandLineProjectCallback(arguments, _pluginManager);
            var loader   = ProjectHandlerFactory.CreateProjectHandler <RiverSystemProject>(callback);

            callback.OutputFileName = fn;
            Show(String.Format("Opening project file: {0}", fn));
            loader.OpenProject();
            Show("Loading project");
            loader.LoadProject(false);
            Show("Project Loaded");
            var project = loader.ProjectMetaStructure.Project;

            projectHandler = loader;
            return(project);
        }
Example #2
0
        public bool GenerateCode()
        {
            // Create compilationUnit
            var compilationUnit = SyntaxFactory.CompilationUnit();

            // Create a namespace
            var @namespace = SyntaxProjectFactory.CreateNamespace(
                DomainProjectOptions,
                NameConstants.Handlers,
                FocusOnSegmentName,
                false);

            // Create class
            var classDeclaration = SyntaxClassDeclarationFactory.CreateWithInterface(HandlerTypeName, InterfaceTypeName)
                                   .WithLeadingTrivia(SyntaxDocumentationFactory.CreateForHandlers(ApiOperation, FocusOnSegmentName));

            // Create members
            var memberDeclarations = CreateMembers();

            // Add members to class
            classDeclaration = memberDeclarations.Aggregate(
                classDeclaration,
                (current, memberDeclaration) => current.AddMembers(memberDeclaration));

            // Add using statement to compilationUnit
            compilationUnit = compilationUnit.AddUsingStatements(
                ProjectHandlerFactory.CreateUsingList(
                    DomainProjectOptions,
                    FocusOnSegmentName));

            // Add the class to the namespace.
            @namespace = @namespace.AddMembers(classDeclaration);

            // Add namespace to compilationUnit
            compilationUnit = compilationUnit.AddMembers(@namespace);

            // Set code property
            Code = compilationUnit;
            return(true);
        }