예제 #1
0
        public void OnBtHeaderClick(object sender, RoutedEventArgs e)
        {
#if DEBUG
            logger.Debug($"SuccessStory [Ignored] - OnBtHeaderClick()");
#endif
            PluginDatabase.IsViewOpen = true;
            var    ViewExtension   = new SuccessView(_Plugin, _PlayniteApi, _Plugin.GetPluginUserDataPath());
            Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(_PlayniteApi, resources.GetString("LOCSuccessStory"), ViewExtension);
            windowExtension.ShowDialog();
            PluginDatabase.IsViewOpen = false;

            /*
             * SuccessView ViewExtension = null;
             * if (settings.EnableRetroAchievementsView && PlayniteTools.IsGameEmulated(PlayniteApi, GameSelected))
             * {
             *  ViewExtension = new SuccessView(this, settings, PlayniteApi, this.GetPluginUserDataPath(), true);
             * }
             * else
             * {
             *  ViewExtension = new SuccessView(this, settings, PlayniteApi, this.GetPluginUserDataPath(), false);
             * }
             * Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(PlayniteApi, resources.GetString("LOCSuccessStory"), ViewExtension);
             * windowExtension.ShowDialog();
             */
        }
예제 #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
        public void OnBtActionBarClick(object sender, RoutedEventArgs e)
        {
#if DEBUG
            logger.Debug($"SuccessStory [Ignored] - OnBtActionBarClick()");
#endif
            PluginDatabase.IsViewOpen = true;
            dynamic ViewExtension = null;
            if (PluginDatabase.PluginSettings.EnableOneGameView)
            {
                ViewExtension = new SuccessStoryOneGameView(SuccessStoryDatabase.GameSelected);
            }
            else
            {
                if (PluginDatabase.PluginSettings.EnableRetroAchievementsView && PlayniteTools.IsGameEmulated(_PlayniteApi, SuccessStoryDatabase.GameSelected))
                {
                    ViewExtension = new SuccessView(_Plugin, _PlayniteApi, _Plugin.GetPluginUserDataPath(), true, SuccessStoryDatabase.GameSelected);
                }
                else
                {
                    ViewExtension = new SuccessView(_Plugin, _PlayniteApi, _Plugin.GetPluginUserDataPath(), false, SuccessStoryDatabase.GameSelected);
                }
            }
            Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(_PlayniteApi, resources.GetString("LOCSuccessStory"), ViewExtension);
            windowExtension.ShowDialog();
            PluginDatabase.IsViewOpen = false;
        }
예제 #4
0
        public IActionResult Success(int userID)
        {
            if (HttpContext.Session.GetInt32("UserId") == null)
            {
                return(RedirectToAction("LoginPage"));
            }
            User        currentUser = dbContext.users.Include(u => u.Transactions).FirstOrDefault(u => u.UserId == userID);
            SuccessView myViewModel = new SuccessView();

            myViewModel.User = currentUser;
            return(View("Success", myViewModel));
        }
		void showSuccess()
		{
			var view = new SuccessView {
				Frame = View.Bounds,
				Close = () => DismissViewController(true,null),
				Tweet = tweet,
			};
			View.AddSubview(view);
			UIView.Animate (.3, () => {
				proccessView.Alpha = 0f;
			});
			view.AnimateIn ();
		}
예제 #6
0
        void showSuccess()
        {
            var view = new SuccessView {
                Frame = View.Bounds,
                Close = () => DismissViewController(true, null),
                Tweet = tweet,
            };

            View.AddSubview(view);
            UIView.Animate(.3, () => {
                proccessView.Alpha = 0f;
            });
            view.AnimateIn();
        }
        public void OnBtActionBarClick(object sender, RoutedEventArgs e)
        {
#if DEBUG
            logger.Debug($"SuccessStory - OnBtActionBarClick()");
#endif
            SuccessView ViewExtension = null;
            if (_Settings.EnableRetroAchievementsView && PlayniteTools.IsGameEmulated(_PlayniteApi, SuccessStory.GameSelected))
            {
                ViewExtension = new SuccessView(_Plugin, _Settings, _PlayniteApi, _Plugin.GetPluginUserDataPath(), true, SuccessStory.GameSelected);
            }
            else
            {
                ViewExtension = new SuccessView(_Plugin, _Settings, _PlayniteApi, _Plugin.GetPluginUserDataPath(), false, SuccessStory.GameSelected);
            }
            Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(_PlayniteApi, resources.GetString("LOCSuccessStory"), ViewExtension);
            windowExtension.ShowDialog();
        }
예제 #8
0
        public IActionResult addTrans(SuccessView modelData)
        {
            Transaction newTrans    = modelData.Transaction;
            User        currentUser = dbContext.users.Include(u => u.Transactions).FirstOrDefault(u => u.UserId == HttpContext.Session.GetInt32("UserId"));

            if (ModelState.IsValid)
            {
                if (newTrans.Amount < 0 && Math.Abs(newTrans.Amount) > currentUser.CurrentBalance)
                {
                    return(RedirectToAction("Success", new { userID = currentUser.UserId }));
                }
                newTrans.UserId             = currentUser.UserId;
                currentUser.CurrentBalance += newTrans.Amount;
                currentUser.UpdatedAt       = DateTime.Now;
                dbContext.Add(newTrans);
                dbContext.SaveChanges();
                return(RedirectToAction("Success", new { userID = currentUser.UserId }));
            }
            SuccessView myViewModel = new SuccessView();

            myViewModel.User = currentUser;
            return(View("Success", myViewModel));
        }
        /// <summary>
        /// Examines if the XML input is valid based on a given .xsd from OneOffixx.
        /// </summary>
        /// <param name="obj"></param>
        public async void ExecuteValidation(object obj)
        {
            dial = new ResponseWindow();
            XmlSchemaSet xmlSchema = new XmlSchemaSet();
            var          asm       = Assembly.GetExecutingAssembly();

            using (var stream = asm.GetManifestResourceStream("OneOffixx.ConnectClient.WinApp.XSD.OneOffixxValidation.xsd"))
            {
                if (stream != null)
                {
                    var reader    = new StreamReader(stream);
                    var xmlString = reader.ReadToEnd();
                    xmlSchema.Add("", XmlReader.Create(new StringReader(xmlString)));
                }
            }
            try
            {
                var xdoc = new XmlDocument();
                xdoc.LoadXml(Request.XmlString);
                xdoc.Schemas = xmlSchema;
                ValidationEventHandler eventHandler = new ValidationEventHandler(XmlSettingsValidationEventHandler);
                xdoc.Validate(eventHandler);
                if (validation)
                {
                    SuccessView success = new SuccessView(this);
                    success.tb.Visibility       = Visibility.Hidden;
                    success.tb1.Visibility      = Visibility.Hidden;
                    success.tb2.Visibility      = Visibility.Hidden;
                    success.tb3.Visibility      = Visibility.Hidden;
                    success.Save.Visibility     = Visibility.Hidden;
                    success.Open.Visibility     = Visibility.Hidden;
                    success.Time.Visibility     = Visibility.Hidden;
                    success.Size.Visibility     = Visibility.Hidden;
                    success.Filename.Visibility = Visibility.Hidden;
                    dial.Content = success;
                    dial.Height  = 300;
                    dial.Width   = 300;
                    await((MetroWindow)Application.Current.MainWindow).ShowMetroDialogAsync(dial);
                }
                else
                {
                    FailView fail = new FailView(this);
                    fail.ServerStatus.Text = "The XML is not valid.";
                    fail.Details.Text      = validationText;
                    dial.Content           = fail;
                    dial.Height            = 300;
                    dial.Width             = 300;
                    await((MetroWindow)Application.Current.MainWindow).ShowMetroDialogAsync(dial);
                    validation = true;
                }
            }
            catch (XmlException e)
            {
                FailView fail = new FailView(this);
                fail.ServerStatus.Text = "Xml Parse Exception";
                fail.Details.Text      = "The XML contains an error. Make sure it is well formed and validate again.";
                dial.Content           = fail;
                dial.Height            = 300;
                dial.Width             = 300;
                await((MetroWindow)Application.Current.MainWindow).ShowMetroDialogAsync(dial);
                validation = true;
            }
        }
        /// <summary>
        /// Sends the Server Request.
        /// Posts given input fields to the OneOffixx Server.
        /// </summary>
        /// <param name="obj"></param>
        public async void SendRequest(object obj)
        {
            double length;

            isErrorAppeared    = false;
            Request.CanExecute = false;
            LogEntryViewModel values = new LogEntryViewModel(this);
            var date = System.DateTime.Now;

            values.Id           = Guid.NewGuid();
            values.Name         = date.ToString();
            values.Action       = "Server";
            values.RequestEntry = new Request()
            {
                Uri = Request.Url, Content = Request.XmlString, Username = Request.Username, Password = Request.Password, Date = date
            };
            values.ResponseEntry = new Response();
            values.IsFavorite    = false;
            using (HttpClient client = new HttpClient())
            {
                try
                {
                    var inBytes = Encoding.ASCII.GetBytes($"{Request.Username}:{Request.Password}");
                    client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(inBytes));
                    HttpContent content = new StringContent(Request.XmlString);
                    Stopwatch   sw      = Stopwatch.StartNew();
                    var         result  = await client.PostAsync(Request.Url, content);

                    sw.Stop();
                    values.ResponseEntry.TimeUsed = Math.Round((decimal)sw.ElapsedMilliseconds / 1000, 3).ToString();
                    if (result.StatusCode == HttpStatusCode.OK)
                    {
                        using (content = result.Content)
                        {
                            length     = (double)content.Headers.ContentLength;
                            filename   = content.Headers.ContentDisposition.FileName;
                            filename   = filename.Replace("\"", "");
                            byteResult = await content.ReadAsByteArrayAsync();
                        }
                        values.ResponseEntry.StatusCode = ((int)result.StatusCode).ToString();
                        SuccessView success = new SuccessView(this);
                        dial                  = new ResponseWindow();
                        length                = Math.Round((length / 1048576), 2);
                        success.Size.Text     = length.ToString() + " MB";
                        success.Filename.Text = filename;
                        success.Time.Text     = values.ResponseEntry.TimeUsed + " Seconds";
                        dial.Content          = success;
                        dial.Height           = 300;
                        dial.Width            = 300;
                        await((MetroWindow)Application.Current.MainWindow).ShowMetroDialogAsync(dial);
                    }
                    else
                    {
                        FailView fail = new FailView(this);
                        dial = new ResponseWindow();
                        values.ResponseEntry.StatusCode = ((int)result.StatusCode).ToString();
                        fail.ServerStatus.Text          = result.StatusCode.ToString() + " " + (int)result.StatusCode;
                        fail.Details.Text = result.ReasonPhrase;
                        dial.Content      = fail;
                        dial.Height       = 300;
                        dial.Width        = 300;
                        await((MetroWindow)Application.Current.MainWindow).ShowMetroDialogAsync(dial);
                    }
                }
                catch (Exception)
                {
                    FailView fail = new FailView(this);
                    dial = new ResponseWindow();
                    fail.ServerStatus.Text = "Uri not found";
                    values.ResponseEntry   = new Response()
                    {
                        StatusCode = "Uri not found"
                    };
                    fail.Details.Text = "Your Server input may be wrong as we could not find the Uri you requested.";
                    dial.Content      = fail;
                    dial.Height       = 300;
                    dial.Width        = 300;
                    await((MetroWindow)Application.Current.MainWindow).ShowMetroDialogAsync(dial);
                }
                finally
                {
                    values.ResponseEntry.Filename = filename;
                    Request.CanExecute            = true;
                    log.Logs.Add(values);
                    Request.Log         = new ObservableCollection <LogEntryViewModel>(log.Logs.OrderByDescending(x => x.RequestEntry.Date).ToList());
                    Request.FavoriteLog = new ObservableCollection <LogEntryViewModel>(log.Logs.Where(x => x.IsFavorite));
                    SaveHistory();
                }
            }
        }