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


C# Runner.SetSplitTime方法代码示例

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


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

示例1: ParseXmlData


//.........这里部分代码省略.........
                        }

                        string status = competitorStatusNode.Attributes["value"].Value;
                        string time = resultTimeNode.InnerText;
                        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);
                        }

                        int itime = ParseTime(time);
                        int istatus = 10;

                        switch (status)
                        {
                            case "MisPunch":
                                istatus = 3;
                                break;

                            case "Disqualified":
                                istatus = 4;
                                break;
                            case "DidNotFinish":
                                istatus = 3;
                                itime = -3;
                                break;
                            case "DidNotStart":
                                istatus = 1;
                                itime = -3;
                                break;
                            case "Overtime":
                                istatus = 5;
                                break;
                            case "OK":
                                istatus = 0;
                                break;
                            case "NotCompeting":
                                //Does not compete, exclude
                                continue;
                        }

                        runner.SetResult(itime, istatus);

                        var lsplitCodes = new List<int>();
                        var lsplitTimes = new List<int>();

                        XmlNodeList splittimes = personNode.SelectNodes("Result/SplitTime");
                        if (splittimes != null)
                        {
                            foreach (XmlNode splitNode in splittimes)
                            {
                                XmlNode splitcode = splitNode.SelectSingleNode("ControlCode");
                                XmlNode splittime = splitNode.SelectSingleNode("Time");
                                if (splittime == null || splitcode == null)
                                    continue;

                                int iSplitcode;
                                string sSplittime = splittime.InnerText;
                                if (int.TryParse(splitcode.InnerText, out iSplitcode) && sSplittime.Length > 0)
                                {
                                    if (iSplitcode == 999)
                                    {
                                        if (istatus == 0 && itime == -1)
                                        {
                                            //Målstämpling
                                            itime = ParseTime(sSplittime);
                                            runner.SetResult(itime, 0);
                                        }
                                    }
                                    else
                                    {
                                        iSplitcode += 1000;
                                        while (lsplitCodes.Contains(iSplitcode))
                                        {
                                            iSplitcode += 1000;
                                        }

                                        int iSplittime = ParseTime(sSplittime);
                                        lsplitCodes.Add(iSplitcode);
                                        lsplitTimes.Add(iSplittime);

                                        runner.SetSplitTime(iSplitcode, iSplittime);
                                    }
                                }
                            }
                        }

                        runners.Add(runner);
                    }
                }
            }

            return runners.ToArray();
        }
开发者ID:xkenia,项目名称:liveresults,代码行数:101,代码来源:IOFXmlV2Parser.cs

示例2: ParseXmlData


//.........这里部分代码省略.........
                        if (!string.IsNullOrEmpty(starttime))
                        {
                            int istarttime = ParseTime(starttime);
                            runner.SetStartTime(istarttime);
                        }

                        int itime = ParseTime(time);
                        int istatus = 10;

                        if (status.ToLower() == "notcompeting")
                        {
                            //Does not compete, exclude
                            continue;
                        }

                        //runners without starttimenode have not started yet
                        if (startTimeNode != null)
                        {
                            switch (status.ToLower())
                            {
                                case "mispunch":
                                    istatus = 3;
                                    break;

                                case "disqualified":
                                    istatus = 4;
                                    break;
                                case "didnotfinish":
                                    istatus = 3;
                                    itime = -3;
                                    break;
                                case "didnotstart":
                                    istatus = 1;
                                    itime = -3;
                                    break;
                                case "overtime":
                                    istatus = 5;
                                    break;
                                case "ok":
                                    istatus = 0;
                                    break;
                            }
                        }

                        runner.SetResult(itime, istatus);

                        var lsplitCodes = new List<int>();
                        var lsplitTimes = new List<int>();

                        XmlNodeList splittimes = personNode.SelectNodes("Result/SplitTime");
                        if (splittimes != null)
                        {
                            foreach (XmlNode splitNode in splittimes)
                            {
                                XmlNode splitcode = splitNode.SelectSingleNode("ControlCode");
                                XmlNode splittime = splitNode.SelectSingleNode("Time");
                                if (splittime == null || splitcode == null)
                                    continue;

                                int iSplitcode;
                                string sSplittime = splittime.InnerText;

                                bool parseOK = int.TryParse(splitcode.InnerText, out iSplitcode);
                                bool isFinishPunch = splitcode.InnerText.StartsWith("F", StringComparison.InvariantCultureIgnoreCase) || iSplitcode == 999;
                                if ((parseOK || isFinishPunch) && sSplittime.Length > 0)
                                {
                                    if (isFinishPunch)
                                    {
                                        if ((istatus == 0 && itime == -1) || (istatus == 10 && itime == -9))
                                        {
                                            //Målstämpling
                                            itime = ParseTime(sSplittime);
                                            runner.SetResult(itime, 0);
                                        }
                                    }
                                    else
                                    {
                                        iSplitcode += 1000;
                                        while (lsplitCodes.Contains(iSplitcode))
                                        {
                                            iSplitcode += 1000;
                                        }

                                        int iSplittime = ParseTime(sSplittime);
                                        lsplitCodes.Add(iSplitcode);
                                        lsplitTimes.Add(iSplittime);

                                        runner.SetSplitTime(iSplitcode, iSplittime);
                                    }
                                }
                            }
                        }

                        runners.Add(runner);
                    }
                }
            }

            return runners.ToArray();
        }
开发者ID:xkenia,项目名称:liveresults,代码行数:101,代码来源:IOFXmlV2Parser.cs


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