예제 #1
0
 public override void Close()
 {
     base.Close();
     m_raysStartPositions.Clear();
     m_raysStartPositions = null;
     m_work = null;
 }
        private void ScanBuffer(ITextSnapshot snapshot)
        {
            if (this.scan != null)
            {
                //Stop and blow away the old scan (even if it didn't finish, the results are not interesting anymore).
                this.scan.Abort();
                this.scan = null;
            }

            //The underlying buffer could be very large, meaning that doing the scan for all matches on the UI thread
            //is a bad idea. Do the scan on the background thread and use a callback to raise the changed event when
            //the entire scan has completed.
            this.scan = new BackgroundScan(snapshot, this.parser,
                                           delegate(CodeBlock newRoot)
            {
                //This delegate is executed on a background thread.
                this.root = newRoot;

                EventHandler <SnapshotSpanEventArgs> handler = _tagsChanged;
                if (handler != null)
                {
                    handler(this, new SnapshotSpanEventArgs(new SnapshotSpan(snapshot, 0, snapshot.Length)));
                }
            });
        }
예제 #3
0
        public void Release()
        {
            if (--_refCount == 0)
            {
                _buffer.Changed -= OnChanged;

                if (_scan != null)
                {
                    //Stop and blow away the old scan (even if it didn't finish, the results are not interesting anymore).
                    _scan.Cancel();
                    _scan = null;
                }
                _root = null; //Allow the old root to be GC'd
            }
        }
예제 #4
0
 public MyPrefabScanningPartRays(MyPrefabScanner scanner)
     : base(scanner)
 {
     m_work = new BackgroundScan(scanner);
     m_raysStartPositions = new List <Vector3>();
 }
예제 #5
0
 public override void Close()
 {
     base.Close();
     m_raysStartPositions.Clear();
     m_raysStartPositions = null;
     m_work = null;
 }
예제 #6
0
 public MyPrefabScanningPartRays(MyPrefabScanner scanner)
     : base(scanner)
 {
     m_work = new BackgroundScan(scanner);
     m_raysStartPositions = new List<Vector3>();
 }