Пример #1
0
        private async void Proxy_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new ProxyView();

            dialog.Server              = SettingsHelper.ProxyServer;
            dialog.Port                = SettingsHelper.ProxyPort.ToString();
            dialog.Username            = SettingsHelper.ProxyUsername;
            dialog.Password            = SettingsHelper.ProxyPassword;
            dialog.IsProxyEnabled      = SettingsHelper.IsProxyEnabled;
            dialog.IsCallsProxyEnabled = SettingsHelper.IsCallsProxyEnabled;

            var enabled = SettingsHelper.IsProxyEnabled == true;

            var confirm = await dialog.ShowQueuedAsync();

            if (confirm == ContentDialogResult.Primary)
            {
                SettingsHelper.ProxyServer         = dialog.Server;
                SettingsHelper.ProxyPort           = int.Parse(dialog.Port ?? "1080");
                SettingsHelper.ProxyUsername       = dialog.Username;
                SettingsHelper.ProxyPassword       = dialog.Password;
                SettingsHelper.IsProxyEnabled      = dialog.IsProxyEnabled;
                SettingsHelper.IsCallsProxyEnabled = dialog.IsCallsProxyEnabled;

                if (SettingsHelper.IsProxyEnabled || SettingsHelper.IsProxyEnabled != enabled)
                {
                    UnigramContainer.Current.ResolveType <ITransportService>().Close();
                    UnigramContainer.Current.ResolveType <IMTProtoService>().PingAsync(TLLong.Random(), null);
                }
            }
        }
Пример #2
0
        public static void Init()
        {
            Version version = Assembly.GetEntryAssembly().GetName().Version;

            object[] objArray1 = new object[] { "v", version.Major, ".", version.Revision };
            VERSION   = string.Concat(objArray1);
            HddSerial = EveAIO.Helpers.GetHardDiskSerialNo();
            if (HddSerial.Length > 0x10)
            {
                HddSerial = HddSerial.Substring(0, 0x10);
            }
            while (HddSerial.Length < 0x10)
            {
                HddSerial = HddSerial + "A";
            }
            EncryptorAes.Key = HddSerial;
            Machine_name     = Environment.UserName;
            EveAIO.Helpers.LoadSettings();
            ViewDashboard     = new DashboardView();
            ViewProfiles      = new ProfilesView();
            ViewLog           = new LogView();
            ViewCaptcha       = new CaptchaView();
            ViewSuccess       = new SuccessView();
            ViewProxy         = new ProxyView();
            ViewNotifications = new NotificationsView();
            ViewSettings      = new SettingsView();
            ViewTools         = new ToolsView();
            CAPTCHA_QUEUE.CollectionChanged += new NotifyCollectionChangedEventHandler(Global.CAPTCHA_QUEUE_CollectionChanged);
            CLIENT = new Client(null, null, false);
            CLIENT.SetDesktopAgent();
            CLIENT.Session.DefaultRequestHeaders.TryAddWithoutValidation("Upgrade-Insecure-Requests", "1");
            CLIENT.Session.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Language", "en-GB, en-US; q=0.9, en; q=0.8");
            CLIENT.Session.DefaultRequestHeaders.TryAddWithoutValidation("Connection", "keep-alive");
        }
Пример #3
0
        private async void ProxyExecute()
        {
            var dialog = new ProxyView();

            dialog.Server              = SettingsHelper.ProxyServer;
            dialog.Port                = SettingsHelper.ProxyPort.ToString();
            dialog.Username            = SettingsHelper.ProxyUsername;
            dialog.Password            = SettingsHelper.ProxyPassword;
            dialog.IsProxyEnabled      = SettingsHelper.IsProxyEnabled;
            dialog.IsCallsProxyEnabled = SettingsHelper.IsCallsProxyEnabled;

            var enabled = SettingsHelper.IsProxyEnabled == true;

            var confirm = await dialog.ShowQueuedAsync();

            if (confirm == ContentDialogResult.Primary)
            {
                SettingsHelper.ProxyServer         = dialog.Server;
                SettingsHelper.ProxyPort           = Extensions.TryParseOrDefault(dialog.Port, 1080);
                SettingsHelper.ProxyUsername       = dialog.Username;
                SettingsHelper.ProxyPassword       = dialog.Password;
                SettingsHelper.IsProxyEnabled      = dialog.IsProxyEnabled;
                SettingsHelper.IsCallsProxyEnabled = dialog.IsCallsProxyEnabled;

                if (SettingsHelper.IsProxyEnabled || SettingsHelper.IsProxyEnabled != enabled)
                {
                    UnigramContainer.Current.ResolveType <IMTProtoService>().ToggleProxy();
                }
            }
        }
Пример #4
0
        private void ProxyBtn_Click(object sender, RoutedEventArgs e)
        {
            var page = new ProxyView();

            if (page.ShowDialog() != true)
            {
                return;
            }
        }
        private async void AddExecute()
        {
            var dialog  = new ProxyView();
            var confirm = await dialog.ShowQueuedAsync();

            if (confirm != ContentDialogResult.Primary)
            {
                return;
            }

            var response = await ProtoService.SendAsync(new AddProxy(dialog.Server, dialog.Port, false, dialog.Type));

            if (response is Proxy proxy)
            {
                Items.Add(new ProxyViewModel(proxy));
            }
        }
Пример #6
0
        private void Window_Loaded(object sender, EventArgs e)
        {
            var list = ConfigOperator.LoadConfig();

            if (list == null)
            {
                return;
            }

            for (int i = 0; i < list.Count; i++)
            {
                var item = list[i];
                var view = new ProxyView();
                view.Data = item;
                view.SetValue(Grid.RowProperty, i);
                grid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Auto)
                });
                grid.Children.Add(view);
            }
        }
Пример #7
0
        private async void ProxyExecute()
        {
            var proxy = ApplicationSettings.Current.Proxy;

            var dialog = new ProxyView(true);

            dialog.Server              = proxy.Server;
            dialog.Port                = proxy.Port.ToString();
            dialog.Username            = proxy.Username;
            dialog.Password            = proxy.Password;
            dialog.IsProxyEnabled      = proxy.IsEnabled;
            dialog.IsCallsProxyEnabled = proxy.IsCallsEnabled;

            var enabled = proxy.IsEnabled == true;

            var confirm = await dialog.ShowQueuedAsync();

            if (confirm == ContentDialogResult.Primary)
            {
                var server   = proxy.Server = dialog.Server ?? string.Empty;
                var port     = proxy.Port = Extensions.TryParseOrDefault(dialog.Port, 1080);
                var username = proxy.Username = dialog.Username ?? string.Empty;
                var password = proxy.Password = dialog.Password ?? string.Empty;
                var newValue = proxy.IsEnabled = dialog.IsProxyEnabled;
                proxy.IsCallsEnabled = dialog.IsCallsProxyEnabled;

                if (newValue || newValue != enabled)
                {
                    if (newValue)
                    {
                        ProtoService.Send(new SetProxy(new ProxySocks5(server, port, username, password)));
                    }
                    else
                    {
                        ProtoService.Send(new SetProxy(new ProxyEmpty()));
                    }
                }
            }
        }
Пример #8
0
        private async void EditExecute(ConnectionViewModel connection)
        {
            var dialog  = new ProxyView(connection as ProxyViewModel);
            var confirm = await dialog.ShowQueuedAsync();

            if (confirm != ContentDialogResult.Primary)
            {
                return;
            }

            var response = await ProtoService.SendAsync(new EditProxy(connection.Id, dialog.Server, dialog.Port, false, dialog.Type));

            if (response is Proxy proxy)
            {
                var index = Items.IndexOf(connection);
                Items.Remove(connection);

                var edited = new ProxyViewModel(proxy);
                Items.Insert(index, edited);
                await UpdateAsync(edited);
            }

            Handle(ProtoService.GetConnectionState());
        }