MonoDevelop.Debugger.Soft.Unity.PlayerConnection.PlayerInfo.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( string playerString ) : PlayerInfo
playerString string
return PlayerInfo
			public static PlayerInfo Parse(string playerString)
			{
				PlayerInfo res = new PlayerInfo();
				
				try {
					// "[IP] %s [Port] %u [Flags] %u [Guid] %u [EditorId] %u [Version] %d [Id] %s"
					Regex r = new Regex("\\[IP\\] (?<ip>.*) \\[Port\\] (?<port>.*) \\[Flags\\] (?<flags>.*)" +
										" \\[Guid\\] (?<guid>.*) \\[EditorId\\] (?<editorid>.*) \\[Version\\] (?<version>.*) \\[Id\\] (?<id>.*) \\[Debug\\] (?<debug>.*)");
					
					MatchCollection matches = r.Matches(playerString);
					
					if (matches.Count != 1)
					{
						throw new Exception(string.Format("Player string not recognised {0}", playerString));
					}
					
					string ip = matches[0].Groups["ip"].Value;
					
					res.m_IPEndPoint = new IPEndPoint(IPAddress.Parse(ip), UInt16.Parse (matches[0].Groups["port"].Value));
					res.m_Flags = UInt32.Parse(matches[0].Groups["flags"].Value);
					res.m_Guid = UInt32.Parse(matches[0].Groups["guid"].Value);
					res.m_EditorGuid = UInt32.Parse(matches[0].Groups["guid"].Value);
					res.m_Version = Int32.Parse (matches[0].Groups["version"].Value);
					res.m_Id = matches[0].Groups["id"].Value;
					res.m_AllowDebugging= (0 != int.Parse (matches[0].Groups["debug"].Value));
					
					System.Console.WriteLine(res.ToString());
				} catch (Exception e) {
					throw new ArgumentException ("Unable to parse player string", e);
				}
				
				return res;
			}
		}
PlayerConnection.PlayerInfo