Exemple #1
0
        // Called by the shell to let the package write user options under the specified key.
        public int WriteUserOptions(IStream pOptionsStream, string _)
        {
            try
            {
                using (var stream = new DataStreamFromComStream(pOptionsStream))
                {
                    _serializer.Serialize(stream, _settings);
                }
            }
            catch
            {
            }

            return(VSConstants.S_OK);
        }
        public int WriteUserOptions(IStream pOptionsStream, string pszKey)
        {
            try
            {
                using (var stream = new DataStreamFromComStream(pOptionsStream))
                {
                    BinaryFormatter serializer = new BinaryFormatter();
                    serializer.Serialize(stream, _nugetSettings);
                }
            }
            catch
            {
            }

            return VSConstants.S_OK;
        }
        int IVsPersistSolutionOpts.WriteUserOptions(Microsoft.VisualStudio.OLE.Interop.IStream pOptionsStream, string pszKey)
        {
            try
            {
                using (var stream = new DataStreamFromComStream(pOptionsStream))
                {
                    BinaryFormatter serializer = new BinaryFormatter();
                    serializer.Serialize(stream, _nugetSettings);
                }
            }
            catch (Exception)
            {
            }

            return(VSConstants.S_OK);
        }
        public int ReadUserOptions(IStream pOptionsStream, string pszKey)
        {
            try
            {
                using (var stream = new DataStreamFromComStream(pOptionsStream))
                {
                    BinaryFormatter serializer = new BinaryFormatter();
                    var obj = serializer.Deserialize(stream) as NuGetSettings;
                    if (obj != null)
                    {
                        _nugetSettings = obj;
                    }
                }
            }
            catch
            {
            }

            return VSConstants.S_OK;
        }
        int IVsPersistSolutionOpts.ReadUserOptions(Microsoft.VisualStudio.OLE.Interop.IStream pOptionsStream, string pszKey)
        {
            try
            {
                using (var stream = new DataStreamFromComStream(pOptionsStream))
                {
                    BinaryFormatter serializer = new BinaryFormatter();
                    var             obj        = serializer.Deserialize(stream) as NuGetSettings;
                    if (obj != null)
                    {
                        _nugetSettings = obj;
                    }
                }
            }
            catch (Exception)
            {
            }

            return(VSConstants.S_OK);
        }
Exemple #6
0
        // Called by the shell if the _strSolutionUserOptionsKey section declared in LoadUserOptions() as
        // being written by this package has been found in the suo file
        public int ReadUserOptions(IStream pOptionsStream, string _)
        {
            _settings = new NuGetSettings();

            try
            {
                using (var stream = new DataStreamFromComStream(pOptionsStream))
                {
                    NuGetSettings settings = _serializer.Deserialize(stream);

                    if (settings != null)
                    {
                        _settings = settings;
                    }
                }
            }
            catch
            {
            }

            return(VSConstants.S_OK);
        }