Start() публичный Метод

Start the Socket Policy Server
public Start ( ) : void
Результат void
Пример #1
0
        /// <summary>
        /// Begin the Socket Policy Server
        /// </summary>
        /// <param name="xmlType">XML Type to be used</param>
        /// <param name="fileLocation">Location of the policy file</param>
        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();
        }
		/// <summary>
		/// Begin the Socket Policy Server
		/// </summary>
		/// <param name="xmlType">XML Type to be used</param>
		/// <param name="fileLocation">Location of the policy file</param>
		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();
		}