public ReportConfig DocumentTitle(string Title)
        {
            string text = "<title>.*</title>";

            this.report.UpdateSource(this.report.Source.Replace(RegexMatcher.GetNthMatch(this.report.Source, text, 0), text.Replace(".*", Title)));
            return(this);
        }
        public ReportConfig ReportName(string Name)
        {
            int num = 20;

            if (Name.Length >= num)
            {
                Name = Name.Substring(0, num - 1);
            }
            string text = UnifiedReportFlag.GetPlaceHolder("logo") + ".*" + UnifiedReportFlag.GetPlaceHolder("logo");

            Name = text.Replace(".*", Name);
            this.report.UpdateSource(this.report.Source.Replace(RegexMatcher.GetNthMatch(this.report.Source, text, 0), Name));
            return(this);
        }
        public ReportConfig ReportRightSideText(string Headline)
        {
            int num = 30;

            if (Headline.Length >= num)
            {
                Headline = Headline.Substring(0, num - 1);
            }
            string text = UnifiedReportFlag.GetPlaceHolder("rightsidetext") + ".*" + UnifiedReportFlag.GetPlaceHolder("rightsidetext");

            Headline = text.Replace(".*", Headline);
            this.report.UpdateSource(this.report.Source.Replace(RegexMatcher.GetNthMatch(this.report.Source, text, 0), Headline));
            return(this);
        }
示例#4
0
 public static string BuildRegex(string Source, string[] Flags, string[] Values)
 {
     for (int i = 0; i < Flags.Length; i++)
     {
         string text     = Flags[i] + ".*" + Flags[i];
         string nthMatch = RegexMatcher.GetNthMatch(Source, text, 0);
         if (nthMatch == null)
         {
             Source = Source.Replace(Flags[i], Values[i]);
         }
         else
         {
             Source = Source.Replace(nthMatch, text.Replace(".*", Values[i]));
         }
     }
     return(Source);
 }
        public static string GetNthMatch(string Text, string Pattern, int MatchNumber)
        {
            GroupCollection match = RegexMatcher.GetMatch(Text, Pattern);

            return(match != null ? match[MatchNumber].ToString() : null);
        }
        private void UpdateMediaList()
        {
            string source = MediaViewBuilder.GetSource <ScreenCapture>(this.mediaList.ScreenCapture, "img");

            string[] flags = new string[]
            {
                UnifiedReportFlag.GetPlaceHolder("imagesView")
            };
            string[] array = new string[]
            {
                source + UnifiedReportFlag.GetPlaceHolder("imagesView")
            };
            if (this.infoWrite < 1 || array[0].IndexOf("No media") < 0)
            {
                lock (this.sourcelock)
                {
                    this.unifiedReportSource = SourceBuilder.BuildRegex(this.unifiedReportSource, flags, array);
                    if (this.mediaList.ScreenCapture.Count > 0)
                    {
                        try
                        {
                            string nthMatch = RegexMatcher.GetNthMatch(this.unifiedReportSource, UnifiedReportFlag.GetPlaceHolder("objectViewNullImg") + ".*" + UnifiedReportFlag.GetPlaceHolder("objectViewNullImg"), 0);
                            this.unifiedReportSource = this.unifiedReportSource.Replace(nthMatch, "");
                        }
                        catch
                        {
                        }
                    }
                    this.mediaList.ScreenCapture.Clear();
                }
            }
            source = MediaViewBuilder.GetSource <Screencast>(this.mediaList.Screencast, "vid");
            flags  = new string[]
            {
                UnifiedReportFlag.GetPlaceHolder("videosView")
            };
            array = new string[]
            {
                source + UnifiedReportFlag.GetPlaceHolder("videosView")
            };
            if (this.infoWrite < 1 || array[0].IndexOf("No media") < 0)
            {
                lock (this.sourcelock)
                {
                    this.unifiedReportSource = SourceBuilder.BuildRegex(this.unifiedReportSource, flags, array);
                    if (this.mediaList.Screencast.Count > 0)
                    {
                        try
                        {
                            string nthMatch = RegexMatcher.GetNthMatch(this.unifiedReportSource, UnifiedReportFlag.GetPlaceHolder("objectViewNullVid") + ".*" + UnifiedReportFlag.GetPlaceHolder("objectViewNullVid"), 0);
                            this.unifiedReportSource = this.unifiedReportSource.Replace(nthMatch, "");
                        }
                        catch
                        {
                        }
                    }
                    this.mediaList.Screencast.Clear();
                }
            }
            this.infoWrite++;
        }