コード例 #1
0
        //private SolutionItem(Package package, Project project) : this(package, project, true) {}

        private SolutionItem(Package package, Project project, bool recursive)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IncrementSettings = new SolutionItemIncrementSettings(this);

            Package = package ?? throw new ArgumentNullException(nameof(package));
            _item   = project ?? throw new ArgumentNullException(nameof(project));
            Name    = project.Name;

            Filename   = project.FileName;
            UniqueName = project.UniqueName;

            if (!string.IsNullOrEmpty(Filename) && string.IsNullOrEmpty(Path.GetExtension(Filename)))
            {
                Filename += Path.GetExtension(project.UniqueName);
            }

            if (string.IsNullOrEmpty(project.FullName))
            {
                ItemType = SolutionItemType.Folder;
                Icon     = IconReader.AddFolderIcon(FolderType.Closed).ToImageSource();
                if (recursive)
                {
                    FillSolutionTree(package, this, project.ProjectItems);
                }
            }
            else
            {
                ItemType = SolutionItemType.Project;
                Icon     = IconReader.AddFileIcon(Filename).ToImageSource();

                GetGlobalVariables();
            }
        }
コード例 #2
0
        public SolutionItem(Package package, Solution solution, bool recursive)
        {
            if (package == null)
            {
                throw (new ArgumentNullException(nameof(package)));
            }

            if (solution == null)
            {
                throw (new ArgumentNullException(nameof(solution)));
            }

            IncrementSettings = new SolutionItemIncrementSettings(this);

            Package    = package;
            _item      = solution;
            ItemType   = SolutionItemType.Solution;
            Icon       = IconReader.AddFileIcon(solution.FileName).ToImageSource();
            Name       = Path.GetFileNameWithoutExtension(solution.FileName);
            Filename   = solution.FileName;
            UniqueName = Name;

            GetGlobalVariables();

            if (recursive)
            {
                FillSolutionTree(package, this, solution.Projects);
            }
        }