コード例 #1
0
 private void ShowSupportForums(object obj)
 {
     try
     {
         Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("SystemSettings_ForumsLink"));
     }
     catch (Exception e)
     {
         LogProvider.Log.Error(this, "Couldn't show support forum", e);
     }
 }
コード例 #2
0
 private void RenewLicense(object obj)
 {
     try
     {
         var license     = ServiceLocator.Current.GetInstance <ILicenseService>();
         var licenseCode = license.LicenseInfos.Where(x => !string.IsNullOrEmpty(x.Serial) && !x.IsTrial).OrderBy(x => x.ExpiryDate).FirstOrDefault()?.Serial ?? string.Empty;
         Process.Start(BrowserHelper.GetDefaultBrowserPath(), String.Format(CommonResourceManager.Instance.GetResourceString("SystemSettings_RenewLicenseLink"), licenseCode));
     }
     catch (Exception ex)
     {
         LogProvider.Log.Error(ex);
     }
 }
コード例 #3
0
        private void btnEulaUrl_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            LicensingManager.InterfaceInteraction.EulaUrlClicked = true;

            if (!String.IsNullOrEmpty(_clientLicense.ProductUrl))
            {
                try
                {
                    Process.Start(BrowserHelper.GetDefaultBrowserPath(), _clientLicense.EulaUrl);
                }
                catch { }
            }
        }
コード例 #4
0
        private void OpenHyperLink()
        {
            if (IsHyperLinkPresent)
            {
                try
                {
                    Process.Start(BrowserHelper.GetDefaultBrowserPath(), HyperLinkText);
                }
                catch (Exception ex)
                {
                    LogProvider.Log.Error(ex);
                }
            }

            InvokeClose();
        }
コード例 #5
0
        private void InitializeCommands()
        {
            var canSend = this.WhenAny(x => x.Email, x => x.Serial, (x1, x2) => Utils.IsValidEmail(x1.Value) &&
                                       (state == RegistrationState.Registration && !string.IsNullOrWhiteSpace(Serial) || state != RegistrationState.Registration));

            SendCommand     = ReactiveCommand.Create(() => Send(), canSend);
            CancelCommand   = ReactiveCommand.Create(() => Cancel());
            TrialCommand    = ReactiveCommand.Create(() => InitializeTrial());
            BackCommand     = ReactiveCommand.Create(() => Back());
            OKCommand       = ReactiveCommand.Create(() => Cancel());
            RegisterCommand = ReactiveCommand.Create(() => InitializeRegister(false));
            ActivateCommand = ReactiveCommand.Create(() => Register());

            BuyCommand = ReactiveCommand.Create(() =>
            {
                try
                {
                    Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("Common_BuyLink"));
                }
                catch (Exception ex)
                {
                    LogProvider.Log.Error(this, "Could not open buy link", ex);
                }
            });

            RenewCommand = ReactiveCommand.Create(() =>
            {
                try
                {
                    var serialToRenew = licenseService.LicenseInfos
                                        .Where(l => !string.IsNullOrEmpty(l.Serial) && !l.IsTrial)
                                        .OrderBy(l => l.ExpiryDate).FirstOrDefault()?
                                        .Serial;

                    if (!string.IsNullOrWhiteSpace(serialToRenew))
                    {
                        Process.Start(BrowserHelper.GetDefaultBrowserPath(), string.Format(CommonResourceManager.Instance.GetResourceString("SystemSettings_RenewLicenseLink"), serialToRenew));
                    }
                }
                catch (Exception ex)
                {
                    LogProvider.Log.Error(this, "Could not open renew link", ex);
                }
            });
        }
コード例 #6
0
        protected virtual void OpenLink(string link)
        {
            if (string.IsNullOrWhiteSpace(link))
            {
                return;
            }

            var browserPath = BrowserHelper.GetDefaultBrowserPath();

            try
            {
                Process.Start(browserPath, link);
            }
            catch (Exception e)
            {
                LogProvider.Log.Error(this, $"Link {link} couldn't be opened", e);
            }
        }
コード例 #7
0
ファイル: WebServer.cs プロジェクト: timunie/HyddwnLauncher
        public async Task <string> Run()
        {
            Log.Info("Initializing Captcha Bypass WebServer...");

            if (WebConf == null)
            {
                WebConf      = new Configuration();
                WebConf.Port = 80;
                WebConf.AllowDirectoryListing = false;
                WebConf.SourcePaths.Add(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "web"));
            }

            if (HttpServer == null)
            {
                HttpServer = new HttpServer(WebConf);
                HttpServer.RequestReceived    += (sender, args) => Log.Debug("[{0}] - {1}", args.Request.HttpMethod, args.Request.Path);
                HttpServer.UnhandledException += (sender, args) => Log.Exception(args.Exception, args.Exception.Source);
            }

            if (!SetHostsFile())
            {
                return(null);
            }

            try
            {
                Log.Info("Starting WebServer...");
                HttpServer.Start();
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Failed to start the WebServer. Possible port or permission issue.");
                try
                {
                    var lines     = File.ReadAllLines(HostsFilePath).ToList();
                    var nexonLine = lines.FirstOrDefault(l => l.Contains("nexon.com"));
                    if (!string.IsNullOrWhiteSpace(nexonLine))
                    {
                        lines.Remove(nexonLine);
                        File.WriteAllLines(HostsFilePath, lines);
                        HostFileFailure = false;
                    }

                    lines     = File.ReadAllLines(HostsFilePath).ToList();
                    nexonLine = lines.FirstOrDefault(l => l.Contains("nexon.com"));
                    if (!string.IsNullOrWhiteSpace(nexonLine))
                    {
                        Log.Error("The sanity check for the HOSTS file failed, falling back!");
                        HostFileFailure = true;
                        return(null);
                    }
                }
                catch (Exception ex2)
                {
                    // Should never be called as non admin...
                    Log.Exception(ex2, "Failed to read or edit the HOSTS file. {0}",
                                  App.IsAdministrator() ? "Running as admin." : "NOT running as admin.");
                    HostFileFailure = true;
                    return(null);
                }

                return(null);
            }

            string recaptchaToken = null;

            Completed += s => recaptchaToken = s;

            Log.Info("Starting the browser...");
            RunAsDesktopUser(BrowserHelper.GetDefaultBrowserPath(), "http://nexon.com");

            while (recaptchaToken == null)
            {
                await Task.Delay(100);
            }

            return(recaptchaToken);
        }
コード例 #8
0
        private void InitializeCommands()
        {
            var canSend = this.WhenAny(x => x.Email, x => Utils.IsValidEmail(x.Value));

            SendCommand     = ReactiveCommand.Create(() => Send(), canSend);
            CancelCommand   = ReactiveCommand.Create(() => Cancel());
            TrialCommand    = ReactiveCommand.Create(() => InitializeTrial());
            BackCommand     = ReactiveCommand.Create(() => Back());
            OKCommand       = ReactiveCommand.Create(() => Cancel());
            RegisterCommand = ReactiveCommand.Create(() => InitializeRegister(false));
            ActivateCommand = ReactiveCommand.Create(() => Register());
            BuyCommand      = ReactiveCommand.Create(() =>
            {
                try
                {
                    Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("PKC_BuyLink"));
                }
                catch (Exception ex)
                {
                    LogProvider.Log.Error(CustomModulesNames.PKCatcher, "Could not open buy link", ex);
                }
            });

            RenewCommand = ReactiveCommand.Create(() =>
            {
                try
                {
                    var serialToRenew = licenseService.LicenseInfos
                                        .Where(l => !string.IsNullOrEmpty(l.Serial) && !l.IsTrial)
                                        .OrderBy(l => l.ExpiryDate).FirstOrDefault()?
                                        .Serial;

                    if (!string.IsNullOrWhiteSpace(serialToRenew))
                    {
                        Process.Start(BrowserHelper.GetDefaultBrowserPath(), string.Format(CommonResourceManager.Instance.GetResourceString("SystemSettings_RenewLicenseLink"), serialToRenew));
                    }
                }
                catch (Exception ex)
                {
                    LogProvider.Log.Error(CustomModulesNames.PKCatcher, "Could not open renew link", ex);
                }
            });

            ResetLicensesCommand = ReactiveCommand.Create(() =>
            {
                try
                {
                    LogProvider.Log.Info(CustomModulesNames.PKCatcher, "Resetting licenses");

                    licenseService.ResetLicenses();

                    LogProvider.Log.Info(CustomModulesNames.PKCatcher, "Licenses has been reset");

                    InitializeMessage("PKC_RegistrationView_ResetLicensesSuccess");
                }
                catch (Exception ex)
                {
                    LogProvider.Log.Error(CustomModulesNames.PKCatcher, "Could not reset licenses", ex);
                    InitializeMessage("PKC_RegistrationView_ResetLicensesFailed");
                }
            });
        }
コード例 #9
0
 private void ShowSupportForums(object obj)
 {
     Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("SystemSettings_ForumsLink"));
 }
コード例 #10
0
 private void ShowKnowledgeBase(object obj)
 {
     Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("SystemSettings_KnowledgeBase"));
 }
コード例 #11
0
 private void ShowOnlineManual(object obj)
 {
     Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("SystemSettings_OnlineManual"));
 }
コード例 #12
0
 private void AddActivation(object obj)
 {
     Process.Start(BrowserHelper.GetDefaultBrowserPath(), CommonResourceManager.Instance.GetResourceString("SystemSettings_AddActivationLink"));
 }