private void ReadWebConfig() { /* * web.config is located in the current directory unless an * ApplicationStorage value has been set by a plugin that * determines the root of the current web app (e.g. Cassini). */ ApplicationStorage appStore = ApplicationStorage.GetInstance(); string webConfigDir = appStore[Constants.APP_STORE_KEY_WEB_APP_ROOT] as string; if (webConfigDir == null) { webConfigDir = Directory.GetCurrentDirectory(); } string webConfig = Path.Combine( webConfigDir, Constants.WEB_CONFIG_FILENAME); /* * Reset the config namespace list before we check for the file. * If there is no file the list should be empty. */ configNamespaceList.Clear(); if (!File.Exists(webConfig)) { return; } _webConfigTagNamespaces.Clear(); _webConfigConnectionStrings.Clear(); _webConfigAppSettings.Clear(); /* * This looks for the parent elements it needs and assumes * that the 'assemblies', 'controls' and 'namespaces' nodes * only appear as children in the sections we are interested * in. */ XmlTextReader rdr = null; try { rdr = new XmlTextReader(webConfig); bool readAssemblies = false; bool readControls = false; bool readNamespaces = false; bool readConnectionStrings = false; bool readAppSettings = false; while (rdr.Read()) { if (rdr.NodeType == System.Xml.XmlNodeType.Element) { switch (rdr.Name) { case "assemblies": readAssemblies = true; break; case "controls": readControls = true; break; case "namespaces": readNamespaces = true; break; case "connectionStrings": readConnectionStrings = true; break; case "appSettings": readAppSettings = true; break; case "add": if (readAssemblies) { /* * Update the assembly list. */ string a = rdr.GetAttribute("assembly"); if (a != null) { a = a.ToLower(); if (!workspaceAssemblyList.Contains(a)) { workspaceAssemblyList.Add(a); } } } else if (readControls) { /* * Update the controls list. */ string tp = rdr.GetAttribute("tagPrefix"); string ns = rdr.GetAttribute("namespace"); if (tp != null && ns != null) { _webConfigTagNamespaces.Add( new TagNamespace(tp, ns)); } } else if (readNamespaces) { configNamespaceList.Add(rdr.GetAttribute("namespace")); } else if (readConnectionStrings) { _webConfigConnectionStrings.Add(rdr.GetAttribute("name")); } else if (readAppSettings) { _webConfigAppSettings.Add(rdr.GetAttribute("key")); } break; /* * As we're only scanning the application level config * we can ignore the clear and remove tags. */ } } else if (rdr.NodeType == System.Xml.XmlNodeType.EndElement) { switch (rdr.Name) { case "assemblies": readAssemblies = false; break; case "controls": readControls = false; break; case "namespaces": readNamespaces = false; break; case "connectionStrings": readConnectionStrings = false; break; case "appSettings": readAppSettings = false; break; } } } } catch { // Give up! } finally { if (rdr != null) { rdr.Close(); } } }
public void OnClosing(EventArgs e) { SendMailParameters smp = this.CollectInfo(); ApplicationStorage.SaveObject(StorageFileName, smp); }
protected override void OnSleep() => ApplicationStorage.EnsureFlushed();
private void ActivatePlugin() { ModuleProxy.GetInstance().Module = this; _applicationManager = ApplicationManager.GetInstance(); _pluginManager = PluginManager.GetInstance(); _sqlConnectionManager = SqlConnectionManager.GetInstance(); _sqlConnectionManager.Load(); /* * Enable SqlMetal/DMBL extract features if client flag set. */ bool enableSqlMetal = _applicationManager.ClientProfile.HaveFlag( ClientFlags.SqlManagerEnableDbmlExtract); _output = _applicationManager.GetDockedForm( QuickSharp.Output.Constants.DOCKED_FORM_KEY) as OutputForm; _toolsMenuRunQuery = MenuTools.CreateMenuItem( Constants.UI_TOOLS_MENU_RUN_QUERY, Resources.MainToolsMenuRunQuery, Resources.RunQuery, Keys.F5, null, UI_TOOLBAR_RUN_SQL_QUERY_Click, true); ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName( QuickSharp.Core.Constants.UI_TOOLS_MENU); int index = toolsMenu.DropDownItems.IndexOfKey( QuickSharp.Core.Constants.UI_TOOLS_MENU_OPTIONS); /* * If menu not found insert at the top. */ if (index == -1) { index = 0; } toolsMenu.DropDownItems.Insert(index, _toolsMenuRunQuery); /* * Create toolbar buttons. */ _toolbarSqlConnection = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SQL_CONNECTION, Resources.ToolbarSqlConnection, Resources.SqlConnection, UI_TOOLBAR_SQL_CONNECTION_Click, true); _toolbarSqlConnection.ToolTipText = Resources.ToolbarActivateConnection; _toolbarSqlConnectionSelect = MenuTools.CreateToolbarDropDownButton( Constants.UI_TOOLBAR_SQL_CONNECTION_SELECT, null); _toolbarSqlConnectionSelect.DropDownOpening += new EventHandler( ToolbarSqlConnectionSelect_DropDownOpening); _toolbarSqlRunQuery = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SQL_RUN_QUERY, Resources.ToolbarSqlRunQuery, Resources.RunQuery, UI_TOOLBAR_RUN_SQL_QUERY_Click); _toolbarSqlExtractDbml = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SQL_EXTRACT_DBML, Resources.ToolbarSqlExtractDbml, Resources.ExtractDbml, UI_TOOLBAR_SQL_EXTRACT_DBML_Click); _mainForm.MainToolbar.Items.Add(_toolbarSqlConnection); _mainForm.MainToolbar.Items.Add(_toolbarSqlConnectionSelect); _mainForm.MainToolbar.Items.Add(_toolbarSqlRunQuery); if (enableSqlMetal) { _mainForm.MainToolbar.Items.Add(_toolbarSqlExtractDbml); } _mainForm.FormClosing += new FormClosingEventHandler(MainForm_FormClosing); _mainForm.ClientWindow.ActiveDocumentChanged += new EventHandler(ClientWindow_ActiveDocumentChanged); _applicationManager.RegisterOptionsPageFactory( delegate { return(new SqlConnectionsOptionsPage()); }); if (enableSqlMetal) { _applicationManager.RegisterOptionsPageFactory( delegate { return(new SqlMetalOptionsPage()); }); } _applicationManager.FileSystemChange += new MessageHandler(UpdateUI); /* * We don't have any build tools but we want SQL files * recognised as source files. Register with the * non-tool source files list in the application store. */ ApplicationStorage appStore = ApplicationStorage.GetInstance(); /* * We have no dependency on the BuildTools plugin so we * can't assume the non-tool source list has been created. * Use the Get method to create the list if it doesn't exist. */ List <String> nonToolSourceTypes = appStore.Get( Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES, typeof(List <String>)) as List <String>; if (nonToolSourceTypes != null) { nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_SQL); } UpdateUI(); }
public static bool OnInvalidate(object sender, string path) { return(ApplicationStorage.InvalidateByPath(path)); }
public static bool OnInvalidate(object sender, Node node) { return(ApplicationStorage.InvalidateByNode(node)); }
private void ActivatePlugin() { /* * Register the document types. */ DocumentManager documentManager = DocumentManager.GetInstance(); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASAX, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASCX, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASHX, Constants.SCINTILLA_LANGUAGE_CS); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASMX, Constants.SCINTILLA_LANGUAGE_CS); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_ASPX, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_MASTER, Constants.SCINTILLA_LANGUAGE_ASPX); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_CONFIG, Constants.SCINTILLA_LANGUAGE_XML); documentManager.RegisterDocumentLanguage( Constants.DOCUMENT_TYPE_SITEMAP, Constants.SCINTILLA_LANGUAGE_XML); /* * Define the document handlers. */ ApplicationManager applicationManager = ApplicationManager.GetInstance(); OpenDocumentHandler openHandler = applicationManager.GetOpenDocumentHandler( QuickSharp.TextEditor.Constants.DOCUMENT_TYPE_TXT); if (openHandler != null) { applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASAX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASCX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASHX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASMX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_ASPX, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_MASTER, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_CONFIG, openHandler); applicationManager.RegisterOpenDocumentHandler( Constants.DOCUMENT_TYPE_SITEMAP, openHandler); } /* * We don't have any build tools but we want ASP.NET files * recognised as source files. Register with the * non-tool source files list in the application store. */ ApplicationStorage appStore = ApplicationStorage.GetInstance(); /* * We have no dependency on the BuildTools plugin so we * can't assume the non-tool source list has been created. * Use the Get method to create the list if it doesn't exist. */ List <String> nonToolSourceTypes = appStore.Get( Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES, typeof(List <String>)) as List <String>; if (nonToolSourceTypes != null) { nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASAX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASCX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASHX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASMX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASPX); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_CONFIG); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_MASTER); nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_SITEMAP); } }
private void ActivatePlugin() { ModuleProxy.GetInstance().Module = this; _applicationManager = ApplicationManager.GetInstance(); _applicationStorage = ApplicationStorage.GetInstance(); _applicationManager.RegisterOptionsPageFactory( delegate { return(new BuildToolOptionsPage()); }); if (!_applicationManager.ClientProfile.HaveFlag( ClientFlags.BuildToolsDisableBuildSettingsPage)) { _applicationManager.RegisterOptionsPageFactory( delegate { return(new BuildSettingsOptionsPage()); }); } _applicationManager.DocumentFilterHandlers.Add( GetSourceFilesFilter); #region UI Elements bool disableCompilerUI = _applicationManager.ClientProfile. HaveFlag(ClientFlags.BuildToolsDisableCompilerUI); _output = _applicationManager.GetDockedForm( QuickSharp.Output.Constants.DOCKED_FORM_KEY) as OutputForm; /* Menu items */ _toolsMenuCompile = MenuTools.CreateMenuItem( Constants.UI_TOOLS_MENU_COMPILE, Resources.MainToolsMenuCompile, Resources.Compile, Keys.Shift | Keys.F5, null, UI_TOOLS_MENU_COMPILE_Click); _toolsMenuCompileAll = MenuTools.CreateMenuItem( Constants.UI_TOOLS_MENU_COMPILE_ALL, Resources.MainToolsMenuCompileAll, null, Keys.F6, null, UI_TOOLS_MENU_COMPILE_ALL_Click, true); _toolsMenuRun = MenuTools.CreateMenuItem( Constants.UI_TOOLS_MENU_RUN, Resources.MainToolsMenuRun, Resources.Run, Keys.Control | Keys.F5, null, UI_TOOLS_MENU_RUN_Click); if (disableCompilerUI) { _toolsMenuRun.Tag = new ToolStripItemTag { IncludeSeparator = true } } ; ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName( QuickSharp.Core.Constants.UI_TOOLS_MENU); if (!disableCompilerUI) { toolsMenu.DropDownItems.Insert(0, _toolsMenuCompileAll); toolsMenu.DropDownItems.Insert(0, _toolsMenuCompile); } toolsMenu.DropDownItems.Insert(0, _toolsMenuRun); toolsMenu.DropDownOpening += new EventHandler(ToolsMenu_DropDownOpening); /* Toolbar */ _toolbarCompile = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_COMPILE, Resources.ToolbarCompile, Resources.Compile, UI_TOOLBAR_COMPILE_Click, true); _toolbarCompile.Enabled = false; _toolbarCompileSelect = MenuTools.CreateToolbarDropDownButton( Constants.UI_TOOLBAR_COMPILE_SELECT, UI_TOOLBAR_COMPILE_SELECT_Click); _toolbarCompileSelect.Enabled = false; _toolbarCompileSelect.DropDownOpening += new EventHandler(ToolbarCompileSelect_DropDownOpening); _toolbarRun = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_RUN, Resources.ToolbarRun, Resources.Run, UI_TOOLBAR_RUN_Click); if (disableCompilerUI) { _toolbarRun.Tag = new ToolStripItemTag { IncludeSeparator = true } } ; _toolbarRun.Enabled = false; _toolbarRunSelect = MenuTools.CreateToolbarDropDownButton( Constants.UI_TOOLBAR_RUN_SELECT, UI_TOOLBAR_RUN_SELECT_Click); _toolbarRunSelect.Enabled = false; _toolbarRunSelect.DropDownOpening += new EventHandler(ToolbarRunSelect_DropDownOpening); _toolbarPin = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_PIN, Resources.ToolbarPinFile, Resources.Pin, UI_TOOLBAR_PIN_Click, true); _toolbarPin.Enabled = false; _toolbarPinSelect = MenuTools.CreateToolbarDropDownButton( Constants.UI_TOOLBAR_PIN_SELECT, UI_TOOLBAR_PIN_SELECT_Click); _toolbarPinSelect.Enabled = false; if (!disableCompilerUI) { _mainForm.MainToolbar.Items.Add(_toolbarCompile); _mainForm.MainToolbar.Items.Add(_toolbarCompileSelect); } _mainForm.MainToolbar.Items.Add(_toolbarRun); _mainForm.MainToolbar.Items.Add(_toolbarRunSelect); _mainForm.MainToolbar.Items.Add(_toolbarPin); _mainForm.MainToolbar.Items.Add(_toolbarPinSelect); #endregion _mainForm.ClientWindow.ActiveDocumentChanged += new EventHandler(MainForm_ActiveDocumentChanged); _buildToolManager = BuildToolManager.GetInstance(); _buildToolManager.LoadSettings(); _buildToolManager.LoadTools(); _buildToolManager.BuildTools.SortTools(); _buildToolManager.LoadPinnedFiles(); _mainForm.FormClosed += new FormClosedEventHandler(MainForm_FormClosed); _applicationManager.FileSystemChange += new MessageHandler(UpdatePinFileStatus); PluginManager.GetInstance().PluginPostActivate += new MessageHandler(PostActivationHandler); }