예제 #1
0
        private void InitializeAssetTree()
        {
            AssetsTreeView.Nodes.Clear();

            //If no project loaded just abort
            if (!m_projectLoaded)
            {
                return;
            }

            var stack   = new Stack <TreeNode>();
            var rootDir = new DirectoryInfo(m_assetsDirectory);
            var node    = new TreeNode(rootDir.Name)
            {
                Tag = rootDir
            };

            stack.Push(node);

            while (stack.Count > 0)
            {
                var currentNode   = stack.Pop();
                var directoryInfo = (DirectoryInfo)currentNode.Tag;
                foreach (var directory in directoryInfo.GetDirectories())
                {
                    FileAttributes attributes = File.GetAttributes(directory.FullName);
                    if ((attributes & FileAttributes.Hidden) == 0)
                    {
                        var childDirNode = new TreeNode(directory.Name)
                        {
                            Tag = directory
                        };
                        currentNode.Nodes.Add(childDirNode);
                        stack.Push(childDirNode);
                    }
                }

                foreach (var file in directoryInfo.GetFiles())
                {
                    FileAttributes attributes = File.GetAttributes(file.FullName);
                    if ((attributes & FileAttributes.Hidden) == 0)
                    {
                        var childNode    = new TreeNode(file.Name);
                        var resourceInfo = BombastResourceHelper.GetBombastResourceFromFilepath(file.FullName, m_assetsDirectory);
                        childNode.Tag = resourceInfo;
                        currentNode.Nodes.Add(childNode);
                    }
                }
            }

            AssetsTreeView.Nodes.Add(node);
        }
예제 #2
0
        private void RecentProjectMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;

            var resourceFilePath = item.Text;

            //If project file not found, remove from list and do not open
            if (!File.Exists(resourceFilePath))
            {
                Properties.Settings.Default.RecentlyOpenedProjects.Remove(resourceFilePath);
                MessageBox.Show(string.Format("The Project file '{0}' does not seem to exist anymore on the disk.", resourceFilePath), "Project does not exist");
                return;
            }

            var resourceInfo = BombastResourceHelper.GetBombastResourceFromFilepath(resourceFilePath);

            OpenResource(resourceInfo);
        }