예제 #1
0
        /// <summary>
        /// Time filter for collection view
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        private bool Filter(object o)
        {
            if (!(o is Log9KEntry))
            {
                return(false);
            }
            Log9KEntry entry     = (Log9KEntry)o;
            DateTime   entryTime = entry.Time.ToDateTime();

            if (!_timeStartSuccess)
            {
                if (entryTime.CompareTo(_endDateTime) <= 0)
                {
                    return(true);
                }
            }
            if (!_timeEndSuccess)
            {
                if (entryTime.CompareTo(_startDateTime) >= 0)
                {
                    return(true);
                }
            }
            if (entryTime.CompareTo(_startDateTime) >= 0 && (entryTime.CompareTo(_endDateTime) <= 0))
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        private void SelectLogEntryAction(object entry)
        {
            Log9KEntry log9KEntry = entry as Log9KEntry;

            if (log9KEntry != null)
            {
                int d = log9KEntry.GetDuplicationHash();
                var a = CurrentTab.DuplicationsDictionary[d];
//                SelectedEntry = log9KEntry;
            }
        }
예제 #3
0
        public void SerializationDeserializationCustomTypeLogEntry_Test()
        {
            // arrange
            Log9KEntry expected = new Log9KEntry("CONSOLE", "message", Levels.SECONDARY);

            // act
            byte[]     e      = expected.ToByteArray();
            Log9KEntry actual = Log9KEntry.FromByteArray(e);

            // assert
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        static bool GetTabType(object value, out TabTypes type, out string customType)
        {
            type       = TabTypes.ALL;
            customType = "";

            if (value == null || (!(value is TabTypes) && !(value is LogEntryTypes) && !(value is Log9KEntry) && !(value is Log9KTab)))
            {
                return(false);
            }

            if (value is TabTypes)
            {
                type = (TabTypes)value;
            }
            if (value is LogEntryTypes)
            {
                bool success = Enum.TryParse(value.ToString(), out type);
                if (!success)
                {
                    return(false);
                }
            }

            if (value is Log9KEntry)
            {
                Log9KEntry e = (Log9KEntry)value;
                if (e.Type == LogEntryTypes.CUSTOM)
                {
                    customType = e.CustomType;
                }
                bool success = Enum.TryParse(e.Type.ToString(), out type);
                if (!success)
                {
                    return(false);
                }
            }

            if (value is Log9KTab)
            {
                Log9KTab t = (Log9KTab)value;
                if (t.TabType == TabTypes.CUSTOM)
                {
                    customType = t.CustomTabType;
                }
                type = t.TabType;
            }

            return(true);
        }
예제 #5
0
        void ShowTempFileContentsAction()
        {
            Collection.Clear();
            string filename = Log9KCore.Instance.TabAll.FilenameTempFile;
            uint   start, end;

            uint.TryParse(Start, out start);
            uint.TryParse(End, out end);
            for (uint i = start; i < end; i++)
            {
                byte[] buffer;
                Log9KUtil.ReadFixedSizeByteArrayEntry(filename, Log9KEntry.ENTRY_SIZE, i, out buffer);
                Log9KEntry entry = Log9KEntry.FromByteArray(buffer);
                Collection.Add(new Tuple <uint, Log9KEntry>(i, entry));
            }
        }
예제 #6
0
        public void AddEntriesToLog9KTabCollectionAndInsertAt0IsSorted_Test()
        {
            // arrange
            Log9KEntry        e1       = new Log9KEntry(LogEntryTypes.INFO, "1"); // ID=1
            Log9KEntry        e2       = new Log9KEntry(LogEntryTypes.INFO, "2"); // ID=2
            Log9KEntry        e3       = new Log9KEntry(LogEntryTypes.INFO, "3"); // ID=3
            Log9KEntry        e4       = new Log9KEntry(LogEntryTypes.INFO, "4"); // ID=4
            List <Log9KEntry> expected = new List <Log9KEntry>()
            {
                e1, e2, e3, e4
            };
            Log9KTabObservableCollection c = new Log9KTabObservableCollection(100u);

            c.Add(e1);
            c.Add(e2);
            c.Add(e4);

            // act
            c.Insert(0, e3);
            List <Log9KEntry> actual = c.ToList();

            // assert
            CollectionAssert.AreEqual(expected, actual);
        }