[Help] C# Application stopped working

[Help] C# Application stopped working
0

#1

Why does this code keep on failing? It works for a bit then they all crash.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GroupFinderPart1
{
    public class Program
    {

        static void Main()
        {
            new Program().Check();
        }
        private void Check()
        {
            // This is getting your settings file to check if it has on or off in it....
            try
            {
                string text = File.ReadAllText(Application.StartupPath + "\\settings.txt");
                string lower = text.ToLower();
                if (lower == "disabled")
                {
                    Application.Exit();
                }
                else
                {
                    if (lower == "enabled")
                    {
                        Task w = Task.Delay(600);
                        w.Wait();
                        new Program().Start();
                    }
                    else
                    {
                        MessageBox.Show("That is not enabled or disabled!");
                    }
                }
            }
            catch
            {

            }
        }
        private void Start()
        {
            try
            {
                //The group finder....
               
                Random random = new Random();
                int i = random.Next(0, 1000000);
                string test = new System.Net.WebClient().DownloadString("http://www.roblox.com/groups/group.aspx?gid=" + i);
                if (test.Contains(">No One!</a>"))
                {
                    Console.WriteLine("A group with no owner has been found!");
                    if (test.Contains("<b>Funds:</b>"))
                    {
                        Console.WriteLine("A group with funds has been found!");
                        if (test.Contains(">0</span>"))
                        {
                            Console.WriteLine("No funds found in a group with no owner!");
                            Check();
                        }
                        else
                        {
                            File.WriteAllText(Application.StartupPath + "\\group.txt", "**Group found:** http://www.roblox.com/groups/group.aspx?gid=" + i);
                            Console.WriteLine("Group with funds outputted!");
                            Check();
                        }
                    }
                    else
                    {
                        Check();
                    }
                }
                else
                {
                    Check();
                }
            }
            
            catch
            {
                Check();
            }
            Check();
            }
            }
        }

#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.


#3

What kind of Visual Studio project?
It looks like a Windows Form project.

Also, can you post your source code somewhere like GitHub or Bitbucket?