Example #1
0
        void InitForm()
        {
            configComponetTable = new Dictionary <int, string>
            {
                { 0, "config.json" },
                { 1, "log" },
                { 2, "api" },
                { 3, "dns" },
                { 4, "stats" },
                { 5, "routing" },
                { 6, "policy" },
                { 7, "inbound" },
                { 8, "outbound" },
                { 9, "transport" },
                { 10, "v2raygcon" },
                { 11, "inboundDetour" },
                { 12, "outboundDetour" },
            };

            // separate between dictionary or array
            componentsSeparator = 11;

            ssrMethodTable = new Dictionary <int, string>
            {
                { 0, "aes-128-cfb" },
                { 1, "aes-128-gcm" },
                { 2, "aes-256-cfb" },
                { 3, "aes-256-gcm" },
                { 4, "chacha20" },
                { 5, "chacha20-ietf" },
                { 6, "chacha20-poly1305" },
                { 7, "chacha20-ietf-poly1305" },
            };


            configTemplate = JObject.Parse(resData("config_tpl"));
            configDefault  = JObject.Parse(resData("config_def"));
            configEditing  = LoadServerConfig();

            cboxServList.Items.Clear();
            for (int i = 0; i < settings.GetServeNum(); i++)
            {
                cboxServList.Items.Add(i + 1);
            }

            perServIndex = settings.curEditingIndex;
            cboxServList.SelectedIndex = perServIndex;

            perConfigComponetIndex       = 0;
            cboxConfigPart.SelectedIndex = perConfigComponetIndex;
            ShowConfigByIndex(perConfigComponetIndex);
        }