public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            string r;

            object var;
            if (VSErr.Succeeded(ProjectHierarchy.GetProperty(itemidAdded, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, out var))
                && (bool)var)
            {
                return VSErr.S_OK; // Extra item for show all files
            }

            if (_loaded)
            {
                if (VSErr.Succeeded(VsProject.GetMkDocument(itemidAdded, out r))
                    && SvnItem.IsValidPath(r))
                {
                    // Check out VSHPROPID_IsNewUnsavedItem
                    if (!SvnItem.PathExists(r))
                    {
                        SetPreCreatedItem(itemidAdded);
                    }
                    else
                    {
                        SetPreCreatedItem(VSItemId.Nil);

                        SetDirty();
                    }
                }
            }

            return VSErr.S_OK;
        }
예제 #2
0
        public int OnItemDeleted(uint itemid)
        {
            SetPreCreatedItem(VSItemId.Nil);

            object var;

            if (VSErr.Succeeded(ProjectHierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, out var)) &&
                (bool)var)
            {
                return(VSErr.S_OK); // Extra item for show all files
            }

            SetDirty();

            return(VSErr.S_OK);
        }
예제 #3
0
        public void SetCommandLine(string NewCommandLine)
        {
            System.Windows.Threading.Dispatcher.CurrentDispatcher.VerifyAccess();

            // Update out MRU combo list
            SetCommandLineMRU(NewCommandLine);

            // Set on the project
            IVsHierarchy ProjectHierarchy;

            if (SolutionBuildManager.get_StartupProject(out ProjectHierarchy) == VSConstants.S_OK && ProjectHierarchy != null)
            {
                object ProjectObject;
                ProjectHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out ProjectObject);
                var SelectedStartupProject = (EnvDTE.Project)ProjectObject;
                if (SelectedStartupProject != null)
                {
                    var ActiveConfiguration = SelectedStartupProject.ConfigurationManager.ActiveConfiguration;
                    if (ActiveConfiguration != null)
                    {
                        var PropertyStorage = ProjectHierarchy as IVsBuildPropertyStorage;
                        if (PropertyStorage != null)
                        {
                            string ConfigurationName = MakeConfigurationName(ActiveConfiguration);

                            // Remove property
                            if (string.IsNullOrEmpty(NewCommandLine))
                            {
                                PropertyStorage.RemoveProperty("LocalDebuggerCommandArguments", ConfigurationName, (uint)_PersistStorageType.PST_USER_FILE);
                                PropertyStorage.RemoveProperty("RemoteDebuggerCommandArguments", ConfigurationName, (uint)_PersistStorageType.PST_USER_FILE);
                            }
                            // Set property
                            else
                            {
                                PropertyStorage.SetPropertyValue("LocalDebuggerCommandArguments", ConfigurationName, (uint)_PersistStorageType.PST_USER_FILE, NewCommandLine);
                                PropertyStorage.SetPropertyValue("RemoteDebuggerCommandArguments", ConfigurationName, (uint)_PersistStorageType.PST_USER_FILE, NewCommandLine);
                            }
                        }
                    }
                }
            }
        }
예제 #4
0
        public static string GetStartupProjectName()
        {
            System.Windows.Threading.Dispatcher.CurrentDispatcher.VerifyAccess();

            var SolutionBuildManager = VisualStudio.VSEvents.Instance?.SolutionBuildManager;

            IVsHierarchy ProjectHierarchy;

            if (SolutionBuildManager.get_StartupProject(out ProjectHierarchy) == VSConstants.S_OK && ProjectHierarchy != null)
            {
                object ProjectObject;
                ProjectHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out ProjectObject);
                var SelectedStartupProject = (EnvDTE.Project)ProjectObject;
                if (SelectedStartupProject != null)
                {
                    return(SelectedStartupProject.Name);
                }
            }
            return(null);
        }
예제 #5
0
        public string GetCommandLine()
        {
            System.Windows.Threading.Dispatcher.CurrentDispatcher.VerifyAccess();

            string debuggerCommandLine = "";

            IVsHierarchy ProjectHierarchy;

            if (SolutionBuildManager.get_StartupProject(out ProjectHierarchy) == VSConstants.S_OK && ProjectHierarchy != null)
            {
                object ProjectObject;
                ProjectHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out ProjectObject);
                var SelectedStartupProject = (EnvDTE.Project)ProjectObject;
                if (SelectedStartupProject != null)
                {
                    var ActiveConfiguration = SelectedStartupProject.ConfigurationManager.ActiveConfiguration;
                    if (ActiveConfiguration != null)
                    {
                        var PropertyStorage = ProjectHierarchy as IVsBuildPropertyStorage;
                        if (PropertyStorage != null)
                        {
                            string ConfigurationName = MakeConfigurationName(ActiveConfiguration);
                            if (PropertyStorage.GetPropertyValue("LocalDebuggerCommandArguments", ConfigurationName, (uint)_PersistStorageType.PST_USER_FILE, out debuggerCommandLine) != VSConstants.S_OK)
                            {
                                if (PropertyStorage.GetPropertyValue("StartArguments", ConfigurationName, (uint)_PersistStorageType.PST_USER_FILE, out debuggerCommandLine) != VSConstants.S_OK)
                                {
                                    debuggerCommandLine = "";
                                }
                            }
                        }
                    }
                }
            }

            return(debuggerCommandLine);
        }