/// <summary> /// 验证实体options的数据有效性 /// </summary> private void Validate() { this.AppId = AppId.Trim(); this.MetaServer = MetaServer.Trim().TrimEnd('/'); this.Cluster = Cluster.Trim(); this.DeployIp = string.IsNullOrWhiteSpace(DeployIp) ? GetHostIp() : DeployIp.Trim(); this.Namespaces = Namespaces.Select(m => m.Trim()).Distinct().ToArray(); }
static void Main(string[] args) { if (args.Length >= 5 && args.Length <= 6) { string httpUrl = args[0]; string database = args[1]; string databaseUser = args[2]; string databasePassword = args[3]; bool maintenance = bool.Parse(args[4]); string ipLock = null; if (args.Length == 6) { ipLock = args[5]; } using (m_gServer = new MetaServer(httpUrl, Constants.kWebRoot, database, databaseUser, databasePassword, maintenance)) { AsyncPump scheduler = new AsyncPump(Thread.CurrentThread, OnException); m_gServer.ExceptionEvent += OnServerException; if (ipLock != null) { m_gServer.SetIpLock(ipLock); } scheduler.RunWithUpdate(m_gServer.Start, m_gServer.Update, Constants.kUpdateTimeoutSeconds); Console.WriteLine("Exiting..."); } } else { Console.WriteLine("Error, usage."); } }