Пример #1
0
        /// <summary>
        /// Stop ignoring the file changes for a certain files
        /// </summary>
        public void Resume(SilentFileChangerModel aSilentFileChanger)
        {
            if (null == aSilentFileChanger)
            {
                return;
            }

            if (!aSilentFileChanger.IsSuspended || null == aSilentFileChanger.PersistDocData)
            {
                return;
            }

            if (null != aSilentFileChanger.PersistDocData && aSilentFileChanger.ReloadDocumentFlag)
            {
                aSilentFileChanger.PersistDocData.ReloadDocData(0);
            }

            if (!VsServiceProvider.TryGetService(typeof(SVsFileChangeEx), out object vsFileChangeService) || null == vsFileChangeService as IVsFileChangeEx)
            {
                return;
            }

            var vsFileChange = vsFileChangeService as IVsFileChangeEx;

            aSilentFileChanger.IsSuspended = false;
            ErrorHandler.ThrowOnFailure(vsFileChange.SyncFile(aSilentFileChanger.DocumentFileName));
            ErrorHandler.ThrowOnFailure(vsFileChange.IgnoreFile(0, aSilentFileChanger.DocumentFileName, 0));
            if (aSilentFileChanger.FileChangeControl != null)
            {
                ErrorHandler.ThrowOnFailure(aSilentFileChanger.FileChangeControl.IgnoreFileChanges(0));
            }
        }
Пример #2
0
 /// <summary>
 /// Ignore all file changes of a file
 /// </summary>
 /// <param name="aSilentFileChanger"></param>
 private void Silent(SilentFileChangerModel aSilentFileChanger)
 {
     if (null != aSilentFileChanger.FileChangeControl)
     {
         ErrorHandler.ThrowOnFailure(aSilentFileChanger.FileChangeControl.IgnoreFileChanges(1));
     }
 }