コード例 #1
0
ファイル: FrecHelper.cs プロジェクト: radislavB/AlmLoggers
        public static List <Frec> ParseFrecsHeaders(FrecCollection frecParent, string fileContent, IList <string> excludedFrecs)
        {
            Regex           startExtractorRegex = new Regex(WebGateConst.PATTERN_START, RegexOptions.Multiline | RegexOptions.Compiled);
            MatchCollection matchCollection     = startExtractorRegex.Matches(fileContent);

            int         defaultSize = 200;
            List <Frec> list        = new List <Frec>(defaultSize);

            foreach (Match match in matchCollection)
            {
                string frecName = match.Groups[PatternGroup.FREC_NAME].Value;
                if (excludedFrecs.Contains(frecName))
                {
                    continue;
                }


                string strTime = match.Groups[PatternGroup.TIME].Value;

                Frec frec = new Frec(
                    frecParent,
                    frecName,
                    match.Groups[PatternGroup.THREAD_ID].Value,
                    TimeSpan.Parse(strTime),
                    match);

                list.Add(frec);
                frec.Id = list.Count;
            }
            return(list);
        }
コード例 #2
0
 public Frec(FrecCollection parent, string title, string thread, TimeSpan time, Match match)
 {
     m_parent = parent;
     m_title  = title;
     m_time   = time;
     m_match  = match;
     m_thread = thread;
 }
コード例 #3
0
        private void LoadFrecs(string fileName, bool suppressParseException)
        {
            if (!File.Exists(fileName))
            {
                string message = string.Format("File <{0}> isn't exist", Path.GetFileName(fileName));
                Helpers.FormUtilities.ShowMessage(message);
                return;
            }


            FrecCollection temp = FrecCollection.LoadCollection(fileName);

            if (temp == null)
            {
                if (!suppressParseException)
                {
                    Helpers.FormUtilities.ShowMessage("Failed to parse file " + fileName);
                }

                return;
            }

            m_frecs = temp;//defense against crash in ctor of FrecCollection


            bool isNewFile = (fileName != m_fileName);

            if (isNewFile)
            {
                m_fileName = fileName;
            }

            PopulateForm(isNewFile);
            Application.DoEvents();

            if (temp.Count == 0 && temp.FileContent.StartsWith("<!DOCTYPE HTML PUBLIC"))
            {
                Helpers.FormUtilities.ShowMessage("File has wrong format. It was created from IE by using \"Save As\" that changed the format of the file. Try to use the original file.");
            }
        }
コード例 #4
0
 public FrecCollectionEventArgs(FrecCollection frecs)
 {
     Debug.Assert(frecs != null, "frecs!=null");
     Frecs = frecs;
 }
コード例 #5
0
        public static FrecCollection LoadCollection(string fileName)
        {
            FrecCollection frecColl = new FrecCollection(fileName);

            return(frecColl);
        }