Exemplo n.º 1
0
        public bool Restore(XmlReader reader)
        {
            int count = reader.AttributeCount;
            for (int i = 0; i < count; ++i)
            {
                reader.MoveToAttribute(i);

                switch (reader.Name)
                {
                    case "id":
                        _id = reader.ReadContentAsGuid();
                        break;

                    case "type":
                        MatchType = reader.ReadContentAsEnum<QuickFilterMatchType>();
                        break;

                    case "value":
                        Value = reader.Value;
                        break;

                    case "ignorecase":
                        IgnoreCase = reader.ReadContentAsBool();
                        break;

                    case "isinclude":
                        IsInverted = reader.ReadContentAsBool();
                        break;
                }
            }

            if (Id == Guid.Empty)
                return false;

            return true;
        }
Exemplo n.º 2
0
        public void Restore(XmlReader reader, out bool neededPatching)
        {
            int count = reader.AttributeCount;
            for (int i = 0; i < count; ++i)
            {
                reader.MoveToAttribute(i);
                switch (reader.Name)
                {
                    case "file":
                        File = reader.Value;
                        break;

                    case "followtail":
                        FollowTail = reader.ReadContentAsBool();
                        break;

                    case "showlinenumbers":
                        ShowLineNumbers = reader.ReadContentAsBool();
                        break;

                    case "stringfilter":
                    case "searchterm":
                        SearchTerm = reader.Value;
                        break;

                    case "levelfilter":
                        LevelFilter = reader.ReadContentAsEnum<LevelFlags>();
                        break;

                    case "colorbylevel":
                        ColorByLevel = reader.ReadContentAsBool();
                        break;

                    case "visibleentryindex":
                        VisibleLogLine = reader.ReadContentAsInt();
                        break;

                    case "id":
                        Id = reader.ReadContentAsGuid();
                        break;

                    case "parentid":
                        ParentId = reader.ReadContentAsGuid();
                        break;

                    case "lastviewed":
                        LastViewed = reader.ReadContentAsDateTime2();
                        break;

                    case "horizontaloffset":
                        HorizontalOffset = reader.ReadContentAsDouble2();
                        break;
                }
            }

            if (Id == Guid.Empty)
            {
                Id = Guid.NewGuid();
                Log.InfoFormat("Data Source '{0}' doesn't have an ID yet, setting it to: {1}",
                               File,
                               Id
                    );
                neededPatching = true;
            }
            else
            {
                neededPatching = false;
            }

            reader.MoveToContent();

            XmlReader subtree = reader.ReadSubtree();
            while (subtree.Read())
            {
                switch (subtree.Name)
                {
                    case "activatedquickfilters":
                        IEnumerable<Guid> filters = ReadActivatedQuickFilters(reader);
                        ActivatedQuickFilters.Clear();
                        ActivatedQuickFilters.AddRange(filters);
                        break;
                }
            }
        }
Exemplo n.º 3
0
        private IEnumerable<Guid> ReadActivatedQuickFilters(XmlReader reader)
        {
            var guids = new List<Guid>();
            XmlReader subtree = reader.ReadSubtree();

            while (subtree.Read())
            {
                switch (subtree.Name)
                {
                    case "quickfilter":
                        int count = reader.AttributeCount;
                        for (int i = 0; i < count; ++i)
                        {
                            reader.MoveToAttribute(i);
                            switch (reader.Name)
                            {
                                case "id":
                                    guids.Add(reader.ReadContentAsGuid());
                                    break;
                            }
                        }
                        break;
                }
            }

            return guids;
        }