Beispiel #1
0
 public BasePage(SolutionWrapper sol, ConvertConfig config)
 {
     InitializeComponent();
     this.sol    = sol;
     this.config = config;
     this.Dock   = DockStyle.Fill;
 }
        public ProjectsAndConfigurationsPage(SolutionWrapper sol, ConvertConfig config)
            : base(sol, config)
        {
            InitializeComponent();

            UpdateCells(sol.Projects);
        }
Beispiel #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();
        }
 public ConvertationPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
     StatusLbl.Text = "";
     generator.LogEvent += new KeilProjectGenerator.LogEventDelegate(generator_LogEvent);
 }
        public ProjectsAndConfigurationsPage(SolutionWrapper sol, ConvertConfig config)
            : base(sol, config)
        {
            InitializeComponent();

            UpdateCells(sol.Projects);
        }
Beispiel #6
0
 public ConvertationPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
     StatusLbl.Text      = "";
     generator.LogEvent += new KeilProjectGenerator.LogEventDelegate(generator_LogEvent);
 }
        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();
        }
Beispiel #8
0
 public BasePage(SolutionWrapper sol, ConvertConfig config)
 {
     InitializeComponent();
     this.sol = sol;
     this.config = config;
     this.Dock = DockStyle.Fill;
 }
Beispiel #9
0
        /// <summary>
        /// Crée un conteneur pour la solution.
        /// </summary>
        /// <param name="actions">Les actions qui peuvent être liées à la solution.</param>
        /// <param name="solution">La solution.</param>
        /// <returns>Le conteneur</returns>
        private SolutionWrapper CreateSolutionWrapper(IEnumerable <KAction> actions, Solution solution)
        {
            var wrapper = new SolutionWrapper(solution);

            wrapper.SetRelatedActions(actions);

            return(wrapper);
        }
Beispiel #10
0
 /// <summary>
 /// Méthode invoquée lors de l'initialisation du viewModel en mode design
 /// </summary>
 protected override Task OnInitializeDesigner()
 {
     Solutions = new SolutionWrapper[]
     {
         new SolutionWrapper(new Solution {
             SolutionDescription = "Mettre une tablette", Investment = 5, Difficulty = 1, Cost = 1, Approved = true, Comments = "blabla"
         })
     };
     return(Task.CompletedTask);
 }
        public void RegisterServiceEndpoints(PluginManifest manifest, IOrganizationService client, TracingHelper t)
        {
            t.Debug($"Entering PluginWrapper.RegisterServiceEndpoints");

            if (manifest.Clobber)
            {
                t.Warning($"Manifest has 'Clobber' set to true. Deleting referenced Plugins before re-registering");
                this.UnregisterServiceEndPoints(manifest, client, t);
            }

            // 1. Register Service Endpoints
            foreach (var serviceEndpoint in manifest.ServiceEndpoints)
            {
                t.Debug($"Registering Assembly {serviceEndpoint.Name}");
                var createdEndpoint = serviceEndpoint.Register(client);
                t.Info($"Assembly {serviceEndpoint.Name} registered with ID {createdEndpoint.Id}");

                SolutionWrapper.AddSolutionComponent(client, manifest.SolutionName, createdEndpoint.Id, ComponentType.ServiceEndpoint);
                t.Debug($"Plugin Step {serviceEndpoint.Name} added to solution {manifest.SolutionName}");

                // 2. Register Steps
                foreach (var step in serviceEndpoint.Steps)
                {
                    t.Debug($"Processing Step = {step.FriendlyName}");

                    var sdkMessage       = GetSdkMessageQuery(step.Message).RetrieveSingleRecord(client);
                    var sdkMessageFilter = GetSdkMessageFilterQuery(step.PrimaryEntity, sdkMessage.Id).RetrieveSingleRecord(client);

                    var createdStep = step.Register(client, createdEndpoint, sdkMessage.ToEntityReference(), sdkMessageFilter.ToEntityReference());
                    t.Info($"Plugin step {step.FriendlyName} registered with ID {createdStep.Id}");

                    if (manifest.SolutionName != null)
                    {
                        SolutionWrapper.AddSolutionComponent(client, manifest.SolutionName, createdStep.Id, ComponentType.SdkMessageProcessingStep);
                        t.Debug($"Plugin Step {step.FriendlyName} added to solution {manifest.SolutionName}");
                    }

                    // 3. register Entity Images
                    if (step.EntityImages == null)
                    {
                        continue;
                    }
                    foreach (var entityImage in step.EntityImages)
                    {
                        t.Debug($"Processing Entity Image = {entityImage.Name}");
                        var createdImage = entityImage.Register(client, createdStep);
                        t.Info($"Entity image {entityImage.Name} registered with ID {createdImage}");
                    }
                }
            }

            t.Debug($"Exiting PluginWrapper.RegisterServiceEndpoints");
        }
Beispiel #12
0
 public SelectProjectPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
     foreach (ProjectWrapper proj in sol.Projects)
     {
         TreeNode node = new TreeNode();
         node.Tag     = proj;
         node.Text    = proj.Name;
         node.Checked = true;
         //node.ImageIndex
         treeView1.Nodes.Add(node);
     }
 }
        public SelectProjectPage(SolutionWrapper sol, ConvertConfig config)
            : base(sol, config)
        {
            InitializeComponent();
            foreach (ProjectWrapper proj in sol.Projects)
	        {
                TreeNode node = new TreeNode();
                node.Tag = proj;
                node.Text = proj.Name;
                node.Checked = true;
                //node.ImageIndex
                treeView1.Nodes.Add(node);
	        }
            
        }
        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();
        }
        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();
        }
Beispiel #16
0
        private async Task UpdateProjectsAsync()
        {
            try
            {
                _logger.Log(String.Empty);
                _logger.Log("**************************************************");
                _logger.Log("     Starting the Project Updating process     ");
                _logger.Log("**************************************************");
                _logger.Log(String.Empty);

                _logger.Log("Solution: {0}", _solutionFileName);

                _solutionWrapper = new SolutionWrapper(_solutionFileName, _selectedVisualStudioVersion, _logger);

                await _solutionWrapper.UpdateTargetFrameworkForProjects(_selectedTargetFramework);
            }
            catch (Exception)
            {
                _logger.Log("~~~~~~ An error occurred while attempting to update all the projects ~~~~~~~");

                if (_solutionWrapper != null)
                {
                    await _solutionWrapper.CloseAsync();
                }
            }
            finally
            {
                BeginUpdateUI(() =>
                {
                    IsUpdatingProjects = false;

                    _logger.Log(String.Empty);
                    _logger.Log("**************************************************");
                    _logger.Log("     Project Updating process is finished     ");
                    _logger.Log("**************************************************");
                    _logger.Log(String.Empty);
                });
            }
        }
        /// <summary>
        /// Sets MFProject for generation
        /// </summary>
        /// <param name="LibCat"></param>
        public void SetSolution(SolutionWrapper Sol)
        {
            cp = new Wizard.Pages.ConvertationPage(Sol, config);
            cp.BuildStartEvent        += new EventHandler(cp_BuildStartEvent);
            cp.BuildStopEvent         += new EventHandler(cp_BuildStopEvent);
            cp.ConvertationStartEvent += new EventHandler(cp_ConvertationStartEvent);
            cp.ConvertationStopEvent  += new EventHandler <ConvertationStopEventArgs>(cp_ConvertationStopEvent);

            //mPageList.Add(new Wizard.Pages.IntroPage());
            //mPageList.Add(new Wizard.Pages.SelectProjectPage(Sol, config));
            mPageList.Add(new Wizard.Pages.ProjectsAndConfigurationsPage(Sol, config));
            mPageList.Add(new Wizard.Pages.SelectPathPage(Sol, config));
            mPageList.Add(new Wizard.Pages.ProcessorPage(Sol, config));
            mPageList.Add(new Wizard.Pages.SummaryPage(Sol, config));
            mPageList.Add(cp);
            mPageList.Add(new Wizard.Pages.ResultPage(Sol, config));

            panel1.Controls.Add(mPageList[0]);
            NameLbl.Text        = mPageList[0].PageName;
            DescriptionLbl.Text = mPageList[0].PageDescription;

            Backbtn.Enabled = false;
        }
        /// <summary>
        /// Sets MFProject for generation
        /// </summary>
        /// <param name="LibCat"></param>
        public void SetSolution(SolutionWrapper Sol)
        {
            cp = new Wizard.Pages.ConvertationPage(Sol, config);
            cp.BuildStartEvent += new EventHandler(cp_BuildStartEvent);
            cp.BuildStopEvent += new EventHandler(cp_BuildStopEvent);
            cp.ConvertationStartEvent += new EventHandler(cp_ConvertationStartEvent);
            cp.ConvertationStopEvent += new EventHandler<ConvertationStopEventArgs>(cp_ConvertationStopEvent);

            //mPageList.Add(new Wizard.Pages.IntroPage());
            //mPageList.Add(new Wizard.Pages.SelectProjectPage(Sol, config));
            mPageList.Add(new Wizard.Pages.ProjectsAndConfigurationsPage(Sol, config));
            mPageList.Add(new Wizard.Pages.SelectPathPage(Sol, config));
            mPageList.Add(new Wizard.Pages.ProcessorPage(Sol, config));
            mPageList.Add(new Wizard.Pages.SummaryPage(Sol, config));            
            mPageList.Add(cp);
            mPageList.Add(new Wizard.Pages.ResultPage(Sol, config));

            panel1.Controls.Add(mPageList[0]);
            NameLbl.Text = mPageList[0].PageName;
            DescriptionLbl.Text = mPageList[0].PageDescription;

            Backbtn.Enabled = false;
        }
Beispiel #19
0
 public SummaryPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
 }
Beispiel #20
0
 public SelectPathPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
     DefaultString = Path.GetDirectoryName(PK.Wrapper.ExpandEnvVars(sol.ProjectPath, "")) + "\\uv2mpw";
 }
        /// <summary>
        /// Loops through each PluginAssembly in the manifest and registers all assemblies, plugins, steps and images
        /// </summary>
        /// <param name="manifest">XML plugin manifest</param>
        /// <param name="client">IOrganizationService client reference</param>
        /// <param name="t">Tracing helpers for logging</param>
        public void RegisterPlugins(PluginManifest manifest, IOrganizationService client, TracingHelper t)
        {
            t.Debug($"Entering PluginWrapper.RegisterPlugins");

            // 0. Validate manifest before continuing
            var manifestValidation = this.Validate(manifest);

            if (!manifestValidation.IsValid)
            {
                t.Critical($"Manifest is invalid and has {manifestValidation.Errors.Count()} errors");
                throw new InvalidManifestException(manifestValidation.ToString());
            }

            if (manifest.Clobber)
            {
                t.Warning($"Manifest has 'Clobber' set to true. Deleting referenced Plugins before re-registering");
                this.UnregisterServiceEndPoints(manifest, client, t);
                this.UnregisterPlugins(manifest, client, t);
            }

            // 1. Register Assemblies
            foreach (var pluginAssembly in manifest.PluginAssemblies)
            {
                t.Debug($"Processing Assembly FriendlyName {pluginAssembly.FriendlyName}");

                if (!File.Exists(pluginAssembly.Assembly))
                {
                    t.Critical($"Assembly {pluginAssembly.Assembly} cannot be found!");
                    continue;
                }

                var targetSolutionName = string.Empty;
                if (!string.IsNullOrEmpty(pluginAssembly.SolutionName))
                {
                    targetSolutionName = pluginAssembly.SolutionName;
                }
                else if (!string.IsNullOrEmpty(manifest.SolutionName))
                {
                    targetSolutionName = manifest.SolutionName;
                }

                t.Debug($"Registering Assembly {pluginAssembly.FriendlyName}");
                var createdAssembly = pluginAssembly.Register(client);
                t.Info($"Assembly {pluginAssembly.FriendlyName} registered with ID {createdAssembly.Id}");

                SolutionWrapper.AddSolutionComponent(client, targetSolutionName, createdAssembly.Id, ComponentType.PluginAssembly);
                t.Debug($"Assembly '{pluginAssembly.FriendlyName}' added to solution {targetSolutionName}");

                if (manifest.UpdateAssemblyOnly)
                {
                    continue;
                }

                // 2a. Register Plugins
                foreach (var plugin in pluginAssembly.Plugins)
                {
                    t.Debug($"PluginType FriendlyName = {plugin.FriendlyName}");
                    var createdPluginType = plugin.Register(client, createdAssembly);
                    t.Info($"Plugin {plugin.FriendlyName} registered with ID {createdPluginType.Id}");

                    if (plugin.Steps != null)
                    {
                        // 2b. Register Plugin Steps
                        foreach (var pluginStep in plugin.Steps)
                        {
                            t.Debug($"Processing Step = {pluginStep.FriendlyName}");

                            var sdkMessage       = GetSdkMessageQuery(pluginStep.Message).RetrieveSingleRecord(client);
                            var sdkMessageFilter = GetSdkMessageFilterQuery(pluginStep.PrimaryEntity, sdkMessage.Id).RetrieveSingleRecord(client);

                            var createdStep = pluginStep.Register(client, createdPluginType, sdkMessage.ToEntityReference(), sdkMessageFilter.ToEntityReference());
                            t.Info($"Plugin step {pluginStep.FriendlyName} registered with ID {createdStep.Id}");

                            SolutionWrapper.AddSolutionComponent(client, targetSolutionName, createdStep.Id, ComponentType.SdkMessageProcessingStep);
                            t.Debug($"Plugin Step '{pluginStep.FriendlyName}' added to solution {targetSolutionName}");

                            // 2c. Register Entity Images
                            if (pluginStep.EntityImages == null)
                            {
                                continue;
                            }
                            foreach (var entityImage in pluginStep.EntityImages)
                            {
                                t.Debug($"Processing Entity Image = {entityImage.Name}");
                                var createdImage = entityImage.Register(client, createdStep);
                                t.Info($"Entity image {entityImage.Name} registered with ID {createdImage.Id}");
                            }
                        }
                    }

                    // 3a. Register Custom APIs
                    if (plugin.CustomApis != null)
                    {
                        // debug: view all apis and children with query - /api/data/v9.1/customapis?$select=uniquename,allowedcustomprocessingsteptype,bindingtype,boundentitylogicalname,description,displayname,executeprivilegename,isfunction,isprivate&$expand=CustomAPIRequestParameters($select=uniquename,name,description,displayname,type,logicalentityname,isoptional),CustomAPIResponseProperties($select=uniquename,name,description,displayname,type,logicalentityname),PluginTypeId($select=plugintypeid,typename,version,name,assemblyname)
                        foreach (var api in plugin.CustomApis)
                        {
                            t.Debug($"Processing Step = {api.FriendlyName}");

                            var createdApi = api.Register(client, createdPluginType);
                            t.Info($"CustomApi {api.FriendlyName} created with ID {createdApi.Id}");

                            SolutionWrapper.AddSolutionComponent(client, targetSolutionName, createdApi.Id, ComponentType.CustomApi);
                            t.Debug($"Custom API '{api.FriendlyName}' added to solution {targetSolutionName}");

                            // 3b. Create/Update Request Parameters
                            if (api.RequestParameters != null)
                            {
                                foreach (var requestParameter in api.RequestParameters)
                                {
                                    t.Debug($"Processing Custom API request parameter '{requestParameter.FriendlyName}'");
                                    var createdParameter = requestParameter.Register(client, createdApi);
                                    t.Info($"Request parameter '{requestParameter.FriendlyName} created with ID {createdParameter.Id}'");

                                    SolutionWrapper.AddSolutionComponent(client, targetSolutionName, createdParameter.Id, ComponentType.CustomApiRequestParameter);
                                    t.Debug($"Request parameter '{requestParameter.FriendlyName}' added to solution {targetSolutionName}");
                                }
                            }

                            // 3c. Create/Update Response Properties
                            if (api.ResponseProperties != null)
                            {
                                foreach (var responseProperty in api.ResponseProperties)
                                {
                                    t.Debug($"Processing Custom API response property '{responseProperty.FriendlyName}'");
                                    var createdProperty = responseProperty.Register(client, createdApi);
                                    t.Info($"Response property '{responseProperty.FriendlyName} created with ID {createdProperty.Id}'");

                                    SolutionWrapper.AddSolutionComponent(client, targetSolutionName, createdProperty.Id, ComponentType.CustomApiResponseProperty);
                                    t.Debug($"Response property '{responseProperty.FriendlyName}' added to solution {targetSolutionName}");
                                }
                            }
                        }
                    }
                }
            }

            t.Debug($"Exiting PluginWrapper.RegisterPlugins");
        }
 public ProcessorPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
 }
        /// <summary>
        /// Create or update security roles
        /// </summary>
        /// <param name="manifest"></param>
        /// <param name="client"></param>
        /// <param name="t"></param>
        /// <param name="publisherPrefix"></param>
        public void CreateSecurityRoles(ConfigurationManifest manifest, IOrganizationService client, TracingHelper t, string publisherPrefix)
        {
            if (manifest.SecurityRoles == null)
            {
                t.Debug($"No security roles in manifest to be processed");
            }
            else
            {
                var rootBusinessUnit = XrmClient.GetRootBusinessUnit(client);

                foreach (var securityRole in manifest.SecurityRoles)
                {
                    var existingRole = GetExistingSecurityRoleQuery(securityRole.Name, rootBusinessUnit)
                                       .RetrieveSingleRecord(client);

                    var role = new Role()
                    {
                        Name           = securityRole.Name,
                        BusinessUnitId = rootBusinessUnit
                    }.CreateOrUpdate(client, GetExistingSecurityRoleQuery(securityRole.Name, rootBusinessUnit));

                    SolutionWrapper.AddSolutionComponent(client, manifest.SolutionName, role.Id, ComponentType.Role);

                    if (securityRole.Privileges == null)
                    {
                        continue;
                    }
                    foreach (var rolePrivilege in securityRole.Privileges)
                    {
                        var retrievePrivilegesByName = new QueryExpression("privilege")
                        {
                            ColumnSet = new ColumnSet(true),
                            Criteria  = new FilterExpression
                            {
                                Conditions =
                                {
                                    new ConditionExpression("name", ConditionOperator.Equal, rolePrivilege)
                                }
                            }
                        };
                        var privilegeId = retrievePrivilegesByName.RetrieveSingleRecord(client);
                        if (privilegeId == null)
                        {
                            t.Warning($"Privilege with name {rolePrivilege} cannot be found. " +
                                      $"{rolePrivilege} for role {securityRole.Name} has been skipped");
                            continue;
                        }

                        var addedPrivilege = new AddPrivilegesRoleRequest()
                        {
                            RoleId     = role.Id,
                            Privileges = new []
                            {
                                new RolePrivilege()
                                {
                                    PrivilegeId = privilegeId.Id,
                                    Depth       = PrivilegeDepth.Global
                                }
                            }
                        };
                        client.Execute(addedPrivilege);
                    }
                }
            }
        }
 public void CopyTemplateFiles(LibraryCategoryWrapper libcat, SolutionWrapper solution, ComponentWrapper template)
 {
     this.m_bw.CopyTemplateFiles(libcat.InnerObject, solution.InnerObject, template.InnerObject);
 }
Beispiel #25
0
 public static bool IsWindowsSolution(SolutionWrapper solution)
 {
     return(0 == string.Compare(solution.Processor.Name, "windows", true));
 }
 public LoadSolutionAsyncCompletedEventArgs(SolutionWrapper Solution)
 {
     this.Solution = Solution;
 }
 /// <summary>
 /// Sync loading of Solution
 /// </summary>
 public SolutionWrapper LoadSolution(ComponentDescriptorWrapper selectedsolution)
 {
     this.m_selectedSolution = selectedsolution;
     this.m_solution = BaseWrapper.Wrap<SolutionWrapper>(this.m_bw.LoadSolutionProj(this.m_selectedSolution.Component.ProjectPath, ""));
     this.m_bw.LoadLibraries(this.m_solution.ProjectPath);
     this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
     this.SetSolutionTransportType(this.m_solution);
     return this.m_solution;
 }
Beispiel #28
0
 private void Build(SolutionWrapper solution, string target)
 {
     this.Build(PK.Wrapper.ExpandEnvVars(Path.GetDirectoryName(solution.ProjectPath) + "\\dotnetmf.proj", ""), target);
 }
Beispiel #29
0
 private void Build(SolutionWrapper solution, string target)
 {
     this.Build(PK.Wrapper.ExpandEnvVars(Path.GetDirectoryName(solution.ProjectPath) + "\\dotnetmf.proj", ""), target);
 }
 public void SaveSolutionProj(SolutionWrapper solution)
 {
     this.m_bw.SaveSolutionProj(solution.InnerObject);
 }
 public void GenerateSolution(SolutionWrapper solution)
 {
     if (string.IsNullOrEmpty(solution.ProjectPath))
     {
         solution.ProjectPath = @"$(SPOCLIENT)\Solutions\" + solution.Name + @"\" + solution.Name + ".settings";
     }
     PK.Wrapper.SaveSolutionProj(solution);
     PK.Wrapper.CreateSolutionDirProj(solution);
     foreach (ProjectWrapper project in solution.Projects)
     {
         PK.Wrapper.SaveProjectProj(project);
         PK.Wrapper.CopyProjFilesFromClone(project, solution);
     }
 }
        void m_worker_DoWork(object sender, DoWorkEventArgs e)
        {
            lock (this.m_bw)
            {
                switch (((BackgroundWorkerType)e.Argument))
                {
                    //Load inventory without solutions
                    case BackgroundWorkerType.LoadInventory:
                        m_worker.ReportProgress(0, "Load Default Build Targets...");
                        this.m_bw.LoadDefaultBuildTargets(this.m_spoClientPath);
                        m_worker.ReportProgress(10, "Load Default Processors...");
                        this.m_bw.LoadDefaultProcessors(this.m_spoClientPath);
                        m_worker.ReportProgress(20, "Load Default Library Categories...");
                        this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                        m_worker.ReportProgress(30, "Load Default Libraries...");
                        this.m_bw.LoadDefaultLibraries(this.m_spoClientPath);
                        this.m_bw.LoadLibraries(Path.Combine(this.m_spoClientPath, "Test\\Native\\Src"));
                        m_worker.ReportProgress(60, "Load Default Assemblies...");
                        this.m_bw.LoadDefaultAssemblies(this.m_spoClientPath);
                        m_worker.ReportProgress(70, "Load Default Features...");
                        this.m_bw.LoadDefaultFeatures(this.m_spoClientPath);

                        //m_worker.ReportProgress(80, "Load Solutions...");
                        //this.m_bw.LoadSolutions(Path.Combine(this.m_spoClientPath, "Solutions"));
                        break;
                    case BackgroundWorkerType.LoadDefaultLibraryCategories:
                        this.m_helper.DefaultInventory.LibraryCategories.Clear();
                        m_worker.ReportProgress(0, "Load Default Library Categories...");
                        m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                        break;
                    case BackgroundWorkerType.LoadDefaultFeatures:
                        this.m_helper.DefaultInventory.Features.Clear();
                        m_worker.ReportProgress(0, "Load Default Features...");
                        m_bw.LoadDefaultFeatures(this.m_spoClientPath);
                        break;
                    case BackgroundWorkerType.LoadDefaultLibraries:
                        this.m_helper.DefaultInventory.Libraries.Clear();
                        m_worker.ReportProgress(40, "Load Default Libraries...");
                        this.m_bw.LoadDefaultLibraries(this.m_spoClientPath);
                        if (this.m_solution != null)
                        {
                            m_worker.ReportProgress(30, "Load Solution Libraries...");
                            this.m_bw.LoadLibraries(this.m_solution.ProjectPath);
                        }
                        this.m_bw.LoadLibraries(Path.Combine(this.m_spoClientPath, "Test\\Native\\Src"));

                        break;

                    case BackgroundWorkerType.LoadSolution:
                        m_worker.ReportProgress(0, "Load Solution Proj...");
                        this.m_solution = BaseWrapper.Wrap<SolutionWrapper>(this.m_bw.LoadSolutionProj(this.m_selectedSolution.Component.ProjectPath, ""));
                        m_worker.ReportProgress(30, "Load Libraries...");
                        this.m_bw.LoadLibraries(this.m_solution.ProjectPath);
                        m_worker.ReportProgress(60, "Load Default Library Categories...");
                        this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                        this.SetSolutionTransportType(this.m_solution);
                        break;


                    //case BackgroundWorkerType.LoadFeatures:
                    //    m_worker.ReportProgress(0, "Load Features...");
                    //    if ((this.m_solution == null) && (this.m_selectedSolution != null))
                    //    {
                    //        m_worker.ReportProgress(10, "Load Solution Proj...");
                    //        this.m_solution = this.m_bw.LoadSolutionProj(this.m_selectedSolution.Component.ProjectPath, "");
                    //    }
                    //    if (Helper.IsWindowsSolution(this.m_solution))
                    //    {
                    //        m_worker.ReportProgress(30, "Load Default Libraries...");
                    //        this.m_bw.LoadDefaultLibraries(this.m_spoClientPath);
                    //        m_worker.ReportProgress(40, "Load Default Library Categories...");
                    //        this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                    //        m_worker.ReportProgress(50, "Load Default Manifest Files...");
                    //        this.m_bw.LoadDefaultManifestFiles(this.m_spoClientPath);
                    //    }
                    //    m_worker.ReportProgress(80, "Load Default Features...");
                    //    this.m_bw.LoadDefaultFeatures(this.m_spoClientPath);
                    //    break;

                    //case BackgroundWorkerType.LoadSolution:
                    //    m_worker.ReportProgress(0, "Load Solution Proj...");
                    //    this.m_solution = this.m_bw.LoadSolutionProj(this.m_selectedSolution.Component.ProjectPath, "");
                    //    m_worker.ReportProgress(30, "Load Libraries...");
                    //    this.m_bw.LoadLibraries(this.m_solution.ProjectPath);
                    //    m_worker.ReportProgress(60, "Load Default Library Categories...");
                    //    this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                    //    break;

                    //case BackgroundWorkerType.LoadProjects:
                    //    if (this.m_inv.ProjectTemplates.Count == 0)
                    //    {
                    //        m_worker.ReportProgress(0, "Load Template Projects...");
                    //        this.m_bw.LoadTemplateProjects(this.m_spoClientPath + @"\ProjectTemplates");
                    //    }
                    //    break;

                    //case BackgroundWorkerType.LoadLibraries:
                    //    m_worker.ReportProgress(0, "Load Default Libraries...");
                    //    this.m_bw.LoadDefaultLibraries(this.m_spoClientPath);
                    //    m_worker.ReportProgress(20, "Load Default Manifest Files...");
                    //    this.m_bw.LoadDefaultManifestFiles(this.m_spoClientPath);
                    //    m_worker.ReportProgress(40, "Load Default Library Categories...");
                    //    this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                    //    m_worker.ReportProgress(80, "Load Default Features...");
                    //    this.m_bw.LoadDefaultFeatures(this.m_spoClientPath);
                    //    break;

                    //case BackgroundWorkerType.LoadProcessors:
                    //    m_worker.ReportProgress(0, "Load Processors...");
                    //    this.m_bw.LoadProcessors(this.m_spoClientPath + @"\DeviceCode\Targets\Native");
                    //    this.m_bw.LoadProcessors(this.m_spoClientPath + @"\DeviceCode\Targets\OS");
                    //    break;

                    //case BackgroundWorkerType.LoadAll:
                    //    m_worker.ReportProgress(0, "Load Default Build Targets...");
                    //    this.m_bw.LoadDefaultBuildTargets(this.m_spoClientPath);
                    //    m_worker.ReportProgress(20, "Load Default Processors...");
                    //    this.m_bw.LoadDefaultProcessors(this.m_spoClientPath);
                    //    m_worker.ReportProgress(30, "Load Default Library Categories...");
                    //    this.m_bw.LoadDefaultLibraryCategories(this.m_spoClientPath);
                    //    m_worker.ReportProgress(40, "Load Default Libraries...");
                    //    this.m_bw.LoadDefaultLibraries(this.m_spoClientPath);
                    //    m_worker.ReportProgress(50, "Load Default Assemblies...");
                    //    this.m_bw.LoadDefaultAssemblies(this.m_spoClientPath);
                    //    m_worker.ReportProgress(60, "Load Default Features...");
                    //    this.m_bw.LoadDefaultFeatures(this.m_spoClientPath);
                    //    //m_worker.ReportProgress(80, "Load Solutions...");
                    //    //this.m_bw.LoadSolutions(this.m_spoClientPath + @"\Solutions");
                    //    break;
                }
            }
            e.Result = e.Argument;
            m_worker.ReportProgress(100, "Ready");
        }
        /// <summary>
        /// Create or update global option sets from ConfigurationManifest
        /// </summary>
        /// <param name="manifest"></param>
        /// <param name="client"></param>
        /// <param name="t"></param>
        /// <param name="publisherPrefix"></param>
        public void CreateGlobalOptionSets(ConfigurationManifest manifest, IOrganizationService client, TracingHelper t, string publisherPrefix)
        {
            if (manifest.OptionSets == null)
            {
                t.Debug($"No global optionsets in manifest to be processed");
            }
            else
            {
                foreach (var optionSet in manifest.OptionSets)
                {
                    t.Debug($"Processing global option set: {optionSet.DisplayName}");

                    var targetOptionSet = new OptionSetMetadata
                    {
                        Name          = string.IsNullOrEmpty(optionSet.SchemaName) ? optionSet.DisplayName.GenerateLogicalNameFromDisplayName(publisherPrefix) : optionSet.SchemaName,
                        DisplayName   = new Label(optionSet.DisplayName, 1033),
                        IsGlobal      = true,
                        OptionSetType = OptionSetType.Picklist,
                    };
                    foreach (var option in optionSet.Items)
                    {
                        targetOptionSet.Options.Add(new OptionMetadata(option.CreateLabelFromString(), null));
                    }

                    bool existingOptionSet;
                    try
                    {
                        var retrieveOptionSet = (RetrieveOptionSetResponse)client.Execute(new RetrieveOptionSetRequest()
                        {
                            Name = optionSet.SchemaName
                        });
                        var retrievedMetadataAttribute = retrieveOptionSet.OptionSetMetadata;
                        targetOptionSet.DisplayName = optionSet.DisplayName == null
                            ? retrievedMetadataAttribute.DisplayName
                            : optionSet.DisplayName.CreateLabelFromString();
                        targetOptionSet.MetadataId = retrievedMetadataAttribute.MetadataId;

                        existingOptionSet = true;
                    }
                    catch (FaultException)
                    {
                        existingOptionSet = false;
                    }

                    if (existingOptionSet)
                    {
                        client.Execute(new UpdateOptionSetRequest()
                        {
                            MergeLabels = true,
                            OptionSet   = targetOptionSet
                        });
                        if (targetOptionSet.MetadataId != null)
                        {
                            SolutionWrapper.AddSolutionComponent(client, manifest.SolutionName, targetOptionSet.MetadataId.Value, ComponentType.OptionSet);
                        }
                    }
                    else
                    {
                        var response = (CreateOptionSetResponse)client.Execute(new CreateOptionSetRequest()
                        {
                            OptionSet = targetOptionSet
                        });
                        SolutionWrapper.AddSolutionComponent(client, manifest.SolutionName, response.OptionSetId, ComponentType.OptionSet);
                    }

                    t.Info($"Successfully processed global option set: {optionSet.DisplayName}");
                }
            }
        }
Beispiel #34
0
 public ResultPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
 }
        private void SetSolutionTransportType(SolutionWrapper solution)
        {
            //0_0  Hardcode from solution wizrad... Can't find any other way
            string str = "";
            string DebuggerPort = this.m_solution.DebuggerPort.ToUpper();
            if (DebuggerPort.StartsWith("COM"))
            {
                str = "USART";
            }
            else if (DebuggerPort.StartsWith("USB"))
            {
                str = "USB";
            }
            else if (DebuggerPort.StartsWith("COM_SOCKET_DBG"))
            {
                str = "SOCKETS";
            }

            foreach (LibraryCategoryWrapper LCW in this.m_helper.GetTransports())
            {
                string Name = LCW.Name.ToUpper().Replace("_PAL", "");
                if (string.Compare(Name, str, true) == 0)
                {
                    solution.TransportType = LCW;
                    break;
                }
            }
        }
 public void CopyProjFilesFromClone(ProjectWrapper proj, SolutionWrapper solution)
 {
     this.m_bw.CopyProjFilesFromClone(proj.InnerObject, solution.InnerObject);
 }
 public SelectPathPage(SolutionWrapper sol, ConvertConfig config)
     : base(sol, config)
 {
     InitializeComponent();
     DefaultString = Path.GetDirectoryName(PK.Wrapper.ExpandEnvVars(sol.ProjectPath, "")) + "\\uv2mpw";
 }
 public void CreateSolutionDirProj(SolutionWrapper solution)
 {
     this.m_bw.CreateSolutionDirProj(solution.InnerObject);
 }