OctoTorrent.main.Main C# (CSharp) Method

Main() static private method

static private Main ( string args ) : void
args string
return void
        static void Main(string[] args)
        {
            /* Generate the paths to the folder we will save .torrent files to and where we download files to */
            _basePath = Environment.CurrentDirectory;						// This is the directory we are currently in
            _torrentsPath = Path.Combine(_basePath, "Torrents");				// This is the directory we will save .torrents to
            _downloadsPath = Path.Combine(_basePath, "Downloads");			// This is the directory we will save downloads to
            _fastResumeFile = Path.Combine(_torrentsPath, "fastresume.data");
            _dhtNodeFile = Path.Combine(_basePath, "DhtNodes");
            _torrents = new List<TorrentManager>();							// This is where we will store the torrentmanagers
            _listener = new Top10Listener(10);

            // We need to cleanup correctly when the user closes the window by using ctrl-c
            // or an unhandled exception happens
            Console.CancelKeyPress += delegate { Shutdown(); };
            AppDomain.CurrentDomain.ProcessExit += delegate { Shutdown(); };
            AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.ExceptionObject); Shutdown(); };
            Thread.GetDomain().UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Console.WriteLine(e.ExceptionObject); Shutdown(); };

            StartEngine();
        }