private bool SetFMS()
        {
            string dseventsPath = FilePath + "\\" + Name + ".dsevents";

            if (File.Exists(dseventsPath))
            {
                DSEVENTSReader reader = new DSEVENTSReader(dseventsPath);
                reader.ReadForFMS();
                if (reader.Version == 4)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (DSEVENTSEntry en in reader.Entries)
                    {
                        sb.Append(en.Data + " ");
                    }
                    String txtF = sb.ToString();
                    if (!string.IsNullOrWhiteSpace(txtF))
                    {
                        IsFMSMatch = true;
                    }
                    else
                    {
                        IsFMSMatch = false;
                        return(true);
                    }


                    if (txtF.Contains("FMS Connected:   Qualification"))
                    {
                        MatchType   = FMSMatchType.Qualification;
                        FMSMatchNum = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   Qualification - ") + 33, 5).Split(':')[0]);
                    }
                    else if (txtF.Contains("FMS Connected:   Elimination"))
                    {
                        MatchType   = FMSMatchType.Elimination;
                        FMSMatchNum = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   Elimination - ") + 31, 5).Split(':')[0]);
                    }
                    else if (txtF.Contains("FMS Connected:   Practice"))
                    {
                        MatchType   = FMSMatchType.Practice;
                        FMSMatchNum = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   Practice - ") + 28, 5).Split(':')[0]);
                    }
                    else if (txtF.Contains("FMS Connected:   None"))
                    {
                        MatchType   = FMSMatchType.None;
                        FMSMatchNum = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   None - ") + 24, 5).Split(':')[0]);
                    }
                    Match eventMatch = Regex.Match(txtF, "Info FMS Event Name: [a-zA-Z0-9]+");
                    if (eventMatch.Success)
                    {
                        if (!string.IsNullOrWhiteSpace(eventMatch.Value))
                        {
                            EventName = eventMatch.Value.Replace("FMS Event Name: ", "").Replace("Info", "").Trim();
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #2
0
        private bool SetFMS(string dir, string name, out Match match)
        {
            match = null;
            string dseventsPath = dir + "\\" + name + ".dsevents";

            if (File.Exists(dseventsPath))
            {
                DSEVENTSReader reader = new DSEVENTSReader(dseventsPath);
                reader.ReadForFMS();
                if (reader.Version == 3)
                {
                    match      = new Match();
                    match.Name = name;
                    StringBuilder sb = new StringBuilder();
                    foreach (DSEVENTSEntry en in reader.Entries)
                    {
                        sb.Append(en.Data + " ");
                    }
                    String txtF = sb.ToString();

                    if (!string.IsNullOrWhiteSpace(txtF))
                    {
                        match.IsFMS = true;
                    }
                    else
                    {
                        match.IsFMS = false;
                    }


                    if (txtF.Contains("FMS Connected:   Qualification"))
                    {
                        match.MatchType = FMSMatchType.Qualification;
                        match.MatchNum  = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   Qualification - ") + 33, 5).Split(':')[0]);
                    }
                    else if (txtF.Contains("FMS Connected:   Elimination"))
                    {
                        match.MatchType = FMSMatchType.Elimination;
                        match.MatchNum  = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   Elimination - ") + 31, 5).Split(':')[0]);
                    }
                    else if (txtF.Contains("FMS Connected:   Practice"))
                    {
                        match.MatchType = FMSMatchType.Practice;
                        match.MatchNum  = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   Practice - ") + 28, 5).Split(':')[0]);
                    }
                    else if (txtF.Contains("FMS Connected:   None"))
                    {
                        match.MatchType = FMSMatchType.None;
                        match.MatchNum  = int.Parse(txtF.Substring(txtF.IndexOf("FMS Connected:   None - ") + 24, 5).Split(':')[0]);
                    }

                    if (txtF.Contains("FMS Event Name: "))
                    {
                        string[] sArray = txtF.Split(new string[] { "Info" }, StringSplitOptions.None);
                        foreach (String ss in sArray)
                        {
                            if (ss.Contains("FMS Event Name: "))
                            {
                                match.EventName = ss.Replace("FMS Event Name: ", "").Trim();
                                break;
                            }
                        }
                    }
                    else
                    {
                        match.EventName = "???";
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }