BeardedManStudios.Network.SocketPolicyServer.Begin C# (CSharp) Метод

Begin() публичный статический Метод

Begin the Socket Policy Server
public static Begin ( XMLType xmlType = XMLType.All, string fileLocation = "" ) : void
xmlType XMLType XML Type to be used
fileLocation string Location of the policy file
Результат void
		public static void Begin(XMLType xmlType = XMLType.All, string fileLocation = "")
		{
			string policy = null;
			switch (xmlType)
			{
				case XMLType.All:
					policy = AllPolicy;
					break;
				case XMLType.Local:
					policy = LocalPolicy;
					break;
				case XMLType.File:
					if (fileLocation.Length < 2)
					{
						UnityEngine.Debug.LogError("Missing policy file name");
						throw new NetworkException("Missing policy file name");
					}

					if (!File.Exists(fileLocation))
					{
						UnityEngine.Debug.LogError("Could not find policy file '" + fileLocation + "'.");
						throw new NetworkException("Could not find policy file '" + fileLocation + "'.");
					}
					using (StreamReader sr = new StreamReader(fileLocation))
					{
						policy = sr.ReadToEnd();
					}
					break;
			}

			server = new SocketPolicyServer(policy);
			server.Start();
		}