Esempio n. 1
0
        /// <summary>
        /// Checks if the file name is a settings file. If so, the contained logfile name
        /// is returned. If not, the given file name is returned unchanged.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        private string FindFilenameForSettings(string fileName)
        {
            if (fileName.EndsWith(".lxp"))
            {
                PersistenceData persistenceData = Persister.LoadOptionsOnly(fileName);
                if (persistenceData == null)
                {
                    return(fileName);
                }

                if (persistenceData.fileName != null && persistenceData.fileName.Length > 0)
                {
                    IFileSystemPlugin fs = PluginRegistry.GetInstance().FindFileSystemForUri(persistenceData.fileName);
                    if (fs != null && !fs.GetType().Equals(typeof(LocalFileSystem)))
                    {
                        return(persistenceData.fileName);
                    }

                    // On relative paths the URI check (and therefore the file system plugin check) will fail.
                    // So fs == null and fs == LocalFileSystem are handled here like normal files.
                    if (Path.IsPathRooted(persistenceData.fileName))
                    {
                        return(persistenceData.fileName);
                    }
                    else
                    {
                        // handle relative paths in .lxp files
                        string dir = Path.GetDirectoryName(fileName);
                        return(Path.Combine(dir, persistenceData.fileName));
                    }
                }
            }

            return(fileName);
        }
Esempio n. 2
0
		/// <summary>
		/// Loads the persistence options out of the given persistence file name.
		/// </summary>
		/// <param name="fileName"></param>
		/// <returns></returns>
		public static PersistenceData LoadOptionsOnly(string fileName)
		{
			if (File.Exists(fileName))
			{
				PersistenceData persistenceData = new PersistenceData();
				XmlDocument xmlDoc = new XmlDocument();
				try
				{
					xmlDoc.Load(fileName);
				}
				catch (IOException)
				{
					return null;
				}
				XmlNode fileNode = xmlDoc.SelectSingleNode("logexpert/file");
				if (fileNode != null)
				{
					XmlElement fileElement = fileNode as XmlElement;
					ReadOptions(fileElement, persistenceData);
					persistenceData.fileName = fileElement.GetAttribute("fileName");
					persistenceData.encoding = ReadEncoding(fileElement);
				}
				return persistenceData;
			}
			return null;
		}
Esempio n. 3
0
 /// <summary>
 /// Loads the persistence options out of the given persistence file name.
 /// </summary>
 /// <param name="fileName"></param>
 /// <returns></returns>
 public static PersistenceData LoadOptionsOnly(string fileName)
 {
     if (File.Exists(fileName))
     {
         PersistenceData persistenceData = new PersistenceData();
         XmlDocument     xmlDoc          = new XmlDocument();
         try
         {
             xmlDoc.Load(fileName);
         }
         catch (IOException)
         {
             return(null);
         }
         XmlNode fileNode = xmlDoc.SelectSingleNode("logexpert/file");
         if (fileNode != null)
         {
             XmlElement fileElement = fileNode as XmlElement;
             ReadOptions(fileElement, persistenceData);
             persistenceData.fileName = fileElement.GetAttribute("fileName");
             persistenceData.encoding = ReadEncoding(fileElement);
         }
         return(persistenceData);
     }
     return(null);
 }
Esempio n. 4
0
		public static string SavePersistenceData(String logFileName, PersistenceData persistenceData, Preferences preferences)
		{
			string fileName = BuildPersisterFileName(logFileName, preferences);
			if (preferences.saveLocation == SessionSaveLocation.SameDir)
			{
				// make to log file in .lxp file relative
				string filePart = Path.GetFileName(persistenceData.fileName);
				persistenceData.fileName = filePart;
			}
			Save(fileName, persistenceData);
			return fileName;
		}
Esempio n. 5
0
        public static string SavePersistenceData(String logFileName, PersistenceData persistenceData, Preferences preferences)
        {
            string fileName = BuildPersisterFileName(logFileName, preferences);

            if (preferences.saveLocation == SessionSaveLocation.SameDir)
            {
                // make to log file in .lxp file relative
                string filePart = Path.GetFileName(persistenceData.fileName);
                persistenceData.fileName = filePart;
            }
            Save(fileName, persistenceData);
            return(fileName);
        }
Esempio n. 6
0
        private static PersistenceData Load(String fileName)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(fileName);
            XmlNode         fileNode        = xmlDoc.SelectSingleNode("logexpert/file");
            PersistenceData persistenceData = new PersistenceData();

            if (fileNode != null)
            {
                persistenceData = ReadPersistenceDataFromNode(fileNode);
            }
            return(persistenceData);
        }
Esempio n. 7
0
 private static PersistenceData Load(string fileName)
 {
     if (File.Exists(fileName))
     {
         XmlDocument xmlDoc = new XmlDocument();
         xmlDoc.Load(fileName);
         XmlNode         fileNode        = xmlDoc.SelectSingleNode("logexpert/file");
         PersistenceData persistenceData = new PersistenceData();
         if (fileNode != null)
         {
             persistenceData = ReadPersistenceDataFromNode(fileNode);
         }
         return(persistenceData);
     }
     else
     {
         throw new FileNotFoundException("File not found", fileName);
     }
 }
Esempio n. 8
0
        private static PersistenceData ReadPersistenceDataFromNode(XmlNode node)
        {
            PersistenceData persistenceData = new PersistenceData();
            XmlElement      fileElement     = node as XmlElement;

            persistenceData.bookmarkList  = ReadBookmarks(fileElement);
            persistenceData.rowHeightList = ReadRowHeightList(fileElement);
            ReadOptions(fileElement, persistenceData);
            persistenceData.fileName = fileElement.GetAttribute("fileName");
            string sLineCount = fileElement.GetAttribute("lineCount");

            if (sLineCount != null && sLineCount.Length > 0)
            {
                persistenceData.lineCount = Int32.Parse(sLineCount);
            }
            persistenceData.filterParamsList  = ReadFilter(fileElement);
            persistenceData.filterTabDataList = ReadFilterTabs(fileElement);
            persistenceData.encoding          = ReadEncoding(fileElement);
            return(persistenceData);
        }
Esempio n. 9
0
        private static void Save(String fileName, PersistenceData persistenceData)
        {
            XmlDocument xmlDoc      = new XmlDocument();
            XmlElement  rootElement = xmlDoc.CreateElement("logexpert");

            xmlDoc.AppendChild(rootElement);
            XmlElement fileElement = xmlDoc.CreateElement("file");

            rootElement.AppendChild(fileElement);
            fileElement.SetAttribute("fileName", persistenceData.fileName);
            fileElement.SetAttribute("lineCount", "" + persistenceData.lineCount);
            WriteBookmarks(xmlDoc, fileElement, persistenceData.bookmarkList);
            WriteRowHeightList(xmlDoc, fileElement, persistenceData.rowHeightList);
            WriteOptions(xmlDoc, fileElement, persistenceData);
            WriteFilter(xmlDoc, fileElement, persistenceData.filterParamsList);
            WriteFilterTabs(xmlDoc, fileElement, persistenceData.filterTabDataList);
            WriteEncoding(xmlDoc, fileElement, persistenceData.encoding);
            if (xmlDoc.HasChildNodes)
            {
                xmlDoc.Save(fileName);
            }
        }
Esempio n. 10
0
 private static void WriteFilterTabs(XmlDocument xmlDoc, XmlElement rootElement, List <FilterTabData> dataList)
 {
     if (dataList.Count > 0)
     {
         XmlElement filterTabsElement = xmlDoc.CreateElement("filterTabs");
         rootElement.AppendChild(filterTabsElement);
         foreach (FilterTabData data in dataList)
         {
             PersistenceData persistenceData  = data.persistenceData;
             XmlElement      filterTabElement = xmlDoc.CreateElement("filterTab");
             filterTabsElement.AppendChild(filterTabElement);
             WriteBookmarks(xmlDoc, filterTabElement, persistenceData.bookmarkList);
             WriteRowHeightList(xmlDoc, filterTabElement, persistenceData.rowHeightList);
             WriteOptions(xmlDoc, filterTabElement, persistenceData);
             WriteFilter(xmlDoc, filterTabElement, persistenceData.filterParamsList);
             WriteFilterTabs(xmlDoc, filterTabElement, persistenceData.filterTabDataList);
             XmlElement filterElement = xmlDoc.CreateElement("tabFilter");
             filterTabElement.AppendChild(filterElement);
             List <FilterParams> filterList = new List <FilterParams>();
             filterList.Add(data.filterParams);
             WriteFilter(xmlDoc, filterElement, filterList);
         }
     }
 }
Esempio n. 11
0
        private static List <FilterTabData> ReadFilterTabs(XmlElement startNode)
        {
            List <FilterTabData> dataList = new List <FilterTabData>();
            XmlNode filterTabsNode        = startNode.SelectSingleNode("filterTabs");

            if (filterTabsNode != null)
            {
                XmlNodeList filterTabNodeList = filterTabsNode.ChildNodes; // all "filterTab" nodes
                foreach (XmlNode node in filterTabNodeList)
                {
                    PersistenceData persistenceData = ReadPersistenceDataFromNode(node);
                    XmlNode         filterNode      = node.SelectSingleNode("tabFilter");
                    if (filterNode != null)
                    {
                        List <FilterParams> filterList = ReadFilter(filterNode as XmlElement);
                        FilterTabData       data       = new FilterTabData();
                        data.persistenceData = persistenceData;
                        data.filterParams    = filterList[0]; // there's only 1
                        dataList.Add(data);
                    }
                }
            }
            return(dataList);
        }
Esempio n. 12
0
 void RestoreFilterTabs(PersistenceData persistenceData)
 {
     foreach (FilterTabData data in persistenceData.filterTabDataList)
     {
         FilterParams persistFilterParams = data.filterParams;
         ReInitFilterParams(persistFilterParams);
         List<int> filterResultList = new List<int>();
         List<int> filterHitList = new List<int>();
         Filter(persistFilterParams, filterResultList, _lastFilterLinesList, filterHitList);
         FilterPipe pipe = new FilterPipe(persistFilterParams.CreateCopy(), this);
         WritePipeToTab(pipe, filterResultList, data.persistenceData.tabName, data.persistenceData);
     }
 }
Esempio n. 13
0
		private static PersistenceData ReadPersistenceDataFromNode(XmlNode node)
		{
			PersistenceData persistenceData = new PersistenceData();
			XmlElement fileElement = node as XmlElement;
			persistenceData.bookmarkList = ReadBookmarks(fileElement);
			persistenceData.rowHeightList = ReadRowHeightList(fileElement);
			ReadOptions(fileElement, persistenceData);
			persistenceData.fileName = fileElement.GetAttribute("fileName");
			string sLineCount = fileElement.GetAttribute("lineCount");
			if (sLineCount != null && sLineCount.Length > 0)
			{
				persistenceData.lineCount = Int32.Parse(sLineCount);
			}
			persistenceData.filterParamsList = ReadFilter(fileElement);
			persistenceData.filterTabDataList = ReadFilterTabs(fileElement);
			persistenceData.encoding = ReadEncoding(fileElement);
			return persistenceData;
		}
Esempio n. 14
0
		private static PersistenceData Load(string fileName)
		{
			if (File.Exists(fileName))
			{
				XmlDocument xmlDoc = new XmlDocument();
				xmlDoc.Load(fileName);
				XmlNode fileNode = xmlDoc.SelectSingleNode("logexpert/file");
				PersistenceData persistenceData = new PersistenceData();
				if (fileNode != null)
				{
					persistenceData = ReadPersistenceDataFromNode(fileNode);
				}
				return persistenceData;
			}
			else
			{
				throw new FileNotFoundException("File not found", fileName);
			}
		}
Esempio n. 15
0
		private static void Save(String fileName, PersistenceData persistenceData)
		{
			XmlDocument xmlDoc = new XmlDocument();
			XmlElement rootElement = xmlDoc.CreateElement("logexpert");
			xmlDoc.AppendChild(rootElement);
			XmlElement fileElement = xmlDoc.CreateElement("file");
			rootElement.AppendChild(fileElement);
			fileElement.SetAttribute("fileName", persistenceData.fileName);
			fileElement.SetAttribute("lineCount", "" + persistenceData.lineCount);
			WriteBookmarks(xmlDoc, fileElement, persistenceData.bookmarkList);
			WriteRowHeightList(xmlDoc, fileElement, persistenceData.rowHeightList);
			WriteOptions(xmlDoc, fileElement, persistenceData);
			WriteFilter(xmlDoc, fileElement, persistenceData.filterParamsList);
			WriteFilterTabs(xmlDoc, fileElement, persistenceData.filterTabDataList);
			WriteEncoding(xmlDoc, fileElement, persistenceData.encoding);
			if (xmlDoc.HasChildNodes)
			{
				xmlDoc.Save(fileName);
			}
		}
Esempio n. 16
0
 void FilterRestore(LogWindow newWin, PersistenceData persistenceData)
 {
     newWin.WaitForLoadingFinished();
     ILogLineColumnizer columnizer = Util.FindColumnizerByName(persistenceData.columnizerName, PluginRegistry.GetInstance().RegisteredColumnizers);
     if (columnizer != null)
     {
         Action<ILogLineColumnizer> fx = new Action<ILogLineColumnizer>(newWin.ForceColumnizer);
         newWin.Invoke(fx, new object[] { columnizer });
     }
     else
     {
         Logger.logWarn("FilterRestore(): Columnizer " + persistenceData.columnizerName + " not found");
     }
     newWin.BeginInvoke(new Action<PersistenceData>(newWin.RestoreFilters), new object[] { persistenceData });
 }
Esempio n. 17
0
 void WriteFilterToTabFinished(FilterPipe pipe, string name, PersistenceData persistenceData)
 {
     _isSearching = false;
     if (!_shouldCancel)
     {
         string title = name;
         ILogLineColumnizer preProcessColumnizer = null;
         if (!(CurrentColumnizer is ILogLineXmlColumnizer))
         {
             preProcessColumnizer = CurrentColumnizer;
         }
         LogWindow newWin = _parentLogTabWin.AddFilterTab(pipe, title, preProcessColumnizer);
         newWin.FilterPipe = pipe;
         pipe.OwnLogWindow = newWin;
         if (persistenceData != null)
         {
             Action<LogWindow, PersistenceData> fx = new Action<LogWindow, PersistenceData>(FilterRestore);
             fx.BeginInvoke(newWin, persistenceData, null, null);
         }
     }
     _progressEventArgs.Value = _progressEventArgs.MaxValue;
     _progressEventArgs.Visible = false;
     SendProgressBarUpdate();
     _guiStateArgs.MenuEnabled = true;
     SendGuiStateUpdate();
     StatusLineText("");
     filterSearchButton.Enabled = true;
 }
Esempio n. 18
0
        void WritePipeToTab(FilterPipe pipe, IList<int> lineNumberList, string name, PersistenceData persistenceData)
        {
            Logger.logInfo("WritePipeToTab(): " + lineNumberList.Count + " lines.");
            _guiStateArgs.MenuEnabled = false;
            SendGuiStateUpdate();

            StartProgressBar(lineNumberList.Count, "Writing to temp file... Press ESC to cancel.");

            _isSearching = true;
            _shouldCancel = false;

            lock (_filterPipeList)
            {
                _filterPipeList.Add(pipe);
            }
            pipe.Closed += new FilterPipe.ClosedEventHandler(Pipe_Disconnected);
            int count = 0;
            pipe.OpenFile();
            LogExpertCallback callback = new LogExpertCallback(this);
            foreach (int i in lineNumberList)
            {
                if (_shouldCancel)
                {
                    break;
                }
                string line = CurrentLogFileReader.GetLogLine(i);
                if (CurrentColumnizer is ILogLineXmlColumnizer)
                {
                    callback.LineNum = i;
                    line = (CurrentColumnizer as ILogLineXmlColumnizer).GetLineTextForClipboard(line, callback);
                }
                pipe.WriteToPipe(line, i);
                if (++count % PROGRESS_BAR_MODULO == 0)
                {
                    _progressEventArgs.Value = count;
                    Invoke(new MethodInvoker(SendProgressBarUpdate));
                }
            }
            pipe.CloseFile();
            Logger.logInfo("WritePipeToTab(): finished");
            Invoke(new Action<FilterPipe, string, PersistenceData>(WriteFilterToTabFinished), new object[] { pipe, name, persistenceData });
        }
Esempio n. 19
0
        public PersistenceData GetPersistenceData()
        {
            PersistenceData persistenceData = new PersistenceData();
            persistenceData.bookmarkList = BookmarkProvider.BookmarkList;
            persistenceData.rowHeightList = _rowHeightList;
            persistenceData.multiFile = IsMultiFile;
            persistenceData.multiFilePattern = _multifileOptions.FormatPattern;
            persistenceData.multiFileMaxDays = _multifileOptions.MaxDayTry;
            persistenceData.currentLine = dataGridView.CurrentCellAddress.Y;
            persistenceData.firstDisplayedLine = dataGridView.FirstDisplayedScrollingRowIndex;
            persistenceData.filterVisible = !splitContainer1.Panel2Collapsed;
            persistenceData.filterAdvanced = !advancedFilterSplitContainer.Panel1Collapsed;
            persistenceData.filterPosition = splitContainer1.SplitterDistance;
            persistenceData.followTail = _guiStateArgs.FollowTail;
            persistenceData.fileName = FileName;
            persistenceData.tabName = Text;
            persistenceData.columnizerName = CurrentColumnizer.GetName();
            persistenceData.lineCount = CurrentLogFileReader.LineCount;
            _filterParams.isFilterTail = filterTailCheckBox.Checked; // this option doesnt need a press on 'search'
            if (Preferences.saveFilters)
            {
                List<FilterParams> filterList = new List<FilterParams>();
                filterList.Add(_filterParams);
                persistenceData.filterParamsList = filterList;

                foreach (FilterPipe filterPipe in _filterPipeList)
                {
                    FilterTabData data = new FilterTabData();
                    data.persistenceData = filterPipe.OwnLogWindow.GetPersistenceData();
                    data.filterParams = filterPipe.FilterParams;
                    persistenceData.filterTabDataList.Add(data);
                }
            }
            if (_currentHighlightGroup != null)
            {
                persistenceData.highlightGroupName = _currentHighlightGroup.GroupName;
            }
            if (_fileNames != null && IsMultiFile)
            {
                persistenceData.multiFileNames.AddRange(_fileNames);
            }
            //persistenceData.showBookmarkCommentColumn = bookmarkWindow.ShowBookmarkCommentColumn;
            persistenceData.filterSaveListVisible = !highlightSplitContainer.Panel2Collapsed;
            persistenceData.encoding = CurrentLogFileReader.CurrentEncoding;
            return persistenceData;
        }
Esempio n. 20
0
        private static void WriteOptions(XmlDocument xmlDoc, XmlElement rootElement, PersistenceData persistenceData)
        {
            XmlElement optionsElement = xmlDoc.CreateElement("options");

            rootElement.AppendChild(optionsElement);

            XmlElement element = xmlDoc.CreateElement("multifile");

            element.SetAttribute("enabled", persistenceData.multiFile ? "1" : "0");
            element.SetAttribute("pattern", persistenceData.multiFilePattern);
            element.SetAttribute("maxDays", "" + persistenceData.multiFileMaxDays);
            foreach (string fileName in persistenceData.multiFileNames)
            {
                XmlElement entryElement = xmlDoc.CreateElement("fileEntry");
                entryElement.SetAttribute("fileName", "" + fileName);
                element.AppendChild(entryElement);
            }
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("currentline");
            element.SetAttribute("line", "" + persistenceData.currentLine);
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("firstDisplayedLine");
            element.SetAttribute("line", "" + persistenceData.firstDisplayedLine);
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("filter");
            element.SetAttribute("visible", persistenceData.filterVisible ? "1" : "0");
            element.SetAttribute("advanced", persistenceData.filterAdvanced ? "1" : "0");
            element.SetAttribute("position", "" + persistenceData.filterPosition);
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("bookmarklist");
            element.SetAttribute("visible", persistenceData.bookmarkListVisible ? "1" : "0");
            element.SetAttribute("position", "" + persistenceData.bookmarkListPosition);
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("followTail");
            element.SetAttribute("enabled", persistenceData.followTail ? "1" : "0");
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("tab");
            element.SetAttribute("name", persistenceData.tabName);
            rootElement.AppendChild(element);

            element = xmlDoc.CreateElement("columnizer");
            element.SetAttribute("name", persistenceData.columnizerName);
            rootElement.AppendChild(element);

            element = xmlDoc.CreateElement("highlightGroup");
            element.SetAttribute("name", persistenceData.highlightGroupName);
            rootElement.AppendChild(element);

            element = xmlDoc.CreateElement("bookmarkCommentColumn");
            element.SetAttribute("visible", persistenceData.showBookmarkCommentColumn ? "1" : "0");
            optionsElement.AppendChild(element);

            element = xmlDoc.CreateElement("filterSaveList");
            element.SetAttribute("visible", persistenceData.filterSaveListVisible ? "1" : "0");
            optionsElement.AppendChild(element);
        }
Esempio n. 21
0
 public static string SavePersistenceDataWithFixedName(String persistenceFileName, PersistenceData persistenceData)
 {
     Save(persistenceFileName, persistenceData);
     return(persistenceFileName);
 }
Esempio n. 22
0
		private static void WriteOptions(XmlDocument xmlDoc, XmlElement rootElement, PersistenceData persistenceData)
		{
			XmlElement optionsElement = xmlDoc.CreateElement("options");
			rootElement.AppendChild(optionsElement);
			
			XmlElement element = xmlDoc.CreateElement("multifile");
			element.SetAttribute("enabled", persistenceData.multiFile ? "1" : "0");
			element.SetAttribute("pattern", persistenceData.multiFilePattern);
			element.SetAttribute("maxDays", "" + persistenceData.multiFileMaxDays);
			foreach (string fileName in persistenceData.multiFileNames)
			{
				XmlElement entryElement = xmlDoc.CreateElement("fileEntry");
				entryElement.SetAttribute("fileName", "" + fileName);
				element.AppendChild(entryElement);
			}
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("currentline");
			element.SetAttribute("line", "" + persistenceData.currentLine);
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("firstDisplayedLine");
			element.SetAttribute("line", "" + persistenceData.firstDisplayedLine);
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("filter");
			element.SetAttribute("visible", persistenceData.filterVisible ? "1" : "0");
			element.SetAttribute("advanced", persistenceData.filterAdvanced ? "1" : "0");
			element.SetAttribute("position", "" + persistenceData.filterPosition);
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("bookmarklist");
			element.SetAttribute("visible", persistenceData.bookmarkListVisible ? "1" : "0");
			element.SetAttribute("position", "" + persistenceData.bookmarkListPosition);
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("followTail");
			element.SetAttribute("enabled", persistenceData.followTail ? "1" : "0");
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("tab");
			element.SetAttribute("name", persistenceData.tabName);
			rootElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("columnizer");
			element.SetAttribute("name", persistenceData.columnizerName);
			rootElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("highlightGroup");
			element.SetAttribute("name", persistenceData.highlightGroupName);
			rootElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("bookmarkCommentColumn");
			element.SetAttribute("visible", persistenceData.showBookmarkCommentColumn ? "1" : "0");
			optionsElement.AppendChild(element);
			
			element = xmlDoc.CreateElement("filterSaveList");
			element.SetAttribute("visible", persistenceData.filterSaveListVisible ? "1" : "0");
			optionsElement.AppendChild(element);
		}
Esempio n. 23
0
        private static void ReadOptions(XmlElement startNode, PersistenceData persistenceData)
        {
            XmlNode optionsNode = startNode.SelectSingleNode("options");
            string  value       = GetOptionsAttribute(optionsNode, "multifile", "enabled");

            persistenceData.multiFile        = value != null && value.Equals("1");
            persistenceData.multiFilePattern = GetOptionsAttribute(optionsNode, "multifile", "pattern");
            value = GetOptionsAttribute(optionsNode, "multifile", "maxDays");
            try
            {
                persistenceData.multiFileMaxDays = value != null?Int16.Parse(value) : 0;
            }
            catch (Exception)
            {
                persistenceData.multiFileMaxDays = 0;
            }

            XmlNode multiFileNode = optionsNode.SelectSingleNode("multifile");

            if (multiFileNode != null)
            {
                XmlNodeList multiFileNodeList = multiFileNode.ChildNodes; // all "fileEntry" nodes
                foreach (XmlNode node in multiFileNodeList)
                {
                    string fileName = null;
                    foreach (XmlAttribute attr in node.Attributes)
                    {
                        if (attr.Name.Equals("fileName"))
                        {
                            fileName = attr.InnerText;
                        }
                    }
                    persistenceData.multiFileNames.Add(fileName);
                }
            }

            value = GetOptionsAttribute(optionsNode, "currentline", "line");
            if (value != null)
            {
                persistenceData.currentLine = Int32.Parse(value);
            }
            value = GetOptionsAttribute(optionsNode, "firstDisplayedLine", "line");
            if (value != null)
            {
                persistenceData.firstDisplayedLine = Int32.Parse(value);
            }

            value = GetOptionsAttribute(optionsNode, "filter", "visible");
            persistenceData.filterVisible = value != null && value.Equals("1");
            value = GetOptionsAttribute(optionsNode, "filter", "advanced");
            persistenceData.filterAdvanced = value != null && value.Equals("1");
            value = GetOptionsAttribute(optionsNode, "filter", "position");
            if (value != null)
            {
                persistenceData.filterPosition = Int32.Parse(value);
            }

            value = GetOptionsAttribute(optionsNode, "bookmarklist", "visible");
            persistenceData.bookmarkListVisible = value != null && value.Equals("1");
            value = GetOptionsAttribute(optionsNode, "bookmarklist", "position");
            if (value != null)
            {
                persistenceData.bookmarkListPosition = Int32.Parse(value);
            }

            value = GetOptionsAttribute(optionsNode, "followTail", "enabled");
            persistenceData.followTail = value != null && value.Equals("1");

            value = GetOptionsAttribute(optionsNode, "bookmarkCommentColumn", "visible");
            persistenceData.showBookmarkCommentColumn = value != null && value.Equals("1");

            value = GetOptionsAttribute(optionsNode, "filterSaveList", "visible");
            persistenceData.filterSaveListVisible = value != null && value.Equals("1");

            XmlNode tabNode = startNode.SelectSingleNode("tab");

            if (tabNode != null)
            {
                persistenceData.tabName = (tabNode as XmlElement).GetAttribute("name");
            }
            XmlNode columnizerNode = startNode.SelectSingleNode("columnizer");

            if (columnizerNode != null)
            {
                persistenceData.columnizerName = (columnizerNode as XmlElement).GetAttribute("name");
            }
            XmlNode highlightGroupNode = startNode.SelectSingleNode("highlightGroup");

            if (highlightGroupNode != null)
            {
                persistenceData.highlightGroupName = (highlightGroupNode as XmlElement).GetAttribute("name");
            }
        }
Esempio n. 24
0
		private static void ReadOptions(XmlElement startNode, PersistenceData persistenceData)
		{
			XmlNode optionsNode = startNode.SelectSingleNode("options");
			string value = GetOptionsAttribute(optionsNode, "multifile", "enabled");
			persistenceData.multiFile = value != null && value.Equals("1");
			persistenceData.multiFilePattern = GetOptionsAttribute(optionsNode, "multifile", "pattern");
			value = GetOptionsAttribute(optionsNode, "multifile", "maxDays");
			try
			{
				persistenceData.multiFileMaxDays = value != null ? Int16.Parse(value) : 0;
			}
			catch (Exception)
			{
				persistenceData.multiFileMaxDays = 0;
			}
			
			XmlNode multiFileNode = optionsNode.SelectSingleNode("multifile");
			if (multiFileNode != null)
			{
				XmlNodeList multiFileNodeList = multiFileNode.ChildNodes;   // all "fileEntry" nodes
				foreach (XmlNode node in multiFileNodeList)
				{
					string fileName = null;
					foreach (XmlAttribute attr in node.Attributes)
					{
						if (attr.Name.Equals("fileName"))
						{
							fileName = attr.InnerText;
						}
					}
					persistenceData.multiFileNames.Add(fileName);
				}
			}
			
			value = GetOptionsAttribute(optionsNode, "currentline", "line");
			if (value != null)
			{
				persistenceData.currentLine = Int32.Parse(value);
			}
			value = GetOptionsAttribute(optionsNode, "firstDisplayedLine", "line");
			if (value != null)
			{
				persistenceData.firstDisplayedLine = Int32.Parse(value);
			}
			
			value = GetOptionsAttribute(optionsNode, "filter", "visible");
			persistenceData.filterVisible = value != null && value.Equals("1");
			value = GetOptionsAttribute(optionsNode, "filter", "advanced");
			persistenceData.filterAdvanced = value != null && value.Equals("1");
			value = GetOptionsAttribute(optionsNode, "filter", "position");
			if (value != null)
			{
				persistenceData.filterPosition = Int32.Parse(value);
			}
			
			value = GetOptionsAttribute(optionsNode, "bookmarklist", "visible");
			persistenceData.bookmarkListVisible = value != null && value.Equals("1");
			value = GetOptionsAttribute(optionsNode, "bookmarklist", "position");
			if (value != null)
			{
				persistenceData.bookmarkListPosition = Int32.Parse(value);
			}
			
			value = GetOptionsAttribute(optionsNode, "followTail", "enabled");
			persistenceData.followTail = value != null && value.Equals("1");
			
			value = GetOptionsAttribute(optionsNode, "bookmarkCommentColumn", "visible");
			persistenceData.showBookmarkCommentColumn = value != null && value.Equals("1");
			
			value = GetOptionsAttribute(optionsNode, "filterSaveList", "visible");
			persistenceData.filterSaveListVisible = value != null && value.Equals("1");
			
			XmlNode tabNode = startNode.SelectSingleNode("tab");
			if (tabNode != null)
			{
				persistenceData.tabName = (tabNode as XmlElement).GetAttribute("name");
			}
			XmlNode columnizerNode = startNode.SelectSingleNode("columnizer");
			if (columnizerNode != null)
			{
				persistenceData.columnizerName = (columnizerNode as XmlElement).GetAttribute("name");
			}
			XmlNode highlightGroupNode = startNode.SelectSingleNode("highlightGroup");
			if (highlightGroupNode != null)
			{
				persistenceData.highlightGroupName = (highlightGroupNode as XmlElement).GetAttribute("name");
			}
		}
Esempio n. 25
0
 protected void LoadPersistenceOptions(PersistenceData persistenceData)
 {
     splitContainer1.SplitterDistance = persistenceData.filterPosition;
     splitContainer1.Panel2Collapsed = !persistenceData.filterVisible;
     ToggleHighlightPanel(persistenceData.filterSaveListVisible);
     ShowAdvancedFilterPanel(persistenceData.filterAdvanced);
 }
Esempio n. 26
0
		public static string SavePersistenceDataWithFixedName(String persistenceFileName, PersistenceData persistenceData)
		{
			Save(persistenceFileName, persistenceData);
			return persistenceFileName;
		}
Esempio n. 27
0
 void RestoreFilters(PersistenceData persistenceData)
 {
     if (persistenceData.filterParamsList.Count > 0)
     {
         _filterParams = persistenceData.filterParamsList[0];
         ReInitFilterParams(_filterParams);
     }
     ApplyFilterParams();  // re-loaded filter settingss
     BeginInvoke(new MethodInvoker(FilterSearch));
     try
     {
         splitContainer1.SplitterDistance = persistenceData.filterPosition;
         splitContainer1.Panel2Collapsed = !persistenceData.filterVisible;
     }
     catch (InvalidOperationException e)
     {
         Logger.logError("Error setting splitter distance: " + e.Message);
     }
     ShowAdvancedFilterPanel(persistenceData.filterAdvanced);
     if (_filterPipeList.Count == 0)     // don't restore if it's only a reload
     {
         RestoreFilterTabs(persistenceData);
     }
 }