TVSorter.Model.FileResult.ProcessMatch C# (CSharp) 메소드

ProcessMatch() 개인적인 메소드

Processes a single match of a format code.
private ProcessMatch ( Match match ) : string
match System.Text.RegularExpressions.Match /// The matched format code. ///
리턴 string
        private string ProcessMatch(Match match)
        {
            string type = match.Groups[1].Value;
            string arg = match.Groups[2].Value;
            switch (type)
            {
                case "SName":
                    return this.FormatName(this.Show.Name, arg);
                case "EName":
                    string name = this.GetEpisodeName();
                    return this.FormatName(name, arg);
                case "ENum":
                    try
                    {
                        return this.FormatNum(arg, this.Episodes.Select(x => x.EpisodeNumber).ToArray());
                    }
                    catch
                    {
                        return match.Value;
                    }

                case "SNum":
                    try
                    {
                        return this.FormatNum(arg, this.Episodes.Select(x => x.SeasonNumber).ToArray());
                    }
                    catch
                    {
                        return match.Value;
                    }

                case "Date":
                    try
                    {
                        return this.Episode.FirstAir.ToString(arg);
                    }
                    catch
                    {
                        return match.Value;
                    }
            }

            return match.Value;
        }