Example #1
0
        public bool Equals(RegistryImport other)
        {
            if (Type == null) return false;

            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Prefix, Prefix) && Equals(other.Type, Type);
        }
Example #2
0
        public void SetUp()
        {
            registry1 = new FubuRegistry();
            registry1.Actions.IncludeType <RegistryImportEndpoint>();

            theImport = new RegistryImport
            {
                Prefix   = "area1",
                Registry = registry1
            };

            graph2 = BehaviorGraph.BuildFrom(x => {
                x.Actions.IncludeType <TestController>();
            });

            theImport.InitializeSettings(graph2);
            graph2.As <IChainImporter>().Import(theImport.BuildChains(graph2));
        }
        public void SetUp()
        {
            registry1 = new FubuRegistry();
            registry1.Actions.IncludeType<RegistryImportEndpoint>();

            theImport = new RegistryImport
            {
                Prefix = "area1",
                Registry = registry1
            };

            graph2 = BehaviorGraph.BuildFrom(x => {
                x.Actions.IncludeType<TestController>();
            });

            theImport.InitializeSettings(graph2);
            graph2.As<IChainImporter>().Import(theImport.BuildChains(graph2, new PerfTimer()).Result());
        }
Example #4
0
        private void ImportFilesInComponent(TreeNode node, XmlNode componentNode, string[] files)
        {
            if (componentNode.Name == "Component")
            {
                bool mustExpand = (node.Nodes.Count == 0);

                CurrentTreeView.SuspendLayout();

                bool foundReg = false;
                foreach (string file in files)
                {
                    if (Path.GetExtension(file).ToLower() == ".reg")
                    {
                        foundReg = true;
                        break;
                    }
                }

                bool importRegistryFiles = false;
                if (foundReg == true)
                {
                    DialogResult result = MessageBox.Show(this, "Import Registry (*.reg) files to Registry elements?", "Import?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }
                    else if (result == DialogResult.Yes)
                    {
                        importRegistryFiles = true;
                    }
                }

                WixFiles.UndoManager.BeginNewCommandRange();
                StringBuilder errorMessageBuilder = new StringBuilder();

                foreach (string file in files)
                {
                    FileInfo fileInfo = new FileInfo(file);
                    try
                    {
                        if (fileInfo.Extension.ToLower() == ".reg" && importRegistryFiles)
                        {
                            RegistryImport regImport = new RegistryImport(WixFiles, fileInfo, componentNode);
                            regImport.Import(node);
                        }
                        else
                        {
                            FileImport fileImport = new FileImport(WixFiles, fileInfo, componentNode);
                            fileImport.Import(node);
                        }
                    }
                    catch (WixEditException ex)
                    {
                        errorMessageBuilder.AppendFormat("{0} ({1})\r\n", fileInfo.Name, ex.Message);
                    }
                    catch (Exception ex)
                    {
                        string        message = String.Format("An exception occured during the import of \"{0}\"! Please press OK to report this error to the WixEdit website, so this error can be fixed.", fileInfo.Name);
                        ExceptionForm form    = new ExceptionForm(message, ex);
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            ErrorReporter reporter = new ErrorReporter();
                            reporter.Report(ex);
                        }
                    }
                }

                if (errorMessageBuilder.Length > 0)
                {
                    MessageBox.Show(this, "Import failed for the following files:\r\n\r\n" + errorMessageBuilder.ToString(), "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                ShowNode(componentNode);

                if (mustExpand)
                {
                    node.Expand();
                }

                CurrentTreeView.ResumeLayout();
            }
        }
Example #5
0
 public bool Equals(RegistryImport other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Prefix, Prefix) && Equals(other.Registry.GetType(), Registry.GetType());
 }
Example #6
0
        public void AddImport(RegistryImport import)
        {
            if (HasImported(import.Registry)) return;

            _imports.Add(import);
        }
Example #7
0
        }               //

        /// <summary>
        /// May be workaround, may be permanent, getting combined
        /// </summary>
        /// <param name="parentUid"></param>
        /// <param name="alignmentType"></param>
        /// <returns></returns>
        public static List <CredentialAlignmentObjectProfile> GetAllAs_CredentialAlignmentObjectProfile(Guid parentUid, ref Dictionary <string, RegistryImport> frameworksList)
        {
            CredentialAlignmentObjectProfile        entity = new CredentialAlignmentObjectProfile();
            List <CredentialAlignmentObjectProfile> list   = new List <CredentialAlignmentObjectProfile>();
            //var frameworksList = new Dictionary<string, RegistryImport>();
            string prevFramework = "";
            Entity parent        = EntityManager.GetEntity(parentUid);

            if (parent == null || parent.Id == 0)
            {
                return(list);
            }
            try
            {
                using (var context = new ViewContext())
                {
                    /*
                     * List<DBEntity> results = context.Entity_Competency
                     *              .Where( s => s.EntityId == parent.Id
                     *              )
                     *              .OrderBy( s => s.CompetencyFramework )
                     *              .ThenBy( s => s.TargetNodeName )
                     *              .ToList();
                     * if ( results != null && results.Count > 0 )
                     * {
                     *      foreach ( DBEntity item in results )
                     *      {
                     *              entity = new CredentialAlignmentObjectProfile();
                     *              MapFromDB( item, entity );
                     *              list.Add( entity );
                     *      }
                     * }
                     */
                    List <Views.EntityCompetencyFramework_Items_Summary> results = context.EntityCompetencyFramework_Items_Summary
                                                                                   .Where(s => s.EntityId == parent.Id
                                                                                          )
                                                                                   .OrderBy(s => s.FrameworkName)
                                                                                   .ThenBy(s => s.Competency)
                                                                                   .ToList();
                    if (results != null && results.Count > 0)
                    {
                        foreach (var item in results)
                        {
                            entity = new CredentialAlignmentObjectProfile();
                            MapFromDB(item, entity);
                            if (prevFramework != entity.FrameworkName)
                            {
                                if (!string.IsNullOrWhiteSpace(entity.FrameworkCtid))
                                {
                                    //var fw = new Dictionary<string, RegistryImport>();
                                    RegistryImport ri = ImportManager.GetByCtid(entity.FrameworkCtid);
                                    if (frameworksList.ContainsKey(entity.FrameworkName) == false)
                                    {
                                        frameworksList.Add(entity.FrameworkName, ri);
                                    }
                                }
                                prevFramework = entity.FrameworkName;
                            }

                            list.Add(entity);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".GetAllAs_CredentialAlignmentObjectProfile");
            }
            return(list);
        }        //