Ejemplo n.º 1
0
        Tuple <bool, List <string[]> > ImportSSLinks(string text, string mark = "")
        {
            var             isAddNewServer = false;
            var             links          = Lib.Utils.ExtractLinks(text, VgcApis.Models.Datas.Enum.LinkTypes.ss);
            List <string[]> result         = new List <string[]>();

            foreach (var link in links)
            {
                var config = configMgr.SsLink2Config(link);

                if (config == null)
                {
                    result.Add(GenImportResult(link, false, I18N.DecodeFail, mark));
                    continue;
                }

                if (servers.AddServer(Lib.Utils.Config2String(config), mark, true))
                {
                    isAddNewServer = true;
                    result.Add(GenImportResult(link, true, I18N.Success, mark));
                }
                else
                {
                    result.Add(GenImportResult(link, false, I18N.DuplicateServer, mark));
                }
            }

            return(new Tuple <bool, List <string[]> >(isAddNewServer, result));
        }
Ejemplo n.º 2
0
        private async void Servers_Loaded(object sender, RoutedEventArgs e)
        {
            var servers = await _settingsProvider.GetServerSettingsAsync();

            foreach (var server in servers)
            {
                Servers.AddServer(server);
            }
        }
Ejemplo n.º 3
0
        public async Task AddServerAsync(RedisServerInformation serverInfo)
        {
            Servers.AddServer(serverInfo);

            await _settingsProvider.SaveServerSettingsAsync(Servers.GetAllServerInformation());
        }