static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Instantiate the kernel object kernel = new Kernel(); kernel.PluginLoaded += new Kernel.PluginNotification(kernel_PluginLoaded); kernel.SkinLoaded += new Kernel.SkinNotification(kernel_SkinLoaded); // Show splash screen splashScreenForm = new SplashScreenForm(); splashScreenForm.Show(); splashScreenForm.Percent = 0; // Load profile kernel.LoadDefaultProfile(null); splashScreenForm.Percent = 5; // Uninstall pending plug-ins kernel.PerformPluginUninstallation(); splashScreenForm.Percent = 10; // Install pending plug-ins kernel.PerformPluginInstallation(); splashScreenForm.Percent = 15; // Load skins if (kernel.InstalledSkinsCount == 0) { MessageBox.Show(Language.Program_NoSkins, Language.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } skinstep = (int)Math.Floor((double)30 / kernel.InstalledSkinsCount); kernel.LoadSkins(); if (kernel.InstalledPluginsCount > 0) { pluginstep = (int)Math.Floor((double)60 / kernel.InstalledPluginsCount); kernel.LoadPlugins(); } else { splashScreenForm.Percent = 100; } splashScreenForm.Close(); // Gets the client Tibia.Util.ClientChooserOptions options = new Tibia.Util.ClientChooserOptions(); options.LookUpClients = true; options.Smart = false; kernel.Client = Tibia.Util.ClientChooserWPF.ShowBox(options); if (kernel.Client == null) { Environment.Exit(0); } kernel.Client.Process.WaitForInputIdle(); kernel.Client.Window.Title = string.Format(Kernel.TitleFormat, ProductName, Language.mainForm_Title_Loading); kernel.Proxy = new Tibia.Packets.HookProxy(kernel.Client); kernel.Proxy.ReceivedSelfAppearIncomingPacket += new Tibia.Packets.ProxyBase.IncomingPacketListener(proxy_ReceivedSelfAppearIncomingPacket); //kernel.Client.StartProxy(); // Create the main form mainForm = new MainForm(); mainForm.Shown += new EventHandler(mainForm_Shown); // Enable the kernel (initialization prior to main window) kernel.Enable(); ApplicationContext appContext = new ApplicationContext(mainForm); appContext.ThreadExit += new EventHandler(OnApplicationExit); Application.Run(appContext); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Instantiate the kernel object kernel = new Kernel(); kernel.PluginLoaded += new Kernel.PluginNotification(kernel_PluginLoaded); kernel.SkinLoaded += new Kernel.SkinNotification(kernel_SkinLoaded); // Show splash screen splashScreenForm = new SplashScreenForm(); splashScreenForm.Show(); splashScreenForm.Percent = 0; // Load profile kernel.LoadDefaultProfile(null); splashScreenForm.Percent = 5; // Uninstall pending plug-ins kernel.PerformPluginUninstallation(); splashScreenForm.Percent = 10; // Install pending plug-ins kernel.PerformPluginInstallation(); splashScreenForm.Percent = 15; // Load skins if (kernel.InstalledSkinsCount == 0) { MessageBox.Show(Language.Program_NoSkins, Language.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } skinstep = (int)Math.Floor((double)30 / kernel.InstalledSkinsCount); kernel.LoadSkins(); if (kernel.InstalledPluginsCount > 0) { pluginstep = (int)Math.Floor((double)60 / kernel.InstalledPluginsCount); kernel.LoadPlugins(); } else { splashScreenForm.Percent = 100; } splashScreenForm.Close(); // Gets the client Tibia.Util.ClientChooserOptions options = new Tibia.Util.ClientChooserOptions(); options.LookUpClients = true; options.Smart = false; kernel.Client = Tibia.Util.ClientChooserWPF.ShowBox(options); if (kernel.Client == null) Environment.Exit(0); kernel.Client.Process.WaitForInputIdle(); kernel.Client.Window.Title = string.Format(Kernel.TitleFormat, ProductName, Language.mainForm_Title_Loading); kernel.Proxy = new Tibia.Packets.HookProxy(kernel.Client); kernel.Proxy.ReceivedSelfAppearIncomingPacket += new Tibia.Packets.ProxyBase.IncomingPacketListener(proxy_ReceivedSelfAppearIncomingPacket); //kernel.Client.StartProxy(); // Create the main form mainForm = new MainForm(); mainForm.Shown += new EventHandler(mainForm_Shown); // Enable the kernel (initialization prior to main window) kernel.Enable(); ApplicationContext appContext = new ApplicationContext(mainForm); appContext.ThreadExit += new EventHandler(OnApplicationExit); Application.Run(appContext); }