Beispiel #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;
        }
Beispiel #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;
                }
            }
        }
        public void Restore(XmlReader reader)
        {
            for (int i = 0; i < reader.AttributeCount; ++i)
            {
                reader.MoveToAttribute(i);
                switch (reader.Name)
                {
                    case "checkforupdates":
                        CheckForUpdates = reader.ReadContentAsBool();
                        break;

                    case "automaticallyinstallupdates":
                        AutomaticallyInstallUpdates = reader.ReadContentAsBool();
                        break;

                    case "passwordsalt":
                        _passwordSalt = reader.ReadContentAsBase64();
                        break;

                    case "proxyserver":
                        ProxyServer = reader.ReadContentAsString();
                        break;

                    case "proxyusername":
                        ProxyUsername = reader.ReadContentAsString();
                        break;

                    case "proxypassword":
                        _password = reader.ReadContentAsBase64();
                        break;

                    default:
                        Log.WarnFormat("Skipping unknown attribute '{0}'", reader.Name);
                        break;
                }
            }

            CreatePasswordSaltIfNecessary();
        }