Exemplo n.º 1
0
        /// <summary>
        /// Called if we hit an exception at a bad time (when
        ///  updating the index files) and must discard all
        ///  currently buffered docs.  this resets our state,
        ///  discarding any docs added since last flush.
        /// </summary>
        internal virtual void Abort(ISet <string> createdFiles)
        {
            //System.out.println(Thread.currentThread().getName() + ": now abort seg=" + segmentInfo.name);
            HasAborted = Aborting = true;
            try
            {
                if (InfoStream.IsEnabled("DWPT"))
                {
                    InfoStream.Message("DWPT", "now abort");
                }
                try
                {
                    Consumer.Abort();
                }
                catch (Exception t)
                {
                }

                PendingUpdates.Clear();
                CollectionsHelper.AddAll(createdFiles, Directory.CreatedFiles);
            }
            finally
            {
                Aborting = false;
                if (InfoStream.IsEnabled("DWPT"))
                {
                    InfoStream.Message("DWPT", "done abort");
                }
            }
        }
Exemplo n.º 2
0
        public unsafe void ApplyBackground(IPenContext context)
        {
            if (context == null)
            {
                return;
            }

            IBufferPen Pen = (context is IBufferPen) ? context as IBufferPen : context.ToPen(Width, Height);

            if (Pen == null || Pen.ID == BackgroundPen)
            {
                return;
            }

            var rc = Factory.newRectangle(0, 0, Pen.Width, Pen.Height);

            Pen.CopyTo(rc, Pixels, Length, Width, 0, 0);
            BackgroundPen = Pen.ID;
            Factory.Add(Pen, ObjType.Buffer);
            PendingUpdates.Clear();
            BackgroundChanged?.Invoke(this, Factory.EventArgsEmpty);
            //RefreshAll();
            PendingUpdates.Clear();
            PendingUpdates.Invalidate(rc);
        }
Exemplo n.º 3
0
        public unsafe void ClearBackground(IRectangle target)
        {
            IBufferPen pen = null;

            var rc = this.CompitibleRC(target?.X, target?.Y, target?.Width, target?.Height);

            if (!string.IsNullOrEmpty(BackgroundPen))
            {
                Factory.Get(BackgroundPen, out pen, ObjType.Buffer);
                if (pen is IPenContext && (pen.Width != Width || pen.Height != Height))
                {
                    Factory.Remove(pen.ID, ObjType.Buffer);
                    pen           = (pen as IPenContext).ToPen(Width, Height);
                    BackgroundPen = pen.ID;
                    Factory.Add(pen, ObjType.Buffer);
                }
            }
            if (pen != null)
            {
                pen.CopyTo(rc, Pixels, Length, Width, rc.X, rc.Y);
                goto mks;
            }

            int[] array = new int[rc.Width * rc.Height];
            fixed(int *p = array)
            {
                CopyMemory(p, 0, (int *)Pixels, IndexOf(rc.X, rc.Y, true), array.Length);
            }

mks:
            PendingUpdates.Invalidate(target);
        }
Exemplo n.º 4
0
 private void OnPendingUpdatesChange()
 {
     if (PendingUpdates == null)
     {
         UpdateInfoText = NoUpdatesFoundText;
     }
     else
     {
         UpdateInfoText = (PendingUpdates.Count() == 0) ? NoUpdatesFoundText : string.Format(UpdatesFoundText, PendingUpdates.Count());
     }
 }
Exemplo n.º 5
0
        public void Resize(int?width = null, int?height = null)
        {
            if (width == null && height == null)
            {
                return;
            }

            var w = width ?? this.Width;
            var h = height ?? this.Height;

            ResetDataInternally(w, h);
#if AdvancedVersion
            Buffers?.ResizeAll();
#endif
            PendingUpdates.Clear();
            PendingUpdates.Invalidate(Factory.newRectangle(0, 0, Width, Height));
        }
Exemplo n.º 6
0
 public Person AddAttributes(IEnumerable <PersonAttribute> attributes)
 {
     Attributes.AddRange(attributes);
     PendingUpdates.Enqueue(new UpdateOneModel <Person>(null, Builders <Person> .Update.PushEach(a => a.Attributes, attributes)));
     return(this);
 }