public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
        {
            if ((grfLoadOpts & (uint)__VSLOADUSEROPTS.LUO_OPENEDDSW) != 0)
            {
                return(VSErr.S_OK); // We only know .suo; let's ignore old style projects
            }

            try
            {
                pPersistence.LoadPackageUserOpts(this, SccPendingChangeStream);
                pPersistence.LoadPackageUserOpts(this, SccExcludedStream);
                pPersistence.LoadPackageUserOpts(this, SccTranslateStream);

                return(VSErr.S_OK);
            }
            catch (Exception ex)
            {
                IAnkhErrorHandler handler = GetService <IAnkhErrorHandler>();

                if (handler != null)
                {
                    handler.OnError(ex);
                }

                return(Marshal.GetHRForException(ex));
            }
            finally
            {
                if (Marshal.IsComObject(pPersistence))
                {
                    Marshal.ReleaseComObject(pPersistence); // See Package.cs from MPF for reason
                }
            }
        }
Example #2
0
 public int LoadUserOptions(IVsSolutionPersistence pPersistence, [ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSLOADUSEROPTS")] uint grfLoadOpts)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     pPersistence.LoadPackageUserOpts(this, SELECTED_WEB_RESOURCES);
     pPersistence.LoadPackageUserOpts(this, SELECTED_REPORTS);
     return(VSConstants.S_OK);
 }
        private async Task SolutionDevKitSettingInitializeAsync()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsSolutionPersistence solutionPersistence = await GetServiceAsync(typeof(IVsSolutionPersistence)) as IVsSolutionPersistence ?? throw new ArgumentNullException(nameof(solutionPersistence));

            solutionPersistence.LoadPackageUserOpts(this, SELECTED_WEB_RESOURCES);
            solutionPersistence.LoadPackageUserOpts(this, SELECTED_REPORTS);
        }
Example #4
0
        private async Task SolutionInitializeAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IVsSolutionPersistence solutionPersistence = await GetServiceAsync(typeof(IVsSolutionPersistence)) as IVsSolutionPersistence ?? throw new ArgumentNullException(nameof(solutionPersistence));

            solutionPersistence.LoadPackageUserOpts(this, SELECTED_WEB_RESOURCES);
            solutionPersistence.LoadPackageUserOpts(this, SELECTED_REPORTS);
        }
        public bool ForceLoadUserSettings(string streamName)
        {
            IVsSolutionPersistence persistence = GetService <IVsSolutionPersistence>(typeof(SVsSolutionPersistence));

            if (persistence == null)
            {
                return(false);
            }

            try
            {
                int hr = persistence.LoadPackageUserOpts(this, streamName);

                return(true);
            }
            catch (Exception ex)
            {
                IAnkhErrorHandler handler = GetService <IAnkhErrorHandler>();

                if (handler != null)
                {
                    handler.OnError(ex);
                }

                return(false);
            }
        }
Example #6
0
        // Called by the shell when a solution is opened and the SUO file is read.
        public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            pPersistence.LoadPackageUserOpts(this, NuGetOptionsStreamKey);
            return(VSConstants.S_OK);
        }
 /// <summary>
 /// Called by the shell when a solution is opened and the SUO file is read.
 /// </summary>
 public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
 {
     // Note this can be during opening a new solution, or may be during merging of 2 solutions.
     // The provider calls the shell back to let it know which options keys from the suo file were written by this provider.
     // If the shell will find in the suo file a section that belong to this package, it will create a stream,
     // and will call back the provider on IVsPersistSolutionProps.ReadUserOptions() to read specific options
     // under that option key.
     pPersistence.LoadPackageUserOpts(this, _strSolutionUserOptionsKey);
     return(VSConstants.S_OK);
 }
Example #8
0
        private int _LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
        {
            solutionService.GetSolutionInfo(out string solutionPath, out string solutionFilePath, out string suoPath);
            this.BookmarksManager.SolutionPath = solutionPath;

            return
                (StorageOptions.SaveBookmarksToOwnFile ?
                 VSConstants.S_OK :
                 pPersistence.LoadPackageUserOpts(this, persistenceKey));
        }
Example #9
0
        internal void ReadProjectTrustInformation()
        {
            this.projectTrustTable.Clear();

            IVsSolutionPersistence persistance = this.GetService(typeof(SVsSolutionPersistence)) as IVsSolutionPersistence;

            if (persistance != null)
            {
                // Read the stream out of the .SUO file.  This will call us back on our ReadUserOptions method.
                persistance.LoadPackageUserOpts(this, this.ProjectTrustPersistenceKey);
            }
        }
 public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
 {
     try {
         foreach (StoreType type in Enum.GetValues(typeof(StoreType)))
         {
             pPersistence.LoadPackageUserOpts(this, getKey(type));
         }
     }
     finally {
         Marshal.ReleaseComObject(pPersistence);
     }
     return(VSConstants.S_OK);
 }
Example #11
0
        public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
        {
            try
            {
                pPersistence.LoadPackageUserOpts(this, CqrsNetSettingsKey);
            }
            finally
            {
                Marshal.ReleaseComObject(pPersistence);
            }

            return(VSConstants.S_OK);
        }
        public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();
                pPersistence.LoadPackageUserOpts(this, SettingsKey);
            }
            finally
            {
                Marshal.ReleaseComObject(pPersistence);
            }

            return(VSConstants.S_OK);
        }
Example #13
0
 public PersistedSolutionSettings?LoadSolutionSettings()
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     try
     {
         _solutionSettingsToLoad = null;
         _vsSolutionPersistence.LoadPackageUserOpts(this, SolutionSettingsString);
         return(_solutionSettingsToLoad);
     }
     finally
     {
         _solutionSettingsToLoad = null;
     }
 }
        public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
        {
            if ((grfLoadOpts & (uint)__VSLOADUSEROPTS.LUO_OPENEDDSW) != 0)
            {
                return VSConstants.S_OK; // We only know .suo; let's ignore old style projects
            }

            try
            {
                pPersistence.LoadPackageUserOpts(this, SccPendingChangeStream);
                pPersistence.LoadPackageUserOpts(this, SccEnlistStream);

                return VSConstants.S_OK;
            }
            finally
            {
                Marshal.ReleaseComObject(pPersistence); // See Package.cs from MPF for reason
            }
        }
Example #15
0
 public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
 {
     pPersistence.LoadPackageUserOpts(this, _strSolutionPersistanceKey + _strUsername);
     pPersistence.LoadPackageUserOpts(this, _strSolutionPersistanceKey + _strPassword);
     return(VSConstants.S_OK);
 }
Example #16
0
        public async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
        {
            IVsSolutionPersistence solutionPersistence = await package.GetServiceAsync((typeof(IVsSolutionPersistence))) as IVsSolutionPersistence ?? throw new ArgumentNullException(nameof(solutionPersistence));

            solutionPersistence.LoadPackageUserOpts(this, SELECTED_WEB_RESOURCES);
        }
Example #17
0
        /// <include file='doc\Package.uex' path='docs/doc[@for="Package.IVsPersistSolutionOpts.LoadUserOptions"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// IVsPersistSolutionOpts implementation.
        /// Called when a solution is opened, and allows us to inspect our options.
        /// </devdoc>
        int IVsPersistSolutionOpts.LoadUserOptions(IVsSolutionPersistence pPersistance, uint options) {

            int hr = NativeMethods.S_OK;
            if ((options & (uint)__VSLOADUSEROPTS.LUO_OPENEDDSW) != 0) {
                return hr;
            }

            if (_optionKeys != null) {
                foreach(string key in _optionKeys) {
                    hr = pPersistance.LoadPackageUserOpts(this, key);
                    if (NativeMethods.Failed(hr))
                        break;
                }
            }

            // Shell relies on this being released when we're done with it.  If you see strange
            // faults in the shell when saving the solution, suspect this!
            //
            Marshal.ReleaseComObject(pPersistance);

            NativeMethods.ThrowOnFailure(hr);
            return hr;
        }
Example #18
0
 // Called by the shell when a solution is opened and the SUO file is read.
 public int LoadUserOptions(IVsSolutionPersistence pPersistence, uint grfLoadOpts)
 {
     pPersistence.LoadPackageUserOpts(this, NuGetOptionsStreamKey);
     return(VSConstants.S_OK);
 }
 private void LoadNuGetSettings()
 {
     IVsSolutionPersistence solutionPersistence = GetGlobalService(typeof(SVsSolutionPersistence)) as IVsSolutionPersistence;
     solutionPersistence.LoadPackageUserOpts(this, "nuget");
 }
Example #20
0
        /// <include file='doc\Package.uex' path='docs/doc[@for="Package.IVsPersistSolutionOpts.LoadUserOptions"]/*' />
        /// <internalonly/>
        /// <devdoc>
        /// IVsPersistSolutionOpts implementation.
        /// Called when a solution is opened, and allows us to inspect our options.
        /// </devdoc>
        int IVsPersistSolutionOpts.LoadUserOptions(IVsSolutionPersistence pPersistance, uint options)
        {
            int hr = NativeMethods.S_OK;
            if ((options & (uint)__VSLOADUSEROPTS.LUO_OPENEDDSW) != 0) {
                return hr;
            }

            if (_optionKeys != null) {
                foreach(string key in _optionKeys) {
                    hr = pPersistance.LoadPackageUserOpts(this, key);
                    if (NativeMethods.Failed(hr))
                        break;
                }
            }

            NativeMethods.ThrowOnFailure(hr);
            return hr;
        }