public Match(TMatch match) { Id = match.MatchID; StarteTime = DateTime.Parse(match.StartTime); Players = match.Users.Select(o => new User(o)).ToList(); Court = match.Court; }
static void Main(string[] args) { //IList<int> test = new List<int>() {10,8,15,46,8,16,6 }; //Console.WriteLine(test.LastOrDefault(n => n > 10)); //Console.ReadLine(); //return; TSocket socket = new TSocket("127.0.0.1", 8807); TBinaryProtocol pro = new TBinaryProtocol(socket); TennisDataAnaliy.Client client = new TennisDataAnaliy.Client(pro); bool isopen = false; while (!isopen) { try { socket.Open(); isopen = true; } catch (Exception ex) { Console.WriteLine("等待服务启动..."); Thread.Sleep(1000); } } Console.WriteLine("可以开始测试了"); TMatch match = new TMatch(); match.Court = new TennisCourt(); match.Court.Width = 10970; match.Court.Height = 23770; match.MatchID = Guid.NewGuid().ToString(); match.StartTime = DateTime.Now.ToString(); match.Users = new List<userInfo>(); match.Users.Add(new userInfo() { UserID=Guid.NewGuid().ToString(), Direction=1,Hand=0}); match.Users.Add(new userInfo() { UserID = Guid.NewGuid().ToString(), Direction = -1, Hand = 0 }); if (client.StartMatch(match)) { Console.WriteLine("开始新的比赛成功"); } else { Console.WriteLine("开始比赛失败"); } string path = @"E:\网球\03网球鹰眼顶级赛事版\02doc\00-项目文档\Log.txt"; StreamReader reader = new StreamReader(path); while (!reader.EndOfStream) { string trace = reader.ReadLine(); client.InsertPathToDB(trace); } Console.WriteLine("轨迹数据发送完毕"); Console.ReadLine(); }
internal NMatch(TMatch message) { Id = message.MatchId.ToByteArray(); Presence = new List <INUserPresence>(); foreach (var item in message.Presences) { Presence.Add(new NUserPresence(item)); } Self = new NUserPresence(message.Self); }
//Constructor FromString( s, Settings) public TGameRR(string s, TSettings Settings) { string[] a; string[] b; int i; int j; this.Settings = Settings; // Create Match to point on later CurrentMatch = new TMatch(); CurrentA = 0; CurrentB = 0; a = UHelpers.UHelpers.Explode(s, Units.Class.SEP_GAME); // Players + nPlayers b = UHelpers.UHelpers.Explode(a[1], Units.Class.SEP_LIST); nPlayers = b.Length; Players = new TPlayer[nPlayers]; for (i = 0; i < nPlayers; i++) { Players[i] = new TPlayer(b[i]); } // PointsGrid b = UHelpers.UHelpers.Explode(a[2], Units.Class.SEP_LIST); PointsGrid = new int[nPlayers, nPlayers]; for (i = 0; i < nPlayers; i++) { for (j = 0; j < nPlayers; j++) { PointsGrid[i, j] = Convert.ToInt32(b[i * nPlayers + j]); } } // TimeGrid b = UHelpers.UHelpers.Explode(a[3], Units.Class.SEP_LIST); TimeGrid = new int[nPlayers, nPlayers]; for (i = 0; i < nPlayers; i++) { for (j = 0; j < nPlayers; j++) { TimeGrid[i, j] = Convert.ToInt32(b[i * nPlayers + j]); } } // CountList b = UHelpers.UHelpers.Explode(a[4], Units.Class.SEP_LIST); CountList = new int[nPlayers]; for (i = 0; i < nPlayers; i++) { CountList[i] = Convert.ToInt32(b[i]); } // TimeStarted TimeStarted = Convert.ToDateTime(a[5]); }
/// <summary> /// 开始比赛 /// </summary> /// <param name="match"></param> public bool StartMatch(TMatch match) { rmode = Runmode.Match; if (Cmatch == null || Cmatch.Id != match.MatchID) { Cmatch = new RigourTech.Service.Match(match); LogText.Info("StartMatch", "*******************************************开始新比赛************************************"); } else { LogText.Info("StartMatch", "*******************************************回复比赛************************************"); } return(true); }
//Constructor Create( Candidates, Settings) public TGameRR(TPlayer[] Candidates, TSettings Settings) { int i; int j; this.Settings = Settings; nPlayers = Candidates.Length; TimeStarted = DateTime.MinValue; //done in GetNextMatch // Copy Players to own List Players = new TPlayer[nPlayers]; for (i = 0; i < nPlayers; i++) { Players[i] = Candidates[i]; Players[i].ID = i; } // Init Matrix and Counter Table PointsGrid = new int[nPlayers, nPlayers]; TimeGrid = new int[nPlayers, nPlayers]; CountList = new int[nPlayers]; for (i = 0; i < nPlayers; i++) { for (j = 0; j < nPlayers; j++) { if (i == j) { PointsGrid[i, j] = -1; TimeGrid[i, j] = -1; } else { PointsGrid[i, j] = 0; TimeGrid[i, j] = 0; } } CountList[i] = 99; } // Create Match to point on later CurrentMatch = new TMatch(); CurrentA = 0; CurrentB = 0; }
public static SwitchSection Create(TMatch value, Action action, TResult result) { return(new SwitchSection(value, action, result)); }
public SwitchSection(TMatch value, Action action, TResult result) { Value = value; Action = action; Result = result; }
internal NMatch(TMatch message) : this(message.Match) { }