private void EditorPanelContent_Shown(object sender, EventArgs e) { if (LoadFile() == false) { MessageBox.Show("File '" + this.FileName + "' failed to open"); this.Close(); return; } if (file.FileExt == "c" || file.FileExt == "cpp" || file.FileExt == "h" || file.FileExt == "hpp" || file.FileExt == "pde") { scint = SettingsManagement.SetScintSettings(scint, false, false); scint = KeywordImageGen.ApplyImageList(scint); } else if (file.FileExt == "s" || file.FileExt == "asm") { //scint.Lexing.Lexer = Lexer.Asm; //scint = SettingsManagement.SetScintSettings(scint, true, false); scint = SettingsManagement.SetScintSettings(scint, true, true); } else if (file.FileName.ToLowerInvariant() == "makefile") { scint.Lexing.Lexer = Lexer.MakeFile; scint = SettingsManagement.SetScintSettings(scint, true, true); } else { scint.Lexing.Lexer = Lexer.Null; scint = SettingsManagement.SetScintSettings(scint, true, true); } fileSystemWatcher1.Filter = file.FileName; fileSystemWatcher1.Path = file.FileDir + Path.DirectorySeparatorChar; fileSystemWatcher1.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite; fileSystemWatcher1.EnableRaisingEvents = true; }
public static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); splash = new SplashScreen(); splash.Show(); try { SettingsManagement.Load(); FileTemplate.Unpack(); ProjTemplate.Load(); if (SettingsManagement.AutocompleteEnable) { KeywordImageGen.GenerateKeywordImages(); } } catch (Exception ex) { ErrorReportWindow.Show(ex, "Initialization Error"); } try { UpdateMech.CheckForUpdates(); } catch (Exception ex) { ErrorReportWindow.Show(ex, "Error Checking Updates"); } try { AVRProject newProject = new AVRProject(); if (args.Length > 0) { string fname = args[0]; if (newProject.Open(fname) == true) { SettingsManagement.AddFileAsMostRecent(fname); } else { MessageBox.Show("Error, failed to open file"); } } else if (SettingsManagement.OpenLastProject) { if (string.IsNullOrEmpty(SettingsManagement.LastProjectPath) == false) { if (newProject.Open(SettingsManagement.LastProjectPath) == true) { SettingsManagement.AddFileAsMostRecent(SettingsManagement.LastProjectPath); } else { MessageBox.Show("Error, failed to open file"); } } } KeywordScanner.Initialize(); Application.Run(new IDEWindow(newProject)); if (newProject.IsReady) { if (SettingsManagement.SaveRecentList() == false) { MessageBox.Show("Error, Could Not Save Recent File List"); } } } catch (Exception ex) { ErrorReportWindow.Show(ex, "Main IDE Error"); } try { if (UpdateMech.HasFinishedChecking) { if (UpdateMech.UpdateAvailable) { try { if (MessageBox.Show("An Updated Version of AVR Project IDE is Available (" + SettingsManagement.Version + " to " + UpdateMech.NewBuildID + "). Would you like to download it?", "Update Available", MessageBoxButtons.YesNo) == DialogResult.Yes) { System.Diagnostics.Process.Start(Properties.Resources.WebsiteURL); } } catch (Exception ex) { ErrorReportWindow.Show(ex, "Updater Error"); } } } } catch (Exception ex) { ErrorReportWindow.Show(ex, "Error Checking Updates"); } try { if (SettingsManagement.LastRunVersion != SettingsManagement.Version) { NotifyOfUserAction(); } SettingsManagement.LastRunVersion = SettingsManagement.Version; } catch { } }