当前位置: 首页>>代码示例>>C#>>正文


C# Runner.SetStartTime方法代码示例

本文整理汇总了C#中Runner.SetStartTime方法的典型用法代码示例。如果您正苦于以下问题:C# Runner.SetStartTime方法的具体用法?C# Runner.SetStartTime怎么用?C# Runner.SetStartTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Runner的用法示例。


在下文中一共展示了Runner.SetStartTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseXmlData

        public static Runner[] ParseXmlData(byte[] xml, LogMessageDelegate logit, bool deleteFile, out RadioControl[] definedRadioControls)
        {
            var runners = new List<Runner>();
            definedRadioControls = null;
            var defRadios = new List<RadioControl>();

            var xmlDoc = new XmlDocument();
            using (var ms = new MemoryStream(xml))
            {
                var setts = new XmlReaderSettings();
                setts.XmlResolver = null;
                setts.ProhibitDtd = false;
                using (XmlReader xr = XmlReader.Create(ms, setts))
                {
                    xmlDoc.Load(xr);
                }
            }

            foreach (XmlNode classNode in xmlDoc.GetElementsByTagName("ClassStart"))
            {
                XmlNode classNameNode = classNode.SelectSingleNode("ClassShortName");
                if (classNameNode == null)
                    continue;

                string className = classNameNode.InnerText;
                var personNodes = classNode.SelectNodes("PersonStart");
                if (personNodes != null)
                {
                    foreach (XmlNode personNode in personNodes)
                    {
                        string familyname;
                        string givenname;
                        long pid;
                        string club;
                        if (!ParseNameClubAndId(personNode, out familyname, out givenname, out pid, out club)) continue;

                        var startTimeNode = personNode.SelectSingleNode("Start/StartTime/Clock");
                        var ccCardNode = personNode.SelectSingleNode("Start/CCard/CCardId");

                        if (startTimeNode == null || ccCardNode == null)
                            continue;
                        string starttime = startTimeNode.InnerText;
                        string si = ccCardNode.InnerText;
                        var dbid = CalculateIDFromSiCard(logit, si, familyname, givenname, pid);

                        var runner = new Runner(dbid, givenname + " " + familyname, club, className);

                        if (!string.IsNullOrEmpty(starttime))
                        {
                            int istarttime = ParseTime(starttime);
                            runner.SetStartTime(istarttime);
                        }

                        runners.Add(runner);
                    }
                }
            }

            foreach (XmlNode classNode in xmlDoc.GetElementsByTagName("ClassResult"))
            {
                XmlNode classNameNode = classNode.SelectSingleNode("ClassShortName");
                if (classNameNode == null)
                    continue;

                string className = classNameNode.InnerText;

                var personNodes = classNode.SelectNodes("PersonResult");
                if (personNodes != null)
                {
                    foreach (XmlNode personNode in personNodes)
                    {
                        string familyname;
                        string givenname;
                        long pid;
                        string club;
                        if (!ParseNameClubAndId(personNode, out familyname, out givenname, out pid, out club)) continue;

                        var competitorStatusNode = personNode.SelectSingleNode("Result/CompetitorStatus");
                        var resultTimeNode = personNode.SelectSingleNode("Result/Time");
                        var startTimeNode = personNode.SelectSingleNode("Result/StartTime/Clock");
                        var ccCardNode = personNode.SelectSingleNode("Result/CCard/CCardId");
                        if (competitorStatusNode == null || competitorStatusNode.Attributes == null || competitorStatusNode.Attributes["value"] == null ||
                            resultTimeNode == null || startTimeNode == null || ccCardNode == null)
                            continue;
                        if (familyname == "* Radio controls definition *")
                        {
                            //Special handling of SportSoftware way of telling what RadioControls will appear for this class
                            XmlNodeList pSplittimes = personNode.SelectNodes("Result/SplitTime");
                            if (pSplittimes != null)
                            {

                            }

                            continue;
                        }

                        string status = competitorStatusNode.Attributes["value"].Value;
                        string time = resultTimeNode.InnerText;
                        string starttime = startTimeNode.InnerText;
                        string si = ccCardNode.InnerText;
//.........这里部分代码省略.........
开发者ID:xkenia,项目名称:liveresults,代码行数:101,代码来源:IOFXmlV2Parser.cs

示例2: ParseXmlData

        public static Runner[] ParseXmlData(byte[] xml, LogMessageDelegate logit, bool deleteFile, GetIdDelegate getIdFunc)
        {
            var runners = new List<Runner>();

            var xmlDoc = new XmlDocument();
            using (var ms = new MemoryStream(xml))
            {
                var setts = new XmlReaderSettings();
                setts.XmlResolver = null;
                setts.ProhibitDtd = false;
                using (XmlReader xr = XmlReader.Create(ms, setts))
                {
                    xmlDoc.Load(xr);
                }
            }

            foreach (XmlNode classNode in xmlDoc.GetElementsByTagName("ClassStart"))
            {
                XmlNode classNameNode = classNode.SelectSingleNode("ClassShortName");
                if (classNameNode == null)
                    continue;

                string className = classNameNode.InnerText;
                var personNodes = classNode.SelectNodes("PersonStart");
                if (personNodes != null)
                {
                    foreach (XmlNode personNode in personNodes)
                    {
                        string familyname;
                        string givenname;
                        string club;
                        string sourceId;
                        if (!ParseNameClubAndId(personNode, out familyname, out givenname, out club, out sourceId)) continue;

                        var startTimeNode = personNode.SelectSingleNode("Start/StartTime/Clock");
                        var ccCardNode = personNode.SelectSingleNode("Start/CCard/CCardId");

                        if (startTimeNode == null || ccCardNode == null)
                            continue;
                        string starttime = startTimeNode.InnerText;
                        string si = ccCardNode.InnerText;
                        string storeAlias;

                        if (string.IsNullOrEmpty(sourceId) && string.IsNullOrEmpty(si))
                        {
                            string name = givenname + " " + familyname + ", " + club;
                            if (!m_suppressedIDCalculationErrors.ContainsKey(name))
                            {
                                logit("Cannot calculculate ID for runner: " + name + ", skipping [supressing further output for this name]");
                                m_suppressedIDCalculationErrors.Add(name, name);
                            }
                            continue;
                        }

                        int dbId = getIdFunc(sourceId, si, out storeAlias);

                        var runner = new Runner(dbId, givenname + " " + familyname, club, className, storeAlias);

                        if (!string.IsNullOrEmpty(starttime))
                        {
                            int istarttime = ParseTime(starttime);
                            runner.SetStartTime(istarttime);
                        }

                        runners.Add(runner);
                    }
                }
            }

            foreach (XmlNode classNode in xmlDoc.GetElementsByTagName("ClassResult"))
            {
                XmlNode classNameNode = classNode.SelectSingleNode("ClassShortName");
                if (classNameNode == null)
                    continue;

                string className = classNameNode.InnerText;

                var personNodes = classNode.SelectNodes("PersonResult");
                if (personNodes != null)
                {
                    foreach (XmlNode personNode in personNodes)
                    {
                        string familyname;
                        string givenname;
                        string club;
                        string sourceId;
                        if (!ParseNameClubAndId(personNode, out familyname, out givenname, out club, out sourceId)) continue;

                        var competitorStatusNode = personNode.SelectSingleNode("Result/CompetitorStatus");
                        var resultTimeNode = personNode.SelectSingleNode("Result/Time");
                        var startTimeNode = personNode.SelectSingleNode("Result/StartTime/Clock");
                        var ccCardNode = personNode.SelectSingleNode("Result/CCard/CCardId");
                        if (competitorStatusNode == null || competitorStatusNode.Attributes == null || competitorStatusNode.Attributes["value"] == null ||
                            resultTimeNode == null || ccCardNode == null)
                            continue;

                        string status = competitorStatusNode.Attributes["value"].Value;
                        string time = resultTimeNode.InnerText;
                        string starttime = "";
                        if (startTimeNode != null)
//.........这里部分代码省略.........
开发者ID:xkenia,项目名称:liveresults,代码行数:101,代码来源:IOFXmlV2Parser.cs


注:本文中的Runner.SetStartTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。