public MainForm() { InitializeComponent(); try { //Set helper classes myDatabase = new Database(dbFile); myIni = new Ini(iniSettingsFile); //Set language menu List <ToolStripMenuItem> languageMenuItems = myLanguage.Create_LanguageMenuItems(ref toolSSeperator, ref toolSMLanguage, languageDir); foreach (ToolStripMenuItem menuItem in languageMenuItems) { menuItem.Click += new EventHandler(LanguageMenuItem_Click); } InitLanguage(); //Initialize controls InitControls(); //Check for unnseen mails when program start Check_AccountsForUnseenMails(); //Start program updater Updater.Updater.Configurator myConfig = new Updater.Updater.Configurator(); myConfig.ApplicationName = AppDomain.CurrentDomain.FriendlyName.Replace(".exe", ""); myConfig.Version = Assembly.GetEntryAssembly().GetName().Version; myConfig.Homepage = "https://sourceforge.net/projects/mailcheckerpro/"; myConfig.UpdateUrl = "https://sourceforge.net/projects/mailcheckerpro/files/"; myConfig.SupportEmail = "*****@*****.**"; myConfig.ConfirmDownload = true; myConfig.UpdateInterval = 10; LoadExternalDlls(ref myConfig); //external dlls myUpdater = new Updater.Updater(myConfig); myUpdater.Start(); } catch (Exception e) { MessageBox.Show("Fatal error: " + e.Message); CloseApplication = true; Close(); } }
public MainForm() { InitializeComponent(); try { //Set helper classes myDatabase = new Database(dbFile); myIni = new Ini(iniSettingsFile); //Set language menu List<ToolStripMenuItem> languageMenuItems = myLanguage.Create_LanguageMenuItems(ref toolSSeperator, ref toolSMLanguage, languageDir); foreach (ToolStripMenuItem menuItem in languageMenuItems) menuItem.Click += new EventHandler(LanguageMenuItem_Click); InitLanguage(); //Initialize controls InitControls(); //Check for unnseen mails when program start Check_AccountsForUnseenMails(); //Start program updater Updater.Updater.Configurator myConfig = new Updater.Updater.Configurator(); myConfig.ApplicationName = AppDomain.CurrentDomain.FriendlyName.Replace(".exe", ""); myConfig.Version = Assembly.GetEntryAssembly().GetName().Version; myConfig.Homepage = "https://sourceforge.net/projects/mailcheckerpro/"; myConfig.UpdateUrl = "https://sourceforge.net/projects/mailcheckerpro/files/"; myConfig.SupportEmail = "*****@*****.**"; myConfig.ConfirmDownload = true; myConfig.UpdateInterval = 10; LoadExternalDlls(ref myConfig); //external dlls myUpdater = new Updater.Updater(myConfig); myUpdater.Start(); } catch (Exception e) { MessageBox.Show("Fatal error: " + e.Message); CloseApplication = true; Close(); } }
private void LoadExternalDlls(ref Updater.Updater.Configurator myConfig) { List <string> ExternalDlls = new List <string>(); ExternalDlls.Add("aenetmail_csharp.dll"); ExternalDlls.Add("Ini.dll"); ExternalDlls.Add("System.Data.SQLite.dll"); ExternalDlls.Add("Updater.dll"); foreach (string dll in ExternalDlls) { Assembly assembly = Assembly.LoadFrom(dll); string fullname = assembly.FullName.ToLower(); string pattern = "version="; int pos = fullname.IndexOf(pattern) + pattern.Length; int length = fullname.IndexOf(",", pos) - pos; if (pos != -1 && length > 0) { string version = fullname.Substring(pos, length); myConfig.ExternalDlls.Add(new Updater.Updater.Configurator.ExternalDll(dll, version)); } } }