Ejemplo n.º 1
0
        private static void RunGenerateShadowsocksUrlTest(IReadOnlyDictionary <string, Server> testCases)
        {
            foreach (var testCase in testCases)
            {
                string expected = testCase.Key;
                Server config   = testCase.Value;

                var actual = ShadowsocksController.GetServerURL(config);
                Assert.AreEqual(expected, actual);
            }
        }
        private void QRCodeForm_Load(object sender, EventArgs e)
        {
            var servers     = Configuration.Load();
            var serverDatas = servers.configs.Select(
                server =>
                new KeyValuePair <string, string>(ShadowsocksController.GetServerURL(server), server.FriendlyName())
                ).ToList();

            listBox1.DataSource = serverDatas;

            var selectIndex = serverDatas.FindIndex(serverData => serverData.Key.StartsWith(code));

            if (selectIndex >= 0)
            {
                listBox1.SetSelected(selectIndex, true);
            }
        }