Esempio n. 1
0
        public int OnBeforeFirstDocumentLock(IVsHierarchy pHier, uint itemid, string moniker)
        {
            RdtEvent evt = new RdtEvent(string.Format("OnBeforeFirstDocumentLock: {0}", moniker));

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 2
0
        public int OnAfterLastDocumentUnlock(IVsHierarchy pHier, uint itemid, string moniker, int fClosedWithoutSaving)
        {
            RdtEvent evt = new RdtEvent(string.Format("OnAfterLastDocumentUnlock: {0} (fClosedWithoutSaving={1})", moniker, (fClosedWithoutSaving != 0)));

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 3
0
        public int OnAfterSaveAll()
        {
            RdtEvent evt = new RdtEvent("OnAfterSaveAll");

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 4
0
        public int OnBeforeSave(VSCOOKIE cookie)
        {
            RdtEvent evt = MakeEvent(cookie, "OnBeforeSave");

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 5
0
        public int OnBeforeDocumentWindowShow(VSCOOKIE cookie, int fFirstShow, IVsWindowFrame pFrame)
        {
            RdtEvent evt = MakeEvent(cookie, "OnBeforeDocumentWindowShow (first show={0})", (fFirstShow != 0));

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 6
0
        public int OnAfterDocumentWindowHide(VSCOOKIE cookie, IVsWindowFrame pFrame)
        {
            RdtEvent evt = MakeEvent(cookie, "OnAfterDocumentWindowHide");

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 7
0
        /// <summary>
        /// Records an RDT event in the events collection
        /// </summary>
        /// <param name="evt"></param>
        public void RecordEvent(RdtEvent evt)
        {
            Events.Add(evt);

            if (Events.Count > MaxEventCount)
            {
                Events.RemoveAt(0);
            }
        }
Esempio n. 8
0
        public int OnBeforeLastDocumentUnlock(VSCOOKIE cookie, uint lockType, uint readLocksRemaining, uint editLocksRemaining)
        {
            RdtFlags flags = (RdtFlags)(int)lockType;
            RdtEvent evt   = MakeEvent(cookie, "OnBeforeLastDocumentUnlock: Lock Type={0}, Read Locks Remaining={1}, Edit Locks Remaining={2}", flags, readLocksRemaining, editLocksRemaining);

            _ds.RecordEvent(evt);

            return(VSConstants.S_OK);
        }
Esempio n. 9
0
        void HandleOnAfterAttributeChange(VSCOOKIE cookie, uint grfAttribs, string oldName, string newName, string eventName)
        {
            RdtAttributes attrs = (RdtAttributes)(int)grfAttribs;

            string eventText = $"{eventName}: attributes={attrs}";

            if (attrs.HasFlag(RdtAttributes.RDTA_MkDocument))
            {
                eventText += $", old={oldName}, new={newName}";
            }

            RdtEvent evt = MakeEvent(cookie, eventText);

            _ds.RecordEvent(evt);

            RdtEntry entry = _ds.FindEntry(cookie);

            if (entry == null)
            {
                return;
            }

            if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsDirty))
            {
                entry.IsDirty = true;
            }
            else if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsNotDirty))
            {
                entry.IsDirty = false;
            }

            if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsReadOnly))
            {
                entry.IsReadOnly = true;
            }
            else if (attrs.HasFlag(RdtAttributes.RDTA_DocDataIsNotReadOnly))
            {
                entry.IsReadOnly = false;
            }

            if (attrs.HasFlag(RdtAttributes.RDTA_MkDocument))
            {
                entry.Moniker = newName;
            }
        }
Esempio n. 10
0
        public int OnAfterFirstDocumentLock(VSCOOKIE cookie, uint lockType, uint readLocksRemaining, uint editLocksRemaining)
        {
            RdtFlags flags = (RdtFlags)(int)lockType;
            RdtEvent evt   = MakeEvent(cookie, "OnAfterFirstDocumentLock: Lock Type={0}, Read Locks Remaining={1}, Edit Locks Remaining={2}", flags, readLocksRemaining, editLocksRemaining);

            _ds.RecordEvent(evt);

            // add this document to the data source if it's not there yet
            RdtEntry entry = _ds.FindEntry(cookie);

            if (entry == null)
            {
                RunningDocumentTable rdt  = new RunningDocumentTable();
                RunningDocumentInfo  info = rdt.GetDocumentInfo(cookie);

                entry = new RdtEntry(info);
                _ds.Entries.Add(entry);
            }

            return(VSConstants.S_OK);
        }
Esempio n. 11
0
        public void OnAfterDocumentLockCountChanged(VSCOOKIE cookie, uint lockType, VSCOOKIE oldCount, VSCOOKIE newCount)
        {
            RdtFlags flags = (RdtFlags)(int)lockType;
            RdtEvent evt   = MakeEvent(cookie, "OnAfterDocumentLockCountChanged: Lock Type={0}, Before={1}, After={2}", flags, oldCount, newCount);

            _ds.RecordEvent(evt);

            RdtEntry entry = _ds.FindEntry(cookie);

            if (entry == null)
            {
                return;
            }

            if (flags.HasFlag(RdtFlags.RDT_ReadLock))
            {
                entry.ReadLocks = newCount;
            }

            else if (flags.HasFlag(RdtFlags.RDT_EditLock))
            {
                entry.EditLocks = newCount;
            }
        }
Esempio n. 12
0
        public void OnAfterDocDataChanged(uint cookie, System.IntPtr punkDocDataOld, System.IntPtr punkDocDataNew)
        {
            RdtEvent evt = MakeEvent(cookie, "OnAfterDocDataChanged: DocDataOld={0}, DocDataNew={1}", punkDocDataOld, punkDocDataNew);

            _ds.RecordEvent(evt);
        }