diff --git a/CI/build.cmd b/CI/build.cmd index f91de102d8..be47a5003b 100644 --- a/CI/build.cmd +++ b/CI/build.cmd @@ -35,15 +35,15 @@ if %errorlevel% neq 0 goto :error git clean -xfd -nuget restore FlashDevelop.sln - -msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="x86" /t:Rebuild %MSBuildLogger% +:: Extract version from HEAD +call SetVersion.bat -:: Check for build errors -if %errorlevel% neq 0 goto :error +nuget restore FlashDevelop.sln -:: Build AnyCPU version for 64bits support -msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Build %MSBuildLogger% +:: Build the solutions +msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild +ping -n 5 127.0.0.1 > nul +msbuild FlashDevelop.sln /p:Configuration=Release /p:Platform=x86 /t:Rebuild :: Check for build errors if %errorlevel% neq 0 goto :error diff --git a/External/Plugins/StartPage/Controls/DragDropPanel.cs b/External/Plugins/StartPage/Controls/DragDropPanel.cs index e452d594d7..7be2f1dfdb 100644 --- a/External/Plugins/StartPage/Controls/DragDropPanel.cs +++ b/External/Plugins/StartPage/Controls/DragDropPanel.cs @@ -8,12 +8,12 @@ public class DragDropPanel : Panel { public DragDropPanel() { - this.AutoSize = false; - this.AllowDrop = true; - this.DragOver += this.PanelDragOver; - this.DragDrop += this.PanelDragDrop; - this.Width = 300; - this.Height = 90; + AutoSize = false; + AllowDrop = true; + DragOver += PanelDragOver; + DragDrop += PanelDragDrop; + Width = 300; + Height = 90; } /// @@ -28,7 +28,7 @@ protected override CreateParams CreateParams { get { - CreateParams cp = base.CreateParams; + var cp = base.CreateParams; cp.ExStyle |= 0x20; return cp; } @@ -37,7 +37,7 @@ protected override CreateParams CreateParams /// /// Handles the drag over event and enables correct dn'd effects. /// - private void PanelDragOver(object sender, DragEventArgs e) + static void PanelDragOver(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { @@ -49,21 +49,17 @@ private void PanelDragOver(object sender, DragEventArgs e) /// /// Handles the actual file drop and opens them as editable documents. /// - private void PanelDragDrop(object sender, DragEventArgs e) + static void PanelDragDrop(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) + if (!e.Data.GetDataPresent(DataFormats.FileDrop)) return; + var files = (string[])e.Data.GetData(DataFormats.FileDrop); + foreach (var file in files) { - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - foreach (string file in files) + if (File.Exists(file)) { - if (File.Exists(file)) - { - PluginBase.MainForm.OpenEditableDocument(file); - } + PluginBase.MainForm.OpenEditableDocument(file); } } } - } - -} +} \ No newline at end of file diff --git a/External/Plugins/StartPage/Controls/StartPageWebBrowser.cs b/External/Plugins/StartPage/Controls/StartPageWebBrowser.cs index facd7022b2..11e5caa195 100644 --- a/External/Plugins/StartPage/Controls/StartPageWebBrowser.cs +++ b/External/Plugins/StartPage/Controls/StartPageWebBrowser.cs @@ -13,25 +13,25 @@ namespace StartPage.Controls { public class StartPageWebBrowser : UserControl { - private readonly string rssUrl = string.Empty; - private readonly string pageUrl = string.Empty; - private bool showingStartPage = false; - private readonly RecentProjectList recentProjectList; - private readonly StartPageActions startPageActions; - private WebBrowserEx webBrowser; - private DragDropPanel dndPanel; + readonly string rssUrl; + readonly string pageUrl; + bool showingStartPage; + readonly RecentProjectList recentProjectList; + readonly StartPageActions startPageActions; + WebBrowserEx webBrowser; + DragDropPanel dndPanel; public StartPageWebBrowser(string pageUrl, string rssUrl) { this.rssUrl = rssUrl; this.pageUrl = pageUrl; - this.InitializeDragDrop(); - this.InitializeComponent(); - this.startPageActions = new StartPageActions(); - this.recentProjectList = new RecentProjectList(); - this.webBrowser.ObjectForScripting = this.startPageActions; - this.startPageActions.DocumentCompleted += WebBrowserDocumentCompleted; - this.ShowStartPage(); + InitializeDragDrop(); + InitializeComponent(); + startPageActions = new StartPageActions(); + recentProjectList = new RecentProjectList(); + webBrowser.ObjectForScripting = startPageActions; + startPageActions.DocumentCompleted += WebBrowserDocumentCompleted; + ShowStartPage(); } #region Component Designer Generated Code @@ -40,34 +40,33 @@ public StartPageWebBrowser(string pageUrl, string rssUrl) /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + void InitializeComponent() { - this.webBrowser = new WebBrowserEx(); - this.SuspendLayout(); + webBrowser = new WebBrowserEx(); + SuspendLayout(); // // webBrowser // - this.webBrowser.AllowWebBrowserDrop = false; - this.webBrowser.Dock = System.Windows.Forms.DockStyle.Fill; - this.webBrowser.IsWebBrowserContextMenuEnabled = false; - this.webBrowser.Location = new System.Drawing.Point(0, 0); - this.webBrowser.MinimumSize = new System.Drawing.Size(20, 20); - this.webBrowser.Name = "webBrowser"; - this.webBrowser.Size = new System.Drawing.Size(696, 602); - this.webBrowser.TabIndex = 0; - this.webBrowser.WebBrowserShortcutsEnabled = false; - this.webBrowser.Navigating += this.WebBrowserNavigating; - this.webBrowser.NewWindow += this.WebBrowserNewWindow; + webBrowser.AllowWebBrowserDrop = false; + webBrowser.Dock = DockStyle.Fill; + webBrowser.IsWebBrowserContextMenuEnabled = false; + webBrowser.Location = new System.Drawing.Point(0, 0); + webBrowser.MinimumSize = new System.Drawing.Size(20, 20); + webBrowser.Name = "webBrowser"; + webBrowser.Size = new System.Drawing.Size(696, 602); + webBrowser.TabIndex = 0; + webBrowser.WebBrowserShortcutsEnabled = false; + webBrowser.Navigating += WebBrowserNavigating; + webBrowser.NewWindow += WebBrowserNewWindow; // // StartPageWebBrowser // - this.Dock = System.Windows.Forms.DockStyle.Fill; - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.Controls.Add(this.webBrowser); - this.Name = "StartPageWebBrowser"; - this.Size = new System.Drawing.Size(696, 602); - this.ResumeLayout(false); - + Dock = DockStyle.Fill; + AutoScaleMode = AutoScaleMode.None; + Controls.Add(webBrowser); + Name = "StartPageWebBrowser"; + Size = new System.Drawing.Size(696, 602); + ResumeLayout(false); } #endregion @@ -77,10 +76,10 @@ private void InitializeComponent() /// /// Initializes the drag and drop operation. /// - private void InitializeDragDrop() + void InitializeDragDrop() { - this.dndPanel = new DragDropPanel(); - this.Controls.Add(this.dndPanel); + dndPanel = new DragDropPanel(); + Controls.Add(dndPanel); } /// @@ -88,8 +87,8 @@ private void InitializeDragDrop() /// public void ShowStartPage() { - this.showingStartPage = true; - this.webBrowser.Navigate(this.pageUrl); + showingStartPage = true; + webBrowser.Navigate(pageUrl); } /// @@ -97,49 +96,46 @@ public void ShowStartPage() /// public void SendProjectInfo() { - this.recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects); - this.webBrowser.Document.InvokeScript("handleXmlData", new[] { this.recentProjectList.ToXml(), null}); + recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects); + webBrowser.Document?.InvokeScript("handleXmlData", new[] { recentProjectList.ToXml(), null}); } /// /// Updates the recent projects list /// - private void WebBrowserDocumentCompleted(object sender, EventArgs e) + void WebBrowserDocumentCompleted(object sender, EventArgs e) { - this.recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects); - this.webBrowser.Document.InvokeScript("handleXmlData", new[] { this.recentProjectList.ToXml(), this.rssUrl}); + recentProjectList.Update(ProjectManager.PluginMain.Settings.RecentProjects); + webBrowser.Document?.InvokeScript("handleXmlData", new[] { recentProjectList.ToXml(), rssUrl}); } /// /// If the page tries to open a new window use a fd tab instead /// - private void WebBrowserNewWindow(object sender, CancelEventArgs e) + void WebBrowserNewWindow(object sender, CancelEventArgs e) { - this.startPageActions.ShowURL(this.webBrowser.StatusText); + startPageActions.ShowURL(webBrowser.StatusText); e.Cancel = true; } /// /// If we're not about to show the start page and it isn't a javascript call then open a new fd tab /// - private void WebBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) + void WebBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) { - if (this.IsDownloadable(e.Url.ToString())) return; - if (!this.showingStartPage && !e.Url.ToString().StartsWithOrdinal("javascript")) + if (IsDownloadable(e.Url.ToString())) return; + if (!showingStartPage && !e.Url.ToString().StartsWithOrdinal("javascript")) { - this.startPageActions.ShowURL(e.Url.ToString()); + startPageActions.ShowURL(e.Url.ToString()); e.Cancel = true; } - this.showingStartPage = false; + showingStartPage = false; } /// /// Checks if the url is downloadable file /// - private bool IsDownloadable(string url) - { - return url.EndsWithOrdinal(".exe") || url.EndsWithOrdinal(".zip"); - } + static bool IsDownloadable(string url) => url.EndsWithOrdinal(".exe") || url.EndsWithOrdinal(".zip"); #endregion @@ -150,107 +146,78 @@ public class StartPageActions { public event EventHandler DocumentCompleted; - private static string RELEASE_NOTES_URL = Path.Combine(PathHelper.DocDir, "index.html"); + static string RELEASE_NOTES_URL = Path.Combine(PathHelper.DocDir, "index.html"); - public void PageReady() - { - DocumentCompleted?.Invoke(this, null); - } + public void PageReady() => DocumentCompleted?.Invoke(this, null); /// - /// Called from webpage to browse any url in seperate browser control + /// Called from webpage to browse any url in separate browser control /// - public void ShowURL(string url) - { - PluginBase.MainForm.CallCommand("Browse", url); - } + public void ShowURL(string url) => PluginBase.MainForm.CallCommand("Browse", url); /// /// Called from webpage to browse FlashDevelop Homepage /// - public void ShowHome() - { - this.ShowURL(DistroConfig.DISTRIBUTION_HOME); - } + public void ShowHome() => ShowURL(DistroConfig.DISTRIBUTION_HOME); /// /// Called from webpage to browse release notes /// - public void ShowReleaseNotes() - { - this.ShowURL(RELEASE_NOTES_URL); - } + public void ShowReleaseNotes() => ShowURL(RELEASE_NOTES_URL); /// /// Called from webpage to browse documentation /// - public void ShowDocumentation() - { - this.ShowURL(DistroConfig.DISTRIBUTION_HELP); - } + public void ShowDocumentation() => ShowURL(DistroConfig.DISTRIBUTION_HELP); /// /// Called from webpage to show FlashDevelop About dialog /// - public void ShowAbout() - { - PluginBase.MainForm.CallCommand("About", null); - } + public void ShowAbout() => PluginBase.MainForm.CallCommand("About", null); /// /// Opens appman to install new software /// - public void InstallSoftware() - { - PluginBase.MainForm.CallCommand("RunProcess", "$(Quote)$(AppDir)\\Tools\\appman\\AppMan.exe$(Quote);-locale=$(Locale)"); - } + public void InstallSoftware() => PluginBase.MainForm.CallCommand("RunProcess", "$(Quote)$(AppDir)\\Tools\\appman\\AppMan.exe$(Quote);-locale=$(Locale)"); /// /// Called from webpage to show New Project Dialog /// public void NewProject() { - DataEvent de = new DataEvent(EventType.Command, ProjectManagerCommands.NewProject, null); + var de = new DataEvent(EventType.Command, ProjectManagerCommands.NewProject, null); EventManager.DispatchEvent(this, de); } /// /// Called from webpage to open a project /// - public void OpenProject(string path) - { - PluginBase.MainForm.OpenEditableDocument(path); - } + public void OpenProject(string path) => PluginBase.MainForm.OpenEditableDocument(path); /// /// Called from webpage to open project dialog /// public void OpenProjectDialog() { - DataEvent de = new DataEvent(EventType.Command, ProjectManagerCommands.OpenProject, null); + var de = new DataEvent(EventType.Command, ProjectManagerCommands.OpenProject, null); EventManager.DispatchEvent(this, de); } } #endregion - } #region WebBrowserEx - class WebBrowserEx : WebBrowser + internal class WebBrowserEx : WebBrowser { /// /// Redirect events to MainForm. /// public override bool PreProcessMessage(ref Message msg) - { - return ((Form)PluginBase.MainForm).PreProcessMessage(ref msg); - } - + => ((Form)PluginBase.MainForm).PreProcessMessage(ref msg); } #endregion - -} +} \ No newline at end of file diff --git a/External/Plugins/StartPage/PluginMain.cs b/External/Plugins/StartPage/PluginMain.cs index 49436a2fdb..455a0f7e3c 100644 --- a/External/Plugins/StartPage/PluginMain.cs +++ b/External/Plugins/StartPage/PluginMain.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel; using System.Drawing; using System.IO; using System.Web; @@ -18,8 +17,8 @@ namespace StartPage public class PluginMain : IPlugin { bool justOpened = true; - string defaultRssUrl = ""; - string defaultStartPageUrl = ""; + string defaultRssUrl = string.Empty; + string defaultStartPageUrl = string.Empty; StartPageWebBrowser startPageWebBrowser; string settingFilename; Settings settingObject; @@ -90,27 +89,30 @@ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority) { switch (e.Type) { - case EventType.Command : + case EventType.Command: var de = (DataEvent)e; switch (de.Action) { - case ProjectManagerEvents.Project : + case ProjectManagerEvents.Project: // Close pluginPanel if the user has the setting checked and a project is opened if (de.Data != null && startPage != null) { if (settingObject.CloseOnProjectOpen) startPage.Close(); // The project manager does not update recent projects until after // it broadcasts this event so we'll wait a little bit before refreshing - Timer timer = new Timer(); - timer.Interval = 100; - timer.Tick += delegate { timer.Stop(); if (!startPageWebBrowser.IsDisposed) startPageWebBrowser.SendProjectInfo(); }; + var timer = new Timer {Interval = 100}; + timer.Tick += (_, _) => + { + timer.Stop(); + if (!startPageWebBrowser.IsDisposed) startPageWebBrowser.SendProjectInfo(); + }; timer.Start(); } break; } break; - case EventType.FileEmpty : + case EventType.FileEmpty: if ((justOpened & (settingObject.ShowStartPageOnStartup == ShowStartPageOnStartupEnum.Always || settingObject.ShowStartPageOnStartup == ShowStartPageOnStartupEnum.NotRestoringSession)) || settingObject.ShowStartPageInsteadOfUntitled) { ShowStartPage(); @@ -139,15 +141,18 @@ public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority) /// /// Initializes important variables /// - public void InitBasics() + void InitBasics() { - int length = DistroConfig.DISTRIBUTION_NAME.Length + 1; - string dataDir = Path.Combine(PathHelper.DataDir, "StartPage"); - string localeName = PluginBase.Settings.LocaleVersion.ToString(); - string version = Application.ProductName.Substring(length, Application.ProductName.IndexOfOrdinal(" for") - length); - string fileWithArgs = "index.html?l=" + localeName + "&v=" + HttpUtility.HtmlEncode(version); + var length = DistroConfig.DISTRIBUTION_NAME.Length + 1; + var localeName = PluginBase.Settings.LocaleVersion.ToString(); + var productName = Application.ProductName; + var version = productName.Contains(" for", out var index) + ? productName.Substring(length, index - length) + : productName; + var fileWithArgs = $"index.html?l={localeName}&v={HttpUtility.HtmlEncode(version)}"; defaultStartPageUrl = Path.Combine(PathHelper.AppDir, "StartPage", fileWithArgs); defaultRssUrl = DistroConfig.DISTRIBUTION_RSS; // Default feed... + var dataDir = Path.Combine(PathHelper.DataDir, nameof(StartPage)); if (!Directory.Exists(dataDir)) Directory.CreateDirectory(dataDir); settingFilename = Path.Combine(dataDir, "Settings.fdb"); Description = TextHelper.GetString("Info.Description"); @@ -165,7 +170,7 @@ public void AddEventHandlers() /// /// Loads the plugin settings /// - public void LoadSettings() + void LoadSettings() { settingObject = new Settings(); if (!File.Exists(settingFilename)) SaveSettings(); @@ -175,12 +180,12 @@ public void LoadSettings() /// /// Saves the plugin settings /// - public void SaveSettings() => ObjectSerializer.Serialize(settingFilename, settingObject); + void SaveSettings() => ObjectSerializer.Serialize(settingFilename, settingObject); /// /// Creates a menu item for the plugin /// - public void CreateMenuItem() + void CreateMenuItem() { var title = TextHelper.GetString("Label.ViewMenuItem"); var menu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("ViewMenu"); @@ -192,20 +197,26 @@ public void CreateMenuItem() /// /// Creates the Start Page Tab /// - public void CreateStartPage() + void CreateStartPage() { startPageWebBrowser = new StartPageWebBrowser(CurrentPageUrl, CurrentRssUrl); startPage = PluginBase.MainForm.CreateCustomDocument(startPageWebBrowser); startPage.Icon = ImageKonverter.ImageToIcon(pluginImage); - startPage.Disposed += PluginPanelDisposed; - startPage.Closing += PluginPanelClosing; + startPage.Disposed += (_, _) => startPage = null; + startPage.Closing += (_, e) => + { + if (settingObject.ShowStartPageInsteadOfUntitled && PluginBase.MainForm.Documents.Length == 1) + { + e.Cancel = true; + } + }; startPage.Text = TextHelper.GetString("Title.StartPage"); } /// /// Shows the Start Page Tab and creates if necessary. /// - public void ShowStartPage() + void ShowStartPage() { if (startPage is null) CreateStartPage(); else startPage.Show(PluginBase.MainForm.DockPanel); @@ -220,22 +231,6 @@ public void ShowStartPage() /// void ViewMenuClick(object sender, EventArgs e) => ShowStartPage(); - /// - /// Some internal event handling for closing. - /// - void PluginPanelClosing(object sender, CancelEventArgs e) - { - if (settingObject.ShowStartPageInsteadOfUntitled && PluginBase.MainForm.Documents.Length == 1) - { - e.Cancel = true; - } - } - - /// - /// Reset the start page reference. - /// - void PluginPanelDisposed(object sender, EventArgs e) => startPage = null; - #endregion } } \ No newline at end of file diff --git a/External/Plugins/StartPage/ProjectInfo/RecentProjectList.cs b/External/Plugins/StartPage/ProjectInfo/RecentProjectList.cs index e7da7ed30b..8d4f5c22f0 100644 --- a/External/Plugins/StartPage/ProjectInfo/RecentProjectList.cs +++ b/External/Plugins/StartPage/ProjectInfo/RecentProjectList.cs @@ -8,14 +8,9 @@ public class RecentProjectList : List { readonly XmlSerializer xmlSerializer; - public RecentProjectList() - { - xmlSerializer = XmlSerializer.FromTypes(new[]{GetType()})[0]; - } - public RecentProjectList(List recentProjects) - { - Update(recentProjects); - } + public RecentProjectList() => xmlSerializer = XmlSerializer.FromTypes(new[]{GetType()})[0]; + + public RecentProjectList(List recentProjects) => Update(recentProjects); /// /// Updates the recent project list from list of paths @@ -23,7 +18,7 @@ public RecentProjectList(List recentProjects) public void Update(List recentProjects) { Clear(); - foreach (string recentProject in recentProjects) + foreach (var recentProject in recentProjects) { Add(new RecentProject(recentProject)); } @@ -42,9 +37,9 @@ public string ToXml() public class RecentProject { - public string Path = ""; - public string Name = ""; - public string Type = ""; + public string Path = string.Empty; + public string Name = string.Empty; + public string Type = string.Empty; public string Created = "Error getting file information."; public string Modified = "Error getting file information."; diff --git a/External/Plugins/StartPage/Settings.cs b/External/Plugins/StartPage/Settings.cs index 87c20806dd..d5f4560b7a 100644 --- a/External/Plugins/StartPage/Settings.cs +++ b/External/Plugins/StartPage/Settings.cs @@ -27,7 +27,7 @@ public class Settings public bool CloseOnProjectOpen { get => closeOnProjectOpen; - set => this.closeOnProjectOpen = value; + set => closeOnProjectOpen = value; } /// @@ -40,7 +40,7 @@ public bool CloseOnProjectOpen public bool ShowStartPageInsteadOfUntitled { get => showStartPageInsteadOfUntitled; - set => this.showStartPageInsteadOfUntitled = value; + set => showStartPageInsteadOfUntitled = value; } /// @@ -53,7 +53,7 @@ public bool ShowStartPageInsteadOfUntitled public ShowStartPageOnStartupEnum ShowStartPageOnStartup { get => showStartPageOnStartup; - set => this.showStartPageOnStartup = value; + set => showStartPageOnStartup = value; } #endregion @@ -70,7 +70,7 @@ public ShowStartPageOnStartupEnum ShowStartPageOnStartup public string CustomStartPage { get => customStartPage; - set => this.customStartPage = value; + set => customStartPage = value; } /// @@ -83,7 +83,7 @@ public string CustomStartPage public bool UseCustomStartPage { get => useCustomStartPage; - set => this.useCustomStartPage = value; + set => useCustomStartPage = value; } /// @@ -96,7 +96,7 @@ public bool UseCustomStartPage public string CustomRssFeed { get => customRssFeed; - set => this.customRssFeed = value; + set => customRssFeed = value; } /// @@ -109,7 +109,7 @@ public string CustomRssFeed public bool UseCustomRssFeed { get => useCustomRssFeed; - set => this.useCustomRssFeed = value; + set => useCustomRssFeed = value; } #endregion diff --git a/External/Plugins/StartPage/StartPage.csproj b/External/Plugins/StartPage/StartPage.csproj index 46fb2eb44e..362b1248d0 100644 --- a/External/Plugins/StartPage/StartPage.csproj +++ b/External/Plugins/StartPage/StartPage.csproj @@ -11,7 +11,6 @@ net48 true false - false false false false @@ -25,7 +24,6 @@ DEBUG;TRACE prompt 4 - true 9 @@ -55,7 +53,6 @@ true ..\..\..\FlashDevelop\Bin\Debug\Plugins\ DEBUG;TRACE - true full x64 9 @@ -76,18 +73,6 @@ - - - Component - - - UserControl - - - - - - {61885F70-B4DC-4B44-852D-5D6D03F2A734} diff --git a/External/Plugins/TaskListPanel/TaskListPanel.csproj b/External/Plugins/TaskListPanel/TaskListPanel.csproj index 5225218663..403040cb2e 100644 --- a/External/Plugins/TaskListPanel/TaskListPanel.csproj +++ b/External/Plugins/TaskListPanel/TaskListPanel.csproj @@ -1,5 +1,4 @@  - Debug