public async Task <ScanResultItem> ScanRareItem(AndroidConnector android, ScanInfo scanInfo)
        {
            Console.WriteLine("- Opening search window");
            await CloseSearch(android);
            await ClickSearchButton(android);
            await ClickSearchBox(android);

            string itemName = scanInfo.SearchName;

            if (itemName.Contains("★"))
            {
                itemName = itemName.Substring(0, itemName.IndexOf("★")).Trim();
            }

            await android.Text(itemName);

            await ClickSearchWindowSearchButton(android); //to close text input
            await ClickSearchWindowSearchButton(android);

            Console.WriteLine("- Scanning search result");
            await android.Screenshot("searchresult.png");

            List <int> indices = FindSearchResult("searchresult.png", scanInfo);

            if (indices.Count == 0)
            {
                //TODO: do something with item0.png - item9.png
                Console.WriteLine("- Error, could not find item");
                await CloseSearch(android);

                return(ScanResult.BuildError <ScanResultItem>(scanInfo));
            }
            if (indices[0] != scanInfo.SearchIndex)
            {
                if (scanInfo.SearchIndex != -1)
                {
                    Console.WriteLine("- Warning, search index not correct");
                }
                scanInfo.SearchIndex = indices[0];
            }


            for (int i = 0; i < indices.Count; i++)
            {
                await ClickSearchWindowIndex(android, indices[i]);

                await Task.Delay(1500); // the UI needs some time to load the card

                Console.WriteLine("- Checking if any items are on sale");
                await android.Screenshot("shopitems.png");

                using (var image = Image.Load <Rgba32>("shopitems.png"))
                    image.Clone(ctx => ctx.Crop(new Rectangle(975, 505, 368, 64))).Save($"nosale.png");


                bool nosale = false;
                if (GetTextFromImage("nosale.png").ToLower().Contains("currently"))
                {
                    nosale = true;
                    Console.WriteLine("- No items currently on sale");
                    if (i + 1 >= indices.Count)
                    {
                        return new ScanResultItem()
                               {
                                   Found    = false,
                                   ScanInfo = scanInfo
                               }
                    }
                    ;
                }

                if (!nosale)
                {
                    await ClickShopItem(android, 0); // these items should only give 1 item result
                    await ClickShopBuyButton(android);

                    await Task.Delay(1500); // the UI needs some time to load the card

                    Console.WriteLine("- Scanning item");
                    await android.Screenshot("shopresult.png");
                    await ClickShopCloseItem(android);

                    ScanResultItem priceInfo = ParseResultWindowRareItem("shopresult.png", scanInfo, android);
                    if (!priceInfo.Error || i + 1 >= indices.Count)
                    {
                        priceInfo.Error = false;

                        return(priceInfo);
                    }
                }
                scanInfo.Message = "";
                Console.WriteLine("Item does not match, or not found on exchange with multiple items, trying to rescan it");
                await CloseSearch(android);
                await ClickSearchButton(android);
                await ClickSearchBox(android);

                await android.Text(itemName);
                await ClickSearchWindowSearchButton(android); //to close text input
                await ClickSearchWindowSearchButton(android);
            }

            return(null);
        }
    }
        public async Task <List <ScanResultEquip> > ScanEquip(AndroidConnector android, ScanInfo scanInfo)
        {
            List <ScanResultEquip> result = new List <ScanResultEquip>();


            if (scanInfo.RealName.Contains("[1]"))
            {
                scanInfo.Slots = 1;
            }
            if (scanInfo.RealName.Contains("[2]"))
            {
                scanInfo.Slots = 2;
            }

            if (scanInfo.SearchName.Contains("["))
            {
                scanInfo.SearchName = scanInfo.SearchName.Substring(0, scanInfo.SearchName.IndexOf("[")).Trim();
            }
            scanInfo.Equip = true;

            Program.status.SetSubStatus("Opening search window");
            await CloseSearch(android);
            await ClickSearchButton(android);
            await ClickSearchBox(android);

            await android.Text(scanInfo.SearchName);

            await ClickSearchWindowSearchButton(android); //to close text input
            await ClickSearchWindowSearchButton(android);

            Program.status.SetSubStatus("Scanning search result");
            await android.Screenshot("searchresult.png");

            using (var image = Image.Load <Rgba32>("searchresult.png"))
                using (var cmp = Image.Load <Rgba32>("data/bigerror.png"))
                    if (ImageDistance(image.Clone(c => c.Crop(new Rectangle(650, 150, 700, 200))), cmp) < 100)
                    {
                        Program.Restart = true;
                        return(null);
                    }


            List <int> indices = FindSearchResult("searchresult.png", scanInfo);

            if (indices.Count == 1 && indices[0] == -1)
            {
                await android.Swipe(1100, 863, 1100, 355, 200);

                await Task.Delay(500);

                await android.Screenshot("searchresult.png");

                indices = FindSearchResult("searchresult.png", scanInfo);
            }

            await Task.Delay(500);

            if (indices.Count == 0)
            {
                //TODO: do something with item0.png - item9.png
                Program.status.SetSubStatus("- Error, could not find item");
                await CloseSearch(android);

                return(new List <ScanResultEquip>()
                {
                    ScanResult.BuildError <ScanResultEquip>(scanInfo)
                });
            }
            if (indices[0] != scanInfo.SearchIndex)
            {
                if (scanInfo.SearchIndex != -1)
                {
                    Program.log.Log(scanInfo.RealName, "Warning, search index not correct");
                }
                scanInfo.SearchIndex = indices[0];
            }


            for (int i = 0; i < indices.Count; i++)
            {
                await ClickSearchWindowIndex(android, indices[i]);

                await Task.Delay(2500);

                Program.status.SetSubStatus("Checking for sales");
                await android.Screenshot("shopitems.png");

                using (var image = Image.Load <Rgba32>("shopitems.png"))
                    image.Clone(ctx => ctx.Crop(new Rectangle(975, 505, 368, 64))).Save($"nosale.png");

                bool onSale = true;
                if (GetTextFromImage("nosale.png").ToLower().Contains("currently"))
                {
                    onSale = false;
                    Program.log.Log(scanInfo.RealName, "Currently not for sale");
                    if (i + 1 >= indices.Count)
                    {
                        return new List <ScanResultEquip>()
                               {
                                   new ScanResultEquip()
                                   {
                                       Found    = false,
                                       ScanInfo = scanInfo
                                   }
                               }
                    }
                    ;
                }

                if (onSale)
                {
                    var images  = new List <Image <Rgba32> >();
                    int subPage = 0;
                    while (!Program.CancelScan)
                    {
                        Program.log.Log(scanInfo.RealName, "Scanning page " + subPage);

                        int  foundResults = images.Count;
                        bool done         = await ScanPage(images, android, scanInfo, result);

                        if (foundResults == images.Count)
                        {
                            Program.log.Log(scanInfo.RealName, "No new items found in last sweep, done");
                            break;
                        }
                        if (subPage % 2 == 0)
                        {
                            await SwipeDown(android);
                        }
                        else
                        if (await NextPage(android))
                        {
                            break;
                        }

                        await android.Screenshot("shopitems.png");

                        subPage++;
                    }
                    Program.status.SetSubStatus("done scanning");

                    foreach (var img in images)
                    {
                        img.Dispose();
                    }


                    return(result);
                }
                //this should not happen
                scanInfo.Message = "";
                Console.WriteLine("Item does not match, or not found on exchange with multiple items, trying to rescan it");
                await CloseSearch(android);
                await ClickSearchButton(android);
                await ClickSearchBox(android);

                await android.Text(scanInfo.SearchName);
                await ClickSearchWindowSearchButton(android); //to close text input
                await ClickSearchWindowSearchButton(android);
            }

            return(null);
        }