From de64adf6171c0ccc865ffd6cd81457faa57da9a3 Mon Sep 17 00:00:00 2001 From: SlavaRa Date: Thu, 30 Apr 2015 08:46:50 +0300 Subject: [PATCH 1/2] Up for FD5 --- .gitignore | 1 + ColtPlugin/ColtPlugin.csproj | 36 +- ColtPlugin/Forms/FirstTimeDialog.cs | 13 +- ColtPlugin/PluginMain.cs | 661 +++++++++----------- ColtPlugin/Properties/AssemblyInfo.cs | 2 +- ColtPlugin/Properties/Resources.Designer.cs | 5 +- ColtPlugin/Rpc/JsonRpcClient.cs | 115 ++-- ColtPlugin/Settings.cs | 44 +- 8 files changed, 359 insertions(+), 518 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2416a67 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +obj/ diff --git a/ColtPlugin/ColtPlugin.csproj b/ColtPlugin/ColtPlugin.csproj index 4cb8bfa..0479137 100644 --- a/ColtPlugin/ColtPlugin.csproj +++ b/ColtPlugin/ColtPlugin.csproj @@ -15,7 +15,7 @@ 3.5 - v2.0 + v3.5 @@ -54,7 +54,7 @@ x86 - ..\..\FD4\FlashDevelop\Bin\Debug\Plugins\ + ..\..\..\..\FlashDevelop\Bin\Debug\Plugins\ TRACE true @@ -77,9 +77,6 @@ jayrock\Jayrock.Json.dll - - - @@ -101,20 +98,11 @@ - + + Component + - - - {78101C01-E186-4954-B1DD-DEBB7905FAD8} - ProjectManager - - - {61885F70-B4DC-4B44-852D-5D6D03F2A734} - PluginCore - False - - FirstTimeDialog.cs @@ -153,18 +141,18 @@ - + + {61885f70-b4dc-4b44-852d-5d6d03f2a734} + PluginCore + + {4EBF2653-9654-4E40-880E-0046B3D6210E} ASCompletion - - {78101C01-E186-4954-B1DD-DEBB7905FAD8} + + {78101c01-e186-4954-b1dd-debb7905fad8} ProjectManager - - {61885F70-B4DC-4B44-852D-5D6D03F2A734} - PluginCore - diff --git a/ColtPlugin/Forms/FirstTimeDialog.cs b/ColtPlugin/Forms/FirstTimeDialog.cs index 384dcdb..cc33ed0 100644 --- a/ColtPlugin/Forms/FirstTimeDialog.cs +++ b/ColtPlugin/Forms/FirstTimeDialog.cs @@ -1,25 +1,20 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; namespace ColtPlugin.Forms { public partial class FirstTimeDialog : Form { - public Boolean AutoRun = true; - public Boolean InterceptBuilds = false; - public String ShortCode = null; + public bool AutoRun = true; + public bool InterceptBuilds; + public string ShortCode; public FirstTimeDialog() { InitializeComponent(); } - public FirstTimeDialog(Boolean interceptBuilds, Boolean autorun) + public FirstTimeDialog(bool interceptBuilds, bool autorun) { InitializeComponent(); InterceptBuilds = checkBox1.Checked = interceptBuilds; diff --git a/ColtPlugin/PluginMain.cs b/ColtPlugin/PluginMain.cs index 9f15e36..f466623 100644 --- a/ColtPlugin/PluginMain.cs +++ b/ColtPlugin/PluginMain.cs @@ -1,55 +1,53 @@ using System; -using System.IO; -using System.Diagnostics; -using System.Drawing; -using System.Windows.Forms; using System.Collections.Generic; using System.ComponentModel; +using System.Drawing; +using System.IO; using System.Reflection; -using WeifenLuo.WinFormsUI.Docking; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using ASCompletion.Context; +using ASCompletion.Model; +using ColtPlugin.Forms; using ColtPlugin.Resources; using ColtPlugin.Rpc; +using PluginCore; +using PluginCore.Helpers; using PluginCore.Localization; -using PluginCore.Utilities; using PluginCore.Managers; -using PluginCore.Helpers; -using PluginCore; -using ProjectManager.Controls; +using PluginCore.Utilities; using ProjectManager.Controls.TreeView; using ProjectManager.Projects.AS3; -using ASCompletion.Context; -using System.Text.RegularExpressions; -using ASCompletion.Model; -using System.Xml; -using System.Runtime.InteropServices; +using ScintillaNet; +using Timer = System.Timers.Timer; namespace ColtPlugin { public class PluginMain : IPlugin { - private String pluginName = "ColtPlugin"; - private String pluginGuid = "12600B5B-D185-4171-A362-25C5F73548C6"; - private String pluginHelp = "codeorchestra.zendesk.com/home/"; - private String pluginDesc = "COLT FD Plugin"; - private String pluginAuth = "Makc"; // as if - private String settingFilename; - private Settings settingObject; - private ToolStripMenuItem menuItem, assetFolderAddItem, assetFolderRemoveItem; - private ToolStripButton toolbarButton, toolbarButton2; - private FileSystemWatcher watcher; - private String pathToLog; - private System.Timers.Timer timer; - private Keys MakeItLiveKeys = Keys.Control | Keys.Shift | Keys.L; - private Boolean allowBuildInterception = true; - private int assetImageIndex = -1; - private TreeView projectTree; + string pluginName = "ColtPlugin"; + string pluginGuid = "12600B5B-D185-4171-A362-25C5F73548C6"; + string pluginHelp = "codeorchestra.zendesk.com/home/"; + string pluginDesc = "COLT FD Plugin"; + string pluginAuth = "Makc"; // as if + string settingFilename; + Settings settingObject; + ToolStripMenuItem menuItem, assetFolderAddItem, assetFolderRemoveItem; + ToolStripButton exportToColt, openInColt; + FileSystemWatcher watcher; + string pathToLog; + Timer timer; + Keys makeItLiveKeys = Keys.Control | Keys.Shift | Keys.L; + bool allowBuildInterception = true; + int assetImageIndex = -1; + TreeView projectTree; #region Required Properties /// /// Api level of the plugin /// - public Int32 Api + public int Api { get { return 1; } } @@ -57,7 +55,7 @@ public Int32 Api /// /// Name of the plugin /// - public String Name + public string Name { get { return pluginName; } } @@ -65,7 +63,7 @@ public String Name /// /// GUID of the plugin /// - public String Guid + public string Guid { get { return pluginGuid; } } @@ -73,7 +71,7 @@ public String Guid /// /// Author of the plugin /// - public String Author + public string Author { get { return pluginAuth; } } @@ -81,7 +79,7 @@ public String Author /// /// Description of the plugin /// - public String Description + public string Description { get { return pluginDesc; } } @@ -89,7 +87,7 @@ public String Description /// /// Web address for help /// - public String Help + public string Help { get { return pluginHelp; } } @@ -98,7 +96,7 @@ public String Help /// Object that contains the settings /// [Browsable(false)] - public Object Settings + public object Settings { get { return settingObject; } } @@ -107,20 +105,11 @@ public Object Settings #region Required Methods -// [DllImport("kernel32.dll", SetLastError = true)] -// [return: MarshalAs(UnmanagedType.Bool)] -// static extern bool AllocConsole(); - -// [DllImport("kernel32.dll", SetLastError = true)] -// [return: MarshalAs(UnmanagedType.Bool)] -// static extern bool FreeConsole(); - /// /// Initializes the plugin /// public void Initialize() { -// AllocConsole(); InitBasics(); LoadSettings(); InitLocalization(); @@ -138,50 +127,48 @@ public void Dispose() /// /// Handles the incoming events /// - public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) + public void HandleEvent(object sender, NotifyEvent e, HandlingPriority priority) { switch (e.Type) { case EventType.UIStarted: - DirectoryNode.OnDirectoryNodeRefresh += new DirectoryNodeRefresh(CreateAssetFoldersIcons); + DirectoryNode.OnDirectoryNodeRefresh += CreateAssetFoldersIcons; break; case EventType.Command: - string cmd = (e as DataEvent).Action; - if (cmd == "ProjectManager.Project") - { - IProject project = PluginBase.CurrentProject; - Boolean as3projectIsOpen = (project != null) && (project.Language == "as3"); - if (menuItem != null) menuItem.Enabled = as3projectIsOpen; - if (toolbarButton != null) toolbarButton.Enabled = as3projectIsOpen; - if (toolbarButton2 != null) toolbarButton2.Enabled = as3projectIsOpen && (GetCOLTFile() != null); - // modified or new project - reconnect in any case - WatchErrorsLog(); - } - else if (cmd == "ProjectManager.Menu") + string cmd = ((DataEvent) e).Action; + switch (cmd) { - Object menu = (e as DataEvent).Data; - CreateMenuItem(menu as ToolStripMenuItem); - } - else if (cmd == "ProjectManager.ToolBar") - { - Object toolStrip = (e as DataEvent).Data; - toolbarButton = CreateToolbarButton(toolStrip as ToolStrip, "colt_save.png", "Menu.ExportToCOLT", OnClick); - toolbarButton2 = CreateToolbarButton(toolStrip as ToolStrip, "colt_run.png", "Menu.OpenInCOLT", OnClick2); - } - else if ((cmd == "ProjectManager.BuildingProject") || (cmd == "ProjectManager.TestingProject")) - { - // todo: FD might send this for projects other than PluginBase.CurrentProject - figure out how to catch that - if (settingObject.InterceptBuilds && allowBuildInterception && toolbarButton2.Enabled) - { - ProductionBuild(cmd == "ProjectManager.TestingProject"); - - e.Handled = true; - } - } - else if (cmd == "ProjectManager.TreeSelectionChanged") - { - CreateContextMenuItems(); + case "ProjectManager.Project": + IProject project = PluginBase.CurrentProject; + bool as3ProjectIsOpen = project != null && project.Language == "as3"; + if (menuItem != null) menuItem.Enabled = as3ProjectIsOpen; + if (exportToColt != null) exportToColt.Enabled = as3ProjectIsOpen; + if (openInColt != null) openInColt.Enabled = as3ProjectIsOpen && GetCOLTFile() != null; + // modified or new project - reconnect in any case + WatchErrorsLog(); + break; + case "ProjectManager.Menu": + object menu = ((DataEvent) e).Data; + CreateMenuItem(menu as ToolStripMenuItem); + break; + case "ProjectManager.ToolBar": + ToolStrip toolStrip = ((DataEvent)e).Data as ToolStrip; + exportToColt = CreateToolbarButton(toolStrip, "colt_save.png", "Menu.ExportToCOLT", OnExportToColt); + openInColt = CreateToolbarButton(toolStrip, "colt_run.png", "Menu.OpenInCOLT", OnOpenInColt); + break; + case "ProjectManager.BuildingProject": + case "ProjectManager.TestingProject": + // todo: FD might send this for projects other than PluginBase.CurrentProject - figure out how to catch that + if (settingObject.InterceptBuilds && allowBuildInterception && openInColt.Enabled) + { + ProductionBuild(cmd == "ProjectManager.TestingProject"); + e.Handled = true; + } + break; + case "ProjectManager.TreeSelectionChanged": + CreateContextMenuItems(); + break; } break; @@ -191,7 +178,7 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) case EventType.Keys: // shortcut pressed KeyEvent ke = (KeyEvent)e; - if (ke.Value == MakeItLiveKeys) + if (ke.Value == makeItLiveKeys) { ke.Handled = true; MakeItLive(); @@ -202,7 +189,7 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) DataEvent de = (DataEvent)e; if (de.Action == "ColtPlugin.MakeItLive") { - MakeItLiveKeys = (Keys)de.Data; + makeItLiveKeys = (Keys)de.Data; } break; @@ -218,7 +205,7 @@ public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) /// public void InitBasics() { - String dataPath = Path.Combine(PathHelper.DataDir, "ColtPlugin"); + string dataPath = Path.Combine(PathHelper.DataDir, "ColtPlugin"); if (!Directory.Exists(dataPath)) Directory.CreateDirectory(dataPath); settingFilename = Path.Combine(dataPath, "Settings.fdb"); } @@ -252,29 +239,26 @@ public void AddEventHandlers() { EventManager.AddEventHandler(this, EventType.UIStarted, HandlingPriority.High); EventManager.AddEventHandler(this, EventType.Command | EventType.FileSave | EventType.Keys | EventType.Shortcut); - - watcher = new FileSystemWatcher(); - watcher.NotifyFilter = NotifyFilters.LastWrite; + watcher = new FileSystemWatcher {NotifyFilter = NotifyFilters.LastWrite}; watcher.Changed += OnFileChange; - - PluginBase.MainForm.RegisterShortcutItem("ColtPlugin.MakeItLive", MakeItLiveKeys); + PluginBase.MainForm.RegisterShortcutItem("ColtPlugin.MakeItLive", makeItLiveKeys); } #endregion #region GetImage() stuff - private static Dictionary imageCache = new Dictionary(); + static Dictionary imageCache = new Dictionary(); /// /// Gets embedded image from resources /// - private static Image GetImage(String imageName) + static Image GetImage(string imageName) { if (!imageCache.ContainsKey(imageName)) { Assembly assembly = Assembly.GetExecutingAssembly(); - imageCache.Add(imageName, new Bitmap(assembly.GetManifestResourceStream("ColtPlugin.Resources." + imageName))); + imageCache.Add(imageName, new Bitmap(assembly.GetManifestResourceStream(string.Format("ColtPlugin.Resources.{0}", imageName)))); } return imageCache[imageName]; @@ -284,20 +268,17 @@ private static Image GetImage(String imageName) #region Menu items stuff - private void CreateAssetFoldersIcons(DirectoryNode node) + void CreateAssetFoldersIcons(DirectoryNode node) { // we are going to save TreeView reference once we saw it // this hack comes from SourceControl's OverlayManager :S projectTree = node.TreeView; - ImageList list = projectTree.ImageList; if (assetImageIndex < 0) { assetImageIndex = list.Images.Count; - //list.Images.Add(GetImage("colt_assets_folder.png")); list.Images.Add(PluginBase.MainForm.FindImage("520")); } - if (IsAssetFolder(node.BackingPath)) { node.ImageIndex = assetImageIndex; @@ -305,16 +286,17 @@ private void CreateAssetFoldersIcons(DirectoryNode node) } } - private void CreateContextMenuItems() + void CreateContextMenuItems() { if (assetFolderAddItem == null) { //assetFolderAddItem = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderAdd"), GetImage("colt_assets.png")); assetFolderAddItem = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderAdd"), PluginBase.MainForm.FindImage("336")); assetFolderAddItem.Click += OnAssetAddOrRemoveClick; - - assetFolderRemoveItem = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderRemove")); - assetFolderRemoveItem.Checked = true; + assetFolderRemoveItem = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderRemove")) + { + Checked = true + }; assetFolderRemoveItem.Click += OnAssetAddOrRemoveClick; } @@ -325,54 +307,55 @@ private void CreateContextMenuItems() { // good to go - insert after 1st separator ContextMenuStrip menu = projectTree.ContextMenuStrip; - - Int32 index = 0; + int index = 0; while (index < menu.Items.Count) { - index++; if (menu.Items[index - 1] is ToolStripSeparator) break; + index++; + if (menu.Items[index - 1] is ToolStripSeparator) break; } - menu.Items.Insert(index, IsAssetFolder(node.BackingPath) ? assetFolderRemoveItem : assetFolderAddItem); } } } - private void OnAssetAddOrRemoveClick(Object sender, EventArgs e) + void OnAssetAddOrRemoveClick(object sender, EventArgs e) { DirectoryNode node = projectTree.SelectedNode as DirectoryNode; if (node != null) { - List assets = new List(AssetFolders); + List assets = new List(AssetFolders); if (assets.Contains(node.BackingPath)) assets.Remove(node.BackingPath); else assets.Add(node.BackingPath); AssetFolders = assets.ToArray(); node.Refresh(false); } } - private void CreateMenuItem(ToolStripMenuItem projectMenu) + void CreateMenuItem(ToolStripMenuItem projectMenu) { - menuItem = new ToolStripMenuItem(LocaleHelper.GetString("Menu.ExportToCOLT"), GetImage("colt_save.png"), OnClick, null); - menuItem.Enabled = false; + menuItem = new ToolStripMenuItem(LocaleHelper.GetString("Menu.ExportToCOLT"), GetImage("colt_save.png"), + OnExportToColt, null) {Enabled = false}; projectMenu.DropDownItems.Add(menuItem); } - private ToolStripButton CreateToolbarButton(ToolStrip toolStrip, String image, String hint, EventHandler handler) + ToolStripButton CreateToolbarButton(ToolStrip toolStrip, string image, string hint, EventHandler handler) { - ToolStripButton button = new ToolStripButton(); - button.Image = GetImage(image); - button.Text = LocaleHelper.GetString(hint); - button.DisplayStyle = ToolStripItemDisplayStyle.Image; + ToolStripButton button = new ToolStripButton + { + Image = GetImage(image), + Text = LocaleHelper.GetString(hint), + DisplayStyle = ToolStripItemDisplayStyle.Image + }; button.Click += handler; toolStrip.Items.Add(button); return button; } - private void OnClick(Object sender, EventArgs e) + void OnExportToColt(object sender, EventArgs e) { ExportAndOpen(settingObject.AutoRun); } - private void OnClick2(Object sender, EventArgs e) + void OnOpenInColt(object sender, EventArgs e) { FindAndOpen(settingObject.AutoRun); } @@ -386,10 +369,8 @@ private void OnClick2(Object sender, EventArgs e) /// public void LoadSettings() { - string defaultExe = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + @"\COLT\colt.exe"; - + string defaultExe = string.Format("{0}\\COLT\\colt.exe", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)); settingObject = new Settings(); - if (!File.Exists(settingFilename)) { settingObject.Executable = defaultExe; @@ -397,12 +378,8 @@ public void LoadSettings() } else { - Object obj = ObjectSerializer.Deserialize(settingFilename, settingObject); - settingObject = (Settings)obj; -// debug -//settingObject.SecurityToken = null; - string exe = settingObject.Executable; - if ((exe == null) || (exe.Length == 0)) + settingObject = (Settings)ObjectSerializer.Deserialize(settingFilename, settingObject); + if (string.IsNullOrEmpty(settingObject.Executable)) { settingObject.Executable = defaultExe; SaveSettings(); @@ -421,36 +398,29 @@ public void SaveSettings() /// /// Convenience property to get or set asset folders todo: extract this into something nice /// - private String[] AssetFolders + string[] AssetFolders { get { AS3Project project = PluginBase.CurrentProject as AS3Project; - - if ((project != null) && project.Storage.ContainsKey("colt.assets")) + if (project != null && project.Storage.ContainsKey("colt.assets")) { return project.Storage["colt.assets"].Split('|'); } - - return new String[] { }; + return new string[] { }; } - set { AS3Project project = PluginBase.CurrentProject as AS3Project; - - if (project != null) - { - project.Storage["colt.assets"] = String.Join("|", value); - - project.Save(); - } + if (project == null) return; + project.Storage["colt.assets"] = string.Join("|", value); + project.Save(); } } - private Boolean IsAssetFolder(String path) + bool IsAssetFolder(string path) { - return (Array.IndexOf(AssetFolders, path) >= 0); + return Array.IndexOf(AssetFolders, path) >= 0; } #endregion @@ -460,60 +430,53 @@ private Boolean IsAssetFolder(String path) /// /// Watches for COLT compilation errors log (optionally creates COLT folder if it does not exist) /// - private void WatchErrorsLog(Boolean createFolder = false) + void WatchErrorsLog(bool createFolder = false) { // shut down errors log watcher and its timer watcher.EnableRaisingEvents = false; - if (timer != null) { timer.Stop(); timer = null; } - + if (timer != null) + { + timer.Stop(); + timer = null; + } // create the folder and subscribe to errors log updates IProject project = PluginBase.CurrentProject; if (project == null) return; - - String coltFolderPath = project.GetAbsolutePath(settingObject.WorkingFolder); + string coltFolderPath = project.GetAbsolutePath(settingObject.WorkingFolder); if (createFolder && !Directory.Exists(coltFolderPath)) Directory.CreateDirectory(coltFolderPath); - - if (Directory.Exists(coltFolderPath)) - { - pathToLog = Path.Combine(coltFolderPath, "compile_errors.log"); - watcher.Path = coltFolderPath; - watcher.EnableRaisingEvents = true; - } + if (!Directory.Exists(coltFolderPath)) return; + pathToLog = Path.Combine(coltFolderPath, "compile_errors.log"); + watcher.Path = coltFolderPath; + watcher.EnableRaisingEvents = true; } - private void OnFileChange(Object sender, FileSystemEventArgs e) + void OnFileChange(object sender, FileSystemEventArgs e) { - if (e.FullPath.EndsWith("compile_errors.log")) + if (!e.FullPath.EndsWith("compile_errors.log") || timer != null) return; + timer = new Timer { - if (timer == null) - { - timer = new System.Timers.Timer(); - timer.SynchronizingObject = (Form)PluginBase.MainForm; // thread safe - timer.Interval = 200; - timer.Elapsed += OnTimerElapsed; - timer.Enabled = true; - timer.Start(); - } - } + SynchronizingObject = (Form) PluginBase.MainForm, + Interval = 200 + }; + // thread safe + timer.Elapsed += OnTimerElapsed; + timer.Enabled = true; + timer.Start(); } - private void OnTimerElapsed(object sender, EventArgs e) + void OnTimerElapsed(object sender, EventArgs e) { timer.Stop(); timer = null; - ClearErrors(); - - String message = File.ReadAllText(pathToLog); - + string message = File.ReadAllText(pathToLog); // COLT copies sources to "incremental" folder, so let's try to find correct path and patch the output - String incremental = "colt\\incremental"; - String[] sources = PluginBase.CurrentProject.SourcePaths; - + string incremental = "colt\\incremental"; + string[] sources = PluginBase.CurrentProject.SourcePaths; // send the log line by line - String[] messageLines = message.Split(new Char[] {'\r', '\n'}); + string[] messageLines = message.Split('\r', '\n'); bool hasErrors = false; - foreach (String line in messageLines) if (line.Length > 0) + foreach (string line in messageLines) if (line.Length > 0) { int errorLevel = -3; if (line.Contains(incremental)) @@ -521,22 +484,19 @@ private void OnTimerElapsed(object sender, EventArgs e) try { // carefully take the file name out - String file = line.Substring(0, line.IndexOf("): col")); + string file = line.Substring(0, line.IndexOf("): col")); file = file.Substring(0, file.LastIndexOf("(")); file = file.Substring(file.IndexOf(incremental) + incremental.Length + 1); - // look for it in all source folders - for (int i = 0; i < sources.Length; i++) + foreach (string it in sources) { - if (File.Exists(PluginBase.CurrentProject.GetAbsolutePath(Path.Combine(sources[i], file)))) - { - TraceManager.Add(line.Replace(incremental, sources[i]), errorLevel); - hasErrors = true; - break; - } + if (!File.Exists(PluginBase.CurrentProject.GetAbsolutePath(Path.Combine(it, file)))) + continue; + TraceManager.Add(line.Replace(incremental, it), errorLevel); + hasErrors = true; + break; } } - catch (Exception) { // unexpected format, send as is @@ -553,12 +513,12 @@ private void OnTimerElapsed(object sender, EventArgs e) if (hasErrors) ShowErrors(); } - private void ClearErrors() + void ClearErrors() { EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ClearResults", null)); } - private void ShowErrors() + void ShowErrors() { // should be an option: if the panel was hidden it captures keyboard focus //EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ResultsPanel.ShowResults", null)); @@ -571,13 +531,12 @@ private void ShowErrors() /// /// Generate meta tags /// - private void MakeItLive() + void MakeItLive() { - ScintillaNet.ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; - if (sci == null) - return; + ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; + if (sci == null) return; - IASContext context = ASCompletion.Context.ASContext.Context; + IASContext context = ASContext.Context; if (context.CurrentClass == null || context.CurrentClass.IsVoid() || context.CurrentClass.LineFrom == 0) return; @@ -593,7 +552,7 @@ private void MakeItLive() line = context.CurrentMember.LineFrom; indent = LineIndentPosition(sci, line); pos = sci.PositionFromLine(line) + indent.Length; - string insert = "[LiveCodeUpdateListener(method=\"" + member.Name + "\")]\n" + indent; + string insert = string.Format("[LiveCodeUpdateListener(method=\"{0}\")]\n{1}", member.Name, indent); sci.SetSel(pos, pos); sci.ReplaceSel(insert); originalPos += insert.Length; @@ -605,7 +564,7 @@ private void MakeItLive() line = context.CurrentClass.LineFrom; indent = LineIndentPosition(sci, line); pos = sci.PositionFromLine(line) + indent.Length; - string insert = "[Live]\n" + indent; + string insert = string.Format("[Live]\n{0}", indent); sci.SetSel(pos, pos); sci.ReplaceSel(insert); originalPos += insert.Length; @@ -614,7 +573,7 @@ private void MakeItLive() sci.SetSel(originalPos, originalPos); } - private string LineIndentPosition(ScintillaNet.ScintillaControl sci, int line) + string LineIndentPosition(ScintillaControl sci, int line) { string txt = sci.GetLine(line); for (int i = 0; i < txt.Length; i++) @@ -624,99 +583,81 @@ private string LineIndentPosition(ScintillaNet.ScintillaControl sci, int line) #endregion - private void GetSecurityToken() + void GetSecurityToken() { // we expect this file to be open by now // because we get here from auth exception - String coltFileName = GetCOLTFile(); - - if (coltFileName != null) + string coltFileName = GetCOLTFile(); + if (coltFileName == null) return; + try { - try - { - JsonRpcClient client = new JsonRpcClient(coltFileName); - // knock - client.Invoke("requestShortCode", new Object[] { "FlashDevelop" /*LocaleHelper.GetString("Info.Description").TrimEnd(new Char[] { '.' })*/ }); - - // if still here, user needs to enter the code - Forms.FirstTimeDialog dialog = new Forms.FirstTimeDialog(settingObject.InterceptBuilds, settingObject.AutoRun); - dialog.ShowDialog(); - - // regardless of the code, set boolean options - settingObject.AutoRun = dialog.AutoRun; - settingObject.InterceptBuilds = dialog.InterceptBuilds; - - if ((dialog.ShortCode != null) && (dialog.ShortCode.Length == 4)) - { - // short code looks right - request security token - settingObject.SecurityToken = client.Invoke("obtainAuthToken", new Object[] { dialog.ShortCode }).ToString(); - } - } - - catch (Exception details) + JsonRpcClient client = new JsonRpcClient(coltFileName); + // knock + client.Invoke("requestShortCode", "FlashDevelop"); + + // if still here, user needs to enter the code + FirstTimeDialog dialog = new FirstTimeDialog(settingObject.InterceptBuilds, settingObject.AutoRun); + dialog.ShowDialog(); + // regardless of the code, set boolean options + settingObject.AutoRun = dialog.AutoRun; + settingObject.InterceptBuilds = dialog.InterceptBuilds; + if (dialog.ShortCode != null && dialog.ShortCode.Length == 4) { - HandleAuthenticationExceptions(details); + // short code looks right - request security token + settingObject.SecurityToken = client.Invoke("obtainAuthToken", dialog.ShortCode).ToString(); } } + catch (Exception details) + { + HandleAuthenticationExceptions(details); + } } /// /// Makes production build and optionally runs its output /// - private void ProductionBuild(Boolean run) + void ProductionBuild(bool run) { // make sure the COLT project is open - String path = FindAndOpen(false); - - if (path != null) + string path = FindAndOpen(false); + if (path == null) return; + try { - try + JsonRpcClient client = new JsonRpcClient(path); + client.PingOrRunCOLT(settingObject.Executable); + // leverage FD launch mechanism + if (run) { - JsonRpcClient client = new JsonRpcClient(path); - client.PingOrRunCOLT(settingObject.Executable); - - // leverage FD launch mechanism - if (run) - { - client.InvokeAsync("runProductionCompilation", RunAfterProductionBuild, new Object[] { settingObject.SecurityToken, /*run*/false }); - } - else - { - client.InvokeAsync("runProductionCompilation", HandleAuthenticationExceptions, new Object[] { settingObject.SecurityToken, /*run*/false }); - } + client.InvokeAsync("runProductionCompilation", RunAfterProductionBuild, settingObject.SecurityToken, false); } - catch (Exception details) + else { - HandleAuthenticationExceptions(details); + client.InvokeAsync("runProductionCompilation", HandleAuthenticationExceptions, settingObject.SecurityToken, false); } } + catch (Exception details) + { + HandleAuthenticationExceptions(details); + } } - private void RunAfterProductionBuild(Object result) + void RunAfterProductionBuild(object result) { Exception exception = result as Exception; - if (exception != null) - { - HandleAuthenticationExceptions(exception); - } - else - { - EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ProjectManager.PlayOutput", null)); - } + if (exception != null) HandleAuthenticationExceptions(exception); + else EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ProjectManager.PlayOutput", null)); } /// /// Opens the project in COLT and optionally runs live session /// - private String FindAndOpen(Boolean run) + string FindAndOpen(bool run) { // Create COLT subfolder if does not exist yet // While at that, start listening for colt/compile_errors.log changes WatchErrorsLog(true); - // Find COLT project to open - String coltFileName = GetCOLTFile(); - + string coltFileName = GetCOLTFile(); // Open it if (coltFileName != null) { @@ -726,9 +667,8 @@ private String FindAndOpen(Boolean run) { JsonRpcClient client = new JsonRpcClient(coltFileName); client.PingOrRunCOLT(settingObject.Executable); - client.InvokeAsync("runBaseCompilation", HandleAuthenticationExceptions, new Object[] { settingObject.SecurityToken }); + client.InvokeAsync("runBaseCompilation", HandleAuthenticationExceptions, settingObject.SecurityToken); } - return coltFileName; } catch (Exception details) @@ -737,109 +677,88 @@ private String FindAndOpen(Boolean run) return null; } } - - else - { - toolbarButton2.Enabled = false; - return null; - } - + openInColt.Enabled = false; + return null; } /// /// Exports the project to COLT and optionally runs live session /// - private void ExportAndOpen(Boolean run) + void ExportAndOpen(bool run) { // Create COLT subfolder if does not exist yet // While at that, start listening for colt/compile_errors.log changes WatchErrorsLog(true); - // Create COLT project in it COLTRemoteProject project = ExportCOLTProject(); - if (project != null) + if (project == null) return; + try { - try + // Export the project as xml file + project.Save(); + // Optionally run base compilation + if (run) { - // Export the project as xml file - project.Save(); - - // Optionally run base compilation - if (run) - { - JsonRpcClient client = new JsonRpcClient(project.path); - client.PingOrRunCOLT(settingObject.Executable); - client.InvokeAsync("runBaseCompilation", HandleAuthenticationExceptions, new Object[] { settingObject.SecurityToken }); - } - - // Enable "open" button - toolbarButton2.Enabled = true; - - // Remove older *.colt files - foreach (String oldFile in Directory.GetFiles(Path.GetDirectoryName(project.path), "*.colt")) - { - if (!project.path.Contains(Path.GetFileName(oldFile))) - { - File.Delete(oldFile); - } - } + JsonRpcClient client = new JsonRpcClient(project.path); + client.PingOrRunCOLT(settingObject.Executable); + client.InvokeAsync("runBaseCompilation", HandleAuthenticationExceptions, settingObject.SecurityToken); } - catch (Exception details) + openInColt.Enabled = true; + // Remove older *.colt files + foreach (string oldFile in Directory.GetFiles(Path.GetDirectoryName(project.path), "*.colt")) { - HandleAuthenticationExceptions(details); + if (!project.path.Contains(Path.GetFileName(oldFile))) + { + File.Delete(oldFile); + } } } + catch (Exception details) + { + HandleAuthenticationExceptions(details); + } } /// /// Handles possible authentication exceptions /// - private void HandleAuthenticationExceptions(object param) + void HandleAuthenticationExceptions(object param) { Exception exception = param as Exception; - if (exception != null) - { - JsonRpcException rpcException = exception as JsonRpcException; - if (rpcException != null) + if (exception == null) return; + JsonRpcException rpcException = exception as JsonRpcException; + if (rpcException != null) + { + // if the exception comes from rpc, we have two special situations to handle: + // 1 short code was wrong (might happen a lot) + // 2 security token was wrong (should never happen) + // in both cases, we need to request new security token + if ((rpcException.TypeName == "codeOrchestra.colt.core.rpc.security.InvalidShortCodeException") || + (rpcException.TypeName == "codeOrchestra.colt.core.rpc.security.InvalidAuthTokenException")) { - // if the exception comes from rpc, we have two special situations to handle: - // 1 short code was wrong (might happen a lot) - // 2 security token was wrong (should never happen) - // in both cases, we need to request new security token - if ((rpcException.TypeName == "codeOrchestra.colt.core.rpc.security.InvalidShortCodeException") || - (rpcException.TypeName == "codeOrchestra.colt.core.rpc.security.InvalidAuthTokenException")) - { - settingObject.SecurityToken = null; + settingObject.SecurityToken = null; - // request new security token immediately - GetSecurityToken(); - } - } - - else - { - TraceManager.Add(exception.ToString(), -1); + // request new security token immediately + GetSecurityToken(); } } + else TraceManager.Add(exception.ToString(), -1); } /// /// Returns path to existing COLT project or null. /// - private String GetCOLTFile() + string GetCOLTFile() { IProject project = PluginBase.CurrentProject; - try { - String[] files = Directory.GetFiles(project.GetAbsolutePath(settingObject.WorkingFolder), "*.colt"); + string[] files = Directory.GetFiles(project.GetAbsolutePath(settingObject.WorkingFolder), "*.colt"); if (files.Length > 0) return files[0]; } - catch (Exception) { } - return null; } @@ -847,114 +766,96 @@ private String GetCOLTFile() /// Exports FD project setting to COLTRemoteProject instance. /// /// - private COLTRemoteProject ExportCOLTProject() + COLTRemoteProject ExportCOLTProject() { // our options: parse project.ProjectPath (xml file) or use api AS3Project project = (AS3Project)PluginBase.CurrentProject; - - String configCopy = ""; + string configCopy = ""; if (settingObject.FullConfig) { // Construct flex config file name (see AS3ProjectBuilder, line 140) - String projectName = project.Name.Replace(" ", ""); - String configFile = Path.Combine("obj", projectName + "Config.xml"); - + string projectName = project.Name.Replace(" ", ""); + string configFile = Path.Combine("obj", string.Format("{0}Config.xml", projectName)); if (!File.Exists(project.GetAbsolutePath(configFile))) { - TraceManager.Add("Required file (" + projectName + "Config.xml) does not exist, project must be built first...", -1); - + TraceManager.Add(string.Format("Required file ({0}Config.xml) does not exist, project must be built first...", projectName), -1); try { allowBuildInterception = false; EventManager.DispatchEvent(this, new DataEvent(EventType.Command, "ProjectManager.BuildProject", null)); } - finally { allowBuildInterception = true; } - return null; } - // Create config copy with ... commented out - configCopy = Path.Combine("obj", projectName + "ConfigCopy.xml"); + configCopy = Path.Combine("obj", string.Format("{0}ConfigCopy.xml", projectName)); File.WriteAllText(project.GetAbsolutePath(configCopy), File.ReadAllText(project.GetAbsolutePath(configFile)) .Replace("", "/file-specs -->")); } - - // Export COLT project - COLTRemoteProject result = new COLTRemoteProject(); - - result.path = project.GetAbsolutePath(Path.Combine(settingObject.WorkingFolder, System.Guid.NewGuid() + ".colt")); - - result.name = project.Name; - - List libraryPathsList = new List(project.CompilerOptions.LibraryPaths); + COLTRemoteProject result = new COLTRemoteProject + { + path = project.GetAbsolutePath(Path.Combine(settingObject.WorkingFolder, string.Format("{0}.colt", System.Guid.NewGuid()))), + name = project.Name + }; + List libraryPathsList = new List(project.CompilerOptions.LibraryPaths); for (int i=0; i -1) { result.outputPath = project.GetAbsolutePath(outputPath.Substring(0, lastSlash)); result.outputFileName = outputPath.Substring(lastSlash + 1); } - else { result.outputPath = project.GetAbsolutePath(""); result.outputFileName = outputPath; } - String[] sourcePaths = project.SourcePaths.Clone() as String[]; - for (int i=0; i= 0) additionalOptions += "-define+=" + define + " "; + if (define.IndexOf(',') >= 0) additionalOptions += string.Format("-define+={0} ", define); } } - - result.compilerOptions = additionalOptions.Trim() + (debugMode ? " -debug" : ""); - + result.compilerOptions = string.Format("{0}{1}", additionalOptions.Trim(), (debugMode ? " -debug" : "")); return result; } } -} +} \ No newline at end of file diff --git a/ColtPlugin/Properties/AssemblyInfo.cs b/ColtPlugin/Properties/AssemblyInfo.cs index 6928f8a..fd3b767 100644 --- a/ColtPlugin/Properties/AssemblyInfo.cs +++ b/ColtPlugin/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodeOrchestra.com")] [assembly: AssemblyProduct("ColtPlugin")] -[assembly: AssemblyCopyright("")] +[assembly: AssemblyCopyright("CodeOrchestra.com 2013-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/ColtPlugin/Properties/Resources.Designer.cs b/ColtPlugin/Properties/Resources.Designer.cs index 57867a9..e7c0365 100644 --- a/ColtPlugin/Properties/Resources.Designer.cs +++ b/ColtPlugin/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.296 +// Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -60,6 +60,9 @@ internal Resources() { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// internal static System.Drawing.Bitmap colt_banner { get { object obj = ResourceManager.GetObject("colt_banner", resourceCulture); diff --git a/ColtPlugin/Rpc/JsonRpcClient.cs b/ColtPlugin/Rpc/JsonRpcClient.cs index 69b094f..69c8a69 100644 --- a/ColtPlugin/Rpc/JsonRpcClient.cs +++ b/ColtPlugin/Rpc/JsonRpcClient.cs @@ -1,20 +1,24 @@ -namespace ColtPlugin.Rpc +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Net; +using System.Text; +using System.Web.Services.Protocols; +using System.Windows.Forms; +using System.Xml; +using ColtPlugin.Resources; +using Jayrock.Json; +using PluginCore; +using PluginCore.Managers; +using Timer = System.Timers.Timer; + +namespace ColtPlugin.Rpc { - using System; - using System.IO; - using System.Net; - using System.Reflection; - using System.Text; - using System.Web.Services.Protocols; - using Jayrock.Json; - using System.Xml; - using System.Timers; - using System.Diagnostics; - public class JsonRpcException : Exception { - public String TypeName; - public JsonRpcException(String typeName, String message) : base((typeName == null) ? "" : ("[" + typeName + "] ") + message) + public string TypeName; + public JsonRpcException(string typeName, string message) : base((typeName == null) ? "" : ("[" + typeName + "] ") + message) { TypeName = typeName; } @@ -24,31 +28,30 @@ public JsonRpcException(String typeName, String message) : base((typeName == nul /// Based on sample client from Jayrock author /// http://markmail.org/message/xwlaeb3nfanv2kgm /// - [System.ComponentModel.DesignerCategory("")] + [DesignerCategory("")] public class JsonRpcClient : HttpWebClientProtocol { - private int _id; - private string _projectPath; + int id; + readonly string projectPath; public JsonRpcClient(string projectPath) - : base() { - _projectPath = projectPath; + this.projectPath = projectPath; - string coltFolder = System.Environment.GetEnvironmentVariable("USERPROFILE") + @"\.colt\"; + string coltFolder = string.Format("{0}\\.colt_as\\", Environment.GetEnvironmentVariable("USERPROFILE")); XmlDocument storageDescriptor = new XmlDocument(); - storageDescriptor.Load(coltFolder + "storage.xml"); + storageDescriptor.Load(string.Format("{0}storage.xml", coltFolder)); // // - XmlNodeList storageList = storageDescriptor.SelectNodes("/xml/storage[@path='" + _projectPath + "']"); + XmlNodeList storageList = storageDescriptor.SelectNodes(string.Format("/xml/storage[@path='{0}']", this.projectPath)); if (storageList.Count == 1) { string storage = storageList[0].Attributes["subDir"].Value; - int port = int.Parse ( File.ReadAllText(coltFolder + @"storage\" + storage + @"\rpc.info").Split(':')[1] ); + int port = int.Parse ( File.ReadAllText(string.Format("{0}storage\\{1}\\rpc.info", coltFolder, storage)).Split(':')[1] ); - Url = "http://127.0.0.1:" + port + "/rpc/coltService"; return; + Url = string.Format("http://127.0.0.1:{0}/rpc/coltService", port); return; } Url = "http://127.0.0.1:8092/rpc/coltService"; @@ -58,20 +61,19 @@ public void PingOrRunCOLT(string executable) { try { - Invoke("ping", new Object[] { }); + Invoke("ping"); } - catch (Exception) { // put it on recent files list - string coltFolder = System.Environment.GetEnvironmentVariable("USERPROFILE") + @"\.colt\"; + string coltFolder = string.Format("{0}\\.colt_as\\", Environment.GetEnvironmentVariable("USERPROFILE")); XmlDocument workingSet = new XmlDocument(); - workingSet.Load(coltFolder + "workingset.xml"); + workingSet.Load(string.Format("{0}workingset.xml", coltFolder)); XmlElement root = (XmlElement)workingSet.SelectSingleNode("/workingset"); XmlElement project = (XmlElement)root.PrependChild(workingSet.CreateElement("", "project", "")); - project.Attributes.Append(workingSet.CreateAttribute("path")).Value = _projectPath; - workingSet.Save(coltFolder + "workingset.xml"); + project.Attributes.Append(workingSet.CreateAttribute("path")).Value = projectPath; + workingSet.Save(string.Format("{0}workingset.xml", coltFolder)); // open COLT exe Process.Start(executable); @@ -85,7 +87,7 @@ public virtual void InvokeAsync(string method, Callback callback, params object[ public virtual object Invoke(string method, params object[] args) { - Console.WriteLine("Invoke: method = " + method); + Console.WriteLine("Invoke: method = {0}", method); WebRequest request = GetWebRequest(new Uri(Url)); request.Method = "POST"; @@ -94,7 +96,7 @@ public virtual object Invoke(string method, params object[] args) using (StreamWriter writer = new StreamWriter(stream, Encoding.UTF8)) { JsonObject call = new JsonObject(); - call["id"] = ++_id; + call["id"] = ++id; call["method"] = method; call["params"] = args; call.Export(new JsonTextWriter(writer)); @@ -104,15 +106,10 @@ public virtual object Invoke(string method, params object[] args) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) { -// String s = reader.ReadToEnd(); -// return s; JsonObject answer = new JsonObject(); answer.Import(new JsonTextReader(reader)); - object errorObject = answer["error"]; - if (errorObject != null) OnError(errorObject); - return answer["result"]; } } @@ -120,23 +117,13 @@ public virtual object Invoke(string method, params object[] args) protected virtual void OnError(object errorObject) { JsonObject error = errorObject as JsonObject; - - if (error != null) - { - string message = error["message"] as string; - if (message == null) message = ""; - - string exceptionType = null; - JsonObject data = error["data"] as JsonObject; - if (data != null) - { - exceptionType = data["exceptionTypeName"] as string; - } - - throw new JsonRpcException(exceptionType, message); - } - - throw new Exception(errorObject as string); + if (error == null) throw new Exception(errorObject as string); + string message = error["message"] as string; + if (message == null) message = ""; + string exceptionType = null; + JsonObject data = error["data"] as JsonObject; + if (data != null) exceptionType = data["exceptionTypeName"] as string; + throw new JsonRpcException(exceptionType, message); } } @@ -158,19 +145,21 @@ public JsonRpcClientAsyncHelper(JsonRpcClient client, string method, Callback ca this.args = args; this.callback = callback; - timer = new Timer(); - timer.SynchronizingObject = (System.Windows.Forms.Form)PluginCore.PluginBase.MainForm; - timer.Interval = 1000; + timer = new Timer + { + SynchronizingObject = (Form) PluginBase.MainForm, + Interval = 1000 + }; timer.Elapsed += OnTimer; count = 0; OnTimer(); } - private void OnTimer(Object sender = null, EventArgs e = null) + void OnTimer(object sender = null, EventArgs e = null) { timer.Stop(); - Console.WriteLine("JsonRpcClientAsyncHelper's OnTimer(), method = " + method); + Console.WriteLine("JsonRpcClientAsyncHelper's OnTimer(), method = {0}", method); if (COLTIsRunning()) { @@ -191,25 +180,23 @@ private void OnTimer(Object sender = null, EventArgs e = null) if (count++ > 13) { - PluginCore.Managers.TraceManager.Add(Resources.LocaleHelper.GetString("Error.StartingCOLTTimedOut"), -1); + TraceManager.Add(LocaleHelper.GetString("Error.StartingCOLTTimedOut"), -1); return; } timer.Start(); } - private Boolean COLTIsRunning() + bool COLTIsRunning() { try { - client.Invoke("ping", new Object[] { }); + client.Invoke("ping"); return true; } - catch (Exception) { } - return false; } } diff --git a/ColtPlugin/Settings.cs b/ColtPlugin/Settings.cs index d83b9ad..99b1160 100644 --- a/ColtPlugin/Settings.cs +++ b/ColtPlugin/Settings.cs @@ -1,76 +1,46 @@ using System; using System.ComponentModel; -using System.Collections.Generic; -using System.Windows.Forms; -using System.Text; namespace ColtPlugin { [Serializable] public class Settings { - public String SecurityToken; - - private String coltExe = null; - private String workingFolder = "colt"; - private Boolean autorun = true; - private Boolean fullConfig = false; - private Boolean interceptBuilds = false; + public string SecurityToken; /// /// Get and sets colt.exe path /// [DisplayName("Path to COLT")] [Description("Path to COLT executable.")] - public String Executable - { - get { return this.coltExe; } - set { this.coltExe = value; } - } + public string Executable { get; set; } /// /// Get and sets colt folder /// [DisplayName("COLT Working Folder")] [Description("Path to COLT working folder."), DefaultValue("colt")] - public String WorkingFolder - { - get { return this.workingFolder; } - set { this.workingFolder = value; } - } + public string WorkingFolder { get; set; } /// /// Get and sets full autorun flag /// [DisplayName("Automatically run COLT project")] [Description("Automatically compile and run COLT project after opening it in COLT."), DefaultValue(true)] - public Boolean AutoRun - { - get { return this.autorun; } - set { this.autorun = value; } - } + public bool AutoRun { get; set; } /// /// Get and sets full config flag /// [DisplayName("Load Full FD Configuration")] [Description("Attempt to load full FD configuration in COLT. FD project must be built at least once first."), DefaultValue(false)] - public Boolean FullConfig - { - get { return this.fullConfig; } - set { this.fullConfig = value; } - } + public bool FullConfig { get; set; } /// /// Get and sets production builds flag /// [DisplayName("Use COLT for FD builds")] [Description("Use COLT fast compiler to build your FD projects."), DefaultValue(false)] - public Boolean InterceptBuilds - { - get { return this.interceptBuilds; } - set { this.interceptBuilds = value; } - } + public bool InterceptBuilds { get; set; } } - -} +} \ No newline at end of file From 84bdd3362222d25d8d42ff1e2580845a94f3ba3d Mon Sep 17 00:00:00 2001 From: SlavaRa Date: Thu, 30 Apr 2015 19:50:10 +0300 Subject: [PATCH 2/2] Fix typo... --- ColtPlugin/Settings.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ColtPlugin/Settings.cs b/ColtPlugin/Settings.cs index 99b1160..7f59821 100644 --- a/ColtPlugin/Settings.cs +++ b/ColtPlugin/Settings.cs @@ -7,6 +7,8 @@ namespace ColtPlugin public class Settings { public string SecurityToken; + private bool autorun = true; + private string workingFolder = "colt"; /// /// Get and sets colt.exe path @@ -14,20 +16,28 @@ public class Settings [DisplayName("Path to COLT")] [Description("Path to COLT executable.")] public string Executable { get; set; } - + /// /// Get and sets colt folder /// [DisplayName("COLT Working Folder")] [Description("Path to COLT working folder."), DefaultValue("colt")] - public string WorkingFolder { get; set; } + public string WorkingFolder + { + get { return workingFolder; } + set { workingFolder = value; } + } /// /// Get and sets full autorun flag /// [DisplayName("Automatically run COLT project")] [Description("Automatically compile and run COLT project after opening it in COLT."), DefaultValue(true)] - public bool AutoRun { get; set; } + public bool AutoRun + { + get { return autorun; } + set { autorun = value; } + } /// /// Get and sets full config flag