Exemple #1
0
        /// <summary>
        /// Realtime analysis enumerable
        /// </summary>
        /// <param name="dataConsumer">Data consumer</param>
        /// <param name="reader">Input</param>
        /// <param name="stop">Stop function</param>
        /// <param name="reason">Reason</param>
        /// <param name="timeType">Time type</param>
        /// <param name="isAbsoluteTime">The absolute time "sign"</param>
        /// <returns>The enumerable</returns>
        public static IEnumerable <object> RealtimeAnalysisEnumerable(this IDataConsumer dataConsumer,
                                                                      ILogReader reader, Func <object, bool> stop, string reason,
                                                                      TimeType timeType, bool isAbsoluteTime)
        {
            IEnumerable <object> en = reader.Load(0, 0);

            return(dataConsumer.RealtimeAnalysisEnumerable(en, stop, reason, timeType, isAbsoluteTime));
        }
        /// <summary>
        /// Transfrmation to stream
        /// </summary>
        /// <param name="reader">Reader</param>
        /// <param name="begin">Begin</param>
        /// <param name="end">End</param>
        /// <returns>Transformation result</returns>
        public static void ToStream(this ILogReader reader, Stream stream, uint begin, uint end)
        {
            IEnumerable <object> en = reader.Load(begin, end);

            foreach (object o in en)
            {
                formatter.Serialize(stream, o);
            }
        }
Exemple #3
0
        /// <summary>
        /// Realtime analysis
        /// </summary>
        /// <param name="dataConsumer">Data consumer</param>
        /// <param name="input">Input</param>
        /// <param name="stop">Stop function</param>
        /// <param name="reason">Reason</param>
        /// <param name="timeType">Time type</param>
        /// <param name="isAbsoluteTime">The absolute time "sign"</param>
        public static bool RealtimeAnalysis(this IDataConsumer dataConsumer,
                                            ILogReader input, Func <object, bool> stop, string reason,
                                            TimeType timeType, bool isAbsoluteTime)
        {
            ILogReader           lr  = input as ILogReader;
            IEnumerable <object> enu = input.Load(0, 0);

            return(dataConsumer.RealtimeAnalysis(enu, stop, reason, timeType, isAbsoluteTime));
        }
        /// <summary>
        /// Transfrmation to bytes
        /// </summary>
        /// <param name="reader">Reader</param>
        /// <param name="begin">Begin</param>
        /// <param name="end">End</param>
        /// <returns>Transformation result</returns>
        public static IEnumerable <byte[]> ToBytes(this ILogReader reader, uint begin, uint end)
        {
            IEnumerable <object> en = reader.Load(begin, end);

            foreach (object o in en)
            {
                using (MemoryStream stream = new MemoryStream())
                {
                    formatter.Serialize(stream, o);
                    byte[] b    = stream.GetBuffer();
                    byte[] outp = new byte[stream.Length];
                    Array.Copy(b, outp, outp.Length);
                    yield return(outp);
                }
            }
        }