Пример #1
0
        public SolutionFolderNode(SolutionFolder solutionFolder, IconProvider iconProvider)
            : base(solutionFolder.FilePath)
        {
            this.SolutionFolder = solutionFolder;
            this._iconProvider = iconProvider;
            Text = solutionFolder.Name;
            UpdateTextOnFilePathChanged = false;

            AddStub();

            ImageIndex = SelectedImageIndex = (_iconProvider = iconProvider).GetImageIndex(solutionFolder);

            solutionFolder.Nodes.InsertedItem += Nodes_InsertedItem;
            solutionFolder.Nodes.RemovedItem += Nodes_RemovedItem;
            solutionFolder.FilePathChanged += solutionFolder_FilePathChanged;
        }
Пример #2
0
        public CreateProjectDialog(SolutionFolder parentFolder)
        {
            InitializeComponent();
            SetupMuiComponents();

            checkBox1.Checked = checkBox1.Visible = parentFolder == null;

            _parentFolder = parentFolder;

            if (parentFolder == null)
                directoryTextBox.Text = LiteDevelopSettings.Instance.GetValue("Projects.DefaultProjectsPath");
            else
                directoryTextBox.Text = parentFolder.FilePath.HasExtension ? parentFolder.FilePath.ParentDirectory.FullPath : parentFolder.FilePath.FullPath;

            List<TreeNode> rootNodes = new List<TreeNode>();
            foreach (var entry in LanguageDescriptor.RegisteredLanguages)
            {
                if (entry.Templates.FirstOrDefault(x => x is ProjectTemplate) != null)
                {
                    var node = GetLanguageOrderNode(rootNodes, entry.LanguageOrder);
                    node.Nodes.Add(new TreeNode(entry.Name) { Tag = entry });
                    node.Expand();
                }
            }
            languagesTreeView.Nodes.AddRange(rootNodes.ToArray());

            templatesListView.SmallImageList = new ImageList()
            {
                ColorDepth = ColorDepth.Depth32Bit,
                ImageSize = new Size(24, 24),
            };

            templatesListView.LargeImageList = new ImageList()
            {
                ColorDepth = ColorDepth.Depth32Bit,
                ImageSize = new Size(32, 32),
            };
        }
Пример #3
0
        private SolutionFolder ReadProjectEntry(Solution parent, Match match)
        {
            string path = match.Groups["HintPath"].Value;
            SolutionFolder entry;

            Guid typeID = Guid.Parse(match.Groups["TypeGuid"].Value);

            if (typeID == SolutionFolder.SolutionFolderGuid)
            {
                entry = new SolutionFolder();
            }
            else
            {
                entry = new ProjectEntry();
            }

            entry.TypeGuid = typeID;
            entry.Name = match.Groups["Name"].Value;
            entry.FilePath = new FilePath(parent.FilePath.ParentDirectory.FullPath, match.Groups["HintPath"].Value);
            entry.ObjectGuid = Guid.Parse(match.Groups["ProjectGuid"].Value);

            ReadNextLine();

            Match sectionMatch;
            while (IsAtSection(out sectionMatch))
            {
                entry.Sections.Add(ReadSection(sectionMatch));
                ReadNextLine();
            }

            if (_currentLine != "EndProject")
                ThrowSyntaxError("Expected \"EndProject\" keyword.");

            return entry;
        }
Пример #4
0
        public static ProjectFileEntry SearchProjectFileEntry(SolutionFolder folder, FilePath path)
        {
            foreach (var node in folder.Nodes)
            {
                if (node is ProjectEntry)
                {
                    var projectEntry = node as ProjectEntry;
                    if (projectEntry.HasProject)
                    {
                        var fileEntry = projectEntry.Project.GetProjectFile(path.FullPath, false);
                        if (fileEntry != null)
                            return fileEntry;
                    }
                }

                if (node is SolutionFolder)
                {
                    var fileEntry = SearchProjectFileEntry(node as SolutionFolder, path);
                    if (fileEntry != null)
                        return fileEntry;
                }
            }

            return null;
        }
Пример #5
0
        private static ProjectFileEntry FindProjectFile(SolutionFolder folder, FilePath path)
        {
            if (folder is ProjectEntry)
            {
                var projectEntry = folder as ProjectEntry;
                if (projectEntry.HasProject)
                {
                    var file = projectEntry.Project.GetProjectFile(path.FullPath, false);
                    if (file != null)
                        return file;
                }
            }

            foreach (var subFolder in folder.Nodes)
            {
                if (subFolder is SolutionFolder)
                {
                    var file = FindProjectFile(subFolder as SolutionFolder, path);
                    if (file != null)
                        return file;
                }
            }

            return null;
        }