コード例 #1
0
        public bool SaveProject(bool saveAs)
        {
            // Do we need file name?
            if (saveAs || string.IsNullOrEmpty(_project.OriginalPath))
            {
                string newFilePath = _project.OriginalPath;
                if (!View.AskSaveName(ref newFilePath, null))
                {
                    return(false);
                }

                _project.OriginalPath = newFilePath;
                View.SetTreeRoot(_project);
            }

            // Do the save.
            ProjectDirty = false;
            var parser = new PipelineProjectParser(this, _project);

            parser.SaveProject();

            // Note: This is where a project loaded via 'new project' or 'import project'
            //       get recorded into PipelineSettings because up until this point they did not
            //       exist as files on disk.
            PipelineSettings.Default.AddProjectHistory(_project.OriginalPath);
            PipelineSettings.Default.StartupProject = _project.OriginalPath;
            PipelineSettings.Default.Save();
            View.UpdateRecentList(PipelineSettings.Default.ProjectHistory);
            UpdateMenu();

            return(true);
        }
コード例 #2
0
        public void RebuildItems()
        {
            var items = new List <IProjectItem>();

            // If the project itself was selected, just
            // rebuild the entire project
            if (items.Contains(_project))
            {
                Build(true);
                return;
            }

            // Convert selected DirectoryItems into ContentItems
            foreach (var item in SelectedItems)
            {
                if (item is ContentItem)
                {
                    if (!items.Contains(item))
                    {
                        items.Add(item);
                    }

                    continue;
                }

                foreach (var subitem in GetItems(item))
                {
                    if (!items.Contains(subitem))
                    {
                        items.Add(subitem);
                    }
                }
            }

            // Create a unique file within the same folder as
            // the normal project to store this incremental build.
            var uniqueName = Guid.NewGuid().ToString();
            var tempPath   = Path.Combine(Path.GetDirectoryName(_project.OriginalPath), uniqueName);

            // Write the incremental project file limiting the
            // content to just the files we want to rebuild.
            using (var io = File.CreateText(tempPath))
            {
                var parser = new PipelineProjectParser(this, _project);
                parser.SaveProject(io, (i) => !items.Contains(i));
            }

            // Run the build the command.
            var commands = string.Format("/@:\"{0}\" /rebuild /incremental", tempPath);

            if (LaunchDebugger)
            {
                commands += " /launchdebugger";
            }

            BuildCommand(commands);

            // Cleanup the temp file once we're done.
            _buildTask.ContinueWith((e) => File.Delete(tempPath));
        }
コード例 #3
0
        public void RebuildItems(IEnumerable <IProjectItem> items)
        {
            // Make sure we save first!
            if (!AskSaveProject())
            {
                return;
            }

            // Create a unique file within the same folder as
            // the normal project to store this incremental build.
            var uniqueName = Guid.NewGuid().ToString();
            var tempPath   = Path.Combine(Path.GetDirectoryName(_project.OriginalPath), uniqueName);

            // Write the incremental project file limiting the
            // content to just the files we want to rebuild.
            using (var io = File.CreateText(tempPath))
            {
                var parser = new PipelineProjectParser(this, _project);
                parser.SaveProject(io, (i) => !items.Contains(i));
            }

            // Run the build the command.
            var commands = string.Format("/@:\"{0}\" /rebuild /incremental", tempPath);

            if (LaunchDebugger)
            {
                commands += " /launchdebugger";
            }

            BuildCommand(commands);

            // Cleanup the temp file once we're done.
            _buildTask.ContinueWith((e) => File.Delete(tempPath));
        }
コード例 #4
0
        public void RebuildItems(IEnumerable<IProjectItem> items)
        {
            // Make sure we save first!
            if (!AskSaveProject())
                return;

            // Create a unique file within the same folder as
            // the normal project to store this incremental build.
            var uniqueName = Guid.NewGuid().ToString();
            var tempPath = Path.Combine(Path.GetDirectoryName(_project.OriginalPath), uniqueName);

            // Write the incremental project file limiting the
            // content to just the files we want to rebuild.
            using (var io = File.CreateText(tempPath))
            {
                var parser = new PipelineProjectParser(this, _project);
                parser.SaveProject(io, (i) => !items.Contains(i));
            }

            // Run the build the command.
            var commands = string.Format("/@:\"{0}\" /rebuild /incremental", tempPath);
            if (LaunchDebugger)
                commands += " /launchdebugger";

            BuildCommand(commands);

            // Cleanup the temp file once we're done.
            _buildTask.ContinueWith((e) => File.Delete(tempPath));
        }
コード例 #5
0
        public bool SaveProject(bool saveAs)
        {
            // Do we need file name?
            if (saveAs || string.IsNullOrEmpty(_project.OriginalPath))
            {
                string newFilePath = _project.OriginalPath;
                if (!_view.AskSaveName(ref newFilePath, null))
                    return false;

                _project.OriginalPath = newFilePath;
            }

            // Do the save.
            ProjectDiry = false;
            var parser = new PipelineProjectParser(this, _project);
            parser.SaveProject();            

            return true;
        }
コード例 #6
0
ファイル: PipelineController.cs プロジェクト: Zodge/MonoGame
        public bool SaveProject(bool saveAs)
        {
            // Do we need file name?
            if (saveAs || string.IsNullOrEmpty(_project.OriginalPath))
            {
                string newFilePath = _project.OriginalPath;
                if (!View.AskSaveName(ref newFilePath, null))
                    return false;

                _project.OriginalPath = newFilePath;
				View.SetTreeRoot(_project);
            }

            // Do the save.
            ProjectDirty = false;
            var parser = new PipelineProjectParser(this, _project);
            parser.SaveProject();

            // Note: This is where a project loaded via 'new project' or 'import project' 
            //       get recorded into PipelineSettings because up until this point they did not
            //       exist as files on disk.
            PipelineSettings.Default.AddProjectHistory(_project.OriginalPath);
            PipelineSettings.Default.StartupProject = _project.OriginalPath;
            PipelineSettings.Default.Save();

            return true;
        }