Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: obsolete/Microsoft.VisualStudio.Project/SuspendFileChanges.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: obsolete/Microsoft.VisualStudio.Project/SuspendFileChanges.cs
diff --git a/obsolete/Microsoft.VisualStudio.Project/SuspendFileChanges.cs b/obsolete/Microsoft.VisualStudio.Project/SuspendFileChanges.cs
deleted file mode 100644
index 610c0a25dd3b7caff8bcb7147c5965118a66222f..0000000000000000000000000000000000000000
--- a/obsolete/Microsoft.VisualStudio.Project/SuspendFileChanges.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-/// Copyright (c) Microsoft Corporation. All rights reserved.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using Microsoft.VisualStudio;
-using Microsoft.VisualStudio.Shell.Interop;
-using IServiceProvider = System.IServiceProvider;
-using ShellConstants = Microsoft.VisualStudio.Shell.Interop.Constants;
-
-namespace Microsoft.VisualStudio.Project
-{
- /// <summary>
- /// helper to make the editor ignore external changes
- /// </summary>
- internal class SuspendFileChanges
- {
- private string documentFileName;
-
- private bool isSuspending;
-
- private IServiceProvider site;
-
- private IVsDocDataFileChangeControl fileChangeControl;
-
- public SuspendFileChanges(IServiceProvider site, string document)
- {
- this.site = site;
- this.documentFileName = document;
- }
-
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
- public void Suspend()
- {
- if(this.isSuspending)
- return;
-
- IntPtr docData = IntPtr.Zero;
- try
- {
- IVsRunningDocumentTable rdt = this.site.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
-
- IVsHierarchy hierarchy;
- uint itemId;
- uint docCookie;
- IVsFileChangeEx fileChange;
-
-
- if(rdt == null) return;
-
- ErrorHandler.ThrowOnFailure(rdt.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, this.documentFileName, out hierarchy, out itemId, out docData, out docCookie));
-
- if((docCookie == (uint)ShellConstants.VSDOCCOOKIE_NIL) || docData == IntPtr.Zero)
- return;
-
- fileChange = this.site.GetService(typeof(SVsFileChangeEx)) as IVsFileChangeEx;
-
- if(fileChange != null)
- {
- this.isSuspending = true;
- ErrorHandler.ThrowOnFailure(fileChange.IgnoreFile(0, this.documentFileName, 1));
- if(docData != IntPtr.Zero)
- {
- IVsPersistDocData persistDocData = null;
-
- // if interface is not supported, return null
- object unknown = Marshal.GetObjectForIUnknown(docData);
- if(unknown is IVsPersistDocData)
- {
- persistDocData = (IVsPersistDocData)unknown;
- if(persistDocData is IVsDocDataFileChangeControl)
- {
- this.fileChangeControl = (IVsDocDataFileChangeControl)persistDocData;
- if(this.fileChangeControl != null)
- {
- ErrorHandler.ThrowOnFailure(this.fileChangeControl.IgnoreFileChanges(1));
- }
- }
- }
- }
- }
- }
- catch(InvalidCastException e)
- {
- Trace.WriteLine("Exception" + e.Message);
- }
- finally
- {
- if(docData != IntPtr.Zero)
- {
- Marshal.Release(docData);
- }
- }
- return;
- }
-
- public void Resume()
- {
- if(!this.isSuspending)
- return;
- IVsFileChangeEx fileChange;
- fileChange = this.site.GetService(typeof(SVsFileChangeEx)) as IVsFileChangeEx;
- if(fileChange != null)
- {
- this.isSuspending = false;
- ErrorHandler.ThrowOnFailure(fileChange.IgnoreFile(0, this.documentFileName, 0));
- if(this.fileChangeControl != null)
- {
- ErrorHandler.ThrowOnFailure(this.fileChangeControl.IgnoreFileChanges(0));
- }
- }
- }
- }
-}
« no previous file with comments | « obsolete/Microsoft.VisualStudio.Project/StructuresEnums.cs ('k') | obsolete/Microsoft.VisualStudio.Project/TokenProcessor.cs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698