public void CheckProjectSearchByRandomString()
        {
            var projectSection = Scope.Resolve <IProjectsSection>();

            var projects = PageExtension.WaitForLoading(projectSection).GetAllProjects();

            var descriptions = projects.Select(project => (project.Description + " " + project.Title + " ")).ToList();

            Logger.Info("Projects were recieved successfully");

            Random randomizer = new Random();

            string description = string.Join("", descriptions);
            var    words       = description.Split(' ');
            int    index       = randomizer.Next(words.Length);

            string randomWord = words[index];

            Logger.Info($"A word to search : --- {randomWord} ---");

            Scope.Resolve <ISearchSection>().SearchResultsByString(randomWord);

            projectSection = Scope.Resolve <IProjectsSection>();

            projects = PageExtension.WaitForLoading(projectSection).GetAllProjects();

            foreach (var project in projects)
            {
                Logger.Info($"Project --- {project.Title} --- on the page with description: --- {project.Description} ---");
                Assert.That(project.Description.Contains(randomWord) || project.Title.Contains(randomWord));
            }
        }
Beispiel #2
0
        private void NextButtonClick(object sender, RoutedEventArgs e)
        {
            NavigationWindow root = FindNavigationWindow();

            // Reset SDService so that it's ready for later
            SDService.ResetHandlers();
            SDService.Stop();

            root.Navigate(new DerivingPage((page) =>
            {
                // setup key derivation task and execute it asynchronously on the next page
                HACGUIKeyset.Keyset.DeriveKeys();

                PageExtension next = null;

                // move to next page (after the task is complete)
                page.Dispatcher.BeginInvoke(new Action(() => // move to UI thread
                {
                    next = new PickNANDPage();
                    page.FindNavigationWindow().Navigate(next);
                })).Wait();   // must wait, otherwise a race condition may occur

                return(next); // return the page we are navigating to
            }));
        }
        public void TestSetUp()
        {
            Scope.Resolve <IOpenSource>().Open();

            try
            {
                PageExtension.WaitForLoading(Scope.Resolve <ICookiesFrame>()).AgreeWithPrivacyPolicy();
            }
            catch (Exception e)
            {
                Logger.Error($"Cookies were not accepted! {e.Message}");
            }
        }
        public void CheckProjectBackgroundImage()
        {
            var projectSection = Scope.Resolve <IProjectsSection>();

            var projects = PageExtension.WaitForLoading(projectSection).GetAllProjects();

            Logger.Info("Projects were recieved successfully");

            foreach (var project in projects)
            {
                Logger.Info($"Project image was {project.Image}," + "\n" + $"Project background image was {project.BackgroundImage}");
                Assert.That(project.Image, Is.EqualTo(project.BackgroundImage));
            }
        }
Beispiel #5
0
        public DerivingPage(DerivingPageAction Run)
        {
            InitializeComponent();

            Loaded += (_, __) =>
                      FindRootWindow().Submit(new Task(() =>
            {
                PageExtension next = Run(this);                                   // asyncronously run the derivation task
                Dispatcher.Invoke(() =>                                           // move to UI thread
                {
                    next.Loaded += (___, ____) =>                                 // wait until the next page has fully loaded (so that it becomes a child of NavigationWindow)
                                   next.FindNavigationWindow().RemoveBackEntry(); // remove DerivingPage from backstack so that the user can't see it
                });
            }));
        }
        public void CheckMembershipsTitleDescription()
        {
            var membershipSection = Scope.Resolve <IMembershipSection>();

            Assert.IsTrue(PageExtension.WaitForLoading(membershipSection).HasMemberships());

            var memberships = membershipSection.GetAllMemberships();

            foreach (var membership in memberships)
            {
                Logger.Info($"Membership title ---{membership.Title}---");

                Assert.That(membership.Title, !Is.EqualTo(""));

                Logger.Info($"Membership description ---{membership.Description}---");

                Assert.IsTrue(membership.Description != "");
            }
        }
Beispiel #7
0
        public IHttpActionResult Get(int page, int pageSize)
        {
            //
            var empList = new ServiceResponse <IEnumerable <Employee> >();

            empList.Data = null;
            if (page < 1 || pageSize < 1)
            {
                return(BadRequest("invalid page or pageSize "));
            }

            var _employeeList = PageExtension.Page(_employeeManager.GetEmployeeList(), page, pageSize);


            empList.Data       = _employeeList;
            empList.statusCode = HttpStatusCode.OK;

            return(Ok(empList));
        }
Beispiel #8
0
        public void TestSetUp()
        {
            logonStrategy = Scope.Resolve <LogOnFrame>();

            var mainPage = Scope.Resolve <IMainPage>();

            mainPage.Open();
            mainPage.WaitForLoading();

            try
            {
                PageExtension.WaitForLoading(Scope.Resolve <ICookiesFrame>()).AgreeWithPrivacyPolicy();
            }
            catch (Exception e)
            {
                Logger.Error($"Cookies were not accepted! {e.Message}");

                // Assert.Warn(e.Message);//implement custom exception
            }
        }
Beispiel #9
0
        public DerivingPage(DerivingPageAction Run)
        {
            InitializeComponent();

            Loaded += (_, __) =>
            {
                Thread thread = new Thread(new ThreadStart(() =>
                {
                    PageExtension next = Run(this);              // asyncronously run the derivation task
                    next.Dispatcher.BeginInvoke(new Action(() => // move to UI thread
                    {
                        next.Loaded += (___, ____) =>            // wait until the next page has fully loaded (so that it becomes a child of NavigationWindow)
                        {
                            next.FindRoot().RemoveBackEntry();   // remove DerivingPage from backstack so that the user can't see it
                        };
                    }));
                }));
                thread.Start();
            };
        }
Beispiel #10
0
        private void StartDeriving()
        {
            Dispatcher.BeginInvoke(new Action(() => // move to UI thread
            {
                NavigationWindow root = FindRoot();
                root.Navigate(new DerivingPage((page) =>
                {
                    OnNandFound();

                    PageExtension next = null;
                    // move to next page (after the task is complete)
                    page.Dispatcher.BeginInvoke(new Action(() => // move to UI thread again...
                    {
                        next = new Finish();
                        page.FindRoot().Navigate(next);
                    })).Wait(); // must wait, otherwise a race condition may occur

                    return(next);
                }));
                KeepAlive = false;
            })).Wait();
        }
Beispiel #11
0
        private void btn_next_Click(object sender, RoutedEventArgs e)
        {
            NavigationWindow root = FindRoot();

            // Reset SDService so that it's ready for later
            SDService.ResetHandlers();
            SDService.Stop();

            root.Navigate(new DerivingPage((page) =>
            {
                // setup key derivation task and execute it asynchronously on the next page

                Array.Copy(SBK, HACGUIKeyset.Keyset.SecureBootKey, 0x10);
                Array.Copy(TSECKeys[0], HACGUIKeyset.Keyset.TsecKey, 0x10);

                FileStream boot0 = HACGUIKeyset.TempBOOT0FileInfo.OpenRead();
                boot0.Seek(0x180000, SeekOrigin.Begin); // Seek to keyblob area

                for (int i = 0; i < 32; i++)
                {
                    boot0.Read(HACGUIKeyset.Keyset.EncryptedKeyblobs[i], 0, 0xB0);
                    boot0.Seek(0x150, SeekOrigin.Current); // skip empty region
                }

                boot0.Seek(0x100000, SeekOrigin.Begin);
                List <HashSearchEntry> searches = new List <HashSearchEntry>
                {
                    new HashSearchEntry(NintendoKeys.MasterKeySourceHash, 0x10),
                    new HashSearchEntry(NintendoKeys.KeyblobMacKeySourceHash, 0x10)
                };
                Dictionary <byte[], byte[]> hashes = boot0.FindKeyViaHash(searches, new SHA256Managed(), 0x10, 0x40000);
                Array.Copy(hashes[NintendoKeys.MasterKeySourceHash], HACGUIKeyset.Keyset.MasterKeySource, 0x10);
                Array.Copy(hashes[NintendoKeys.KeyblobMacKeySourceHash], HACGUIKeyset.Keyset.KeyblobMacKeySource, 0x10);

                HACGUIKeyset.Keyset.DeriveKeys();

                // Copy package1 into seperate file
                boot0.Seek(0x100000, SeekOrigin.Begin);
                FileStream pkg1stream = HACGUIKeyset.TempPkg1FileInfo.Create();
                boot0.CopyToNew(pkg1stream, 0x40000);
                boot0.Close();
                pkg1stream.Seek(0, SeekOrigin.Begin); // reset position

                HACGUIKeyset.RootTempPkg1FolderInfo.Create();
                Package1 pkg1 = new Package1(HACGUIKeyset.Keyset, pkg1stream);

                // Extracting package1 contents
                FileStream NXBootloaderStream  = HACGUIKeyset.TempNXBootloaderFileInfo.Create();
                FileStream SecureMonitorStream = HACGUIKeyset.TempSecureMonitorFileInfo.Create();
                FileStream WarmbootStream      = HACGUIKeyset.TempWarmbootFileInfo.Create();
                pkg1.Pk11.OpenNxBootloader().CopyToNew(NXBootloaderStream);
                pkg1.Pk11.OpenSecureMonitor().CopyToNew(SecureMonitorStream);
                pkg1.Pk11.OpenWarmboot().CopyToNew(WarmbootStream);


                searches = new List <HashSearchEntry>
                {
                    new HashSearchEntry(NintendoKeys.Pkg2KeySourceHash, 0x10),
                    new HashSearchEntry(NintendoKeys.TitleKekSourceHash, 0x10),
                    new HashSearchEntry(NintendoKeys.AesKekGenerationSourceHash, 0x10)
                };

                SecureMonitorStream.Seek(0, SeekOrigin.Begin);
                hashes = SecureMonitorStream.FindKeyViaHash(searches, new SHA256Managed(), 0x10);
                Array.Copy(hashes[NintendoKeys.Pkg2KeySourceHash], HACGUIKeyset.Keyset.Package2KeySource, 0x10);
                Array.Copy(hashes[NintendoKeys.TitleKekSourceHash], HACGUIKeyset.Keyset.TitlekekSource, 0x10);
                Array.Copy(hashes[NintendoKeys.AesKekGenerationSourceHash], HACGUIKeyset.Keyset.AesKekGenerationSource, 0x10);

                HACGUIKeyset.Keyset.DeriveKeys(); // derive the additional keys obtained from package1

                // close shit
                NXBootloaderStream.Close();
                SecureMonitorStream.Close();
                WarmbootStream.Close();
                pkg1stream.Close();

                PageExtension next = null;

                // move to next page (after the task is complete)
                page.Dispatcher.BeginInvoke(new Action(() => // move to UI thread
                {
                    next = new PickNANDPage();
                    page.FindRoot().Navigate(next);
                })).Wait();   // must wait, otherwise a race condition may occur

                return(next); // return the page we are navigating to
            }));
        }
Beispiel #12
0
        /// <summary>
        /// 分页
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="source"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public static IEnumerable <TSource> Paged <TSource>(this IQueryable <TSource> source, PageExtension page)
        {
            var expression = Expression.Call(null, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(new Type[] { typeof(TSource) }), new Expression[] { source.Expression, Expression.Constant(page) });

            return((IEnumerable <TSource>)(new HQueryProvider().CreateQuery <TSource>(expression)).GetEnumerator());
        }