Beispiel #1
0
        public async Task ScanScreenTaskAsync()
        {
            HideForm();

            string result = await Task.Run(() =>
            {
                return(Utils.ScanScreen());
            });

            ShowForm();

            if (Utils.IsNullOrEmpty(result))
            {
                UI.ShowWarning(ResUI.NoValidQRcodeFound);
            }
            else
            {
                int ret = ConfigHandler.AddBatchServers(ref config, result, "", groupId);
                if (ret > 0)
                {
                    RefreshServers();
                    UI.Show(ResUI.SuccessfullyImportedServerViaScan);
                }
            }
        }
Beispiel #2
0
 private int AddBatchServers(string clipboardData, string subid = "")
 {
     if (ConfigHandler.AddBatchServers(ref config, clipboardData, subid) == 0)
     {
         RefreshServers();
         return(0);
     }
     return(-1);
 }
Beispiel #3
0
        private void menuAddServers_Click(object sender, EventArgs e)
        {
            string clipboardData = Utils.GetClipboardData();
            int    ret           = ConfigHandler.AddBatchServers(ref config, clipboardData, "", groupId);

            if (ret > 0)
            {
                RefreshServers();
                UI.Show(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
            }
        }
Beispiel #4
0
 private int AddBatchServers(string clipboardData, string subid = "")
 {
     if (ConfigHandler.AddBatchServers(ref config, clipboardData, subid) != 0)
     {
         clipboardData = Utils.Base64Decode(clipboardData);
         if (ConfigHandler.AddBatchServers(ref config, clipboardData, subid) != 0)
         {
             return(-1);
         }
     }
     RefreshServers();
     return(0);
 }
Beispiel #5
0
        private int AddBatchServers(string clipboardData, string subid = "")
        {
            int counter;

            int _Add()
            {
                return(ConfigHandler.AddBatchServers(ref config, clipboardData, subid));
            }

            counter = _Add();
            if (counter < 1)
            {
                clipboardData = Utils.Base64Decode(clipboardData);
                counter       = _Add();
            }
            RefreshServers();
            return(counter);
        }