private void OnGUI()
        {
            GUILayout.BeginHorizontal();
            string[] filesArray = this.files.ToArray();
            this.selectedIndex = EditorGUILayout.Popup(this.selectedIndex, filesArray);

            string lastFile = this.fileName;

            this.fileName = this.files[this.selectedIndex];

            if (this.fileName != lastFile)
            {
                this.LoadConfig();
            }

            this.newFileName = EditorGUILayout.TextField("文件名", this.newFileName);

            if (GUILayout.Button("添加"))
            {
                this.fileName    = this.newFileName;
                this.newFileName = "";
                File.WriteAllText(this.GetFilePath(), "");
                this.files         = this.GetConfigFiles();
                this.selectedIndex = this.files.IndexOf(this.fileName);
                this.LoadConfig();
            }

            if (GUILayout.Button("复制"))
            {
                this.fileName = $"{this.fileName}-copy";
                this.Save();
                this.files         = this.GetConfigFiles();
                this.selectedIndex = this.files.IndexOf(this.fileName);
                this.newFileName   = "";
            }

            if (GUILayout.Button("重命名"))
            {
                if (this.newFileName == "")
                {
                    Log.Debug("请输入新名字!");
                }
                else
                {
                    File.Delete(this.GetFilePath());
                    this.fileName = this.newFileName;
                    this.Save();
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = this.files.IndexOf(this.fileName);
                    this.newFileName   = "";
                }
            }

            if (GUILayout.Button("删除"))
            {
                File.Delete(this.GetFilePath());
                this.files         = this.GetConfigFiles();
                this.selectedIndex = 0;
                this.newFileName   = "";
            }

            GUILayout.EndHorizontal();

            GUILayout.Label("配置内容:");
            for (int i = 0; i < this.startConfigs.Count; ++i)
            {
                StartConfig startConfig = this.startConfigs[i];
                GUILayout.BeginHorizontal();
                GUILayout.Label($"AppId:");
                startConfig.AppId = EditorGUILayout.IntField(startConfig.AppId);
                GUILayout.Label($"服务器IP:");
                startConfig.ServerIP = EditorGUILayout.TextField(startConfig.ServerIP);
                GUILayout.Label($"AppType:");
                startConfig.AppType = (AppType)EditorGUILayout.EnumPopup(startConfig.AppType);

                InnerConfig innerConfig = startConfig.GetComponent <InnerConfig>();
                if (innerConfig != null)
                {
                    GUILayout.Label($"InnerHost:");
                    innerConfig.Host = EditorGUILayout.TextField(innerConfig.Host);
                    GUILayout.Label($"InnerPort:");
                    innerConfig.Port = EditorGUILayout.IntField(innerConfig.Port);
                }

                OuterConfig outerConfig = startConfig.GetComponent <OuterConfig>();
                if (outerConfig != null)
                {
                    GUILayout.Label($"OuterHost:");
                    outerConfig.Host = EditorGUILayout.TextField(outerConfig.Host);
                    GUILayout.Label($"OuterHost2:");
                    outerConfig.Host2 = EditorGUILayout.TextField(outerConfig.Host2);
                    GUILayout.Label($"OuterPort:");
                    outerConfig.Port = EditorGUILayout.IntField(outerConfig.Port);
                }

                ClientConfig clientConfig = startConfig.GetComponent <ClientConfig>();
                if (clientConfig != null)
                {
                    GUILayout.Label($"Host:");
                    clientConfig.Host = EditorGUILayout.TextField(clientConfig.Host);
                    GUILayout.Label($"Port:");
                    clientConfig.Port = EditorGUILayout.IntField(clientConfig.Port);
                }

                HttpConfig httpConfig = startConfig.GetComponent <HttpConfig>();
                if (httpConfig != null)
                {
                    GUILayout.Label($"AppId:");
                    httpConfig.AppId = EditorGUILayout.IntField(httpConfig.AppId);
                    GUILayout.Label($"AppKey:");
                    httpConfig.AppKey = EditorGUILayout.TextField(httpConfig.AppKey);
                    GUILayout.Label($"Url:");
                    httpConfig.Url = EditorGUILayout.TextField(httpConfig.Url);
                    GUILayout.Label($"ManagerSystemUrl:");
                    httpConfig.ManagerSystemUrl = EditorGUILayout.TextField(httpConfig.ManagerSystemUrl);
                }

                DBConfig dbConfig = startConfig.GetComponent <DBConfig>();
                if (dbConfig != null)
                {
                    GUILayout.Label($"Connection:");
                    dbConfig.ConnectionString = EditorGUILayout.TextField(dbConfig.ConnectionString);

                    GUILayout.Label($"DBName:");
                    dbConfig.DBName = EditorGUILayout.TextField(dbConfig.DBName);
                }

                if (GUILayout.Button("删除"))
                {
                    this.startConfigs.Remove(startConfig);
                    break;
                }
                if (GUILayout.Button("复制"))
                {
                    for (int j = 1; j < this.copyNum + 1; ++j)
                    {
                        StartConfig newStartConfig = MongoHelper.FromBson <StartConfig>(startConfig.ToBson());
                        newStartConfig.AppId += j;
                        this.startConfigs.Add(newStartConfig);
                    }
                    break;
                }

                if (i > 0)
                {
                    if (GUILayout.Button("上移"))
                    {
                        StartConfig s = this.startConfigs[i];
                        this.startConfigs.RemoveAt(i);
                        this.startConfigs.Insert(i - 1, s);
                        for (int j = 0; j < startConfigs.Count; ++j)
                        {
                            this.startConfigs[j].AppId = j + 1;
                        }
                        break;
                    }
                }

                if (i < this.startConfigs.Count - 1)
                {
                    if (GUILayout.Button("下移"))
                    {
                        StartConfig s = this.startConfigs[i];
                        this.startConfigs.RemoveAt(i);
                        this.startConfigs.Insert(i + 1, s);
                        for (int j = 0; j < startConfigs.Count; ++j)
                        {
                            this.startConfigs[j].AppId = j + 1;
                        }
                        break;
                    }
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.Label("");

            GUILayout.BeginHorizontal();
            this.copyNum = EditorGUILayout.IntField("复制数量: ", this.copyNum);

            GUILayout.Label($"添加的AppType:");
            this.AppType = (AppType)EditorGUILayout.EnumPopup(this.AppType);

            if (GUILayout.Button("添加一行配置"))
            {
                StartConfig newStartConfig = new StartConfig();

                newStartConfig.AppType = this.AppType;

                if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager))
                {
                    newStartConfig.AddComponent <OuterConfig>();
                }

                if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager | AppType.Http | AppType.DB | AppType.Map | AppType.Location))
                {
                    newStartConfig.AddComponent <InnerConfig>();
                }

                if (this.AppType.Is(AppType.Benchmark))
                {
                    newStartConfig.AddComponent <ClientConfig>();
                }

                if (this.AppType.Is(AppType.Http))
                {
                    newStartConfig.AddComponent <HttpConfig>();
                }

                if (this.AppType.Is(AppType.DB))
                {
                    newStartConfig.AddComponent <DBConfig>();
                }

                this.startConfigs.Add(newStartConfig);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("保存"))
            {
                this.Save();
            }

            if (GUILayout.Button("启动"))
            {
                StartConfig startConfig = null;
                foreach (StartConfig config in this.startConfigs)
                {
                    if (config.AppType.Is(AppType.Manager))
                    {
                        startConfig = config;
                    }
                }

                if (startConfig == null)
                {
                    Log.Error("没有配置Manager!");
                    return;
                }

                string arguments = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config=../Config/StartConfig/{this.fileName}";

                ProcessStartInfo info = new ProcessStartInfo("dotnet", arguments)
                {
                    UseShellExecute = true, WorkingDirectory = @"../Bin/"
                };
                Process.Start(info);
            }
            GUILayout.EndHorizontal();
        }
        private void OnGUI()
        {
            GUILayout.BeginHorizontal();
            string[] filesArray = this.files.ToArray();
            this.selectedIndex = EditorGUILayout.Popup(this.selectedIndex, filesArray);

            string lastFile = this.fileName;

            this.fileName = this.files[this.selectedIndex];

            if (this.fileName != lastFile)
            {
                this.LoadConfig();
            }

            this.newFileName = EditorGUILayout.TextField("文件名", this.newFileName);

            if (GUILayout.Button("添加"))
            {
                this.fileName    = this.newFileName;
                this.newFileName = "";
                File.WriteAllText(this.GetFilePath(), "");
                this.files         = this.GetConfigFiles();
                this.selectedIndex = this.files.IndexOf(this.fileName);
                this.LoadConfig();
            }

            if (GUILayout.Button("复制"))
            {
                this.fileName = $"{this.fileName}-copy";
                this.Save();
                this.files         = this.GetConfigFiles();
                this.selectedIndex = this.files.IndexOf(this.fileName);
                this.newFileName   = "";
            }

            if (GUILayout.Button("重命名"))
            {
                if (this.newFileName == "")
                {
                    Log.Debug("请输入新名字!");
                }
                else
                {
                    File.Delete(this.GetFilePath());
                    this.fileName = this.newFileName;
                    this.Save();
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = this.files.IndexOf(this.fileName);
                    this.newFileName   = "";
                }
            }

            if (GUILayout.Button("删除"))
            {
                File.Delete(this.GetFilePath());
                this.files         = this.GetConfigFiles();
                this.selectedIndex = 0;
                this.newFileName   = "";
            }

            GUILayout.EndHorizontal();

            GUILayout.Label("配置内容:");
            for (int i = 0; i < this.startConfigs.Count; ++i)
            {
                StartConfig startConfig = this.startConfigs[i];
                GUILayout.BeginHorizontal();
                GUILayout.Label($"AppId:");
                startConfig.AppId = EditorGUILayout.IntField(startConfig.AppId);
                GUILayout.Label($"服务器IP:");
                startConfig.ServerIP = EditorGUILayout.TextField(startConfig.ServerIP);
                GUILayout.Label($"AppType:");
                startConfig.AppType = (AppType)EditorGUILayout.EnumPopup(startConfig.AppType);

                InnerConfig innerConfig = startConfig.GetComponent <InnerConfig>();
                if (innerConfig != null)
                {
                    GUILayout.Label($"InnerHost:");
                    innerConfig.Host = EditorGUILayout.TextField(innerConfig.Host);
                    GUILayout.Label($"InnerPort:");
                    innerConfig.Port = EditorGUILayout.IntField(innerConfig.Port);
                }

                OuterConfig outerConfig = startConfig.GetComponent <OuterConfig>();
                if (outerConfig != null)
                {
                    GUILayout.Label($"OuterHost:");
                    outerConfig.Host = EditorGUILayout.TextField(outerConfig.Host);
                    GUILayout.Label($"OuterPort:");
                    outerConfig.Port = EditorGUILayout.IntField(outerConfig.Port);
                }

                ClientConfig clientConfig = startConfig.GetComponent <ClientConfig>();
                if (clientConfig != null)
                {
                    GUILayout.Label($"Host:");
                    clientConfig.Host = EditorGUILayout.TextField(clientConfig.Host);
                    GUILayout.Label($"Port:");
                    clientConfig.Port = EditorGUILayout.IntField(clientConfig.Port);
                }

                if (GUILayout.Button("删除"))
                {
                    this.startConfigs.Remove(startConfig);
                    break;
                }
                if (GUILayout.Button("复制"))
                {
                    for (int j = 1; j < this.copyNum + 1; ++j)
                    {
                        StartConfig newStartConfig = (StartConfig)startConfig.Clone();
                        newStartConfig.AppId += j;
                        this.startConfigs.Add(newStartConfig);
                    }
                    break;
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.Label("");

            GUILayout.BeginHorizontal();
            this.copyNum = EditorGUILayout.IntField("复制数量: ", this.copyNum);

            GUILayout.Label($"添加的AppType:");
            this.AppType = (AppType)EditorGUILayout.EnumPopup(this.AppType);

            if (GUILayout.Button("添加一行配置"))
            {
                StartConfig newStartConfig = new StartConfig();

                newStartConfig.AppType = this.AppType;

                if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager))
                {
                    newStartConfig.AddComponent <InnerConfig>();
                    newStartConfig.AddComponent <OuterConfig>();
                }

                if (this.AppType.Is(AppType.Benchmark))
                {
                    newStartConfig.AddComponent <ClientConfig>();
                }

                this.startConfigs.Add(newStartConfig);
            }
            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();

            if (GUILayout.Button("保存"))
            {
                this.Save();
            }

            if (GUILayout.Button("启动"))
            {
                StartConfig startConfig = null;
                foreach (StartConfig config in this.startConfigs)
                {
                    if (config.AppType.Is(AppType.Manager))
                    {
                        startConfig = config;
                    }
                }

                if (startConfig == null)
                {
                    Log.Error("没有配置Manager!");
                    return;
                }

                string arguments = $"--appId={startConfig.AppId} --appType={startConfig.AppType} --config=../Config/StartConfig/{this.fileName}";

                ProcessStartInfo info = new ProcessStartInfo(@"App.exe", arguments)
                {
                    UseShellExecute  = true,
                    WorkingDirectory = @"..\Bin\"
                };
                Process.Start(info);
            }
            GUILayout.EndHorizontal();
        }
示例#3
0
        private void OnGUI()
        {
            {
                GUILayout.BeginHorizontal();
                string[] filesArray = this.files.ToArray();
                this.selectedIndex = EditorGUILayout.Popup(this.selectedIndex, filesArray);

                string lastFile = this.fileName;
                this.fileName = this.files[this.selectedIndex];

                if (this.fileName != lastFile)
                {
                    this.LoadConfig();
                }

                this.newFileName = EditorGUILayout.TextField("文件名", this.newFileName);

                if (GUILayout.Button("添加"))
                {
                    this.fileName    = this.newFileName;
                    this.newFileName = "";
                    File.WriteAllText(this.GetFilePath(), "");
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = this.files.IndexOf(this.fileName);
                    this.LoadConfig();
                }

                if (GUILayout.Button("复制"))
                {
                    this.fileName = $"{this.fileName}-copy";
                    this.Save();
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = this.files.IndexOf(this.fileName);
                    this.newFileName   = "";
                }

                if (GUILayout.Button("重命名"))
                {
                    if (this.newFileName == "")
                    {
                        Log.Debug("请输入新名字!");
                    }
                    else
                    {
                        File.Delete(this.GetFilePath());
                        this.fileName = this.newFileName;
                        this.Save();
                        this.files         = this.GetConfigFiles();
                        this.selectedIndex = this.files.IndexOf(this.fileName);
                        this.newFileName   = "";
                    }
                }

                if (GUILayout.Button("删除"))
                {
                    File.Delete(this.GetFilePath());
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = 0;
                    this.newFileName   = "";
                }

                GUILayout.EndHorizontal();
            }

            scrollPos = GUILayout.BeginScrollView(this.scrollPos, true, true);
            for (int i = 0; i < this.startConfigs.Count; ++i)
            {
                StartConfig startConfig = this.startConfigs[i];


                GUILayout.BeginHorizontal();
                {
                    GUILayout.BeginHorizontal(GUILayout.Width(1700));
                    {
                        GUILayout.BeginHorizontal(GUILayout.Width(350));
                        GUILayout.Label($"AppId:");
                        startConfig.AppId = EditorGUILayout.IntField(startConfig.AppId, GUILayout.Width(30));
                        GUILayout.Label($"服务器IP:");
                        startConfig.ServerIP = EditorGUILayout.TextField(startConfig.ServerIP, GUILayout.Width(100));
                        GUILayout.Label($"AppType:");
                        startConfig.AppType = (AppType)EditorGUILayout.EnumPopup(startConfig.AppType);
                        GUILayout.EndHorizontal();
                    }
                    {
                        GUILayout.BeginHorizontal(GUILayout.Width(150));
                        InnerConfig innerConfig = startConfig.GetComponent <InnerConfig>();
                        if (innerConfig != null)
                        {
                            GUILayout.Label($"内网地址:");
                            innerConfig.Address = EditorGUILayout.TextField(innerConfig.Address, GUILayout.Width(120));
                        }

                        GUILayout.EndHorizontal();
                    }
                    {
                        GUILayout.BeginHorizontal(GUILayout.Width(350));
                        OuterConfig outerConfig = startConfig.GetComponent <OuterConfig>();
                        if (outerConfig != null)
                        {
                            GUILayout.Label($"外网地址:");
                            outerConfig.Address = EditorGUILayout.TextField(outerConfig.Address, GUILayout.Width(120));
                            GUILayout.Label($"外网地址2:");
                            outerConfig.Address2 = EditorGUILayout.TextField(outerConfig.Address2, GUILayout.Width(120));
                        }

                        GUILayout.EndHorizontal();
                    }
                    {
                        GUILayout.BeginHorizontal(GUILayout.Width(350));
                        ClientConfig clientConfig = startConfig.GetComponent <ClientConfig>();
                        if (clientConfig != null)
                        {
                            GUILayout.Label($"连接地址:");
                            clientConfig.Address = EditorGUILayout.TextField(clientConfig.Address, GUILayout.Width(120));
                        }

                        HttpConfig httpConfig = startConfig.GetComponent <HttpConfig>();
                        if (httpConfig != null)
                        {
                            GUILayout.Label($"AppId:");
                            httpConfig.AppId = EditorGUILayout.IntField(httpConfig.AppId, GUILayout.Width(20));
                            GUILayout.Label($"AppKey:");
                            httpConfig.AppKey = EditorGUILayout.TextField(httpConfig.AppKey);
                            GUILayout.Label($"Url:");
                            httpConfig.Url = EditorGUILayout.TextField(httpConfig.Url);
                            GUILayout.Label($"ManagerSystemUrl:");
                            httpConfig.ManagerSystemUrl = EditorGUILayout.TextField(httpConfig.ManagerSystemUrl);
                        }

                        DBConfig dbConfig = startConfig.GetComponent <DBConfig>();
                        if (dbConfig != null)
                        {
                            GUILayout.Label($"Connection:");
                            dbConfig.ConnectionString = EditorGUILayout.TextField(dbConfig.ConnectionString);

                            GUILayout.Label($"DBName:");
                            dbConfig.DBName = EditorGUILayout.TextField(dbConfig.DBName);
                        }

                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndHorizontal();
                }

                {
                    GUILayout.BeginHorizontal();
                    if (GUILayout.Button("删除"))
                    {
                        this.startConfigs.Remove(startConfig);
                        break;
                    }

                    if (GUILayout.Button("复制"))
                    {
                        for (int j = 1; j < this.copyNum + 1; ++j)
                        {
                            StartConfig newStartConfig = MongoHelper.FromBson <StartConfig>(startConfig.ToBson());
                            newStartConfig.AppId += j;
                            this.startConfigs.Add(newStartConfig);
                        }

                        break;
                    }

                    if (i >= 0)
                    {
                        if (GUILayout.Button("上移"))
                        {
                            if (i == 0)
                            {
                                break;
                            }
                            StartConfig s = this.startConfigs[i];
                            this.startConfigs.RemoveAt(i);
                            this.startConfigs.Insert(i - 1, s);
                            for (int j = 0; j < startConfigs.Count; ++j)
                            {
                                this.startConfigs[j].AppId = j + 1;
                            }

                            break;
                        }
                    }

                    if (i <= this.startConfigs.Count - 1)
                    {
                        if (GUILayout.Button("下移"))
                        {
                            if (i == this.startConfigs.Count - 1)
                            {
                                break;
                            }
                            StartConfig s = this.startConfigs[i];
                            this.startConfigs.RemoveAt(i);
                            this.startConfigs.Insert(i + 1, s);
                            for (int j = 0; j < startConfigs.Count; ++j)
                            {
                                this.startConfigs[j].AppId = j + 1;
                            }

                            break;
                        }
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();



            GUILayout.Label("");

            GUILayout.BeginHorizontal();
            this.copyNum = EditorGUILayout.IntField("复制数量: ", this.copyNum);

            GUILayout.Label($"添加的AppType:");
            this.AppType = (AppType)EditorGUILayout.EnumPopup(this.AppType);

            if (GUILayout.Button("添加一行配置"))
            {
                StartConfig newStartConfig = new StartConfig();

                newStartConfig.AppType = this.AppType;

                if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager))
                {
                    newStartConfig.AddComponent <OuterConfig>();
                }

                if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager | AppType.Http | AppType.DB | AppType.Map | AppType.Location))
                {
                    newStartConfig.AddComponent <InnerConfig>();
                }

                if (this.AppType.Is(AppType.Http))
                {
                    newStartConfig.AddComponent <HttpConfig>();
                }

                if (this.AppType.Is(AppType.DB))
                {
                    newStartConfig.AddComponent <DBConfig>();
                }

                if (this.AppType.Is(AppType.Benchmark))
                {
                    newStartConfig.AddComponent <ClientConfig>();
                }

                if (this.AppType.Is(AppType.BenchmarkWebsocketServer))
                {
                    newStartConfig.AddComponent <OuterConfig>();
                }

                if (this.AppType.Is(AppType.BenchmarkWebsocketClient))
                {
                    newStartConfig.AddComponent <ClientConfig>();
                }

                this.startConfigs.Add(newStartConfig);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("保存"))
            {
                this.Save();
            }

            if (GUILayout.Button("启动"))
            {
                StartConfig startConfig = null;
                foreach (StartConfig config in this.startConfigs)
                {
                    if (config.AppType.Is(AppType.Manager))
                    {
                        startConfig = config;
                    }
                }

                if (startConfig == null)
                {
                    Log.Error("没有配置Manager!");
                    return;
                }

                string arguments = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config=../Config/StartConfig/{this.fileName}";
                //ProcessHelper.Run("dotnet", arguments, "../Bin/");
                var runningProcess = ProcessHelper.Run("/usr/local/share/dotnet/dotnet", arguments, Path.GetFullPath("../Bin/"));
                EditorPrefs.SetInt("CurRunningServer", runningProcess.Id);
                Debug.Log("CurRunningServer : " + runningProcess.Id);
            }

            if (EditorPrefs.HasKey("CurRunningServer"))
            {
                if (GUILayout.Button("关闭服务器"))
                {
                    try
                    {
                        Process.GetProcessById(EditorPrefs.GetInt("CurRunningServer")).Kill();
                    }
                    catch
                    {
                        // ignored
                    }

                    EditorPrefs.DeleteKey("CurRunningServer");
                }
            }

            GUILayout.EndHorizontal();
        }
        private void OnGUI()
        {
            {
                GUILayout.BeginHorizontal();
                string[] filesArray = this.files.ToArray();
                this.selectedIndex = EditorGUILayout.Popup(this.selectedIndex, filesArray);

                string lastFile = this.fileName;
                this.fileName = this.files[this.selectedIndex];

                if (this.fileName != lastFile)
                {
                    this.LoadConfig();
                }

                this.newFileName = EditorGUILayout.TextField("文件名", this.newFileName);

                if (GUILayout.Button("添加"))
                {
                    this.ClearConfig();

                    this.startConfig = new StartConfig();
                    startConfig.AddComponent <StartConfigDrawer>();
                    this.fileName    = this.newFileName;
                    this.newFileName = "";
                    File.WriteAllText(this.GetFilePath(), JsonHelper.ToJson(this.startConfig));

                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = this.files.IndexOf(this.fileName);
                    this.LoadConfig();
                }

                if (GUILayout.Button("复制"))
                {
                    this.fileName = $"{this.fileName}-copy";
                    this.Save();
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = this.files.IndexOf(this.fileName);
                    this.newFileName   = "";
                }

                if (GUILayout.Button("重命名"))
                {
                    if (this.newFileName == "")
                    {
                        DCETRuntime.Log.Debug("请输入新名字!");
                    }
                    else
                    {
                        File.Delete(this.GetFilePath());
                        this.fileName = this.newFileName;
                        this.Save();
                        this.files         = this.GetConfigFiles();
                        this.selectedIndex = this.files.IndexOf(this.fileName);
                        this.newFileName   = "";
                    }
                }

                if (GUILayout.Button("删除"))
                {
                    File.Delete(this.GetFilePath());
                    this.files         = this.GetConfigFiles();
                    this.selectedIndex = 0;
                    this.newFileName   = "";
                }

                GUILayout.EndHorizontal();
            }

            scrollPos = GUILayout.BeginScrollView(this.scrollPos, true, true);

            startConfig.GetComponent <StartConfigDrawer>()?.OnGUI();

            GUILayout.EndScrollView();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("保存"))
            {
                this.Save();
            }

            if (GUILayout.Button("启动"))
            {
                string arguments = $"--config={this.fileName}";
                ProcessHelper.Run("DCET.Init.exe", arguments, "../Bin/");
            }
            if (GUILayout.Button("启动数据库"))
            {
                ProcessHelper.Run("mongod", @"--dbpath=db", "../Database/bin/");
            }
            GUILayout.EndHorizontal();
        }