Exemplo n.º 1
0
        public override void BeforeCloseOnNext()
        {
            Params.Solution.Projects.Clear();
            foreach (BaseNode BN in _treeView.AllNodes)
            {
                ComponentNode CN = BN as ComponentNode;

                if (CN == null)
                {
                    continue;
                }
                if (!CN.Checked)
                {
                    continue;
                }
                else
                {
                    string str = @"$(SPOCLIENT)\Solutions\" + Params.Solution.Name + @"\";

                    ProjectWrapper Template = FindProjectTemplate(CN.TypedContent);

                    MFProject tmpProj = new MFProject();
                    Template.InnerObject.CopyTo(tmpProj, Params.Solution.Name);
                    if (tmpProj != null)
                    {
                        tmpProj.ProjectPath  = str + Path.GetFileName(tmpProj.Directory) + @"\" + Path.GetFileName(tmpProj.ProjectPath);
                        tmpProj.SettingsFile = str + Params.Solution.Name + ".settings";
                        Params.Solution.Projects.Add(ProjectWrapper.Wrap <ProjectWrapper>(tmpProj));
                    }
                }
            }

            this.OnShowNextBtn(true);
        }
        public Library[] GetLibrariesOfType(LibraryCategory LibraryCategory, MFProject proj, MFSolution solution)
        {
            List <Library> ret = new List <Library>();

            foreach (Inventory inv in m_invs)
            {
                foreach (Library lib in inv.Libraries)
                {
                    if (lib.LibraryCategory != null)
                    {
                        if (string.IsNullOrEmpty(lib.LibraryCategory.Guid))
                        {
                            continue;
                        }

                        if (0 == string.Compare(lib.LibraryCategory.Guid, LibraryCategory.Guid, true))
                        {
                            ret.Add(lib);
                        }
                    }
                }
            }

            return(ret.ToArray());
        }
Exemplo n.º 3
0
        public NewProjectWizard(SolutionWrapper Solution)
        {
            InitializeComponent();

            Param.Solution   = Solution;
            Param.OldProject = null;

            MFProject tmpProj = new MFProject();

            Param.NewProject = ProjectWrapper.Wrap <ProjectWrapper>(tmpProj);

            mPDP             = new ProjectDescriptionPage(Param);
            mPDP.IsCLREvent += new EventHandler <IsCLREventArgs>(mPDP_IsCLREvent);

            mMFP = new ManageFeaturesPage(Param);

            mPageList.Add(new ProjectTemplatePage(Param));
            mPageList.Add(mPDP);
            mPageList.Add(mMFP);
            mPageList.Add(new ManageLibrariesPage(Param));

            foreach (BasePage bp in mPageList)
            {
                bp.ShowBackBtnEvent += new EventHandler <ShowBtnEventArgs>(bp_ShowBackBtnEvent);
                bp.ShowNextBtnEvent += new EventHandler <ShowBtnEventArgs>(bp_ShowNextBtnEvent);
            }

            this.Initialize();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Устанавливает MFProject для генерации
        /// </summary>
        /// <param name="LibCat"></param>
        public void SetProject(MFProject Proj)
        {
            this.Proj = Proj;
            LogRtb.Clear();
            LogAddText(Strings.MFProject + ": " + Proj.Name + "\r\n");
            LogAddText(Strings.Description + ": " + Proj.Description + "\r\n");
            LogAddText(Strings.Documentation + ": " + Proj.Documentation + "\r\n");
            LogAddText(Strings.ProjectPath + ": " + Proj.ProjectPath + "\r\n");

            GeneratedTextTB.Clear();

            m_worker.RunWorkerAsync(this.Proj);
        }
Exemplo n.º 5
0
        public void SetProject(SolutionWrapper Solution, ProjectWrapper Project)
        {
            MFProject tmpProj = new MFProject();

            Project.InnerObject.CopyTo(tmpProj, Solution.Name);

            Param.NewProject = ProjectWrapper.Wrap <ProjectWrapper>(tmpProj);
            Param.OldProject = Project;
            Param.Solution   = Solution;

            if (Project.IsClrProject)
            {
                mPageList.Add(new ManageFeaturesPage(Param));
            }
            mPageList.Add(new ManageLibrariesPage(Param));
            //mPageList.Add(new ManageLibrariesPageTest(Solution, Project, NewProject));

            this.Initialize();
        }
Exemplo n.º 6
0
        public override void BeforeCloseOnNext()
        {
            if (selectedProject != null)
            {
                string str = @"$(SPOCLIENT)\Solutions\" + Params.Solution.Name + @"\";

                MFProject tmpProj = new MFProject();


                selectedProject.InnerObject.CopyTo(tmpProj, Params.Solution.Name);
                if (tmpProj != null)
                {
                    tmpProj.ProjectPath  = str + Path.GetFileName(tmpProj.Directory) + @"\" + Path.GetFileName(tmpProj.ProjectPath);
                    tmpProj.SettingsFile = str + Params.Solution.Name + ".settings";
                }

                Params.NewProject = ProjectWrapper.Wrap <ProjectWrapper>(tmpProj);
            }
        }
Exemplo n.º 7
0
        private Library AutoSelectLibrary(ProjectComboData pcd, LibraryCategory lc)
        {
            Library   defaultLib    = null;
            Library   stubLib       = null;
            Library   bootLoaderLib = null;
            Library   generateLib   = null;
            Library   clrLib        = null;
            bool      fTooManyLibs  = false;
            MFProject proj          = pcd.Proj;


            FeatureAssociation fa = GetFeatureAssociation(lc);

            foreach (Library lib in m_helper.GetLibrariesOfType(lc))
            {
                if (proj.ValidateLibrary(lib, m_solution, m_solutionProc, m_helper))
                {
                    if (m_pcdAll.Proj.Libraries.Contains(new MFComponent(MFComponentType.Library, lib.Name, lib.Guid)))
                    {
                        clrLib = lib;
                    }

                    if (lib.IsStub)
                    {
                        stubLib = lib;
                    }
                    else if (lib.IsBootloaderLibrary())
                    {
                        bootLoaderLib = lib;
                    }
                    else if (lib.Name == c_GenerateTemplateString)
                    {
                        generateLib = lib;
                    }
                    else if (defaultLib == null)
                    {
                        defaultLib = lib;
                    }
                    else if (fa != FeatureAssociation.NotSelected)
                    {
                        // there are now too many libraries for us to choose from
                        // so we can not auto-select unless this is a cloned solution
                        // in which case we will look for common libraries.
                        fTooManyLibs = true;
                    }
                }
            }

            // if the solution is cloned then lets try to choose common libraries where possible
            if (m_solution.m_cloneSolution != null)
            {
                MFProject cloneProj = null;

                // for "all projects" choose the TinyCLR project
                bool fAllProj = (0 == string.Compare(proj.Name, Properties.Resources.AllProjects, true));

                // match libraries from the given project
                foreach (MFProject prj in m_solution.m_cloneSolution.Projects)
                {
                    if (fAllProj)
                    {
                        if (prj.IsClrProject)
                        {
                            cloneProj = prj;
                            break;
                        }
                    }
                    else if (0 == string.Compare(prj.Name, proj.Name, true))
                    {
                        cloneProj = prj;
                        break;
                    }
                }

                // Only match libraries from common projects
                if (cloneProj != null)
                {
                    // search the cloned solution for the common library category
                    foreach (MFComponent cloneLib in cloneProj.Libraries)
                    {
                        Library cl = m_helper.FindLibrary(cloneLib);

                        if (cl == null && m_solution.m_clonedLibraryMap.ContainsKey(cloneLib.Guid.ToUpper()))
                        {
                            cl = m_solution.m_clonedLibraryMap[cloneLib.Guid.ToUpper()];
                        }

                        if (cl != null)
                        {
                            if (cl.HasLibraryCategory && (0 == string.Compare(lc.Guid, cl.LibraryCategory.Guid, true)))
                            {
                                // if the library is a solution dependent library, then choose to generate it (which will
                                // at a later stage copy the code from the clone solution).
                                if (cl.ProjectPath.ToLower().Contains("\\solutions\\" + m_solution.m_cloneSolution.Name.ToLower() + "\\"))
                                {
                                    if (generateLib == null)
                                    {
                                        // it is possible that we haven't created the "Generate Template" library yet.
                                        generateLib = AddGenerateTemplateNode(pcd, lc);
                                    }

                                    if (fa == FeatureAssociation.Selected || fa == FeatureAssociation.None)
                                    {
                                        return(generateLib);
                                    }
                                    else
                                    {
                                        defaultLib = generateLib;
                                    }
                                }
                                ///
                                /// if the associated feature is not selected than use the cloned projects selection
                                /// as the default
                                ///
                                else if (fa != FeatureAssociation.Selected)
                                {
                                    defaultLib = cl;
                                }
                                ///
                                /// If the feature is selected use the cloned projects selection if it is not a stub
                                ///
                                else if (!cl.IsStub)
                                {
                                    return(cl);
                                }
                                break;
                            }
                        }
                    }
                }
            }

            switch (fa)
            {
            case FeatureAssociation.Selected:
                if (proj.IsBootloaderProject())
                {
                    if (bootLoaderLib != null)
                    {
                        return(bootLoaderLib);
                    }
                    else if (lc.IsTransport && m_solution.m_transportType.Equals(lc))
                    {
                        if (!fTooManyLibs)
                        {
                            return(defaultLib);
                        }
                    }
                    else if (stubLib != null)
                    {
                        return(stubLib);
                    }
                    else if (!fTooManyLibs && defaultLib != null && (generateLib == null || !string.IsNullOrEmpty(defaultLib.CustomFilter) || !string.IsNullOrEmpty(defaultLib.ProcessorSpecific.Guid)))
                    {
                        return(defaultLib);
                    }
                }
                else
                {
                    if (!fTooManyLibs && defaultLib != null)
                    {
                        return(defaultLib);
                    }
                    else if (clrLib != null)
                    {
                        return(clrLib);
                    }
                }
                break;

            case FeatureAssociation.NotSelected:
                if (!lc.IsTransport || !m_solution.m_transportType.Equals(lc))
                {
                    return(stubLib);
                }
                break;

            case FeatureAssociation.None:
                // if we don't have a stub library then we should be able to select the appropriate library
                // automatically
                if (proj.IsBootloaderProject())
                {
                    if (bootLoaderLib != null)
                    {
                        return(bootLoaderLib);
                    }
                    else if (stubLib != null)
                    {
                        return(stubLib);
                    }
                    else if (!fTooManyLibs)
                    {
                        return(defaultLib);
                    }
                }
                else if (!fTooManyLibs && defaultLib != null && ((stubLib == null && generateLib == null) || !string.IsNullOrEmpty(defaultLib.CustomFilter) || !string.IsNullOrEmpty(defaultLib.ProcessorSpecific.Guid)))
                {
                    return(defaultLib);
                }
                else if (clrLib != null)
                {
                    return(clrLib);
                }
                break;
            }

            return(null);
        }
        //Hashtable m_symOrderMap  = new Hashtable();
        //Hashtable m_symToNavNode = new Hashtable();


        public ScatterfileWrapper(MFProject project)
        {
            m_project = project;
        }