Esempio n. 1
0
        private bool ProcessObject(PSObject so)
        {
            object o = this.formatObjectDeserializer.Deserialize(so);

            if (this.NeedsPreprocessing(o))
            {
                return(false);
            }
            if (this.cache == null)
            {
                this.cache = new FormattedObjectsCache(this.LineOutput.RequiresBuffering);
            }
            FormatStartData data = o as FormatStartData;

            if ((data != null) && (data.autosizeInfo != null))
            {
                FormattedObjectsCache.ProcessCachedGroupNotification callBack = new FormattedObjectsCache.ProcessCachedGroupNotification(this.ProcessCachedGroup);
                this.cache.EnableGroupCaching(callBack, data.autosizeInfo.objectCount);
            }
            List <PacketInfoData> list = this.cache.Add((PacketInfoData)o);

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    this.ctxManager.Process(list[i]);
                }
            }
            return(true);
        }
Esempio n. 2
0
        private bool ProcessObject(PSObject so)
        {
            object o = _formatObjectDeserializer.Deserialize(so);

            //Console.WriteLine("OutCommandInner.Execute() retrieved object {0}, of type {1}", o.ToString(), o.GetType());
            if (NeedsPreprocessing(o))
            {
                return(false);
            }

            // instantiate the cache if not done yet
            if (_cache == null)
            {
                _cache = new FormattedObjectsCache(this.LineOutput.RequiresBuffering);
            }

            // no need for formatting, just process the object
            FormatStartData formatStart = o as FormatStartData;

            if (formatStart != null)
            {
                // get autosize flag from object
                // turn on group caching
                if (formatStart.autosizeInfo != null)
                {
                    FormattedObjectsCache.ProcessCachedGroupNotification callBack = new FormattedObjectsCache.ProcessCachedGroupNotification(ProcessCachedGroup);
                    _cache.EnableGroupCaching(callBack, formatStart.autosizeInfo.objectCount);
                }
                else
                {
                    // If the format info doesn't define column widths, then auto-size based on the first ten elements
                    TableHeaderInfo headerInfo = formatStart.shapeInfo as TableHeaderInfo;
                    if ((headerInfo != null) &&
                        (headerInfo.tableColumnInfoList.Count > 0) &&
                        (headerInfo.tableColumnInfoList[0].width == 0))
                    {
                        FormattedObjectsCache.ProcessCachedGroupNotification callBack = new FormattedObjectsCache.ProcessCachedGroupNotification(ProcessCachedGroup);
                        _cache.EnableGroupCaching(callBack, TimeSpan.FromMilliseconds(300));
                    }
                }
            }

            //Console.WriteLine("OutCommandInner.Execute() calling ctxManager.Process({0})",o.ToString());
            List <PacketInfoData> info = _cache.Add((PacketInfoData)o);

            if (info != null)
            {
                for (int k = 0; k < info.Count; k++)
                {
                    _ctxManager.Process(info[k]);
                }
            }
            return(true);
        }
Esempio n. 3
0
        private bool ProcessObject(PSObject so)
        {
            object o = _formatObjectDeserializer.Deserialize(so);

            //Console.WriteLine("OutCommandInner.Execute() retrieved object {0}, of type {1}", o.ToString(), o.GetType());
            if (NeedsPreprocessing(o))
            {
                return false;
            }

            // instantiate the cache if not done yet
            if (_cache == null)
            {
                _cache = new FormattedObjectsCache(this.LineOutput.RequiresBuffering);
            }

            // no need for formatting, just process the object
            FormatStartData formatStart = o as FormatStartData;

            if (formatStart != null)
            {
                // get autosize flag from object
                // turn on group caching
                if (formatStart.autosizeInfo != null)
                {
                    FormattedObjectsCache.ProcessCachedGroupNotification callBack = new FormattedObjectsCache.ProcessCachedGroupNotification(ProcessCachedGroup);
                    _cache.EnableGroupCaching(callBack, formatStart.autosizeInfo.objectCount);
                }
                else
                {
                    // If the format info doesn't define column widths, then auto-size based on the first ten elements
                    TableHeaderInfo headerInfo = formatStart.shapeInfo as TableHeaderInfo;
                    if ((headerInfo != null) &&
                        (headerInfo.tableColumnInfoList.Count > 0) &&
                        (headerInfo.tableColumnInfoList[0].width == 0))
                    {
                        FormattedObjectsCache.ProcessCachedGroupNotification callBack = new FormattedObjectsCache.ProcessCachedGroupNotification(ProcessCachedGroup);
                        _cache.EnableGroupCaching(callBack, TimeSpan.FromMilliseconds(300));
                    }
                }
            }

            //Console.WriteLine("OutCommandInner.Execute() calling ctxManager.Process({0})",o.ToString());
            List<PacketInfoData> info = _cache.Add((PacketInfoData)o);

            if (info != null)
            {
                for (int k = 0; k < info.Count; k++)
                    _ctxManager.Process(info[k]);
            }
            return true;
        }
Esempio n. 4
0
 internal OutputGroupQueue(FormattedObjectsCache.ProcessCachedGroupNotification callBack, int objectCount)
 {
     this.notificationCallBack = callBack;
     this.objectCount = objectCount;
 }
Esempio n. 5
0
 private bool ProcessObject(PSObject so)
 {
     object o = this.formatObjectDeserializer.Deserialize(so);
     if (this.NeedsPreprocessing(o))
     {
         return false;
     }
     if (this.cache == null)
     {
         this.cache = new FormattedObjectsCache(this.LineOutput.RequiresBuffering);
     }
     FormatStartData data = o as FormatStartData;
     if ((data != null) && (data.autosizeInfo != null))
     {
         FormattedObjectsCache.ProcessCachedGroupNotification callBack = new FormattedObjectsCache.ProcessCachedGroupNotification(this.ProcessCachedGroup);
         this.cache.EnableGroupCaching(callBack, data.autosizeInfo.objectCount);
     }
     List<PacketInfoData> list = this.cache.Add((PacketInfoData) o);
     if (list != null)
     {
         for (int i = 0; i < list.Count; i++)
         {
             this.ctxManager.Process(list[i]);
         }
     }
     return true;
 }
Esempio n. 6
0
 /// <summary>
 /// create a time-bounded grouping cache
 /// </summary>
 /// <param name="callBack">notification callback to be called when the desired number of objects is reached</param>
 /// <param name="groupingDuration">max amount of time to cache of objects</param>
 internal OutputGroupQueue(FormattedObjectsCache.ProcessCachedGroupNotification callBack, TimeSpan groupingDuration)
 {
     _notificationCallBack = callBack;
     _groupingDuration = groupingDuration;
 }