static void Main(string[] args) { var initialize = new Initialize(); initialize.ProgressEvent += Initialize_ProgressEvent; Core = initialize.StartAsync().GetAwaiter().GetResult(); Console.ReadKey(); }
public static void doLoad() { #if DEBUG #else try { #endif Model.SystemLog.addEntry("---------------"); Model.SystemLog.addEntry(""); Model.SystemLog.addEntry("Startup at " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString()); speedLimiter = new Model.GlobalSpeedLimiter(); string username = settings.getString("Username", Environment.MachineName); settings.setString("Username", username); try { udp2 = new System.Net.Sockets.UdpClient(Dimension.Model.NetConstants.controlPort); } catch { } Model.SystemLog.addEntry("Setting up NAT..."); bootstrap = new Model.Bootstrap(); try { bootstrap.launch().Wait(); } catch (System.TypeLoadException) { System.Windows.Forms.MessageBox.Show("Error! It looks like you don't have .NET 4.5 x86 installed."); System.Windows.Forms.Application.Exit(); return; } listener = bootstrap.listener; udp = bootstrap.unreliableClient; System.Threading.Thread t = new System.Threading.Thread(acceptLoop); t.IsBackground = true; t.Name = "UDT Accept Loop"; t.Start(); fileListDatabase = new Model.FileListDatabase(); Model.SystemLog.addEntry("Creating File List Manager..."); fileList = new Model.FileList(); Model.SystemLog.addEntry("Creating a serializer..."); serializer = new Model.Serializer(); Model.SystemLog.addEntry("Creating the client core..."); theCore = new Model.Core(); Model.SystemLog.addEntry("Starting Kademlia launching..."); kademlia = new Model.Kademlia(); if (!isMono) { t = new System.Threading.Thread(delegate() { kademlia.initialize(); }); t.IsBackground = true; t.Name = "Kademlia Init Thread"; t.Start(); } Model.SystemLog.addEntry("Starting a file list update..."); fileList.startUpdate(false); Model.SystemLog.addEntry("Saving settings..."); App.settings.save(); Model.SystemLog.addEntry("Done loading!"); doneLoading = true; #if DEBUG #else } catch (Exception e) { Model.SystemLog.addEntry("Exception!"); Model.SystemLog.addEntry(e.Message); Model.SystemLog.addEntry(e.StackTrace); } #endif }