diff --git a/.gitignore b/.gitignore
index 15cb0b0..81c9bef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -192,3 +192,10 @@ ModelManifest.xml
/.vs/slnx.sqlite
/.vs
/publish/Application Files/ScriptHelp_3_0_0_2/ApiHelp.shfbproj.deploy
+/CS/.vs/ScriptHelp/v15/Server/sqlite3
+/CS/packages/log4net.2.0.8/lib
+/CS/packages/log4net.2.0.8
+/CS/.vs/ScriptHelp/DesignTimeBuild
+/CS/.vs/ScriptHelp/v16/Server/sqlite3
+/VB/.vs/ScriptHelp/v16/Server/sqlite3
+/VB/packages/log4net.2.0.8
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..eb83f1b
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at anthonyduguid@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..9f1ab7b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,92 @@
+# Contributing
+
+When contributing to this repository, please first discuss the change you wish to make via issue,
+email, or any other method with the owners of this repository before making a change.
+
+Please note we have a code of conduct, please follow it in all your interactions with the project.
+
+## Pull Request Process
+
+1. Ensure any install or build dependencies are removed before the end of the layer when doing a
+ build.
+2. Update the README.md with details of changes to the interface, this includes new environment
+ variables, exposed ports, useful file locations and container parameters.
+3. Increase the version numbers in any examples files and the README.md to the new version that this
+ Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
+4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
+ do not have permission to do that, you may request the second reviewer to merge it for you.
+
+## Code of Conduct
+
+### Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+### Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+### Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+### Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+### Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+### Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/CS/.editorconfig b/CS/.editorconfig
new file mode 100644
index 0000000..8f0432e
--- /dev/null
+++ b/CS/.editorconfig
@@ -0,0 +1,4 @@
+[*.cs]
+
+# CS1591: Missing XML comment for publicly visible type or member
+dotnet_diagnostic.CS1591.severity = none
diff --git a/CS/.vs/ScriptHelp/project-colors.json b/CS/.vs/ScriptHelp/project-colors.json
new file mode 100644
index 0000000..520ff91
--- /dev/null
+++ b/CS/.vs/ScriptHelp/project-colors.json
@@ -0,0 +1,11 @@
+{
+ "Version": 1,
+ "ProjectMap": {
+ "2d2477a6-dc2f-4d3e-ae1b-8392c7ab56e4": {
+ "ProjectGuid": "2d2477a6-dc2f-4d3e-ae1b-8392c7ab56e4",
+ "DisplayName": "ScriptHelp",
+ "ColorIndex": 0
+ }
+ },
+ "NextColorIndex": 1
+}
\ No newline at end of file
diff --git a/CS/App_Data/ScriptHelp.sdf b/CS/App_Data/ScriptHelp.sdf
index 95a583b..b29a0b3 100644
Binary files a/CS/App_Data/ScriptHelp.sdf and b/CS/App_Data/ScriptHelp.sdf differ
diff --git a/CS/App_Data/[MS-CUSTOMUI]-170919.docx b/CS/App_Data/[MS-CUSTOMUI]-170919.docx
new file mode 100644
index 0000000..0c23190
Binary files /dev/null and b/CS/App_Data/[MS-CUSTOMUI]-170919.docx differ
diff --git a/CS/Properties/AssemblyInfo.cs b/CS/Properties/AssemblyInfo.cs
index a435ec8..175e950 100644
--- a/CS/Properties/AssemblyInfo.cs
+++ b/CS/Properties/AssemblyInfo.cs
@@ -33,6 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("3.0.0.0")]
-[assembly: AssemblyFileVersion("3.0.0.0")]
+[assembly: AssemblyVersion("4.0.0.1")]
+[assembly: AssemblyFileVersion("4.0.0.1")]
diff --git a/CS/Properties/Resources.Designer.cs b/CS/Properties/Resources.Designer.cs
index 5ac767d..a02010c 100644
--- a/CS/Properties/Resources.Designer.cs
+++ b/CS/Properties/Resources.Designer.cs
@@ -19,7 +19,7 @@ namespace ScriptHelp.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -60,6 +60,16 @@ internal Resources() {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap camera {
+ get {
+ object obj = ResourceManager.GetObject("camera", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -100,6 +110,16 @@ internal static System.Drawing.Bitmap Play {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap problem_steps_recorder {
+ get {
+ object obj = ResourceManager.GetObject("problem_steps_recorder", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -110,6 +130,26 @@ internal static System.Drawing.Bitmap Save {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap SaveCode {
+ get {
+ object obj = ResourceManager.GetObject("SaveCode", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap SaveVersion {
+ get {
+ object obj = ResourceManager.GetObject("SaveVersion", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -123,9 +163,19 @@ internal static System.Drawing.Bitmap ScriptTypeDql {
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
- internal static System.Drawing.Bitmap ScriptTypeGitHub {
+ internal static System.Drawing.Bitmap ScriptTypeMarkdown {
+ get {
+ object obj = ResourceManager.GetObject("ScriptTypeMarkdown", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap ScriptTypeMarkup {
get {
- object obj = ResourceManager.GetObject("ScriptTypeGitHub", resourceCulture);
+ object obj = ResourceManager.GetObject("ScriptTypeMarkup", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
@@ -153,9 +203,9 @@ internal static System.Drawing.Bitmap ScriptTypeTSql {
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
- internal static System.Drawing.Bitmap ScriptTypeXML {
+ internal static System.Drawing.Bitmap snipping_tool {
get {
- object obj = ResourceManager.GetObject("ScriptTypeXML", resourceCulture);
+ object obj = ResourceManager.GetObject("snipping_tool", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
diff --git a/CS/Properties/Resources.resx b/CS/Properties/Resources.resx
index cee54c5..0c16523 100644
--- a/CS/Properties/Resources.resx
+++ b/CS/Properties/Resources.resx
@@ -139,16 +139,31 @@
..\Resources\ScriptTypeDql.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\ScriptTypeGitHub.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\ScriptTypePlSql.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a..\Resources\ScriptTypeTSql.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\ScriptTypeXML.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\problem_steps_recorder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\snipping_tool.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\ScriptTypeMarkdown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\ScriptTypeMarkup.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\SaveCode.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\SaveVersion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\camera.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
\ No newline at end of file
diff --git a/CS/Properties/Settings.Designer.cs b/CS/Properties/Settings.Designer.cs
index fa638af..3efa184 100644
--- a/CS/Properties/Settings.Designer.cs
+++ b/CS/Properties/Settings.Designer.cs
@@ -12,7 +12,7 @@ namespace ScriptHelp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -71,24 +71,24 @@ public int Column_TypeDate {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("dd-mmm-yyyy")]
- public string Table_ColumnDateFormatReplace {
+ public string Table_ColumnFormatDate {
get {
- return ((string)(this["Table_ColumnDateFormatReplace"]));
+ return ((string)(this["Table_ColumnFormatDate"]));
}
set {
- this["Table_ColumnDateFormatReplace"] = value;
+ this["Table_ColumnFormatDate"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("mm:ss.0")]
- public string Table_ColumnDateFormatFind {
+ [global::System.Configuration.DefaultSettingValueAttribute("h:mm:ss AM/PM")]
+ public string Table_ColumnFormatTime {
get {
- return ((string)(this["Table_ColumnDateFormatFind"]));
+ return ((string)(this["Table_ColumnFormatTime"]));
}
set {
- this["Table_ColumnDateFormatFind"] = value;
+ this["Table_ColumnFormatTime"] = value;
}
}
@@ -142,31 +142,7 @@ public int Column_TypeText {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_grpScriptVariables {
- get {
- return ((bool)(this["Visible_grpScriptVariables"]));
- }
- set {
- this["Visible_grpScriptVariables"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_grpFormatDataTable {
- get {
- return ((bool)(this["Visible_grpFormatDataTable"]));
- }
- set {
- this["Visible_grpFormatDataTable"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Visible_grpClipboard {
get {
return ((bool)(this["Visible_grpClipboard"]));
@@ -176,78 +152,6 @@ public bool Visible_grpClipboard {
}
}
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_btnClearInteriorColor {
- get {
- return ((bool)(this["Visible_btnClearInteriorColor"]));
- }
- set {
- this["Visible_btnClearInteriorColor"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_btnZeroToNull {
- get {
- return ((bool)(this["Visible_btnZeroToNull"]));
- }
- set {
- this["Visible_btnZeroToNull"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("C:\\Temp")]
- public string Option_PathFileListing {
- get {
- return ((string)(this["Option_PathFileListing"]));
- }
- set {
- this["Option_PathFileListing"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_btnFileList {
- get {
- return ((bool)(this["Visible_btnFileList"]));
- }
- set {
- this["Visible_btnFileList"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Option_PathFileListingSelect {
- get {
- return ((bool)(this["Option_PathFileListingSelect"]));
- }
- set {
- this["Option_PathFileListingSelect"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_mnuScriptType {
- get {
- return ((bool)(this["Visible_mnuScriptType"]));
- }
- set {
- this["Visible_mnuScriptType"] = value;
- }
- }
-
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("SCRIPT")]
@@ -262,19 +166,7 @@ public string Table_ColumnName {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_btnSeparateValues {
- get {
- return ((bool)(this["Visible_btnSeparateValues"]));
- }
- set {
- this["Visible_btnSeparateValues"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute(",")]
+ [global::System.Configuration.DefaultSettingValueAttribute(";")]
public char Table_ColumnSeparateValuesDelimiter {
get {
return ((char)(this["Table_ColumnSeparateValuesDelimiter"]));
@@ -286,7 +178,7 @@ public char Table_ColumnSeparateValuesDelimiter {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("https://raw.githubusercontent.com/aduguid/ScriptHelp/master/publish/")]
+ [global::System.Configuration.DefaultSettingValueAttribute("https://raw.githubusercontent.com/Excel-projects/Script-Help/master/publish/")]
public string App_PathDeploy {
get {
return ((string)(this["App_PathDeploy"]));
@@ -347,30 +239,30 @@ public bool Visible_mnuScriptType_PLSQL {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_mnuScriptType_Github {
+ public bool Visible_mnuScriptType_Markdown {
get {
- return ((bool)(this["Visible_mnuScriptType_Github"]));
+ return ((bool)(this["Visible_mnuScriptType_Markdown"]));
}
set {
- this["Visible_mnuScriptType_Github"] = value;
+ this["Visible_mnuScriptType_Markdown"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
- public bool Visible_mnuScriptType_XML {
+ public bool Visible_mnuScriptType_Markup {
get {
- return ((bool)(this["Visible_mnuScriptType_XML"]));
+ return ((bool)(this["Visible_mnuScriptType_Markup"]));
}
set {
- this["Visible_mnuScriptType_XML"] = value;
+ this["Visible_mnuScriptType_Markup"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/aduguid/ScriptHelp/blob/master/README.md")]
+ [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Excel-projects/Script-Help/blob/master/README.md")]
public string App_PathReadMe {
get {
return ((string)(this["App_PathReadMe"]));
@@ -406,7 +298,7 @@ public string Table_StyleName {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("07/31/2017 13:05:00")]
+ [global::System.Configuration.DefaultSettingValueAttribute("01/31/2021 13:05:00")]
public global::System.DateTime App_ReleaseDate {
get {
return ((global::System.DateTime)(this["App_ReleaseDate"]));
@@ -418,13 +310,37 @@ public string Table_StyleName {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/aduguid/ScriptHelp/issues/new")]
- public string App_PathReportIssue {
+ [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Excel-projects/Script-Help/issues/new")]
+ public string App_PathNewIssue {
+ get {
+ return ((string)(this["App_PathNewIssue"]));
+ }
+ set {
+ this["App_PathNewIssue"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool Visible_grpAnnotation {
+ get {
+ return ((bool)(this["Visible_grpAnnotation"]));
+ }
+ set {
+ this["Visible_grpAnnotation"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("mm:ss.0")]
+ public string Table_ColumnFormatDatePaste {
get {
- return ((string)(this["App_PathReportIssue"]));
+ return ((string)(this["Table_ColumnFormatDatePaste"]));
}
set {
- this["App_PathReportIssue"] = value;
+ this["Table_ColumnFormatDatePaste"] = value;
}
}
}
diff --git a/CS/Properties/Settings.settings b/CS/Properties/Settings.settings
index e26e2fb..a9cedde 100644
--- a/CS/Properties/Settings.settings
+++ b/CS/Properties/Settings.settings
@@ -14,11 +14,11 @@
2
-
+ dd-mmm-yyyy
-
- mm:ss.0
+
+ h:mm:ss AM/PMNULL
@@ -32,44 +32,17 @@
0
-
- True
-
-
- True
-
- True
-
-
- True
-
-
- True
-
-
- C:\Temp
-
-
- True
-
-
- True
-
-
- True
+ FalseSCRIPT
-
- True
-
- ,
+ ;
- https://raw.githubusercontent.com/aduguid/ScriptHelp/master/publish/
+ https://raw.githubusercontent.com/Excel-projects/Script-Help/master/publish/
@@ -83,14 +56,14 @@
True
-
+ True
-
+ True
- https://github.com/aduguid/ScriptHelp/blob/master/README.md
+ https://github.com/Excel-projects/Script-Help/blob/master/README.md
@@ -99,10 +72,16 @@
TableStyleMedium15
- 07/31/2017 13:05:00
+ 01/31/2021 13:05:00
+
+
+ https://github.com/Excel-projects/Script-Help/issues/new
-
- https://github.com/aduguid/ScriptHelp/issues/new
+
+ False
+
+
+ mm:ss.0
\ No newline at end of file
diff --git a/CS/Resources/SaveCode.png b/CS/Resources/SaveCode.png
new file mode 100644
index 0000000..36216d8
Binary files /dev/null and b/CS/Resources/SaveCode.png differ
diff --git a/CS/Resources/SaveVersion.png b/CS/Resources/SaveVersion.png
new file mode 100644
index 0000000..44c06dd
Binary files /dev/null and b/CS/Resources/SaveVersion.png differ
diff --git a/CS/Resources/ScriptTypeMarkdown.png b/CS/Resources/ScriptTypeMarkdown.png
new file mode 100644
index 0000000..80b5fdf
Binary files /dev/null and b/CS/Resources/ScriptTypeMarkdown.png differ
diff --git a/CS/Resources/ScriptTypeMarkup.png b/CS/Resources/ScriptTypeMarkup.png
new file mode 100644
index 0000000..c54737c
Binary files /dev/null and b/CS/Resources/ScriptTypeMarkup.png differ
diff --git a/CS/Resources/camera.png b/CS/Resources/camera.png
new file mode 100644
index 0000000..8536d1a
Binary files /dev/null and b/CS/Resources/camera.png differ
diff --git a/CS/Resources/problem_steps_recorder.png b/CS/Resources/problem_steps_recorder.png
new file mode 100644
index 0000000..66a2d19
Binary files /dev/null and b/CS/Resources/problem_steps_recorder.png differ
diff --git a/CS/Resources/snipping_tool.png b/CS/Resources/snipping_tool.png
new file mode 100644
index 0000000..133f0e0
Binary files /dev/null and b/CS/Resources/snipping_tool.png differ
diff --git a/CS/Ribbon.xml b/CS/Ribbon.xml
index 00c7ee5..56723ac 100644
--- a/CS/Ribbon.xml
+++ b/CS/Ribbon.xml
@@ -1,520 +1,709 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CS/ScriptHelp.csproj b/CS/ScriptHelp.csproj
index 76b0d8e..9bd3fb3 100644
--- a/CS/ScriptHelp.csproj
+++ b/CS/ScriptHelp.csproj
@@ -27,9 +27,9 @@
falseScriptHelpScriptHelp
- v4.6
+ v4.8VSTO40
- True
+ FalseSAKSAKSAK
@@ -42,19 +42,19 @@
12.0truetrue
- publish\
- https://raw.githubusercontent.com/aduguid/ScriptHelp/master/publish/
+ \\melfile01\infotech%24\Analytics\Apps\ExcelScriptHelp\
+ en
- 3.0.0.0
+ 4.0.0.8falsetrue0daysExcel Addin Script HelpAnthony Duguid
-
+ https://github.com/Excel-projects/Script-HelpExcel Addin Script Help
-
+ This Add-In is used for cleaning & creating a script for batch loading records into SQL Server, Oracle, Documentum, Markup or Markdown Languages. The functionality within the ribbon allows a quick way of preparing a bulk data load. Otherwise, the requests can be both time-consuming and error prone.3
@@ -71,23 +71,13 @@
False.NET Framework 3.5 SP1
- true
-
-
- False
- Microsoft Office 2007 Primary Interop Assemblies
- true
+ falseFalseMicrosoft Visual Studio 2010 Tools for Office Runtime %28x86 and x64%29true
-
- False
- Windows Installer 3.1
- true
-
-
- packages\log4net.2.0.8\lib\net45-full\log4net.dll
+
+ packages\log4net.2.0.14\lib\net45\log4net.dllTrue
@@ -174,12 +165,14 @@
True
+ True
+
@@ -264,10 +257,12 @@
GraphData.cs
+ DesignerTableData.cs
+
@@ -277,6 +272,13 @@
+
+
+
+
+
+
+ Always
@@ -384,9 +386,9 @@
-
+
-
+
diff --git a/CS/ScriptHelp.sln b/CS/ScriptHelp.sln
index 41f3b5f..8bdaa48 100644
--- a/CS/ScriptHelp.sln
+++ b/CS/ScriptHelp.sln
@@ -1,10 +1,15 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptHelp", "ScriptHelp.csproj", "{2D2477A6-DC2F-4D3E-AE1B-8392C7AB56E4}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1F66CFCD-87EC-41DC-A5AF-CAD232010A15}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -19,4 +24,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {9EB2C0FB-C404-4A05-ABE0-C48B56139645}
+ EndGlobalSection
EndGlobal
diff --git a/CS/Scripts/AssemblyInfo.cs b/CS/Scripts/AssemblyInfo.cs
index 3c50519..338d83b 100644
--- a/CS/Scripts/AssemblyInfo.cs
+++ b/CS/Scripts/AssemblyInfo.cs
@@ -6,29 +6,12 @@
using System.Deployment.Application;
using Microsoft.Win32;
-//
-// This namespaces if for generic application classes
-//
namespace ScriptHelp.Scripts
{
- ///
- /// Used to get the assembly information
- ///
- ///
- /// http://danielsaidi.wordpress.com/2009/05/25/c-get-assembly-information/
- ///
public static class AssemblyInfo
{
- ///
- ///
- ///
public static string versionFolderNumber;
- ///
- /// Title
- ///
- ///
- ///
public static string Title
{
get
@@ -47,11 +30,6 @@ public static string Title
}
}
- ///
- /// Description
- ///
- ///
- ///
public static string Description
{
get
@@ -69,11 +47,6 @@ public static string Description
}
}
- ///
- /// Company
- ///
- ///
- ///
public static string Company
{
get
@@ -92,11 +65,6 @@ public static string Company
}
}
- ///
- /// Product
- ///
- ///
- ///
public static string Product
{
get
@@ -114,11 +82,6 @@ public static string Product
}
}
- ///
- /// Copyright
- ///
- ///
- ///
public static string Copyright
{
get
@@ -136,11 +99,6 @@ public static string Copyright
}
}
- ///
- /// Trademark
- ///
- ///
- ///
public static string Trademark
{
get
@@ -158,11 +116,6 @@ public static string Trademark
}
}
- ///
- /// AssemblyVersion
- ///
- ///
- ///
public static string AssemblyVersion
{
get
@@ -172,11 +125,6 @@ public static string AssemblyVersion
}
}
- ///
- /// FileVersion
- ///
- ///
- ///
public static string FileVersion
{
get
@@ -187,11 +135,6 @@ public static string FileVersion
}
}
- ///
- /// Guid
- ///
- ///
- ///
public static string Guid
{
get
@@ -209,11 +152,6 @@ public static string Guid
}
}
- ///
- /// FileName
- ///
- ///
- ///
public static string FileName
{
get
@@ -224,11 +162,6 @@ public static string FileName
}
}
- ///
- /// FilePath
- ///
- ///
- ///
public static string FilePath
{
get
@@ -239,11 +172,6 @@ public static string FilePath
}
}
- ///
- /// Return the current file name (used for error logging)
- ///
- /// A method that returns a string of the current file name
- ///
public static string GetCurrentFileName()
{
try
@@ -256,11 +184,6 @@ public static string GetCurrentFileName()
}
}
- ///
- /// Returns the ClickOnce location
- ///
- /// A method that returns a string of the current location
- ///
public static string GetClickOnceLocation()
{
try
@@ -278,11 +201,6 @@ public static string GetClickOnceLocation()
}
- ///
- /// Returns the assembly location
- ///
- /// A method that returns a string of the current location
- ///
public static string GetAssemblyLocation()
{
try
@@ -299,9 +217,6 @@ public static string GetAssemblyLocation()
}
- ///
- ///
- ///
public static void SetAssemblyFolderVersion()
{
try
@@ -325,13 +240,6 @@ public static void SetAssemblyFolderVersion()
}
}
- ///
- /// set the icon in add/remove programs
- ///
- /// The referenced icon name for the application.
- ///
- /// only run if deployed
- ///
public static void SetAddRemoveProgramsIcon(string iconName)
{
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed
@@ -376,11 +284,6 @@ public static void SetAddRemoveProgramsIcon(string iconName)
}
}
- ///
- /// Open a file as read only
- ///
- /// Represents the file path string
- ///
public static void OpenFile(string filePath)
{
try
diff --git a/CS/Scripts/Data.cs b/CS/Scripts/Data.cs
index 346e25a..fce35af 100644
--- a/CS/Scripts/Data.cs
+++ b/CS/Scripts/Data.cs
@@ -4,6 +4,7 @@
using System.Data.SqlServerCe;
using System.Linq;
using System.Security.AccessControl;
+using System.Windows.Forms;
namespace ScriptHelp.Scripts
{
@@ -12,10 +13,6 @@ class Data
const string dataFolder = "App_Data";
- ///
- /// Relative database connection string
- ///
- /// the data source of the database
public static string Connection()
{
Data.SetUserPath();
@@ -23,29 +20,19 @@ public static string Connection()
return databaseFile;
}
- ///
- /// List of common table alias
- ///
- public static DataTable TableAliasTable = new DataTable();
- ///
- /// List of date format strings
- ///
+ public static DataTable TableAliasTable = new DataTable();
public static DataTable DateFormatTable = new DataTable();
-
- ///
- /// List of graph data
- ///
+ public static DataTable TimeFormatTable = new DataTable();
public static DataTable GraphDataTable = new DataTable();
- ///
- /// Creates the datatable for the list of common table alias
- ///
public static void CreateTableAliasTable()
{
try
{
+ string tableName = "TableAlias";
string columnName = "TableName";
+ string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
dynamic dcTableName = new DataColumn(columnName, typeof(string));
TableAliasTable.Rows.Clear();
DataColumnCollection columns = TableAliasTable.Columns;
@@ -54,14 +41,12 @@ public static void CreateTableAliasTable()
TableAliasTable.Columns.Add(dcTableName);
}
- string tableName = "TableAlias";
- string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
-
using (var da = new SqlCeDataAdapter(sql, Connection()))
{
da.Fill(TableAliasTable);
}
TableAliasTable.DefaultView.Sort = columnName + " asc";
+ TableAliasTable.TableName = tableName;
}
catch (Exception ex)
@@ -72,14 +57,13 @@ public static void CreateTableAliasTable()
}
- ///
- /// Creates the datatable for the date format strings
- ///
public static void CreateDateFormatTable()
{
try
{
+ string tableName = "DateFormat";
string columnName = "FormatString";
+ string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
dynamic dcFormatString = new DataColumn(columnName, typeof(string));
DateFormatTable.Rows.Clear();
DataColumnCollection columns = DateFormatTable.Columns;
@@ -88,14 +72,43 @@ public static void CreateDateFormatTable()
DateFormatTable.Columns.Add(dcFormatString);
}
- string tableName = "DateFormat";
- string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
-
using (var da = new SqlCeDataAdapter(sql, Connection()))
{
da.Fill(DateFormatTable);
}
DateFormatTable.DefaultView.Sort = columnName + " asc";
+ DateFormatTable.TableName = tableName;
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+
+ }
+
+ }
+
+ public static void CreateTimeFormatTable()
+ {
+ try
+ {
+ string tableName = "TimeFormat";
+ string columnName = "FormatString";
+ string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
+ dynamic dcFormatString = new DataColumn(columnName, typeof(string));
+ TimeFormatTable.Rows.Clear();
+ DataColumnCollection columns = TimeFormatTable.Columns;
+ if (columns.Contains(columnName) == false)
+ {
+ TimeFormatTable.Columns.Add(dcFormatString);
+ }
+
+ using (var da = new SqlCeDataAdapter(sql, Connection()))
+ {
+ da.Fill(TimeFormatTable);
+ }
+ TimeFormatTable.DefaultView.Sort = columnName + " asc";
+ TimeFormatTable.TableName = tableName;
}
catch (Exception ex)
@@ -106,9 +119,6 @@ public static void CreateDateFormatTable()
}
- ///
- /// Creates the datatable for the graph data
- ///
public static void CreateGraphDataTable()
{
try
@@ -144,9 +154,6 @@ public static void CreateGraphDataTable()
}
- ///
- /// Sets the server path of the installed sql server ce database and supporting files
- ///
public static void SetServerPath()
{
try
@@ -166,9 +173,6 @@ public static void SetServerPath()
}
}
- ///
- /// Sets the user path of the installed sql server ce database and supporting files
- ///
public static void SetUserPath()
{
string userFilePath = string.Empty;
@@ -179,7 +183,6 @@ public static void SetUserPath()
string versionNumber = AssemblyInfo.versionFolderNumber;
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
userFilePath = Path.Combine(localAppData, AssemblyInfo.Copyright.Replace(" ", "_"), AssemblyInfo.Product, dataFolder);
- //if (!Directory.Exists(userFilePath)) Directory.CreateDirectory(userFilePath);
System.IO.Directory.CreateDirectory(userFilePath);
DirectoryInfo info = new DirectoryInfo(userFilePath);
DirectorySecurity security = info.GetAccessControl();
@@ -203,5 +206,46 @@ public static void SetUserPath()
}
+ public static void InsertRecord(DataTable tbl, string text)
+ {
+ string tableName = tbl.TableName.ToString();
+ string columnName = tbl.Columns[0].ColumnName.ToString();
+ string sql = "SELECT * FROM " + tableName + " ORDER BY " + columnName;
+ if (tbl.Select(columnName + " = '" + text.Replace("'", "''") + "'").Length == 0)
+ {
+ DialogResult dr = MessageBox.Show("Would you like to add '" + text + "' to the list?", "Add New Value", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
+ switch (dr)
+ {
+ case DialogResult.Yes:
+ tbl.Rows.Add(new Object[] { text });
+ SqlCeConnection cn = new SqlCeConnection(Data.Connection());
+ SqlCeCommandBuilder scb = default(SqlCeCommandBuilder);
+ SqlCeDataAdapter sda = new SqlCeDataAdapter(sql, cn);
+ sda.TableMappings.Add("Table", tableName);
+ scb = new SqlCeCommandBuilder(sda);
+ sda.Update(tbl);
+
+ dynamic dcFormatString = new DataColumn(columnName, typeof(string));
+ tbl.Rows.Clear();
+ DataColumnCollection columns = tbl.Columns;
+ if (columns.Contains(columnName) == false)
+ {
+ tbl.Columns.Add(dcFormatString);
+ }
+
+ using (var da = new SqlCeDataAdapter(sql, Connection()))
+ {
+ da.Fill(tbl);
+ }
+ tbl.DefaultView.Sort = columnName + " asc";
+
+ break;
+
+ case DialogResult.No:
+ break;
+ }
+ }
+ }
+
}
}
diff --git a/CS/Scripts/ErrorHandler.cs b/CS/Scripts/ErrorHandler.cs
index 02ec0bf..dda40fc 100644
--- a/CS/Scripts/ErrorHandler.cs
+++ b/CS/Scripts/ErrorHandler.cs
@@ -1,4 +1,7 @@
using System;
+using System.Linq;
+using System.Text;
+using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Excel = Microsoft.Office.Interop.Excel;
@@ -7,26 +10,18 @@
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
-//
-// This namespaces if for generic application classes
-//
namespace ScriptHelp.Scripts
{
- ///
- /// Used to handle exceptions
- ///
- public class ErrorHandler
+ public static class ErrorHandler
{
private static readonly ILog log = LogManager.GetLogger(typeof(ErrorHandler));
- ///
- /// Applies a new path for the log file by FileAppender name
- ///
public static void SetLogPath()
{
XmlConfigurator.Configure();
log4net.Repository.Hierarchy.Hierarchy h = (log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository();
string logFileName = System.IO.Path.Combine(Properties.Settings.Default.App_PathLocalData, AssemblyInfo.Product + ".log");
+
foreach (var a in h.Root.Appenders)
{
if (a is log4net.Appender.FileAppender)
@@ -41,17 +36,22 @@ public static void SetLogPath()
}
}
- ///
- /// Create a log record to track which methods are being used.
- ///
public static void CreateLogRecord()
{
try
{
- System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1);
- System.Reflection.MethodBase caller = sf.GetMethod();
- string currentProcedure = (caller.Name).Trim();
- log.Info("[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName);
+ var sf = new System.Diagnostics.StackFrame(1);
+ var caller = sf.GetMethod();
+ var currentProcedure = caller.Name.Trim();
+
+ var logMessage = string.Concat(new Dictionary
+ {
+ ["PROCEDURE"] = currentProcedure,
+ ["USER NAME"] = Environment.UserName,
+ ["MACHINE NAME"] = Environment.MachineName
+ }.Select(x => $"[{x.Key}]=|{x.Value}|"));
+ log.Info(logMessage);
+
}
catch (Exception ex)
{
@@ -60,41 +60,36 @@ public static void CreateLogRecord()
}
}
- ///
- /// Used to produce an error message and create a log record
- ///
- ///
- /// ErrorHandler.DisplayMessage(ex);
- ///
- ///
- ///
- /// Represents errors that occur during application execution.
- /// Used to show a message to the user and log an error record or just log a record.
- ///
public static void DisplayMessage(Exception ex, Boolean isSilent = false)
{
- System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(1);
- System.Reflection.MethodBase caller = sf.GetMethod();
- string currentProcedure = (caller.Name).Trim();
- string currentFileName = AssemblyInfo.GetCurrentFileName();
- string errorMessageDescription = ex.ToString();
- errorMessageDescription = System.Text.RegularExpressions.Regex.Replace(errorMessageDescription, @"\r\n+", " "); //the carriage returns were messing up my log file
- string msg = "Contact your system administrator. A record has been created in the log file." + Environment.NewLine;
- msg += "Procedure: " + currentProcedure + Environment.NewLine;
- msg += "Description: " + ex.ToString() + Environment.NewLine;
- log.Error("[PROCEDURE]=|" + currentProcedure + "|[USER NAME]=|" + Environment.UserName + "|[MACHINE NAME]=|" + Environment.MachineName + "|[FILE NAME]=|" + currentFileName + "|[DESCRIPTION]=|" + errorMessageDescription);
+ var sf = new System.Diagnostics.StackFrame(1);
+ var caller = sf.GetMethod();
+ var errorDescription = ex.ToString().Replace("\r\n", " ");
+ var currentProcedure = caller.Name.Trim();
+ var currentFileName = AssemblyInfo.GetCurrentFileName();
+
+ var logMessage = string.Concat(new Dictionary
+ {
+ ["PROCEDURE"] = currentProcedure,
+ ["USER NAME"] = Environment.UserName,
+ ["MACHINE NAME"] = Environment.MachineName,
+ ["FILE NAME"] = currentFileName,
+ ["DESCRIPTION"] = errorDescription,
+ }.Select(x => $"[{x.Key}]=|{x.Value}|"));
+ log.Error(logMessage);
+
+ var userMessage = new StringBuilder()
+ .AppendLine("Contact your system administrator. A record has been created in the log file.")
+ .AppendLine("Procedure: " + currentProcedure)
+ .AppendLine("Description: " + errorDescription)
+ .ToString();
+
if (isSilent == false)
{
- MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(userMessage, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
- ///
- /// Check to see if there is an active document
- ///
- /// To show a message
- /// A method that returns true or false if there is an active document
- ///
public static bool IsActiveDocument(bool showMsg = false)
{
try
@@ -103,7 +98,10 @@ public static bool IsActiveDocument(bool showMsg = false)
{
if (showMsg == true)
{
- MessageBox.Show("The command could not be completed. Please open a document and select a range.", AssemblyInfo.Description, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show("The command could not be completed. Please open a document and select a range."
+ , AssemblyInfo.Description
+ , MessageBoxButtons.OK
+ , MessageBoxIcon.Exclamation);
}
return false;
}
@@ -119,23 +117,20 @@ public static bool IsActiveDocument(bool showMsg = false)
}
}
- ///
- /// Check to see if there is an active selection
- ///
- /// To show a message
- /// A method that returns true or false if there is an active selection
- ///
public static bool IsActiveSelection(bool showMsg = false)
{
Excel.Range checkRange = null;
try
{
- checkRange = Globals.ThisAddIn.Application.Selection as Excel.Range; //must cast the selection as range or errors
+ checkRange = Globals.ThisAddIn.Application.Selection as Excel.Range;
if (null == checkRange)
{
if (showMsg == true)
{
- MessageBox.Show("The command could not be completed by using the range specified. Select a single cell within the range and try the command again. [Range]", AssemblyInfo.Description, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show("The command could not be completed by using the range specified. Select a single cell within the range and try the command again. [Range]"
+ , AssemblyInfo.Description
+ , MessageBoxButtons.OK
+ , MessageBoxIcon.Exclamation);
}
return false;
}
@@ -156,12 +151,6 @@ public static bool IsActiveSelection(bool showMsg = false)
}
}
- ///
- /// Check to see if there is an named range selected
- ///
- /// To show a message
- /// A method that returns true or false if there is a valid list object
- ///
public static bool IsValidListObject(bool showMsg = false)
{
Excel.ListObject tbl = null;
@@ -172,7 +161,10 @@ public static bool IsValidListObject(bool showMsg = false)
{
if (showMsg == true)
{
- MessageBox.Show("The command could not be completed by using the range specified. Select a single cell within the range and try the command again. [ListObject]", AssemblyInfo.Description, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ MessageBox.Show("The command could not be completed by using the range specified. Select a single cell within the range and try the command again. [ListObject]"
+ , AssemblyInfo.Description
+ , MessageBoxButtons.OK
+ , MessageBoxIcon.Exclamation);
}
return false;
}
@@ -192,13 +184,6 @@ public static bool IsValidListObject(bool showMsg = false)
}
}
- ///
- /// This method check whether Excel is in Cell Editing mode or not
- /// There are few ways to check this (eg. check to see if a standard menu item is disabled etc.)
- /// I know in cell editing mode app.DisplayAlerts throws an Exception, so here I'm relying on that behaviour
- ///
- /// To show a message
- /// true if Excel is in cell editing mode
private static bool IsInCellEditingMode(bool showMsg = false)
{
bool flag = false;
@@ -210,19 +195,15 @@ private static bool IsInCellEditingMode(bool showMsg = false)
{
if (showMsg == true)
{
- MessageBox.Show("The procedure can not run while you are editing a cell.", "No action taken.", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ MessageBox.Show("The procedure can not run while you are editing a cell.", "No action taken."
+ , MessageBoxButtons.OK
+ , MessageBoxIcon.Information);
}
flag = true;
}
return flag;
}
- ///
- /// Can an object be inserted
- ///
- /// To show a message
- /// A method that returns true or false if an object can be enabled
- ///
public static bool IsEnabled(bool showMsg = false)
{
try
@@ -257,12 +238,6 @@ public static bool IsEnabled(bool showMsg = false)
}
}
- ///
- /// Can an object be inserted
- ///
- /// To show a message
- /// A method that returns true or false if an object can be used
- ///
public static bool IsAvailable(bool showMsg = false)
{
try
@@ -290,12 +265,6 @@ public static bool IsAvailable(bool showMsg = false)
}
}
- ///
- /// Check if the object is a date
- ///
- /// Represents the cell value
- /// A method that returns true or false if there is a valid date
- ///
public static bool IsDate(object expression)
{
if (expression != null)
@@ -313,5 +282,19 @@ public static bool IsDate(object expression)
return false;
}
+ public static bool IsTime(object expression)
+ {
+ try
+ {
+ string timeValue = Convert.ToString(expression);
+ TimeSpan time1;
+ return TimeSpan.TryParse(timeValue, out time1);
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
}
}
\ No newline at end of file
diff --git a/CS/Scripts/Formula.cs b/CS/Scripts/Formula.cs
index d36d4d3..69f7d70 100644
--- a/CS/Scripts/Formula.cs
+++ b/CS/Scripts/Formula.cs
@@ -7,10 +7,10 @@ namespace ScriptHelp.Scripts
{
class Formula
{
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
+ static Formula()
+ {
+ }
+
public static void DqlAppend()
{
Excel.ListObject tbl = null;
@@ -18,6 +18,7 @@ public static void DqlAppend()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -96,7 +97,7 @@ public static void DqlAppend()
}
if (Ribbon.GetSqlDataType(col) == Properties.Settings.Default.Column_TypeDate)
{
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -105,7 +106,7 @@ public static void DqlAppend()
}
}
//replace NULL values with DQL format
- formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnDateFormatReplace + "'\", \"'nulldate'\")";
+ formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnFormatDate + "'\", \"'nulldate'\")";
formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "'\", \"nullstring\")";
formula = "SUBSTITUTE(" + formula + ", \"" + Properties.Settings.Default.Table_ColumnScriptNull + "\", \"nullint\")";
@@ -154,10 +155,6 @@ public static void DqlAppend()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void DqlAppendLocked()
{
Excel.ListObject tbl = null;
@@ -165,6 +162,7 @@ public static void DqlAppendLocked()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -246,10 +244,10 @@ public static void DqlAppendLocked()
{
if (afterWhere == true)
{
- whereClause += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ whereClause += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -262,7 +260,7 @@ public static void DqlAppendLocked()
}
}
//replace NULL values with DQL format
- formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnDateFormatReplace + "'\", \"'nulldate'\")";
+ formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnFormatDate + "'\", \"'nulldate'\")";
formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "'\", \"nullstring\")";
formula = "SUBSTITUTE(" + formula + ", \"" + Properties.Settings.Default.Table_ColumnScriptNull + "\", \"nullint\")";
@@ -314,10 +312,6 @@ public static void DqlAppendLocked()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void DqlCreate()
{
Excel.ListObject tbl = null;
@@ -325,6 +319,7 @@ public static void DqlCreate()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -380,7 +375,7 @@ public static void DqlCreate()
valuePrefix = "\" SET " + col.Name + " = \" & ";
if (Ribbon.GetSqlDataType(col) == Properties.Settings.Default.Column_TypeDate)
{
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -389,7 +384,7 @@ public static void DqlCreate()
}
}
//replace NULL values with DQL format
- formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnDateFormatReplace + "'\", \"'nulldate'\")";
+ formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnFormatDate + "'\", \"'nulldate'\")";
formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "'\", \"nullstring\")";
formula = "SUBSTITUTE(" + formula + ", \"" + Properties.Settings.Default.Table_ColumnScriptNull + "\", \"nullint\")";
@@ -433,10 +428,6 @@ public static void DqlCreate()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void DqlTruncateAppend()
{
Excel.ListObject tbl = null;
@@ -444,6 +435,7 @@ public static void DqlTruncateAppend()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -522,7 +514,7 @@ public static void DqlTruncateAppend()
}
if (Ribbon.GetSqlDataType(col) == Properties.Settings.Default.Column_TypeDate)
{
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -531,7 +523,7 @@ public static void DqlTruncateAppend()
}
}
//replace NULL values with DQL format
- formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnDateFormatReplace + "'\", \"'nulldate'\")";
+ formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnFormatDate + "'\", \"'nulldate'\")";
formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "'\", \"nullstring\")";
formula = "SUBSTITUTE(" + formula + ", \"" + Properties.Settings.Default.Table_ColumnScriptNull + "\", \"nullint\")";
@@ -581,10 +573,6 @@ public static void DqlTruncateAppend()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void DqlUpdate()
{
Excel.ListObject tbl = null;
@@ -592,6 +580,7 @@ public static void DqlUpdate()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -666,7 +655,7 @@ public static void DqlUpdate()
}
if (Ribbon.GetSqlDataType(col) == Properties.Settings.Default.Column_TypeDate)
{
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -675,7 +664,7 @@ public static void DqlUpdate()
}
}
//replace NULL values with DQL format
- formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnDateFormatReplace + "'\", \"'nulldate'\")";
+ formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnFormatDate + "'\", \"'nulldate'\")";
formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "'\", \"nullstring\")";
formula = "SUBSTITUTE(" + formula + ", \"" + Properties.Settings.Default.Table_ColumnScriptNull + "\", \"nullint\")";
@@ -724,10 +713,6 @@ public static void DqlUpdate()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void DqlUpdateLocked()
{
Excel.ListObject tbl = null;
@@ -735,6 +720,7 @@ public static void DqlUpdateLocked()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -816,10 +802,10 @@ public static void DqlUpdateLocked()
{
if (afterWhere == true)
{
- whereClause += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ whereClause += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -832,7 +818,7 @@ public static void DqlUpdateLocked()
}
}
//replace NULL values with DQL format
- formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnDateFormatReplace + "'\", \"'nulldate'\")";
+ formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "', '" + Properties.Settings.Default.Table_ColumnFormatDate + "'\", \"'nulldate'\")";
formula = "SUBSTITUTE(" + formula + ", \"'" + Properties.Settings.Default.Table_ColumnScriptNull + "'\", \"nullstring\")";
formula = "SUBSTITUTE(" + formula + ", \"" + Properties.Settings.Default.Table_ColumnScriptNull + "\", \"nullint\")";
@@ -884,17 +870,14 @@ public static void DqlUpdateLocked()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
- public static void GithubTable()
+ public static void MarkdownTable()
{
Excel.ListObject tbl = null;
Excel.ListColumn sqlCol = null;
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
@@ -938,10 +921,10 @@ public static void GithubTable()
sqlCol.Range.HorizontalAlignment = Excel.Constants.xlLeft;
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "TXT";
- string headerColumn = Ribbon.ConcatenateColumnNames(tbl.Range, string.Empty, "|", "") + "|" + Environment.NewLine;
+ string headerColumn = Ribbon.ConcatenateColumnNames(tbl.Range, string.Empty, "|", string.Empty, string.Empty) + "|" + Environment.NewLine;
string headerSeparator = "|:" + new String('-', 10);
string headerLine = new System.Text.StringBuilder(headerSeparator.Length * lastColumnIndex).Insert(0, headerSeparator, lastColumnIndex).ToString().Substring(0, ((headerSeparator.Length * lastColumnIndex) - (headerSeparator.Length - 1))) + Environment.NewLine;
- Ribbon.AppVariables.ScriptRange = headerColumn + headerLine + (string)Clipboard.GetData(DataFormats.Text);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("Markdown table", "") + headerColumn + headerLine + (string)Clipboard.GetData(DataFormats.Text);
Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
@@ -970,10 +953,6 @@ public static void GithubTable()
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void HtmlTable()
{
Excel.ListObject tbl = null;
@@ -981,6 +960,7 @@ public static void HtmlTable()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1060,7 +1040,7 @@ public static void HtmlTable()
Ribbon.AppVariables.FileType = "XML";
Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
- Ribbon.AppVariables.ScriptRange = "
";
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -1087,10 +1067,6 @@ public static void HtmlTable()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void PlSqlCreateTable()
{
Excel.ListObject tbl = null;
@@ -1098,6 +1074,7 @@ public static void PlSqlCreateTable()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1189,10 +1166,6 @@ public static void PlSqlCreateTable()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void PlSqlInsertValues()
{
Excel.ListObject tbl = null;
@@ -1200,6 +1173,7 @@ public static void PlSqlInsertValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1290,10 +1264,6 @@ public static void PlSqlInsertValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void PlSqlMergeValues()
{
Excel.ListObject tbl = null;
@@ -1301,18 +1271,16 @@ public static void PlSqlMergeValues()
try
{
ErrorHandler.CreateLogRecord();
- Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
+ string sqlColName = string.Empty;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAliasTemp = tableAlias + "_source";
- string sqlColName = string.Empty;
-
- sqlColName = "SELECT " + tableAliasTemp + ".*" + " FROM (VALUES";
+ sqlColName = Properties.Settings.Default.Table_ColumnName;
tbl = Globals.ThisAddIn.Application.ActiveCell.ListObject;
int lastColumnIndex = tbl.Range.Columns.Count;
sqlCol = tbl.ListColumns[lastColumnIndex];
-
if (sqlCol.Name == sqlColName)
{
lastColumnName = sqlCol.Name;
@@ -1324,7 +1292,6 @@ public static void PlSqlMergeValues()
lastColumnIndex = tbl.Range.Columns.Count;
}
- // Columns formatted as text will not work as formulas and the added column will copy the formatting from the previous column so ensure that the added column never has Text format...
sqlCol.DataBodyRange.NumberFormat = "General";
string formula = string.Empty;
string qt = string.Empty;
@@ -1337,7 +1304,6 @@ public static void PlSqlMergeValues()
return;
}
if (col.Name == lastColumnName | col.Range.EntireColumn.Hidden)
- //if (col.Name != lastColumnName | col.Range.EntireColumn.Hidden == false)
{
//DO NOTHING - because the column is hidden or the last column with the sql script
}
@@ -1352,28 +1318,51 @@ public static void PlSqlMergeValues()
colRef = colRef.Replace("'", "''");
colRef = colRef.Replace("#", "'#");
colRef = "SUBSTITUTE(" + colRef + ", " + "\"" + qt + "\", \"" + qt + qt + "\")";
- formula += "\"" + qt + "\" & " + colRef + " & \"" + qt + "\"";
+ string dqt = "\"\"";
+ string valuePlSuffix = "& \" AS " + dqt + col.Name + dqt + "\"";
+ formula += "\"" + qt + "\" & " + colRef + " & \"" + qt + "\"" + valuePlSuffix;
}
}
string nullValue = Properties.Settings.Default.Table_ColumnScriptNull;
formula = "SUBSTITUTE(" + formula + ", \"'" + nullValue + "'\", \"" + nullValue + "\")";
int firstRowNbr = tbl.Range[1, 1].Row + 1; // must use the offset for the first row number
- formula = "=IF(" + (firstRowNbr).ToString() + "-ROW() = 0, \" \", \",\") & " + "\" ( \" & " + formula + " & \")\"";
+ formula = "=IF(" + (firstRowNbr).ToString() + "-ROW() = 0, \"\", \"UNION \") & " + "\"SELECT \" & " + formula + " & \" FROM DUAL\"";
+ tbl.ShowTotals = false;
lastColumnName = sqlColName; // maximum header characters are 255
tbl.HeaderRowRange[lastColumnIndex].Value2 = lastColumnName;
- tbl.ShowTotals = true;
- string totalsColumnValue = ") " + tableAliasTemp + " (" + Ribbon.ConcatenateColumnNames(tbl.Range, "", "[", "]") + ") ";
- tbl.TotalsRowRange[lastColumnIndex].Value2 = totalsColumnValue; // totals row has a maximum limit of 32,767 characters
try
{
sqlCol.DataBodyRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible).Rows.Formula = formula;
sqlCol.Range.Columns.AutoFit();
sqlCol.Range.HorizontalAlignment = Excel.Constants.xlLeft;
- sqlCol.Range.Copy();
+ sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "SQL";
- Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
- Ribbon.AppVariables.ScriptRange = "SET XACT_ABORT ON" + Environment.NewLine + "BEGIN TRANSACTION;" + Environment.NewLine + Environment.NewLine + ";WITH " + Environment.NewLine + tableAliasTemp + Environment.NewLine + "AS " + Environment.NewLine + "(" + Environment.NewLine + Ribbon.AppVariables.ScriptRange + ") " + Environment.NewLine + "MERGE " + tableAlias + " AS T" + Environment.NewLine + "USING " + tableAliasTemp + " AS S" + Environment.NewLine + "ON " + Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S") + "WHEN NOT MATCHED BY TARGET" + Environment.NewLine + "THEN INSERT" + Environment.NewLine + "(" + Environment.NewLine + Ribbon.ConcatenateColumnNames(tbl.Range, "", "[", "]") + Environment.NewLine + ")" + Environment.NewLine + "VALUES" + Environment.NewLine + "(" + Environment.NewLine + Ribbon.ConcatenateColumnNames(tbl.Range, "S", "[", "]") + Environment.NewLine + ")" + Environment.NewLine + "WHEN MATCHED" + Environment.NewLine + "THEN UPDATE SET" + Environment.NewLine + Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S") + "--WHEN NOT MATCHED BY SOURCE AND 'ADD WHERE CLAUSE HERE'" + Environment.NewLine + "--THEN DELETE" + Environment.NewLine + "OUTPUT $action, inserted.*, deleted.*;" + Environment.NewLine + Environment.NewLine + "ROLLBACK TRANSACTION;" + Environment.NewLine + "--COMMIT TRANSACTION;" + Environment.NewLine + "GO";
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To update, insert & delete rows");
+ Ribbon.AppVariables.ScriptRange += "BEGIN" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "WITH " + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += tableAliasTemp + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "AS " + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += (string)Clipboard.GetData(DataFormats.Text);
+ Ribbon.AppVariables.ScriptRange += ") " + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "MERGE INTO " + tableAlias + " AS T" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "USING " + tableAliasTemp + " AS S" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "ON --< Update the join to the correct unique key for the table" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S", "AND") + "WHEN NOT MATCHED" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "THEN INSERT" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += Ribbon.ConcatenateColumnNames(tbl.Range, "", "[", "]") + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += ")" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "VALUES" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += Ribbon.ConcatenateColumnNames(tbl.Range, "S", "[", "]") + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += ")" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "WHEN MATCHED" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "THEN UPDATE SET" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S", ",") + "--WHEN NOT MATCHED THEN DELETE WHERE --< You may want to add a WHERE clause here" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "ROLLBACK;" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "--COMMIT;" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "END;";
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -1400,10 +1389,6 @@ public static void PlSqlMergeValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void PlSqlSelectValues()
{
Excel.ListObject tbl = null;
@@ -1411,6 +1396,7 @@ public static void PlSqlSelectValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
@@ -1508,10 +1494,6 @@ public static void PlSqlSelectValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void PlSqlSelectUnion()
{
Excel.ListObject tbl = null;
@@ -1519,6 +1501,7 @@ public static void PlSqlSelectUnion()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1564,7 +1547,7 @@ public static void PlSqlSelectUnion()
colRef = colRef.Replace("#", "'#");
colRef = "SUBSTITUTE(" + colRef + ", " + "\"" + qt + "\", \"" + qt + qt + "\")";
string dqt = "\"\"";
- string valuePlSuffix = "& \" AS " + dqt + col.Name + dqt + " \"";
+ string valuePlSuffix = "& \" AS " + dqt + col.Name + dqt + "\"";
formula += "\"" + qt + "\" & " + colRef + " & \"" + qt + "\"" + valuePlSuffix;
}
}
@@ -1582,8 +1565,9 @@ public static void PlSqlSelectUnion()
sqlCol.Range.HorizontalAlignment = Excel.Constants.xlLeft;
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "SQL";
- Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To select values with a union operator");
+ Ribbon.AppVariables.ScriptRange += (string)Clipboard.GetData(DataFormats.Text);
+
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -1610,10 +1594,6 @@ public static void PlSqlSelectUnion()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void PlSqlUpdateValues()
{
Excel.ListObject tbl = null;
@@ -1621,6 +1601,7 @@ public static void PlSqlUpdateValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1703,7 +1684,7 @@ public static void PlSqlUpdateValues()
}
if (Ribbon.GetSqlDataType(col) == Properties.Settings.Default.Column_TypeDate)
{
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -1759,10 +1740,6 @@ public static void PlSqlUpdateValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void TSqlCreateTable()
{
Excel.ListObject tbl = null;
@@ -1770,6 +1747,7 @@ public static void TSqlCreateTable()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1820,12 +1798,11 @@ public static void TSqlCreateTable()
string nullValue = Properties.Settings.Default.Table_ColumnScriptNull;
formula = "SUBSTITUTE(" + formula + ", \"'" + nullValue + "'\", \"" + nullValue + "\")";
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
- string insertPrefix = "INSERT INTO " + tableAlias + " (" + Ribbon.ConcatenateColumnNames(tbl.Range) + ") VALUES(";
+ string insertPrefix = "INSERT INTO " + tableAlias + " (" + Ribbon.ConcatenateColumnNames(tbl.Range, "", "[", "]") + ") VALUES(";
formula = "=\"" + insertPrefix + "\" & " + formula + " & \");\"";
tbl.ShowTotals = false;
lastColumnName = sqlColName; // maximum header characters are 255
tbl.HeaderRowRange[lastColumnIndex].Value2 = lastColumnName;
- string createTable = "IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'" + tableAlias + "') AND type in (N'U'))" + Environment.NewLine + "DROP TABLE " + tableAlias + Environment.NewLine + "; " + Environment.NewLine + "CREATE TABLE " + tableAlias + " (" + tableAlias + "_ID [int] PRIMARY KEY IDENTITY(1,1) NOT NULL, " + Ribbon.ConcatenateColumnNames(tbl.Range, "", Environment.NewLine + "[", "] [varchar](max) NULL") + Environment.NewLine + ");" + Environment.NewLine;
try
{
sqlCol.DataBodyRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible).Rows.Formula = formula;
@@ -1833,7 +1810,15 @@ public static void TSqlCreateTable()
sqlCol.Range.HorizontalAlignment = Excel.Constants.xlLeft;
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "SQL";
- Ribbon.AppVariables.ScriptRange = createTable + (string)Clipboard.GetData(DataFormats.Text);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To create and insert records");
+ Ribbon.AppVariables.ScriptRange += "IF EXISTS(SELECT * FROM [sys].[objects] WHERE [object_id]=OBJECT_ID(N'" + tableAlias + "') AND [TYPE]=N'U')" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "DROP TABLE " + tableAlias + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "; " + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "CREATE TABLE " + tableAlias + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += " [" + tableAlias + "_ID] [int] PRIMARY KEY IDENTITY(1,1) NOT NULL" + Ribbon.ConcatenateColumnNames(tbl.Range, "", Environment.NewLine + ", [", "] [varchar](max) NULL", "") + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += ");" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += (string)Clipboard.GetData(DataFormats.Text);
Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
@@ -1861,10 +1846,6 @@ public static void TSqlCreateTable()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void TSqlInsertValues()
{
Excel.ListObject tbl = null;
@@ -1872,6 +1853,7 @@ public static void TSqlInsertValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -1935,7 +1917,7 @@ public static void TSqlInsertValues()
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "SQL";
Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To insert records") + Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -1962,10 +1944,6 @@ public static void TSqlInsertValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void TSqlMergeValues()
{
Excel.ListObject tbl = null;
@@ -1973,6 +1951,7 @@ public static void TSqlMergeValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
@@ -2042,10 +2021,38 @@ public static void TSqlMergeValues()
sqlCol.Range.Columns.AutoFit();
sqlCol.Range.HorizontalAlignment = Excel.Constants.xlLeft;
sqlCol.Range.Copy();
- Ribbon.AppVariables.FileType = "SQL";
- Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
+ Ribbon.AppVariables.FileType = "SQL";
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To update, insert & delete rows");
+ Ribbon.AppVariables.ScriptRange += "SET XACT_ABORT ON;" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "BEGIN TRANSACTION;" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "WITH " + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += tableAliasTemp + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "AS " + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += (string)Clipboard.GetData(DataFormats.Text);
+ Ribbon.AppVariables.ScriptRange += ") " + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "MERGE " + tableAlias + " AS T" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "USING " + tableAliasTemp + " AS S" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "ON --< Update the join to the correct unique key for the table" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S", "AND ") + "WHEN NOT MATCHED BY TARGET" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "THEN INSERT" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += " " + Ribbon.ConcatenateColumnNames(tbl.Range, "", "[", "]") + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += ")" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "VALUES" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "(" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += " " + Ribbon.ConcatenateColumnNames(tbl.Range, "S", "[", "]") + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += ")" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "WHEN MATCHED" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "THEN UPDATE SET" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S", ", ") + "--WHEN NOT MATCHED BY SOURCE --< You may want to add a WHERE clause here" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "--THEN DELETE" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "OUTPUT @@SERVERNAME AS [Server Name], DB_NAME() AS [Database Name], $action, inserted.*, deleted.*;" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "ROLLBACK TRANSACTION;" + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "--COMMIT TRANSACTION;" + Environment.NewLine + Environment.NewLine;
+ Ribbon.AppVariables.ScriptRange += "GO";
Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
- Ribbon.AppVariables.ScriptRange = "SET XACT_ABORT ON" + Environment.NewLine + "BEGIN TRANSACTION;" + Environment.NewLine + Environment.NewLine + ";WITH " + Environment.NewLine + tableAliasTemp + Environment.NewLine + "AS " + Environment.NewLine + "(" + Environment.NewLine + Ribbon.AppVariables.ScriptRange + ") " + Environment.NewLine + "MERGE " + tableAlias + " AS T" + Environment.NewLine + "USING " + tableAliasTemp + " AS S" + Environment.NewLine + "ON " + Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S") + "WHEN NOT MATCHED BY TARGET" + Environment.NewLine + "THEN INSERT" + Environment.NewLine + "(" + Environment.NewLine + Ribbon.ConcatenateColumnNames(tbl.Range, "", "[", "]") + Environment.NewLine + ")" + Environment.NewLine + "VALUES" + Environment.NewLine + "(" + Environment.NewLine + Ribbon.ConcatenateColumnNames(tbl.Range, "S", "[", "]") + Environment.NewLine + ")" + Environment.NewLine + "WHEN MATCHED" + Environment.NewLine + "THEN UPDATE SET" + Environment.NewLine + Ribbon.ConcatenateColumnNamesJoin(tbl.Range, "T", "S") + "--WHEN NOT MATCHED BY SOURCE AND 'ADD WHERE CLAUSE HERE'" + Environment.NewLine + "--THEN DELETE" + Environment.NewLine + "OUTPUT $action, inserted.*, deleted.*;" + Environment.NewLine + Environment.NewLine + "ROLLBACK TRANSACTION;" + Environment.NewLine + "--COMMIT TRANSACTION;" + Environment.NewLine + "GO";
+
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -2072,10 +2079,6 @@ public static void TSqlMergeValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void TSqlSelectUnion()
{
Excel.ListObject tbl = null;
@@ -2083,6 +2086,7 @@ public static void TSqlSelectUnion()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
sqlColName = Properties.Settings.Default.Table_ColumnName;
@@ -2148,7 +2152,7 @@ public static void TSqlSelectUnion()
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "SQL";
Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To select values with a union operator") + Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -2175,10 +2179,6 @@ public static void TSqlSelectUnion()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void TSqlSelectValues()
{
Excel.ListObject tbl = null;
@@ -2186,6 +2186,7 @@ public static void TSqlSelectValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
@@ -2256,7 +2257,7 @@ public static void TSqlSelectValues()
sqlCol.Range.Copy();
Ribbon.AppVariables.FileType = "SQL";
Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To select values") + Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -2283,10 +2284,6 @@ public static void TSqlSelectValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void TSqlUpdateValues()
{
Excel.ListObject tbl = null;
@@ -2294,6 +2291,7 @@ public static void TSqlUpdateValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -2376,7 +2374,7 @@ public static void TSqlUpdateValues()
}
if (Ribbon.GetSqlDataType(col) == Properties.Settings.Default.Column_TypeDate)
{
- formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnDateFormatReplace + qt + ")\"";
+ formula += valuePrefix + "\"DATE(" + qt + "\" & " + colRef + " & \"" + qt + ", " + qt + Properties.Settings.Default.Table_ColumnFormatDate + qt + ")\"";
}
else
{
@@ -2405,7 +2403,7 @@ public static void TSqlUpdateValues()
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "SQL";
Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("To update records") + Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
{
@@ -2432,10 +2430,6 @@ public static void TSqlUpdateValues()
}
}
- ///
- /// Add a formula at the end of the table to use as a script
- ///
- ///
public static void XmlValues()
{
Excel.ListObject tbl = null;
@@ -2443,6 +2437,7 @@ public static void XmlValues()
try
{
ErrorHandler.CreateLogRecord();
+ if (ErrorHandler.IsValidListObject(true) == false) { return; };
string lastColumnName = Properties.Settings.Default.Table_ColumnTableAlias;
string tableAlias = Properties.Settings.Default.Table_ColumnTableAlias;
string sqlColName = string.Empty;
@@ -2521,7 +2516,7 @@ public static void XmlValues()
sqlCol.DataBodyRange.Copy();
Ribbon.AppVariables.FileType = "XML";
Ribbon.AppVariables.ScriptRange = (string)Clipboard.GetData(DataFormats.Text);
- Ribbon.AppVariables.ScriptRange = Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
+ Ribbon.AppVariables.ScriptRange = Ribbon.GetCommentHeader("XML table", "") + Ribbon.AppVariables.ScriptRange.Replace(@"""", String.Empty);
}
catch (System.Runtime.InteropServices.COMException)
{
diff --git a/CS/Scripts/Ribbon.cs b/CS/Scripts/Ribbon.cs
index 045ac10..8e88588 100644
--- a/CS/Scripts/Ribbon.cs
+++ b/CS/Scripts/Ribbon.cs
@@ -1,125 +1,54 @@
using System;
using System.IO;
-using System.Windows.Forms;
using System.Reflection;
using System.Runtime.InteropServices;
-using Office = Microsoft.Office.Core;
+using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
+using Office = Microsoft.Office.Core;
-//
-// This namespaces if for ribbon classes and methods
-//
namespace ScriptHelp.Scripts
{
- ///
- /// Class for the ribbon procedures
- ///
[ComVisible(true)]
public class Ribbon : Office.IRibbonExtensibility
{
private Office.IRibbonUI ribbon;
-
- ///
- /// Used to reference the ribbon object
- ///
public static Ribbon ribbonref;
- ///
- /// Used for values across different classes
- ///
public static class AppVariables
{
- ///
- /// variable used for sending the copied range to the form for export
- ///
- public static string ScriptRange { get; set; }
- ///
- /// variable used for saving the script file
- ///
+ public static string ScriptRange { get; set; }
public static string FileType { get; set; }
-
- ///
- /// variable used for the table name used to populate a datagrid
- ///
public static string TableName { get; set; }
-
- ///
- /// The first visible column name in the table
- ///
public static string FirstColumnName { get; set; }
+ public static string ControlLabel { get; set; }
}
#region | Task Panes |
- ///
- /// Settings TaskPane
- ///
public TaskPane.Settings mySettings;
-
- ///
- /// Script TaskPane
- ///
public static TaskPane.Script myScript;
-
- ///
- /// TableData TaskPane
- ///
public TaskPane.TableData myTableData;
-
- ///
- /// TableData TaskPane
- ///
public TaskPane.GraphData myGraphData;
-
- ///
- /// Settings Custom Task Pane
- ///
public Microsoft.Office.Tools.CustomTaskPane myTaskPaneSettings;
-
- ///
- /// Script Custom Task Pane
- ///
public static Microsoft.Office.Tools.CustomTaskPane myTaskPaneScript;
-
- ///
- /// TableData Custom Task Pane
- ///
public Microsoft.Office.Tools.CustomTaskPane myTaskPaneTableData;
-
- ///
- /// TableData Custom Task Pane
- ///
public Microsoft.Office.Tools.CustomTaskPane myTaskPaneGraphData;
#endregion
#region | Ribbon Events |
- ///
- /// The ribbon
- ///
public Ribbon()
{
}
- ///
- /// Loads the XML markup, either from an XML customization file or from XML markup embedded in the procedure, that customizes the Ribbon user interface.
- ///
- /// Represents the XML customization file
- /// A method that returns a bitmap image for the control id.
- ///
public string GetCustomUI(string ribbonID)
{
return GetResourceText("ScriptHelp.Ribbon.xml");
}
- ///
- /// Called by the GetCustomUI method to obtain the contents of the Ribbon XML file.
- ///
- /// name of the XML file
- /// the contents of the XML file
private static string GetResourceText(string resourceName)
{
Assembly asm = Assembly.GetExecutingAssembly();
@@ -140,11 +69,6 @@ private static string GetResourceText(string resourceName)
return null;
}
- ///
- /// loads the ribbon UI and creates a log record
- ///
- /// Represents the IRibbonUI instance that is provided by the Microsoft Office application to the Ribbon extensibility code.
- ///
public void Ribbon_Load(Office.IRibbonUI ribbonUI)
{
try
@@ -171,6 +95,7 @@ public void Ribbon_Load(Office.IRibbonUI ribbonUI)
Data.CreateTableAliasTable();
Data.CreateDateFormatTable();
+ Data.CreateTimeFormatTable();
Data.CreateGraphDataTable();
}
@@ -180,11 +105,6 @@ public void Ribbon_Load(Office.IRibbonUI ribbonUI)
}
}
- ///
- /// Assigns an image to a button on the ribbon in the xml file
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns a bitmap image for the control id.
public System.Drawing.Bitmap GetButtonImage(Office.IRibbonControl control)
{
try
@@ -197,6 +117,12 @@ public System.Drawing.Bitmap GetButtonImage(Office.IRibbonControl control)
case "btnScriptTypeDqlTruncateAppend":
case "btnScriptTypeDqlUpdate":
case "btnScriptTypeDqlUpdateLocked":
+ case "btn1ScriptTypeDqlAppend":
+ case "btn1ScriptTypeDqlAppendLocked":
+ case "btn1ScriptTypeDqlCreate":
+ case "btn1ScriptTypeDqlTruncateAppend":
+ case "btn1ScriptTypeDqlUpdate":
+ case "btn1ScriptTypeDqlUpdateLocked":
return Properties.Resources.ScriptTypeDql;
case "btnScriptTypeTSqlCreateTable":
case "btnScriptTypeTSqlInsertValues":
@@ -204,6 +130,12 @@ public System.Drawing.Bitmap GetButtonImage(Office.IRibbonControl control)
case "btnScriptTypeTSqlSelectValues":
case "btnScriptTypeTSqlSelectUnion":
case "btnScriptTypeTSqlUpdateValues":
+ case "btn1ScriptTypeTSqlCreateTable":
+ case "btn1ScriptTypeTSqlInsertValues":
+ case "btn1ScriptTypeTSqlMergeValues":
+ case "btn1ScriptTypeTSqlSelectValues":
+ case "btn1ScriptTypeTSqlSelectUnion":
+ case "btn1ScriptTypeTSqlUpdateValues":
return Properties.Resources.ScriptTypeTSql;
case "btnScriptTypePlSqlCreateTable":
case "btnScriptTypePlSqlInsertValues":
@@ -211,12 +143,35 @@ public System.Drawing.Bitmap GetButtonImage(Office.IRibbonControl control)
case "btnScriptTypePlSqlSelectValues":
case "btnScriptTypePlSqlSelectUnion":
case "btnScriptTypePlSqlUpdateValues":
+ case "btn1ScriptTypePlSqlCreateTable":
+ case "btn1ScriptTypePlSqlInsertValues":
+ case "btn1ScriptTypePlSqlMergeValues":
+ case "btn1ScriptTypePlSqlSelectValues":
+ case "btn1ScriptTypePlSqlSelectUnion":
+ case "btn1ScriptTypePlSqlUpdateValues":
return Properties.Resources.ScriptTypePlSql;
- case "btnScriptTypeGithubTable":
- return Properties.Resources.ScriptTypeGitHub;
+ case "btnScriptTypeMarkdownTable":
+ case "btn1ScriptTypeMarkdownTable":
+ return Properties.Resources.ScriptTypeMarkdown;
case "btnScriptTypeHtmlTable":
case "btnScriptTypeXmlValues":
- return Properties.Resources.ScriptTypeXML;
+ case "btn1ScriptTypeHtmlTable":
+ case "btn1ScriptTypeXmlValues":
+ return Properties.Resources.ScriptTypeMarkup;
+ case "btnProblemStepRecorder":
+ case "btnProblemStepRecorder1":
+ return Properties.Resources.problem_steps_recorder;
+ case "btnSnippingTool":
+ case "btnSnippingTool1":
+ return Properties.Resources.snipping_tool;
+ case "btnSaveVersion":
+ return Properties.Resources.SaveVersion;
+ case "btnSaveCode":
+ return Properties.Resources.SaveCode;
+ case "btnCamera":
+ return Properties.Resources.camera;
+ case "btn1Start":
+ return Properties.Resources.Play;
default:
return null;
}
@@ -228,11 +183,6 @@ public System.Drawing.Bitmap GetButtonImage(Office.IRibbonControl control)
}
}
- ///
- /// Assigns the enabled to controls
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns true or false if the control is enabled
public bool GetEnabled(Office.IRibbonControl control)
{
try
@@ -243,6 +193,7 @@ public bool GetEnabled(Office.IRibbonControl control)
case "btnCleanData":
case "btnZeroToNull":
case "btnFormatDateColumns":
+ case "btnFormatTimeColumns":
case "btnClearInteriorColor":
case "btnAddScriptColumn":
return ErrorHandler.IsEnabled(false);
@@ -257,11 +208,6 @@ public bool GetEnabled(Office.IRibbonControl control)
}
}
- ///
- /// Assigns text to a label on the ribbon from the xml file
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns a string for a label.
public string GetLabelText(Office.IRibbonControl control)
{
try
@@ -284,6 +230,69 @@ public string GetLabelText(Office.IRibbonControl control)
case "txtReleaseDate":
DateTime dteCreateDate = Properties.Settings.Default.App_ReleaseDate;
return dteCreateDate.ToString("dd-MMM-yyyy hh:mm tt");
+ case "btnScriptTypeDqlAppend":
+ case "btn1ScriptTypeDqlAppend":
+ return "DQL Append";
+ case "btnScriptTypeDqlAppendLocked":
+ case "btn1ScriptTypeDqlAppendLocked":
+ return "DQL Append/Locked";
+ case "btnScriptTypeDqlCreate":
+ case "btn1ScriptTypeDqlCreate":
+ return "DQL Create";
+ case "btnScriptTypeDqlTruncateAppend":
+ case "btn1ScriptTypeDqlTruncateAppend":
+ return "DQL Truncate/Append";
+ case "btnScriptTypeDqlUpdate":
+ case "btn1ScriptTypeDqlUpdate":
+ return "DQL Update";
+ case "btnScriptTypeDqlUpdateLocked":
+ case "btn1ScriptTypeDqlUpdateLocked":
+ return "DQL Update/Locked";
+ case "btnScriptTypeMarkdownTable":
+ case "btn1ScriptTypeMarkdownTable":
+ return "Markdown Table";
+ case "btnScriptTypeHtmlTable":
+ case "btn1ScriptTypeHtmlTable":
+ return "HTML Table";
+ case "btnScriptTypePlSqlCreateTable":
+ case "btn1ScriptTypePlSqlCreateTable":
+ return "PL/SQL Create Table";
+ case "btnScriptTypePlSqlInsertValues":
+ case "btn1ScriptTypePlSqlInsertValues":
+ return "PL/SQL Insert Values";
+ case "btnScriptTypePlSqlMergeValues":
+ case "btn1ScriptTypePlSqlMergeValues":
+ return "PL/SQL Merge Values";
+ case "btnScriptTypePlSqlSelectValues":
+ case "btn1ScriptTypePlSqlSelectValues":
+ return "PL/SQL Select Values";
+ case "btnScriptTypePlSqlSelectUnion":
+ case "btn1ScriptTypePlSqlSelectUnion":
+ return "PL/SQL Select Union";
+ case "btnScriptTypePlSqlUpdateValues":
+ case "btn1ScriptTypePlSqlUpdateValues":
+ return "PL/SQL Update Values";
+ case "btnScriptTypeTSqlCreateTable":
+ case "btn1ScriptTypeTSqlCreateTable":
+ return "T-SQL Create Table";
+ case "btnScriptTypeTSqlInsertValues":
+ case "btn1ScriptTypeTSqlInsertValues":
+ return "T-SQL Insert Values";
+ case "btnScriptTypeTSqlMergeValues":
+ case "btn1ScriptTypeTSqlMergeValues":
+ return "T-SQL Merge Values";
+ case "btnScriptTypeTSqlSelectValues":
+ case "btn1ScriptTypeTSqlSelectValues":
+ return "T-SQL Select Values";
+ case "btnScriptTypeTSqlSelectUnion":
+ case "btn1ScriptTypeTSqlSelectUnion":
+ return "T-SQL Select Union";
+ case "btnScriptTypeTSqlUpdateValues":
+ case "btn1ScriptTypeTSqlUpdateValues":
+ return "T-SQL Update Values";
+ case "btnScriptTypeXmlValues":
+ case "btn1ScriptTypeXmlValues":
+ return "XML Values";
default:
return string.Empty;
}
@@ -295,20 +304,16 @@ public string GetLabelText(Office.IRibbonControl control)
}
}
- ///
- /// Assigns the number of items for a combobox or dropdown
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns an integer of total count of items used for a combobox or dropdown
public int GetItemCount(Office.IRibbonControl control)
{
try
{
switch (control.Id)
{
- case "cboDateFormatReplace":
- case "cboDateFormatFind":
+ case "cboFormatDate":
return Data.DateFormatTable.Rows.Count;
+ case "cboFormatTime":
+ return Data.TimeFormatTable.Rows.Count;
case "cboTableAlias":
return Data.TableAliasTable.Rows.Count;
default:
@@ -322,21 +327,16 @@ public int GetItemCount(Office.IRibbonControl control)
}
}
- ///
- /// Assigns the values to a combobox or dropdown based on an index
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// Represents the index of the combobox or dropdown value
- /// A method that returns a string per index of a combobox or dropdown
public string GetItemLabel(Office.IRibbonControl control, int index)
{
try
{
switch (control.Id)
{
- case "cboDateFormatReplace":
- case "cboDateFormatFind":
+ case "cboFormatDate":
return UpdateDateFormatComboBoxSource(index);
+ case "cboFormatTime":
+ return UpdateTimeFormatComboBoxSource(index);
case "cboTableAlias":
return UpdateTableAliasComboBoxSource(index);
default:
@@ -350,23 +350,22 @@ public string GetItemLabel(Office.IRibbonControl control, int index)
}
}
- ///
- /// Assigns default values to comboboxes
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns a string for the default value of a combobox
public string GetText(Office.IRibbonControl control)
{
try
{
switch (control.Id)
{
- case "cboDateFormatReplace":
- return Properties.Settings.Default.Table_ColumnDateFormatReplace;
- case "cboDateFormatFind":
- return Properties.Settings.Default.Table_ColumnDateFormatFind;
+ case "cboFormatDate":
+ return Properties.Settings.Default.Table_ColumnFormatDate;
+ case "cboFormatTime":
+ return Properties.Settings.Default.Table_ColumnFormatTime;
case "cboTableAlias":
return Properties.Settings.Default.Table_ColumnTableAlias;
+ case "txtColumnSeparateValuesDelimiter":
+ return Properties.Settings.Default.Table_ColumnSeparateValuesDelimiter.ToString();
+ case "txtBlankValuesReplacement":
+ return Properties.Settings.Default.Table_ColumnScriptNull;
default:
return string.Empty;
}
@@ -378,11 +377,36 @@ public string GetText(Office.IRibbonControl control)
}
}
- ///
- /// Assigns the visiblity to controls
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns true or false if the control is visible
+ public bool GetPressed(Office.IRibbonControl control)
+ {
+ try
+ {
+ switch (control.Id)
+ {
+
+ case "chkBackstageTsql":
+ return Properties.Settings.Default.Visible_mnuScriptType_TSQL;
+ case "chkBackstagePlsql":
+ return Properties.Settings.Default.Visible_mnuScriptType_PLSQL;
+ case "chkBackstageDql":
+ return Properties.Settings.Default.Visible_mnuScriptType_DQL;
+ case "chkBackstageMarkdown":
+ return Properties.Settings.Default.Visible_mnuScriptType_Markdown;
+ case "chkBackstageMarkup":
+ return Properties.Settings.Default.Visible_mnuScriptType_Markup;
+ default:
+ return true;
+ }
+
+ }
+ catch (Exception)
+ {
+ return true;
+ //ErrorHandler.DisplayMessage(ex);
+ }
+
+ }
+
public bool GetVisible(Office.IRibbonControl control)
{
try
@@ -391,24 +415,20 @@ public bool GetVisible(Office.IRibbonControl control)
{
case "grpClipboard":
return Properties.Settings.Default.Visible_grpClipboard;
- case "grpFormatDataTable":
- return Properties.Settings.Default.Visible_grpFormatDataTable;
- case "grpScriptVariables":
- return Properties.Settings.Default.Visible_grpScriptVariables;
- case "btnClearInteriorColor":
- return Properties.Settings.Default.Visible_btnClearInteriorColor;
- case "btnZeroToNull":
- return Properties.Settings.Default.Visible_btnZeroToNull;
- case "btnSeparateValues":
- return Properties.Settings.Default.Visible_btnSeparateValues;
- case "btnFileList":
- return Properties.Settings.Default.Visible_btnFileList;
+ case "grpAnnotation":
+ return Properties.Settings.Default.Visible_grpAnnotation;
case "btnScriptTypeTSqlCreateTable":
case "btnScriptTypeTSqlInsertValues":
case "btnScriptTypeTSqlMergeValues":
case "btnScriptTypeTSqlSelectValues":
case "btnScriptTypeTSqlSelectUnion":
case "btnScriptTypeTSqlUpdateValues":
+ case "btn1ScriptTypeTSqlCreateTable":
+ case "btn1ScriptTypeTSqlInsertValues":
+ case "btn1ScriptTypeTSqlMergeValues":
+ case "btn1ScriptTypeTSqlSelectValues":
+ case "btn1ScriptTypeTSqlSelectUnion":
+ case "btn1ScriptTypeTSqlUpdateValues":
return Properties.Settings.Default.Visible_mnuScriptType_TSQL;
case "btnScriptTypePlSqlCreateTable":
case "btnScriptTypePlSqlInsertValues":
@@ -416,6 +436,12 @@ public bool GetVisible(Office.IRibbonControl control)
case "btnScriptTypePlSqlSelectValues":
case "btnScriptTypePlSqlSelectUnion":
case "btnScriptTypePlSqlUpdateValues":
+ case "btn1ScriptTypePlSqlCreateTable":
+ case "btn1ScriptTypePlSqlInsertValues":
+ case "btn1ScriptTypePlSqlMergeValues":
+ case "btn1ScriptTypePlSqlSelectValues":
+ case "btn1ScriptTypePlSqlSelectUnion":
+ case "btn1ScriptTypePlSqlUpdateValues":
return Properties.Settings.Default.Visible_mnuScriptType_PLSQL;
case "btnScriptTypeDqlAppend":
case "btnScriptTypeDqlAppendLocked":
@@ -423,12 +449,21 @@ public bool GetVisible(Office.IRibbonControl control)
case "btnScriptTypeDqlTruncateAppend":
case "btnScriptTypeDqlUpdate":
case "btnScriptTypeDqlUpdateLocked":
+ case "btn1ScriptTypeDqlAppend":
+ case "btn1ScriptTypeDqlAppendLocked":
+ case "btn1ScriptTypeDqlCreate":
+ case "btn1ScriptTypeDqlTruncateAppend":
+ case "btn1ScriptTypeDqlUpdate":
+ case "btn1ScriptTypeDqlUpdateLocked":
return Properties.Settings.Default.Visible_mnuScriptType_DQL;
- case "btnScriptTypeGithubTable":
- return Properties.Settings.Default.Visible_mnuScriptType_Github;
+ case "btnScriptTypeMarkdownTable":
+ case "btn1ScriptTypeMarkdownTable":
+ return Properties.Settings.Default.Visible_mnuScriptType_Markdown;
case "btnScriptTypeHtmlTable":
case "btnScriptTypeXmlValues":
- return Properties.Settings.Default.Visible_mnuScriptType_XML;
+ case "btn1ScriptTypeHtmlTable":
+ case "btn1ScriptTypeXmlValues":
+ return Properties.Settings.Default.Visible_mnuScriptType_Markup;
default:
return false;
}
@@ -440,122 +475,158 @@ public bool GetVisible(Office.IRibbonControl control)
}
}
- ///
- /// Assigns the value to an application setting
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// A method that returns true or false if the control is enabled
public void OnAction(Office.IRibbonControl control)
{
try
{
+ Ribbon.AppVariables.ControlLabel = GetLabelText(control);
switch (control.Id)
{
case "btnStart":
+ case "btn1Start":
OpenGraphData();
break;
case "btnCopyVisibleCells":
CopyVisibleCells();
break;
case "btnCleanData":
+ case "btn1CleanData":
CleanData();
break;
case "btnZeroToNull":
ZeroStringToNull();
break;
case "btnFormatDateColumns":
+ case "btn1FormatDateColumns":
FormatDateColumns();
break;
+ case "btnFormatDateColumnsAll":
+ FormatDateColumnsAll();
+ break;
+ case "btnFormatTimeColumns":
+ case "btn1FormatTimeColumns":
+ FormatTimeColumns();
+ break;
case "btnClearInteriorColor":
ClearInteriorColor();
break;
case "btnSeparateValues":
+ case "btn1SeparateValues":
SeparateValues();
break;
case "btnSettings":
OpenSettings();
break;
- case "btnFileList":
- CreateFileList();
- break;
case "btnOpenReadMe":
OpenReadMe();
break;
case "btnOpenNewIssue":
OpenNewIssue();
break;
- case "btnDownloadNewVersion":
- //DownloadNewVersion();
- break;
case "btnScriptTypeDqlAppend":
+ case "btn1ScriptTypeDqlAppend":
Formula.DqlAppend();
break;
case "btnScriptTypeDqlAppendLocked":
+ case "btn1ScriptTypeDqlAppendLocked":
Formula.DqlAppendLocked();
break;
case "btnScriptTypeDqlCreate":
+ case "btn1ScriptTypeDqlCreate":
Formula.DqlCreate();
break;
case "btnScriptTypeDqlTruncateAppend":
+ case "btn1ScriptTypeDqlTruncateAppend":
Formula.DqlTruncateAppend();
break;
case "btnScriptTypeDqlUpdate":
+ case "btn1ScriptTypeDqlUpdate":
Formula.DqlUpdate();
break;
case "btnScriptTypeDqlUpdateLocked":
+ case "btn1ScriptTypeDqlUpdateLocked":
Formula.DqlUpdateLocked();
break;
- case "btnScriptTypeGithubTable":
- Formula.GithubTable();
+ case "btnScriptTypeMarkdownTable":
+ case "btn1ScriptTypeMarkdownTable":
+ Formula.MarkdownTable();
break;
case "btnScriptTypeHtmlTable":
+ case "btn1ScriptTypeHtmlTable":
Formula.HtmlTable();
break;
case "btnScriptTypePlSqlCreateTable":
+ case "btn1ScriptTypePlSqlCreateTable":
Formula.PlSqlCreateTable();
break;
case "btnScriptTypePlSqlInsertValues":
+ case "btn1ScriptTypePlSqlInsertValues":
Formula.PlSqlInsertValues();
break;
case "btnScriptTypePlSqlMergeValues":
+ case "btn1ScriptTypePlSqlMergeValues":
Formula.PlSqlMergeValues();
break;
case "btnScriptTypePlSqlSelectValues":
+ case "btn1ScriptTypePlSqlSelectValues":
Formula.PlSqlSelectValues();
break;
case "btnScriptTypePlSqlSelectUnion":
+ case "btn1ScriptTypePlSqlSelectUnion":
Formula.PlSqlSelectUnion();
break;
case "btnScriptTypePlSqlUpdateValues":
+ case "btn1ScriptTypePlSqlUpdateValues":
Formula.PlSqlUpdateValues();
break;
case "btnScriptTypeTSqlCreateTable":
+ case "btn1ScriptTypeTSqlCreateTable":
Formula.TSqlCreateTable();
break;
case "btnScriptTypeTSqlInsertValues":
+ case "btn1ScriptTypeTSqlInsertValues":
Formula.TSqlInsertValues();
break;
case "btnScriptTypeTSqlMergeValues":
+ case "btn1ScriptTypeTSqlMergeValues":
Formula.TSqlMergeValues();
break;
case "btnScriptTypeTSqlSelectValues":
+ case "btn1ScriptTypeTSqlSelectValues":
Formula.TSqlSelectValues();
break;
case "btnScriptTypeTSqlSelectUnion":
+ case "btn1ScriptTypeTSqlSelectUnion":
Formula.TSqlSelectUnion();
break;
case "btnScriptTypeTSqlUpdateValues":
+ case "btn1ScriptTypeTSqlUpdateValues":
Formula.TSqlUpdateValues();
break;
case "btnScriptTypeXmlValues":
+ case "btn1ScriptTypeXmlValues":
Formula.XmlValues();
break;
- case "btnDateFormatFind":
- case "btnDateFormatReplace":
+ case "btnFormatDate":
+ case "btnFormatTime":
case "btnTableAlias":
AppVariables.TableName = control.Tag;
OpenTableDataPane();
break;
+ case "btnSnippingTool":
+ case "btnSnippingTool1":
+ OpenSnippingTool();
+ break;
+ case "btnProblemStepRecorder":
+ case "btnProblemStepRecorder1":
+ OpenProblemStepRecorder();
+ break;
+ case "btnSaveVersion":
+ Ribbon.SaveVersion();
+ break;
+ case "btnSaveCode":
+ Ribbon.SaveCode();
+ break;
}
}
catch (Exception ex)
@@ -565,25 +636,63 @@ public void OnAction(Office.IRibbonControl control)
}
- ///
- /// Return the updated value from the comboxbox
- ///
- /// Represents the object passed into the callback procedure of a control in a ribbon or another user interface that can be customized by using Office Fluent ribbon extensibility.
- /// Represents the text from the combobox value
+ public void OnAction_Checkbox(Office.IRibbonControl control, bool pressed)
+ {
+ try
+ {
+ switch (control.Id)
+ {
+
+ case "chkBackstageTsql":
+ Properties.Settings.Default.Visible_mnuScriptType_TSQL = pressed;
+ break;
+ case "chkBackstagePlsql":
+ Properties.Settings.Default.Visible_mnuScriptType_PLSQL = pressed;
+ break;
+ case "chkBackstageDql":
+ Properties.Settings.Default.Visible_mnuScriptType_DQL = pressed;
+ break;
+ case "chkBackstageMarkdown":
+ Properties.Settings.Default.Visible_mnuScriptType_Markdown = pressed;
+ break;
+ case "chkBackstageMarkup":
+ Properties.Settings.Default.Visible_mnuScriptType_Markup = pressed;
+ break;
+ }
+
+ ribbon.Invalidate();
+
+ }
+ catch (Exception)
+ {
+ //ErrorHandler.DisplayMessage(ex);
+ }
+
+ }
+
public void OnChange(Office.IRibbonControl control, string text)
{
try
{
switch (control.Id)
{
- case "cboDateFormatReplace":
- Properties.Settings.Default.Table_ColumnDateFormatReplace = text;
+ case "cboFormatDate":
+ Properties.Settings.Default.Table_ColumnFormatDate = text;
+ Data.InsertRecord(Data.DateFormatTable, text);
break;
- case "cboDateFormatFind":
- Properties.Settings.Default.Table_ColumnDateFormatFind = text;
+ case "cboFormatTime":
+ Properties.Settings.Default.Table_ColumnFormatTime = text;
+ Data.InsertRecord(Data.TimeFormatTable, text);
break;
case "cboTableAlias":
Properties.Settings.Default.Table_ColumnTableAlias = text;
+ Data.InsertRecord(Data.TableAliasTable, text);
+ break;
+ case "txtColumnSeparateValuesDelimiter":
+ Properties.Settings.Default.Table_ColumnSeparateValuesDelimiter = Convert.ToChar(text);
+ break;
+ case "txtBlankValuesReplacement":
+ Properties.Settings.Default.Table_ColumnScriptNull = text;
break;
}
}
@@ -591,16 +700,17 @@ public void OnChange(Office.IRibbonControl control, string text)
{
ErrorHandler.DisplayMessage(ex);
}
+ finally
+ {
+ Properties.Settings.Default.Save();
+ ribbon.InvalidateControl(control.Id);
+ }
}
#endregion
#region | Ribbon Buttons |
- ///
- /// Copy only the visible cells that are selected
- ///
- ///
public void CopyVisibleCells()
{
Excel.Range visibleRange = null;
@@ -625,10 +735,6 @@ public void CopyVisibleCells()
}
}
- ///
- /// Removes all nonprintable characters from text and returns number of cells altered
- ///
- ///
public void CleanData()
{
Excel.ListObject tbl = null;
@@ -699,10 +805,6 @@ public void CleanData()
}
}
- ///
- /// Change zero string cell values to string "NULL"
- ///
- ///
public void ZeroStringToNull()
{
Excel.ListObject tbl = null;
@@ -753,14 +855,56 @@ public void ZeroStringToNull()
}
}
- ///
- /// Finds dates columns with the paste format settings or date specific columns and updates with date format setting
- ///
- ///
public void FormatDateColumns()
{
Excel.ListObject tbl = null;
Excel.Range cell = null;
+ Excel.Range cellCurrent = null;
+ try
+ {
+ if (ErrorHandler.IsAvailable(true) == false)
+ {
+ return;
+ }
+ ErrorHandler.CreateLogRecord();
+ tbl = Globals.ThisAddIn.Application.ActiveCell.ListObject;
+ cell = default(Excel.Range);
+ cellCurrent = Globals.ThisAddIn.Application.ActiveCell;
+ int columnIndex = cellCurrent.Column;
+ Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
+ foreach (Excel.ListColumn col in tbl.ListColumns)
+ {
+ cell = FirstNotNullCellInColumn(col.DataBodyRange);
+ if (((col.Index == columnIndex)))
+ {
+ col.DataBodyRange.NumberFormat = Properties.Settings.Default.Table_ColumnFormatDate;
+ col.DataBodyRange.HorizontalAlignment = Excel.Constants.xlCenter;
+ }
+ }
+ }
+ catch (System.Runtime.InteropServices.COMException ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ finally
+ {
+ Cursor.Current = System.Windows.Forms.Cursors.Arrow;
+ if (tbl != null)
+ Marshal.ReleaseComObject(tbl);
+ if (cell != null)
+ Marshal.ReleaseComObject(cell);
+ }
+ }
+
+ public void FormatDateColumnsAll()
+ {
+ Excel.ListObject tbl = null;
+ Excel.Range cell = null;
+
try
{
if (ErrorHandler.IsAvailable(true) == false)
@@ -770,15 +914,16 @@ public void FormatDateColumns()
ErrorHandler.CreateLogRecord();
tbl = Globals.ThisAddIn.Application.ActiveCell.ListObject;
cell = default(Excel.Range);
+
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
foreach (Excel.ListColumn col in tbl.ListColumns)
{
cell = FirstNotNullCellInColumn(col.DataBodyRange);
if (((cell != null)))
{
- if (cell.NumberFormat.ToString() == Properties.Settings.Default.Table_ColumnDateFormatFind | ErrorHandler.IsDate(cell.Value))
+ if (cell.NumberFormat.ToString() == Properties.Settings.Default.Table_ColumnFormatDatePaste | ErrorHandler.IsDate(cell.Value))
{
- col.DataBodyRange.NumberFormat = Properties.Settings.Default.Table_ColumnDateFormatReplace;
+ col.DataBodyRange.NumberFormat = Properties.Settings.Default.Table_ColumnFormatDate;
col.DataBodyRange.HorizontalAlignment = Excel.Constants.xlCenter;
}
}
@@ -802,10 +947,51 @@ public void FormatDateColumns()
}
}
- ///
- /// Convert a range of cells to a table with a specific table format
- ///
- ///
+ public void FormatTimeColumns()
+ {
+ Excel.ListObject tbl = null;
+ Excel.Range cell = null;
+ Excel.Range cellCurrent = null;
+ try
+ {
+ if (ErrorHandler.IsAvailable(true) == false)
+ {
+ return;
+ }
+ ErrorHandler.CreateLogRecord();
+ tbl = Globals.ThisAddIn.Application.ActiveCell.ListObject;
+ cell = default(Excel.Range);
+ cellCurrent = Globals.ThisAddIn.Application.ActiveCell;
+ int columnIndex = cellCurrent.Column;
+ Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
+ foreach (Excel.ListColumn col in tbl.ListColumns)
+ {
+ cell = FirstNotNullCellInColumn(col.DataBodyRange);
+ if (((col.Index == columnIndex)))
+ {
+ col.DataBodyRange.NumberFormat = Properties.Settings.Default.Table_ColumnFormatTime;
+ col.DataBodyRange.HorizontalAlignment = Excel.Constants.xlCenter;
+ }
+ }
+ }
+ catch (System.Runtime.InteropServices.COMException ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ finally
+ {
+ Cursor.Current = System.Windows.Forms.Cursors.Arrow;
+ if (tbl != null)
+ Marshal.ReleaseComObject(tbl);
+ if (cell != null)
+ Marshal.ReleaseComObject(cell);
+ }
+ }
+
public void FormatAsTable()
{
Excel.Range range = null;
@@ -843,10 +1029,6 @@ public void FormatAsTable()
}
}
- ///
- /// Remove interior cell color format
- ///
- ///
public void ClearInteriorColor()
{
Excel.ListObject tbl = null;
@@ -891,10 +1073,6 @@ public void ClearInteriorColor()
}
}
- ///
- /// Add a row per delimited string value from a column
- ///
- ///
public void SeparateValues()
{
Excel.ListObject tbl = null;
@@ -915,9 +1093,9 @@ public void SeparateValues()
for (int i = 1; i <= m + 1; i++) // by row
{
- string cellValue = tbl.Range.Cells[i, columnIndex].Value2.ToString();
- if (string.IsNullOrEmpty(cellValue) == false)
+ if (tbl.Range.Cells[i, columnIndex].Value2 != null)
{
+ string cellValue = tbl.Range.Cells[i, columnIndex].Value2.ToString();
string[] metadata = cellValue.Split(Properties.Settings.Default.Table_ColumnSeparateValuesDelimiter);
int countValues = metadata.Length - 1;
if (countValues > 0)
@@ -952,55 +1130,6 @@ public void SeparateValues()
}
}
- ///
- /// Creates a recursive file listing based on the users selected directory
- ///
- ///
- public void CreateFileList()
- {
- string filePath = Properties.Settings.Default.Option_PathFileListing;
- try
- {
- ErrorHandler.CreateLogRecord();
- DialogResult msgDialogResult = DialogResult.None;
- FolderBrowserDialog dlg = new FolderBrowserDialog();
- if (Properties.Settings.Default.Option_PathFileListingSelect == true)
- {
- dlg.RootFolder = Environment.SpecialFolder.MyComputer;
- dlg.SelectedPath = filePath;
- msgDialogResult = dlg.ShowDialog();
- filePath = dlg.SelectedPath;
- }
- if (msgDialogResult == DialogResult.OK | Properties.Settings.Default.Option_PathFileListingSelect == false)
- {
- filePath += @"\";
- string scriptCommands = string.Empty;
- string currentDate = DateTime.Now.ToString("dd.MMM.yyyy_hh.mm.tt");
- string batchFileName = filePath + "FileListing_" + currentDate + "_" + Environment.UserName + ".bat";
- scriptCommands = "echo off" + Environment.NewLine;
- scriptCommands += "cd %1" + Environment.NewLine;
- scriptCommands += @"dir """ + filePath + @""" /s /a-h /b /-p /o:gen >""" + filePath + "FileListing_" + currentDate + "_" + Environment.UserName + @".csv""" + Environment.NewLine;
- scriptCommands += @"""" + filePath + "FileListing_" + currentDate + "_" + Environment.UserName + @".csv""" + Environment.NewLine;
- scriptCommands += "cd .. " + Environment.NewLine;
- scriptCommands += "echo on" + Environment.NewLine;
- System.IO.File.WriteAllText(batchFileName, scriptCommands);
- AssemblyInfo.OpenFile(batchFileName);
- }
- }
- catch (System.UnauthorizedAccessException)
- {
- MessageBox.Show("You don't have access to this folder, bro!" + Environment.NewLine + Environment.NewLine + filePath, "No action taken.", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- catch (Exception ex)
- {
- ErrorHandler.DisplayMessage(ex);
- }
- }
-
- ///
- /// Opens the settings taskpane
- ///
- ///
public void OpenSettings()
{
try
@@ -1033,10 +1162,6 @@ public void OpenSettings()
}
}
- ///
- /// Opens an as built help file
- ///
- ///
public void OpenReadMe()
{
ErrorHandler.CreateLogRecord();
@@ -1044,32 +1169,13 @@ public void OpenReadMe()
}
- ///
- /// Opens an as built help file
- ///
- ///
public void OpenNewIssue()
{
ErrorHandler.CreateLogRecord();
- System.Diagnostics.Process.Start(Properties.Settings.Default.App_PathReportIssue);
+ System.Diagnostics.Process.Start(Properties.Settings.Default.App_PathNewIssue);
}
- ///
- /// Opens a api help file
- ///
- ///
- public void OpenHelpApi()
- {
- ErrorHandler.CreateLogRecord();
- string clickOnceLocation = AssemblyInfo.GetClickOnceLocation();
- AssemblyInfo.OpenFile(Path.Combine(clickOnceLocation, @"Documentation\\Api Help.chm"));
- }
-
- ///
- /// Opens the graph taskpane
- ///
- ///
public void OpenGraphData()
{
try
@@ -1091,7 +1197,7 @@ public void OpenGraphData()
myTaskPaneGraphData = Globals.ThisAddIn.CustomTaskPanes.Add(myGraphData, "Graph Data for " + Scripts.AssemblyInfo.Title);
myTaskPaneGraphData.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
myTaskPaneGraphData.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
- myTaskPaneGraphData.Width = 300;
+ myTaskPaneGraphData.Width = 450;
myTaskPaneGraphData.Visible = true;
}
@@ -1103,18 +1209,95 @@ public void OpenGraphData()
}
+ public void OpenSnippingTool()
+ {
+ string filePath;
+ try
+ {
+ if (System.Environment.Is64BitOperatingSystem)
+ {
+ filePath = "C:\\Windows\\sysnative\\SnippingTool.exe";
+ }
+ else
+ {
+ filePath = "C:\\Windows\\system32\\SnippingTool.exe";
+ }
+ System.Diagnostics.Process.Start(filePath);
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ }
+
+ public void OpenProblemStepRecorder()
+ {
+ string filePath = @"C:\Windows\System32\psr.exe";
+ try
+ {
+ System.Diagnostics.Process.Start(filePath);
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ }
+
+ public static void SaveVersion()
+ {
+ try
+ {
+ var filePath = Globals.ThisAddIn.Application.ActiveWorkbook.FullName; //AssemblyInfo.GetCurrentFileName();
+ filePath = string.Concat(
+ Path.GetFileNameWithoutExtension(filePath),
+ "_",
+ DateTime.Now.ToString("yyyy.MM.dd_HH.mm.ss.fff"),
+ "_",
+ Environment.UserName,
+ Path.GetExtension(filePath)
+ );
+ Globals.ThisAddIn.Application.ActiveWorkbook.SaveCopyAs(filePath);
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ }
+
+ public static void SaveCode()
+ {
+ try
+ {
+ //update this for VBA and XML part of current file
+ var filePath = AssemblyInfo.GetCurrentFileName();
+ filePath = string.Concat(
+ Path.GetFileNameWithoutExtension(filePath),
+ "_",
+ DateTime.Now.ToString("yyyy.MM.dd_HH.mm.ss.fff"),
+ "_",
+ Environment.UserName,
+ Path.GetExtension(filePath)
+ );
+ Globals.ThisAddIn.Application.ActiveWorkbook.SaveCopyAs(filePath);
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ }
+
#endregion
#region | Subroutines |
- ///
- /// Used to apply quoting based on the column type
- ///
- /// Represents the list column
- /// A method that returns a string of a quote based on application settings for this value.
- ///
public static string ApplyTextQuotes(Excel.ListColumn col)
{
+ Excel.Range cell = FirstNotNullCellInColumn(col.DataBodyRange);
+ string timeFormat = Properties.Settings.Default.Table_ColumnFormatTime;
try
{
if ((GetSqlDataType(col) != Properties.Settings.Default.Column_TypeNumeric))
@@ -1123,7 +1306,14 @@ public static string ApplyTextQuotes(Excel.ListColumn col)
}
else
{
- return string.Empty;
+ if (cell.NumberFormat.ToString() == timeFormat)
+ {
+ return Properties.Settings.Default.Table_ColumnScriptQuote;
+ }
+ else
+ {
+ return string.Empty;
+ }
}
}
catch (Exception ex)
@@ -1133,15 +1323,6 @@ public static string ApplyTextQuotes(Excel.ListColumn col)
}
}
- ///
- /// Return the list of column names in formatted string for SQL select statements
- ///
- /// Represents the Excel Range value
- /// Table alias used to prefix column names
- /// The prefix character for the column name e.g. "["
- /// The suffix character for the column name e.g. "]"
- /// The selection character for the column name e.g. ", "
- /// A method that returns a string of the column names
public static string ConcatenateColumnNames(Excel.Range rng, string tableAliasName = "", string prefixChar = "", string suffixChar = "", string selectionChar = ", ")
{
try
@@ -1170,14 +1351,7 @@ public static string ConcatenateColumnNames(Excel.Range rng, string tableAliasNa
}
}
- ///
- /// Return the list of column names in formatted string for SQL joins
- ///
- /// Represents the Excel Range value
- /// Table alias used to prefix column names
- /// Table alias used to prefix column names
- /// A method that returns a string of the column names
- public static string ConcatenateColumnNamesJoin(Excel.Range rng, string tableAliasNameTarget, string tableAliasNameSource)
+ public static string ConcatenateColumnNamesJoin(Excel.Range rng, string tableAliasNameTarget, string tableAliasNameSource, string joinPrefix)
{
try
{
@@ -1186,10 +1360,10 @@ public static string ConcatenateColumnNamesJoin(Excel.Range rng, string tableAli
{
if (rng.Columns.EntireColumn[i].Hidden == false)
{
- columnNames = columnNames + ", " + tableAliasNameTarget + ".[" + ((Excel.Range)rng.Cells[1, i]).Value2 + "] = " + tableAliasNameSource + ".[" + ((Excel.Range)rng.Cells[1, i]).Value2 + "]" + Environment.NewLine;
+ columnNames = columnNames + joinPrefix + tableAliasNameTarget + ".[" + ((Excel.Range)rng.Cells[1, i]).Value2 + "] = " + tableAliasNameSource + ".[" + ((Excel.Range)rng.Cells[1, i]).Value2 + "]" + Environment.NewLine;
}
}
- columnNames = columnNames.Substring(2, columnNames.Length - 2);
+ columnNames = new string(' ', joinPrefix.Length) + columnNames.Substring(joinPrefix.Length, columnNames.Length - joinPrefix.Length);
return columnNames;
}
catch (Exception)
@@ -1198,15 +1372,6 @@ public static string ConcatenateColumnNamesJoin(Excel.Range rng, string tableAli
}
}
- ///
- /// Get the first not null cell
- ///
- /// Represents the cell range
- /// A method that returns a range
- ///
- /// TODO: find a way to do this without looping.
- /// NOTE: SpecialCells is unreliable when called from VBA UDFs (Odd ??!)
- ///
public static Excel.Range FirstNotNullCellInColumn(Excel.Range rng)
{
try
@@ -1237,13 +1402,6 @@ public static Excel.Range FirstNotNullCellInColumn(Excel.Range rng)
}
}
- ///
- /// Generate a formula reference with text formatting
- ///
- /// Represents the list column
- /// Represents the formatting string
- /// A method that returns a string of a formula
- ///
public static string FormatCellText(Excel.ListColumn col, string fmt)
{
string functionReturnValue = null;
@@ -1263,12 +1421,6 @@ public static string FormatCellText(Excel.ListColumn col, string fmt)
}
}
- ///
- /// To return a data format for a column
- ///
- /// Represents the list column
- /// A method that returns a string
- ///
public static string GetColumnFormat(Excel.ListColumn col)
{
try
@@ -1279,10 +1431,9 @@ public static string GetColumnFormat(Excel.ListColumn col)
switch (GetSqlDataType(col))
{
case 2:
- fmt = Properties.Settings.Default.Table_ColumnDateFormatReplace;
+ fmt = Properties.Settings.Default.Table_ColumnFormatDate;
return FormatCellText(col, fmt);
case 1:
- // we will use the column formatting if some is applied
if ((col.DataBodyRange.NumberFormat != null))
{
nFmt = col.DataBodyRange.NumberFormat.ToString();
@@ -1302,12 +1453,6 @@ public static string GetColumnFormat(Excel.ListColumn col)
}
}
- ///
- /// Determine the likely SQL type of the column
- ///
- /// Represents the list column
- /// A method that returns an integer of the column data type
- ///
public static int GetSqlDataType(Excel.ListColumn col)
{
try
@@ -1336,7 +1481,7 @@ public static int GetSqlDataType(Excel.ListColumn col)
}
//Excel changes the case of date formats on custom cell format types
- bool result = Properties.Settings.Default.Table_ColumnDateFormatReplace.Equals(col.DataBodyRange.NumberFormat.ToString(), StringComparison.OrdinalIgnoreCase);
+ bool result = Properties.Settings.Default.Table_ColumnFormatDate.Equals(col.DataBodyRange.NumberFormat.ToString(), StringComparison.OrdinalIgnoreCase);
// NOTE: next test relies consistent formatting on numerics in a column
// so we only have to test the first cell
if (ErrorHandler.IsDate(FirstNotNullCellInColumn(col.DataBodyRange)) | result == true)
@@ -1355,18 +1500,12 @@ public static int GetSqlDataType(Excel.ListColumn col)
}
}
- ///
- /// Return the count of items in a delimited list
- ///
- /// Represents the list of values in a string
- /// Represents the list delimiter
- /// the number of values in a delimited string
public int GetListItemCount(string valueList, string delimiter)
{
try
{
- string[] comboList = valueList.Split((delimiter).ToCharArray());
- return comboList.GetUpperBound(0) + 1;
+ string[] comboList = valueList.Split(delimiter.ToCharArray());
+ return comboList.Length;
}
catch (Exception ex)
@@ -1376,17 +1515,11 @@ public int GetListItemCount(string valueList, string delimiter)
}
}
- ///
- /// Used to update/reset the ribbon values
- ///
public void InvalidateRibbon()
{
ribbon.Invalidate();
}
- ///
- /// Open the taskpane for a script view
- ///
public static void OpenScriptPane()
{
try
@@ -1397,7 +1530,7 @@ public static void OpenScriptPane()
myScript.Dispose();
}
myScript = new TaskPane.Script();
- myTaskPaneScript = Globals.ThisAddIn.CustomTaskPanes.Add(myScript, "Script for " + Scripts.AssemblyInfo.Title);
+ myTaskPaneScript = Globals.ThisAddIn.CustomTaskPanes.Add(myScript, Ribbon.AppVariables.ControlLabel);
myTaskPaneScript.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
myTaskPaneScript.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
myTaskPaneScript.Width = 675;
@@ -1410,9 +1543,6 @@ public static void OpenScriptPane()
}
}
- ///
- /// Open the taskpane for the a table view list
- ///
public void OpenTableDataPane()
{
try
@@ -1423,7 +1553,7 @@ public void OpenTableDataPane()
myTableData.Dispose();
}
myTableData = new TaskPane.TableData();
- myTaskPaneTableData = Globals.ThisAddIn.CustomTaskPanes.Add(myTableData, "List of " + Ribbon.AppVariables.TableName + " for " + Scripts.AssemblyInfo.Title);
+ myTaskPaneTableData = Globals.ThisAddIn.CustomTaskPanes.Add(myTableData, Ribbon.AppVariables.TableName);
myTaskPaneTableData.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
myTaskPaneTableData.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
myTaskPaneTableData.Width = 300;
@@ -1436,11 +1566,6 @@ public void OpenTableDataPane()
}
}
- ///
- /// Update the value of the combobox from a data table by index
- ///
- /// Represents the index of the list value
- /// the label value for the combobox index
public string UpdateDateFormatComboBoxSource(int itemIndex)
{
try
@@ -1454,11 +1579,19 @@ public string UpdateDateFormatComboBoxSource(int itemIndex)
}
}
- ///
- /// Update the value of the combobox from a data table by index
- ///
- /// Represents the index of the list value
- /// the label value for the combobox index
+ public string UpdateTimeFormatComboBoxSource(int itemIndex)
+ {
+ try
+ {
+ return Data.TimeFormatTable.Rows[itemIndex]["FormatString"].ToString();
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ return string.Empty;
+ }
+ }
+
public string UpdateTableAliasComboBoxSource(int itemIndex)
{
try
@@ -1473,6 +1606,17 @@ public string UpdateTableAliasComboBoxSource(int itemIndex)
}
+ public static string GetCommentHeader(string purposeLine = "", string prefix = "/*", string suffix = "*/")
+ {
+ string noteLine = string.Concat("Generated from ", AssemblyInfo.Title, " ", AssemblyInfo.FileVersion, " ", DateTime.Now.ToString("yyyy.MM.dd HH.mm.ss"));
+ string dividerLine = string.Concat(System.Linq.Enumerable.Repeat("*", 75));
+ string headerComment = prefix + dividerLine + Environment.NewLine;
+ headerComment += "** Purpose: " + purposeLine + Environment.NewLine;
+ headerComment += "** Note: " + noteLine + Environment.NewLine;
+ headerComment += dividerLine + suffix + Environment.NewLine + Environment.NewLine;
+ return headerComment;
+ }
+
#endregion
}
diff --git a/CS/Scripts/Syntax/CaseInsensitivePatternDefinition.cs b/CS/Scripts/Syntax/CaseInsensitivePatternDefinition.cs
index 5d89af4..1a6ae17 100644
--- a/CS/Scripts/Syntax/CaseInsensitivePatternDefinition.cs
+++ b/CS/Scripts/Syntax/CaseInsensitivePatternDefinition.cs
@@ -2,24 +2,13 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// CaseInsensitivePatternDefinition
- ///
public class CaseInsensitivePatternDefinition : PatternDefinition
{
- ///
- /// CaseInsensitivePatternDefinition
- ///
- /// string values
public CaseInsensitivePatternDefinition(IEnumerable tokens)
: base(false, tokens)
{
}
- ///
- /// CaseInsensitivePatternDefinition
- ///
- /// string values
public CaseInsensitivePatternDefinition(params string[] tokens)
: base(false, tokens)
{
diff --git a/CS/Scripts/Syntax/ColorUtils.cs b/CS/Scripts/Syntax/ColorUtils.cs
index e63638a..8c63624 100644
--- a/CS/Scripts/Syntax/ColorUtils.cs
+++ b/CS/Scripts/Syntax/ColorUtils.cs
@@ -3,16 +3,8 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// ColorUtils
- ///
public class ColorUtils
{
- ///
- /// ColorToRtfTableEntry
- ///
- /// this is the system drawing color
- /// returns the string format of the color
public static string ColorToRtfTableEntry(Color color)
{
return String.Format(@"\red{0}\green{1}\blue{2}", color.R, color.G, color.B);
diff --git a/CS/Scripts/Syntax/Expression.cs b/CS/Scripts/Syntax/Expression.cs
index f4bd5b5..e2f6275 100644
--- a/CS/Scripts/Syntax/Expression.cs
+++ b/CS/Scripts/Syntax/Expression.cs
@@ -2,30 +2,12 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// Expression
- ///
public class Expression
{
- ///
- /// ExpressionType
- ///
public ExpressionType Type { get; private set; }
- ///
- /// Content
- ///
public string Content { get; private set; }
- ///
- /// Group
- ///
public string Group { get; private set; }
- ///
- /// Expression
- ///
- /// content
- /// type
- /// group
public Expression(string content, ExpressionType type, string group)
{
if (content == null)
@@ -38,20 +20,11 @@ public Expression(string content, ExpressionType type, string group)
Group = group;
}
- ///
- /// Expression
- ///
- /// content
- /// type
public Expression(string content, ExpressionType type)
: this(content, type, String.Empty)
{
}
- ///
- /// To override the system ToString function
- ///
- /// returns the overrided string
public override string ToString()
{
if (Type == ExpressionType.Newline)
diff --git a/CS/Scripts/Syntax/ExpressionType.cs b/CS/Scripts/Syntax/ExpressionType.cs
index 4523d35..baea94a 100644
--- a/CS/Scripts/Syntax/ExpressionType.cs
+++ b/CS/Scripts/Syntax/ExpressionType.cs
@@ -1,57 +1,19 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// Enumerates the type of the parsed content
- ///
public enum ExpressionType
{
- ///
- /// None
- ///
+
None = 0,
- ///
- /// i.e. a word which is neither keyword nor inside any word-group
- ///
Identifier,
- ///
- /// Operator
- ///
Operator,
- ///
- /// Number
- ///
Number,
- ///
- /// Whitespace
- ///
Whitespace,
- ///
- /// Newline
- ///
Newline,
- ///
- /// Keyword
- ///
Keyword,
- ///
- /// Comment
- ///
Comment,
- ///
- /// CommentLine
- ///
CommentLine,
- ///
- /// String
- ///
String,
- ///
- /// needs extra argument
- ///
DelimitedGroup,
- ///
- /// needs extra argument
- ///
WordGroup
}
}
diff --git a/CS/Scripts/Syntax/PatternDefinition.cs b/CS/Scripts/Syntax/PatternDefinition.cs
index a67e179..3c74be9 100644
--- a/CS/Scripts/Syntax/PatternDefinition.cs
+++ b/CS/Scripts/Syntax/PatternDefinition.cs
@@ -4,19 +4,13 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// PatternDefinition
- ///
+
public class PatternDefinition
{
private readonly Regex _regex;
private ExpressionType _expressionType = ExpressionType.Identifier;
private readonly bool _isCaseSensitive = false;
- ///
- /// PatternDefinition
- ///
- /// regularExpression
public PatternDefinition(Regex regularExpression)
{
if (regularExpression == null)
@@ -24,10 +18,6 @@ public PatternDefinition(Regex regularExpression)
_regex = regularExpression;
}
- ///
- /// PatternDefinition
- ///
- /// regexPattern
public PatternDefinition(string regexPattern)
{
if (String.IsNullOrEmpty(regexPattern))
@@ -36,29 +26,16 @@ public PatternDefinition(string regexPattern)
_regex = new Regex(regexPattern, RegexOptions.Compiled);
}
- ///
- /// PatternDefinition
- ///
- /// tokens
public PatternDefinition(params string[] tokens)
: this(true, tokens)
{
}
- ///
- /// PatternDefinition
- ///
- /// tokens
public PatternDefinition(IEnumerable tokens)
: this(true, tokens)
{
}
- ///
- /// PatternDefinition
- ///
- /// caseSensitive
- /// tokens
internal PatternDefinition(bool caseSensitive, IEnumerable tokens)
{
if (tokens == null)
@@ -88,26 +65,17 @@ internal PatternDefinition(bool caseSensitive, IEnumerable tokens)
_regex = new Regex(pattern, regexOptions);
}
- ///
- /// ExpressionType
- ///
internal ExpressionType ExpressionType
{
get { return _expressionType; }
set { _expressionType = value; }
}
- ///
- ///
- ///
internal bool IsCaseSensitive
{
get { return _isCaseSensitive; }
}
- ///
- /// Regex
- ///
internal Regex Regex
{
get { return _regex; }
diff --git a/CS/Scripts/Syntax/PatternStyleMap.cs b/CS/Scripts/Syntax/PatternStyleMap.cs
index 5e296f7..2144460 100644
--- a/CS/Scripts/Syntax/PatternStyleMap.cs
+++ b/CS/Scripts/Syntax/PatternStyleMap.cs
@@ -2,30 +2,13 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// PatternStyleMap
- ///
+
internal class PatternStyleMap
{
- ///
- /// Name
- ///
public string Name { get; set; }
- ///
- /// PatternDefinition
- ///
public PatternDefinition PatternDefinition { get; set; }
- ///
- /// SyntaxStyle
- ///
public SyntaxStyle SyntaxStyle { get; set; }
- ///
- /// PatternStyleMap
- ///
- /// name
- /// patternDefinition
- /// syntaxStyle
public PatternStyleMap(string name, PatternDefinition patternDefinition, SyntaxStyle syntaxStyle)
{
if (patternDefinition == null)
diff --git a/CS/Scripts/Syntax/StringExtensions.cs b/CS/Scripts/Syntax/StringExtensions.cs
index e52bb57..52e3914 100644
--- a/CS/Scripts/Syntax/StringExtensions.cs
+++ b/CS/Scripts/Syntax/StringExtensions.cs
@@ -2,27 +2,13 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// StringExtensions
- ///
public static class StringExtensions
{
- ///
- /// NormalizeLineBreaks
- ///
- /// instance
- /// preferredLineBreak
- /// returns the preferred way of doing line breaks
public static string NormalizeLineBreaks(this string instance, string preferredLineBreak)
{
return instance.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", preferredLineBreak);
}
- ///
- /// NormalizeLineBreaks
- ///
- /// instance
- /// returns the line break with Environment.NewLine
public static string NormalizeLineBreaks(this string instance)
{
return NormalizeLineBreaks(instance, Environment.NewLine);
diff --git a/CS/Scripts/Syntax/StyleGroupPair.cs b/CS/Scripts/Syntax/StyleGroupPair.cs
index 465047f..3c7d4e8 100644
--- a/CS/Scripts/Syntax/StyleGroupPair.cs
+++ b/CS/Scripts/Syntax/StyleGroupPair.cs
@@ -2,29 +2,12 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// StyleGroupPair
- ///
internal class StyleGroupPair
{
- ///
- /// Index
- ///
public int Index { get; set; }
- ///
- /// SyntaxStyle
- ///
public SyntaxStyle SyntaxStyle { get; set; }
- ///
- /// GroupName
- ///
public string GroupName { get; set; }
- ///
- /// StyleGroupPair
- ///
- /// syntaxStyle
- /// groupName
public StyleGroupPair(SyntaxStyle syntaxStyle, string groupName)
{
if (syntaxStyle == null)
diff --git a/CS/Scripts/Syntax/SyntaxHighlighter.cs b/CS/Scripts/Syntax/SyntaxHighlighter.cs
index 12f7491..80eacf9 100644
--- a/CS/Scripts/Syntax/SyntaxHighlighter.cs
+++ b/CS/Scripts/Syntax/SyntaxHighlighter.cs
@@ -8,45 +8,15 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// SyntaxHighlighter
- ///
public class SyntaxHighlighter
{
- ///
- /// Reference to the RichTextBox instance, for which the syntax highlighting is going to occur.
- ///
private readonly RichTextBox _richTextBox;
-
- ///
- /// Reference to the font size of the RichTextBox instance, for which the syntax highlighting is going to occur.
- ///
private readonly int _fontSizeFactor;
-
- ///
- /// Reference to the font name of the RichTextBox instance, for which the syntax highlighting is going to occur.
- ///
private readonly string _fontName;
-
- ///
- /// Determines whether the program is busy creating rtf for the previous modification of the text-box. It is necessary to avoid blinks when the user is typing fast.
- ///
private bool _isDuringHighlight;
-
- ///
- /// styleGroupPairs
- ///
private List _styleGroupPairs;
-
- ///
- /// patternStyles
- ///
private readonly List _patternStyles = new List();
- ///
- /// SyntaxHighlighter
- ///
- /// richTextBox
public SyntaxHighlighter(RichTextBox richTextBox)
{
if (richTextBox == null)
@@ -62,29 +32,13 @@ public SyntaxHighlighter(RichTextBox richTextBox)
_richTextBox.TextChanged += RichTextBox_TextChanged;
}
- ///
- /// Gets or sets a value indicating whether highlighting should be disabled or not.
- /// If true, the user input will remain intact. If false, the rich content will be
- /// modified to match the syntax of the currently selected language.
- ///
public bool DisableHighlighting { get; set; }
- ///
- /// AddPattern
- ///
- /// patternDefinition
- /// syntaxStyle
public void AddPattern(PatternDefinition patternDefinition, SyntaxStyle syntaxStyle)
{
AddPattern((_patternStyles.Count + 1).ToString(CultureInfo.InvariantCulture), patternDefinition, syntaxStyle);
}
- ///
- /// AddPattern
- ///
- /// name
- /// patternDefinition
- /// syntaxStyle
public void AddPattern(string name, PatternDefinition patternDefinition, SyntaxStyle syntaxStyle)
{
if (patternDefinition == null)
@@ -102,29 +56,17 @@ public void AddPattern(string name, PatternDefinition patternDefinition, SyntaxS
_patternStyles.Add(new PatternStyleMap(name, patternDefinition, syntaxStyle));
}
- ///
- /// SyntaxStyle
- ///
- /// returns the new style
protected SyntaxStyle GetDefaultStyle()
{
return new SyntaxStyle(_richTextBox.ForeColor, _richTextBox.Font.Bold, _richTextBox.Font.Italic);
}
- ///
- /// PatternStyleMap
- ///
- /// name
- /// returns the style map
private PatternStyleMap FindPatternStyle(string name)
{
var patternStyle = _patternStyles.FirstOrDefault(p => String.Equals(p.Name, name, StringComparison.Ordinal));
return patternStyle;
}
- ///
- /// Rehighlights the text-box content.
- ///
public void ReHighlight()
{
if (!DisableHighlighting)
@@ -136,21 +78,11 @@ public void ReHighlight()
}
}
- ///
- /// RichTextBox_TextChanged
- ///
- /// sender
- /// e
private void RichTextBox_TextChanged(object sender, EventArgs e)
{
ReHighlight();
}
- ///
- /// IEnumerable TODO: make abstact
- ///
- /// text
- /// parsedExpressions
internal IEnumerable Parse(string text)
{
text = text.NormalizeLineBreaks("\n");
@@ -165,15 +97,8 @@ internal IEnumerable Parse(string text)
return parsedExpressions;
}
- ///
- /// lineBreakRegex TODO: move to child
- ///
private Regex _lineBreakRegex;
- ///
- /// GetLineBreakRegex TODO: move to child
- ///
- /// lineBreakRegex
private Regex GetLineBreakRegex()
{
if (_lineBreakRegex == null)
@@ -182,11 +107,6 @@ private Regex GetLineBreakRegex()
return _lineBreakRegex;
}
- ///
- /// List
- ///
- /// expressions
- /// parsedExpressions
private List ProcessLineBreaks(List expressions)
{
var parsedExpressions = new List();
@@ -231,12 +151,6 @@ private List ProcessLineBreaks(List expressions)
return parsedExpressions;
}
- ///
- /// List TODO: move to relevant child class
- ///
- /// patternStyleMap
- /// expressions
- /// parsedExpressions
private List ParsePattern(PatternStyleMap patternStyleMap, List expressions)
{
var parsedExpressions = new List();
@@ -284,10 +198,6 @@ private List ParsePattern(PatternStyleMap patternStyleMap, List
- /// IEnumerable TODO: make abstract
- ///
- /// StyleGroupPair
internal IEnumerable GetStyles()
{
yield return new StyleGroupPair(GetDefaultStyle(), String.Empty);
@@ -299,20 +209,11 @@ internal IEnumerable GetStyles()
}
}
- ///
- /// GetGroupName TODO: make virtual
- ///
- /// expression
- /// expression.Group
internal virtual string GetGroupName(Expression expression)
{
return expression.Group;
}
- ///
- /// List
- ///
- /// styleGroupPairs
private List GetStyleGroupPairs()
{
if (_styleGroupPairs == null)
@@ -329,9 +230,7 @@ private List GetStyleGroupPairs()
}
#region RTF Stuff
- ///
- /// The base method that highlights the text-box content.
- ///
+
private void HighlighTextBase()
{
_isDuringHighlight = true;
@@ -401,10 +300,6 @@ private void HighlighTextBase()
}
}
- ///
- /// RTFColorTable
- ///
- /// sbRtfColorTable.ToString()
private string RTFColorTable()
{
var styleGroupPairs = GetStyleGroupPairs();
@@ -425,10 +320,6 @@ private string RTFColorTable()
return sbRtfColorTable.ToString();
}
- ///
- /// RTFHeader
- ///
- /// String.Concat
private string RTFHeader()
{
return String.Concat(@"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 ", _fontName, @";}}");
diff --git a/CS/Scripts/Syntax/SyntaxStyle.cs b/CS/Scripts/Syntax/SyntaxStyle.cs
index 081f11f..eb8fdc2 100644
--- a/CS/Scripts/Syntax/SyntaxStyle.cs
+++ b/CS/Scripts/Syntax/SyntaxStyle.cs
@@ -2,30 +2,12 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// SyntaxStyle
- ///
public class SyntaxStyle
{
- ///
- /// Bold
- ///
public bool Bold { get; set; }
- ///
- /// Italic
- ///
public bool Italic { get; set; }
- ///
- /// Color
- ///
public Color Color { get; set; }
- ///
- /// SyntaxStyle
- ///
- /// color
- /// bold
- /// italic
public SyntaxStyle(Color color, bool bold, bool italic)
{
Color = color;
@@ -33,10 +15,6 @@ public SyntaxStyle(Color color, bool bold, bool italic)
Italic = italic;
}
- ///
- /// SyntaxStyle
- ///
- /// color
public SyntaxStyle(Color color)
: this(color, false, false)
{
diff --git a/CS/Scripts/Syntax/TextBoxBaseExtensions.cs b/CS/Scripts/Syntax/TextBoxBaseExtensions.cs
index e7434e2..2b98a45 100644
--- a/CS/Scripts/Syntax/TextBoxBaseExtensions.cs
+++ b/CS/Scripts/Syntax/TextBoxBaseExtensions.cs
@@ -4,18 +4,9 @@
namespace ScriptHelp.Scripts.Syntax
{
- ///
- /// TextBoxBaseExtensions
- ///
public static class TextBoxBaseExtensions
{
- ///
- /// In order to make flicker free changes to the TextBox's text, it will
- /// first disable the TextBox using some Win32 API stuff, applies the changes
- /// passed through the Action argument, and then re-enables the TextBox.
- ///
- /// textBox
- /// action
+
public static void DisableThenDoThenEnable(this TextBoxBase textBox, Action action)
{
IntPtr stateLocked = IntPtr.Zero;
@@ -37,53 +28,28 @@ public static void DisableThenDoThenEnable(this TextBoxBase textBox, Action acti
Unlock(textBox, ref stateLocked);
}
- ///
- /// GetHScrollPos
- ///
- /// textBox
- /// GetScrollPos
public static int GetHScrollPos(this TextBoxBase textBox)
{
return GetScrollPos((int)textBox.Handle, SB_HORZ);
}
- ///
- /// SetHScrollPos
- ///
- /// textBox
- /// value
public static void SetHScrollPos(this TextBoxBase textBox, int value)
{
SetScrollPos(textBox.Handle, SB_HORZ, value, true);
PostMessageA(textBox.Handle, WM_HSCROLL, SB_THUMBPOSITION + 0x10000 * value, 0);
}
- ///
- /// GetVScrollPos
- ///
- /// textBox
- /// GetScrollPos
public static int GetVScrollPos(this TextBoxBase textBox)
{
return GetScrollPos((int)textBox.Handle, SB_VERT);
}
- ///
- /// SetVScrollPos
- ///
- /// textBox
- /// value
public static void SetVScrollPos(this TextBoxBase textBox, int value)
{
SetScrollPos(textBox.Handle, SB_VERT, value, true);
PostMessageA(textBox.Handle, WM_VSCROLL, SB_THUMBPOSITION + 0x10000 * value, 0);
}
- ///
- /// Lock
- ///
- /// textBox
- /// stateLocked
private static void Lock(this TextBoxBase textBox, ref IntPtr stateLocked)
{
// Stop redrawing:
@@ -93,11 +59,6 @@ private static void Lock(this TextBoxBase textBox, ref IntPtr stateLocked)
// change colors and stuff in the RichTextBox
}
- ///
- /// Unlock
- ///
- /// textBox
- /// stateLocked
private static void Unlock(this TextBoxBase textBox, ref IntPtr stateLocked)
{
// turn on events
diff --git a/CS/TaskPane/GraphData.Designer.cs b/CS/TaskPane/GraphData.Designer.cs
index bc6bcd3..402d153 100644
--- a/CS/TaskPane/GraphData.Designer.cs
+++ b/CS/TaskPane/GraphData.Designer.cs
@@ -28,145 +28,144 @@ protected override void Dispose(bool disposing)
///
private void InitializeComponent()
{
- System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
- System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
- System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
- this.dgvGraphData = new System.Windows.Forms.DataGridView();
- this.toolStrip1 = new System.Windows.Forms.ToolStrip();
- this.btnStart = new System.Windows.Forms.ToolStripButton();
- this.Rpie = new System.Windows.Forms.DataVisualization.Charting.Chart();
- this.dgvGraphDataResults = new System.Windows.Forms.DataGridView();
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- ((System.ComponentModel.ISupportInitialize)(this.dgvGraphData)).BeginInit();
- this.toolStrip1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.Rpie)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dgvGraphDataResults)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- this.SuspendLayout();
- //
- // dgvGraphData
- //
- this.dgvGraphData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+ System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
+ System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
+ this.dgvGraphData = new System.Windows.Forms.DataGridView();
+ this.mnuToolbar = new System.Windows.Forms.ToolStrip();
+ this.btnStart = new System.Windows.Forms.ToolStripButton();
+ this.Rpie = new System.Windows.Forms.DataVisualization.Charting.Chart();
+ this.dgvGraphDataResults = new System.Windows.Forms.DataGridView();
+ this.picTable = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvGraphData)).BeginInit();
+ this.mnuToolbar.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.Rpie)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvGraphDataResults)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.picTable)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dgvGraphData
+ //
+ this.dgvGraphData.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.dgvGraphData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dgvGraphData.Location = new System.Drawing.Point(186, 728);
- this.dgvGraphData.Name = "dgvGraphData";
- this.dgvGraphData.Size = new System.Drawing.Size(94, 22);
- this.dgvGraphData.TabIndex = 1;
- this.dgvGraphData.Visible = false;
- //
- // toolStrip1
- //
- this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
- this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.dgvGraphData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dgvGraphData.Location = new System.Drawing.Point(186, 728);
+ this.dgvGraphData.Name = "dgvGraphData";
+ this.dgvGraphData.Size = new System.Drawing.Size(94, 22);
+ this.dgvGraphData.TabIndex = 1;
+ this.dgvGraphData.Visible = false;
+ //
+ // mnuToolbar
+ //
+ this.mnuToolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+ this.mnuToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnStart});
- this.toolStrip1.Location = new System.Drawing.Point(0, 0);
- this.toolStrip1.Name = "toolStrip1";
- this.toolStrip1.Size = new System.Drawing.Size(300, 25);
- this.toolStrip1.TabIndex = 2;
- this.toolStrip1.Text = "toolStrip1";
- //
- // btnStart
- //
- this.btnStart.Image = global::ScriptHelp.Properties.Resources.Play;
- this.btnStart.ImageTransparentColor = System.Drawing.Color.Magenta;
- this.btnStart.Name = "btnStart";
- this.btnStart.Size = new System.Drawing.Size(51, 22);
- this.btnStart.Text = "Start";
- this.btnStart.ToolTipText = "Would you like to play a game?";
- this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
- //
- // Rpie
- //
- chartArea1.Area3DStyle.Enable3D = true;
- chartArea1.Area3DStyle.LightStyle = System.Windows.Forms.DataVisualization.Charting.LightStyle.Realistic;
- chartArea1.Area3DStyle.WallWidth = 10;
- chartArea1.Name = "ChartArea1";
- this.Rpie.ChartAreas.Add(chartArea1);
- legend1.Enabled = false;
- legend1.Name = "Legend1";
- this.Rpie.Legends.Add(legend1);
- this.Rpie.Location = new System.Drawing.Point(0, 28);
- this.Rpie.Name = "Rpie";
- this.Rpie.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.None;
- series1.BorderColor = System.Drawing.Color.Silver;
- series1.ChartArea = "ChartArea1";
- series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Doughnut;
- series1.Font = new System.Drawing.Font("Calibri", 8F);
- series1.LabelAngle = 30;
- series1.LabelForeColor = System.Drawing.Color.White;
- series1.Legend = "Legend1";
- series1.Name = "Series1";
- this.Rpie.Series.Add(series1);
- this.Rpie.Size = new System.Drawing.Size(280, 281);
- this.Rpie.TabIndex = 3;
- this.Rpie.Text = "chart1";
- //
- // dgvGraphDataResults
- //
- this.dgvGraphDataResults.AllowUserToAddRows = false;
- this.dgvGraphDataResults.AllowUserToDeleteRows = false;
- this.dgvGraphDataResults.AllowUserToResizeColumns = false;
- this.dgvGraphDataResults.AllowUserToResizeRows = false;
- this.dgvGraphDataResults.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ this.mnuToolbar.Location = new System.Drawing.Point(0, 0);
+ this.mnuToolbar.Name = "mnuToolbar";
+ this.mnuToolbar.Size = new System.Drawing.Size(300, 25);
+ this.mnuToolbar.TabIndex = 2;
+ this.mnuToolbar.Text = "Toolbar";
+ //
+ // btnStart
+ //
+ this.btnStart.Image = global::ScriptHelp.Properties.Resources.Play;
+ this.btnStart.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.btnStart.Name = "btnStart";
+ this.btnStart.Size = new System.Drawing.Size(51, 22);
+ this.btnStart.Text = "Start";
+ this.btnStart.ToolTipText = "Would you like to play a game?";
+ this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
+ //
+ // Rpie
+ //
+ chartArea1.Area3DStyle.Enable3D = true;
+ chartArea1.Area3DStyle.LightStyle = System.Windows.Forms.DataVisualization.Charting.LightStyle.Realistic;
+ chartArea1.Area3DStyle.WallWidth = 10;
+ chartArea1.Name = "ChartArea1";
+ this.Rpie.ChartAreas.Add(chartArea1);
+ legend1.Enabled = false;
+ legend1.Name = "Legend1";
+ this.Rpie.Legends.Add(legend1);
+ this.Rpie.Location = new System.Drawing.Point(0, 28);
+ this.Rpie.Name = "Rpie";
+ this.Rpie.Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.None;
+ series1.BorderColor = System.Drawing.Color.Silver;
+ series1.ChartArea = "ChartArea1";
+ series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Doughnut;
+ series1.Font = new System.Drawing.Font("Calibri", 8F);
+ series1.LabelAngle = 30;
+ series1.LabelForeColor = System.Drawing.Color.White;
+ series1.Legend = "Legend1";
+ series1.Name = "Series1";
+ this.Rpie.Series.Add(series1);
+ this.Rpie.Size = new System.Drawing.Size(280, 281);
+ this.Rpie.TabIndex = 3;
+ this.Rpie.Text = "chart1";
+ //
+ // dgvGraphDataResults
+ //
+ this.dgvGraphDataResults.AllowUserToAddRows = false;
+ this.dgvGraphDataResults.AllowUserToDeleteRows = false;
+ this.dgvGraphDataResults.AllowUserToResizeColumns = false;
+ this.dgvGraphDataResults.AllowUserToResizeRows = false;
+ this.dgvGraphDataResults.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.dgvGraphDataResults.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dgvGraphDataResults.ColumnHeadersVisible = false;
- this.dgvGraphDataResults.Enabled = false;
- this.dgvGraphDataResults.Location = new System.Drawing.Point(186, 327);
- this.dgvGraphDataResults.Name = "dgvGraphDataResults";
- this.dgvGraphDataResults.RowHeadersVisible = false;
- this.dgvGraphDataResults.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.dgvGraphDataResults.Size = new System.Drawing.Size(94, 400);
- this.dgvGraphDataResults.TabIndex = 4;
- this.dgvGraphDataResults.TabStop = false;
- this.dgvGraphDataResults.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGraphDataResults_CellEndEdit);
- this.dgvGraphDataResults.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvGraphDataResults_CellFormatting);
- //
- // pictureBox1
- //
- this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ this.dgvGraphDataResults.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dgvGraphDataResults.ColumnHeadersVisible = false;
+ this.dgvGraphDataResults.Enabled = false;
+ this.dgvGraphDataResults.Location = new System.Drawing.Point(186, 327);
+ this.dgvGraphDataResults.Name = "dgvGraphDataResults";
+ this.dgvGraphDataResults.RowHeadersVisible = false;
+ this.dgvGraphDataResults.ScrollBars = System.Windows.Forms.ScrollBars.None;
+ this.dgvGraphDataResults.Size = new System.Drawing.Size(94, 400);
+ this.dgvGraphDataResults.TabIndex = 4;
+ this.dgvGraphDataResults.TabStop = false;
+ this.dgvGraphDataResults.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvGraphDataResults_CellEndEdit);
+ this.dgvGraphDataResults.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvGraphDataResults_CellFormatting);
+ //
+ // picTable
+ //
+ this.picTable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.pictureBox1.BackgroundImage = global::ScriptHelp.Properties.Resources.table;
- this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.pictureBox1.Location = new System.Drawing.Point(0, 327);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(180, 423);
- this.pictureBox1.TabIndex = 5;
- this.pictureBox1.TabStop = false;
- //
- // GraphData
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.pictureBox1);
- this.Controls.Add(this.dgvGraphDataResults);
- this.Controls.Add(this.Rpie);
- this.Controls.Add(this.toolStrip1);
- this.Controls.Add(this.dgvGraphData);
- this.Name = "GraphData";
- this.Size = new System.Drawing.Size(300, 750);
- ((System.ComponentModel.ISupportInitialize)(this.dgvGraphData)).EndInit();
- this.toolStrip1.ResumeLayout(false);
- this.toolStrip1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.Rpie)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dgvGraphDataResults)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
+ this.picTable.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.picTable.Location = new System.Drawing.Point(0, 327);
+ this.picTable.Name = "picTable";
+ this.picTable.Size = new System.Drawing.Size(180, 423);
+ this.picTable.TabIndex = 5;
+ this.picTable.TabStop = false;
+ //
+ // GraphData
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.picTable);
+ this.Controls.Add(this.dgvGraphDataResults);
+ this.Controls.Add(this.Rpie);
+ this.Controls.Add(this.mnuToolbar);
+ this.Controls.Add(this.dgvGraphData);
+ this.Name = "GraphData";
+ this.Size = new System.Drawing.Size(300, 750);
+ ((System.ComponentModel.ISupportInitialize)(this.dgvGraphData)).EndInit();
+ this.mnuToolbar.ResumeLayout(false);
+ this.mnuToolbar.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.Rpie)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.dgvGraphDataResults)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.picTable)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
}
#endregion
private System.Windows.Forms.DataGridView dgvGraphData;
- private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.ToolStrip mnuToolbar;
private System.Windows.Forms.ToolStripButton btnStart;
private System.Windows.Forms.DataVisualization.Charting.Chart Rpie;
private System.Windows.Forms.DataGridView dgvGraphDataResults;
- private System.Windows.Forms.PictureBox pictureBox1;
+ private System.Windows.Forms.PictureBox picTable;
}
}
diff --git a/CS/TaskPane/GraphData.cs b/CS/TaskPane/GraphData.cs
index 1351d27..d1b3c7e 100644
--- a/CS/TaskPane/GraphData.cs
+++ b/CS/TaskPane/GraphData.cs
@@ -7,26 +7,16 @@
namespace ScriptHelp.TaskPane
{
- ///
- /// GraphData TaskPane
- ///
public partial class GraphData : UserControl
{
- ///
- /// random number stored for multiple processes
- ///
+
public int MyRandomNumber;
- ///
- /// Initialize the controls in the object
- ///
public GraphData()
{
InitializeComponent();
try
{
- //dgvGraphData.AutoGenerateColumns = true;
- //dgvGraphData.DataSource = Data.GraphDataTable.DefaultView;
this.Rpie.Series[0].XValueMember = "NBR_VALUE";
this.Rpie.Series[0].YValueMembers = "VALUE";
this.Rpie.DataSource = Data.GraphDataTable;
@@ -41,19 +31,15 @@ public GraphData()
Application.DoEvents();
}
RefreshResultsToGrid();
-
- }
+ this.picTable.BackgroundImage = ScriptHelp.Properties.Resources.table;
+
+ }
catch (Exception ex)
{
ErrorHandler.DisplayMessage(ex);
}
}
- ///
- /// To start the procedure
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void btnStart_Click(object sender, EventArgs e)
{
try
@@ -87,11 +73,6 @@ private void btnStart_Click(object sender, EventArgs e)
}
- ///
- /// Update the cell formatting
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void dgvGraphDataResults_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
try
@@ -110,19 +91,11 @@ private void dgvGraphDataResults_CellFormatting(object sender, DataGridViewCellF
}
}
- ///
- /// Invalidate the grid formatting
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void dgvGraphDataResults_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
dgvGraphDataResults.Invalidate();
}
- ///
- /// Insert the results to the data table
- ///
private void InsertResultsToDataTable()
{
try
@@ -130,7 +103,6 @@ private void InsertResultsToDataTable()
//TODO: should be querying from the GraphData table instead of from the control
string number = this.Rpie.Series[0].Points[MyRandomNumber].AxisLabel.ToString();
string color = System.Drawing.ColorTranslator.ToHtml(this.Rpie.Series[0].Points[MyRandomNumber].Color);
- //MessageBox.Show(number, "Your number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
string connection = Scripts.Data.Connection();
string query = ("INSERT INTO GraphDataResults (NBR_VALUE, COLOR_ID) Values(@yourNumber, @yourColor)");
using (SqlCeConnection cn = new SqlCeConnection(connection))
@@ -142,7 +114,6 @@ private void InsertResultsToDataTable()
cmd.Parameters.AddWithValue("@yourColor", color);
cn.Open();
cmd.ExecuteNonQuery();
- //cn.Close();
}
}
}
@@ -153,13 +124,10 @@ private void InsertResultsToDataTable()
}
finally
{
- //cn.Close();
+
}
}
- ///
- /// Refresh the results to the grid
- ///
private void RefreshResultsToGrid()
{
try
@@ -204,5 +172,5 @@ private void RefreshResultsToGrid()
}
- }
+ }
}
diff --git a/CS/TaskPane/GraphData.resx b/CS/TaskPane/GraphData.resx
index 5da7a24..79b9acf 100644
--- a/CS/TaskPane/GraphData.resx
+++ b/CS/TaskPane/GraphData.resx
@@ -117,7 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+ 17, 17
\ No newline at end of file
diff --git a/CS/TaskPane/Script.Designer.cs b/CS/TaskPane/Script.Designer.cs
index 2f2f9b4..88fff36 100644
--- a/CS/TaskPane/Script.Designer.cs
+++ b/CS/TaskPane/Script.Designer.cs
@@ -29,13 +29,14 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
this.txtScript = new System.Windows.Forms.RichTextBox();
- this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.mnuToolbar = new System.Windows.Forms.ToolStrip();
this.btnSave = new System.Windows.Forms.ToolStripButton();
this.btnCopy = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.lblFontSize = new System.Windows.Forms.ToolStripLabel();
- this.cboFontSize = new System.Windows.Forms.ToolStripComboBox();
- this.toolStrip1.SuspendLayout();
+ this.nudFontSize = new System.Windows.Forms.NumericUpDown();
+ this.mnuToolbar.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.nudFontSize)).BeginInit();
this.SuspendLayout();
//
// txtScript
@@ -51,20 +52,19 @@ private void InitializeComponent()
this.txtScript.TabIndex = 1;
this.txtScript.Text = "";
//
- // toolStrip1
+ // mnuToolbar
//
- this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
- this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnuToolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+ this.mnuToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnSave,
this.btnCopy,
this.toolStripSeparator1,
- this.lblFontSize,
- this.cboFontSize});
- this.toolStrip1.Location = new System.Drawing.Point(0, 0);
- this.toolStrip1.Name = "toolStrip1";
- this.toolStrip1.Size = new System.Drawing.Size(650, 25);
- this.toolStrip1.TabIndex = 2;
- this.toolStrip1.Text = "toolStrip1";
+ this.lblFontSize});
+ this.mnuToolbar.Location = new System.Drawing.Point(0, 0);
+ this.mnuToolbar.Name = "mnuToolbar";
+ this.mnuToolbar.Size = new System.Drawing.Size(650, 25);
+ this.mnuToolbar.TabIndex = 2;
+ this.mnuToolbar.Text = "Toolbar";
//
// btnSave
//
@@ -99,27 +99,45 @@ private void InitializeComponent()
this.lblFontSize.Text = "Font Size";
this.lblFontSize.Visible = false;
//
- // cboFontSize
- //
- this.cboFontSize.Name = "cboFontSize";
- this.cboFontSize.Size = new System.Drawing.Size(75, 25);
- this.cboFontSize.Visible = false;
- this.cboFontSize.TextUpdate += new System.EventHandler(this.cboFontSize_TextUpdate);
- this.cboFontSize.Click += new System.EventHandler(this.cboFontSize_Click);
- this.cboFontSize.TextChanged += new System.EventHandler(this.cboFontSize_TextChanged);
+ // nudFontSize
+ //
+ this.nudFontSize.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.nudFontSize.Location = new System.Drawing.Point(165, 3);
+ this.nudFontSize.Maximum = new decimal(new int[] {
+ 20,
+ 0,
+ 0,
+ 0});
+ this.nudFontSize.Minimum = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ this.nudFontSize.Name = "nudFontSize";
+ this.nudFontSize.Size = new System.Drawing.Size(43, 22);
+ this.nudFontSize.TabIndex = 3;
+ this.nudFontSize.Value = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ this.nudFontSize.Visible = false;
+ this.nudFontSize.ValueChanged += new System.EventHandler(this.nudFontSize_ValueChanged);
//
// Script
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
- this.Controls.Add(this.toolStrip1);
+ this.Controls.Add(this.nudFontSize);
+ this.Controls.Add(this.mnuToolbar);
this.Controls.Add(this.txtScript);
this.Name = "Script";
this.Size = new System.Drawing.Size(650, 750);
this.Load += new System.EventHandler(this.Script_Load);
- this.toolStrip1.ResumeLayout(false);
- this.toolStrip1.PerformLayout();
+ this.mnuToolbar.ResumeLayout(false);
+ this.mnuToolbar.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.nudFontSize)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -128,11 +146,11 @@ private void InitializeComponent()
#endregion
private System.Windows.Forms.RichTextBox txtScript;
- private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.ToolStrip mnuToolbar;
private System.Windows.Forms.ToolStripButton btnSave;
private System.Windows.Forms.ToolStripButton btnCopy;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripLabel lblFontSize;
- private System.Windows.Forms.ToolStripComboBox cboFontSize;
+ private System.Windows.Forms.NumericUpDown nudFontSize;
}
}
diff --git a/CS/TaskPane/Script.cs b/CS/TaskPane/Script.cs
index 4926c0a..7b79901 100644
--- a/CS/TaskPane/Script.cs
+++ b/CS/TaskPane/Script.cs
@@ -7,33 +7,14 @@
namespace ScriptHelp.TaskPane
{
- ///
- /// Script TaskPane
- ///
+
public partial class Script : UserControl
{
- public float[] FontSize ={8,9,10,12,14,16,18,20,22,24,26,28,36,48,72};
- public string[] FontSizeName ={"8","9","10","12","14","16","18","20","22","24","26","28","36","48","72"};
- private string fontName;
- private int fontSize;
-
- ///
- /// Initialize the controls in the object
- ///
public Script()
{
InitializeComponent();
- //foreach (string name in FontSizeName)
- //{
- // this.cboFontSize.Items.Add(name);
- // this.cboFontSize.SelectedItem = "10";
- //}
-
}
- ///
- /// Highlight words from KeyWords.
- ///
private void UpdateSqlSyntax()
{
try
@@ -50,11 +31,11 @@ private void UpdateSqlSyntax()
// in brackets
//syntaxHighlighter.AddPattern(new PatternDefinition(@"\[([^']|\'\')+\]"), new SyntaxStyle(Color.Black)); //was messing up the color for CREATE table statement, not sure if I need this
// keywords1
- syntaxHighlighter.AddPattern(new PatternDefinition("XACT_ABORT", "BEGIN", "DELETE", "ROLLBACK", "COMMIT", "CREATE", "TABLE", "TRAN", "TRANSACTION", "OUTPUT", "USING", "BY", "TARGET", "WITH", "AS", "VALUES", "MERGE", "ON", "WHEN", "THEN", "UNION", "UPDATE", "SET", "WHERE", "GO", "APPEND", "INSERT", "INTO", "TRUNCATE", "REMOVE", "SELECT", "FROM", "TYPE", "FOLDER", "CABINET", "ORDER BY", "DESC", "ASC", "GROUP BY", "ALTER", "ADD", "DROP", "GROUP", "PRIMARY", "KEY", "IDENTITY", "IF"), new SyntaxStyle(Color.Blue));
+ syntaxHighlighter.AddPattern(new PatternDefinition("END", "XACT_ABORT", "BEGIN", "DELETE", "ROLLBACK", "COMMIT", "CREATE", "TABLE", "TRAN", "TRANSACTION", "OUTPUT", "USING", "BY", "TARGET", "WITH", "AS", "VALUES", "MERGE", "ON", "WHEN", "THEN", "UNION", "UPDATE", "SET", "WHERE", "GO", "APPEND", "INSERT", "INTO", "TRUNCATE", "REMOVE", "SELECT", "FROM", "TYPE", "FOLDER", "CABINET", "ORDER BY", "DESC", "ASC", "GROUP BY", "ALTER", "ADD", "DROP", "GROUP", "PRIMARY", "KEY", "IDENTITY", "IF"), new SyntaxStyle(Color.Blue));
// keywords2
syntaxHighlighter.AddPattern(new PatternDefinition("OBJECTS", "objects", "SYS", "sys"), new SyntaxStyle(Color.Green));
// functions
- syntaxHighlighter.AddPattern(new PatternDefinition("$action", "object_id", "OBJECT_ID", "UPPER", "LOWER", "SUBSTR", "COUNT", "MIN", "MAX", "AVG", "SUM", "DATEDIFF", "DATEADD", "DATEFLOOR", "DATETOSTRING", "ID", "max", "MFILE_URL"), new SyntaxStyle(Color.Fuchsia));
+ syntaxHighlighter.AddPattern(new PatternDefinition("@@SERVERNAME", "DB_NAME", "$action", "object_id", "OBJECT_ID", "UPPER", "LOWER", "SUBSTR", "COUNT", "MIN", "MAX", "AVG", "SUM", "DATEDIFF", "DATEADD", "DATEFLOOR", "DATETOSTRING", "ID", "max", "MFILE_URL"), new SyntaxStyle(Color.Fuchsia));
// operators
syntaxHighlighter.AddPattern(new PatternDefinition("SOURCE", "MATCHED", "+", "-", ">", "<", "&", "|", "*", "**", "!", "=", "AND", "OR", "SOME", "ALL", "ANY", "LIKE", "NOT", "NULL", "NULLDATE", "NULLSTRING", "NULLINT", "IN", "EXISTS"), new SyntaxStyle(Color.Gray));
}
@@ -65,9 +46,6 @@ private void UpdateSqlSyntax()
}
}
- ///
- /// Highlight words from KeyWords.
- ///
private void UpdateDqlSyntax()
{
try
@@ -94,45 +72,11 @@ private void UpdateDqlSyntax()
}
}
- ///
- /// Update the script text with syntax formatting
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void Script_Load(object sender, EventArgs e)
{
- try
- {
- switch (Ribbon.AppVariables.FileType)
- {
- case "SQL":
- UpdateSqlSyntax();
- break;
- case "DQL":
- UpdateDqlSyntax();
- break;
- case "TXT":
- UpdateSqlSyntax();
- break;
- case "XML":
- UpdateSqlSyntax();
- break;
- }
- txtScript.Text = Ribbon.AppVariables.ScriptRange;
-
- }
- catch (Exception ex)
- {
- ErrorHandler.DisplayMessage(ex);
-
- }
+ UpdateScriptText();
}
- ///
- /// Copy the script text
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void btnCopy_Click(object sender, EventArgs e)
{
try
@@ -147,11 +91,6 @@ private void btnCopy_Click(object sender, EventArgs e)
}
}
- ///
- /// Save the script text to a file
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void btnSave_Click(object sender, EventArgs e)
{
try
@@ -194,24 +133,47 @@ private void btnSave_Click(object sender, EventArgs e)
}
}
- private void cboFontSize_TextChanged(object sender, EventArgs e)
+ public void UpdateScriptText()
{
- //this.txtScript.FontSize = this.cboFontSize.Text;
- //this.txtScript.SelectionFont = new Font("Courier New", (float)Convert.ToDouble(this.cboFontSize.Text), FontStyle.Regular);
- //this.txtScript.SelectionFont = new Font("Courier New", 12, FontStyle.Regular);
- }
+ try
+ {
+ switch (Ribbon.AppVariables.FileType)
+ {
+ case "SQL":
+ UpdateSqlSyntax();
+ break;
+ case "DQL":
+ UpdateDqlSyntax();
+ break;
+ case "TXT":
+ UpdateSqlSyntax();
+ break;
+ case "XML":
+ UpdateSqlSyntax();
+ break;
+ }
+ this.txtScript.Text = Ribbon.AppVariables.ScriptRange;
- private void cboFontSize_TextUpdate(object sender, EventArgs e)
- {
- //float fontSize = FontSize[this.cboFontSize.SelectedIndex];
- //this.txtScript.Focus();
- //this.txtScript.SelectAll();
- //this.txtScript.SelectionFont = new Font(this.txtScript.SelectionFont.FontFamily, fontSize, this.txtScript.SelectionFont.Style);
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+
+ }
}
- private void cboFontSize_Click(object sender, EventArgs e)
+ private void nudFontSize_ValueChanged(object sender, EventArgs e)
{
- //this.txtScript.SelectionFont = new Font(this.txtScript.SelectionFont.FontFamily, FontSize[this.cboFontSize.SelectedIndex], this.txtScript.SelectionFont.Style);
+ try
+ {
+ this.txtScript.Font = new Font(this.txtScript.Font.FontFamily, Convert.ToInt32(Math.Round((this.nudFontSize.Value))));
+
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+
+ }
}
}
}
diff --git a/CS/TaskPane/Script.resx b/CS/TaskPane/Script.resx
index 5da7a24..79b9acf 100644
--- a/CS/TaskPane/Script.resx
+++ b/CS/TaskPane/Script.resx
@@ -117,7 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+ 17, 17
\ No newline at end of file
diff --git a/CS/TaskPane/Settings.cs b/CS/TaskPane/Settings.cs
index 24327a1..da63711 100644
--- a/CS/TaskPane/Settings.cs
+++ b/CS/TaskPane/Settings.cs
@@ -2,57 +2,63 @@
using System.Linq;
using System.Windows.Forms;
using System.Reflection;
+using ScriptHelp.Scripts;
namespace ScriptHelp.TaskPane
{
- ///
- /// Settings TaskPane
- ///
public partial class Settings : UserControl
{
- ///
- /// Initialize the controls in the object
- ///
public Settings()
{
- InitializeComponent();
- this.pgdSettings.SelectedObject = Properties.Settings.Default;
+ try
+ {
+ InitializeComponent();
+ this.pgdSettings.SelectedObject = Properties.Settings.Default;
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
}
- ///
- /// Sets the column width of a property grid
- ///
- /// Represents the property grid object.
- /// Represents the width of the column.
- ///
public static void SetLabelColumnWidth(PropertyGrid grid, int width)
{
- if (grid == null)
- return;
+ try
+ {
+ if (grid == null)
+ return;
- FieldInfo fi = grid.GetType().GetField("gridView", BindingFlags.Instance | BindingFlags.NonPublic);
- if (fi == null)
- return;
+ FieldInfo fi = grid.GetType().GetField("gridView", BindingFlags.Instance | BindingFlags.NonPublic);
+ if (fi == null)
+ return;
- Control view = fi.GetValue(grid) as Control;
- if (view == null)
- return;
+ Control view = fi.GetValue(grid) as Control;
+ if (view == null)
+ return;
- MethodInfo mi = view.GetType().GetMethod("MoveSplitterTo", BindingFlags.Instance | BindingFlags.NonPublic);
- if (mi == null)
- return;
- mi.Invoke(view, new object[] { width });
+ MethodInfo mi = view.GetType().GetMethod("MoveSplitterTo", BindingFlags.Instance | BindingFlags.NonPublic);
+ if (mi == null)
+ return;
+ mi.Invoke(view, new object[] { width });
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
}
- ///
- /// Update the ribbon with the changed settings values
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
private void pgdSettings_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
- Scripts.Ribbon.ribbonref.InvalidateRibbon();
+ try
+ {
+ Properties.Settings.Default.Save();
+ Scripts.Ribbon.ribbonref.InvalidateRibbon();
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
}
-
+
}
}
diff --git a/CS/TaskPane/TableData.Designer.cs b/CS/TaskPane/TableData.Designer.cs
index 99bffa2..0052c03 100644
--- a/CS/TaskPane/TableData.Designer.cs
+++ b/CS/TaskPane/TableData.Designer.cs
@@ -29,10 +29,10 @@ protected override void Dispose(bool disposing)
private void InitializeComponent()
{
this.dgvList = new System.Windows.Forms.DataGridView();
- this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.mnuToolbar = new System.Windows.Forms.ToolStrip();
this.btnSave = new System.Windows.Forms.ToolStripButton();
((System.ComponentModel.ISupportInitialize)(this.dgvList)).BeginInit();
- this.toolStrip1.SuspendLayout();
+ this.mnuToolbar.SuspendLayout();
this.SuspendLayout();
//
// dgvList
@@ -46,16 +46,16 @@ private void InitializeComponent()
this.dgvList.Size = new System.Drawing.Size(300, 722);
this.dgvList.TabIndex = 1;
//
- // toolStrip1
+ // mnuToolbar
//
- this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
- this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.mnuToolbar.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
+ this.mnuToolbar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnSave});
- this.toolStrip1.Location = new System.Drawing.Point(0, 0);
- this.toolStrip1.Name = "toolStrip1";
- this.toolStrip1.Size = new System.Drawing.Size(300, 25);
- this.toolStrip1.TabIndex = 2;
- this.toolStrip1.Text = "toolStrip1";
+ this.mnuToolbar.Location = new System.Drawing.Point(0, 0);
+ this.mnuToolbar.Name = "mnuToolbar";
+ this.mnuToolbar.Size = new System.Drawing.Size(300, 25);
+ this.mnuToolbar.TabIndex = 2;
+ this.mnuToolbar.Text = "Toolbar";
//
// btnSave
//
@@ -71,13 +71,13 @@ private void InitializeComponent()
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.toolStrip1);
+ this.Controls.Add(this.mnuToolbar);
this.Controls.Add(this.dgvList);
this.Name = "TableData";
this.Size = new System.Drawing.Size(300, 750);
((System.ComponentModel.ISupportInitialize)(this.dgvList)).EndInit();
- this.toolStrip1.ResumeLayout(false);
- this.toolStrip1.PerformLayout();
+ this.mnuToolbar.ResumeLayout(false);
+ this.mnuToolbar.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -86,7 +86,7 @@ private void InitializeComponent()
#endregion
private System.Windows.Forms.DataGridView dgvList;
- private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.ToolStrip mnuToolbar;
private System.Windows.Forms.ToolStripButton btnSave;
}
}
diff --git a/CS/TaskPane/TableData.cs b/CS/TaskPane/TableData.cs
index 070b6f9..cbb456c 100644
--- a/CS/TaskPane/TableData.cs
+++ b/CS/TaskPane/TableData.cs
@@ -6,97 +6,91 @@
namespace ScriptHelp.TaskPane
{
- ///
- /// TableData TaskPane
- ///
- public partial class TableData : UserControl
- {
- ///
- /// Initialize the controls in the object
- ///
- public TableData()
- {
- InitializeComponent();
- try
- {
- dgvList.AutoGenerateColumns = true;
- string tableName = Ribbon.AppVariables.TableName;
- this.Text = "List of " + tableName;
- switch (tableName)
- {
- case "TableAlias":
- dgvList.DataSource = Data.TableAliasTable;
- break;
- case "DateFormat":
- dgvList.DataSource = Data.DateFormatTable;
- break;
- }
- this.dgvList.Columns[0].Width = dgvList.Width - 75;
- }
- catch (Exception ex)
- {
- ErrorHandler.DisplayMessage(ex);
- }
- }
+ public partial class TableData : UserControl
+ {
+ public TableData()
+ {
+ InitializeComponent();
+ try
+ {
+ dgvList.AutoGenerateColumns = true;
+ string tableName = Ribbon.AppVariables.TableName;
+ this.Text = "List of " + tableName;
+ switch (tableName)
+ {
+ case "TableAlias":
+ dgvList.DataSource = Data.TableAliasTable;
+ break;
+ case "DateFormat":
+ dgvList.DataSource = Data.DateFormatTable;
+ break;
+ case "TimeFormat":
+ dgvList.DataSource = Data.TimeFormatTable;
+ break;
+ }
+ this.dgvList.Columns[0].Width = dgvList.Width - 75;
- ///
- /// Save the changed values in the table
- ///
- /// contains the sender of the event, so if you had one method bound to multiple controls, you can distinguish them.
- /// refers to the event arguments for the used event, they usually come in the form of properties/functions/methods that get to be available on it.
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- this.Validate();
- if (dgvList.IsCurrentRowDirty || dgvList.IsCurrentCellDirty)
- {
- dgvList.CommitEdit(DataGridViewDataErrorContexts.Commit);
- dgvList.EndEdit();
- }
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
+ }
- string tableName = Ribbon.AppVariables.TableName;
- //string sql = "SELECT * FROM @tableName";
- string sql = "SELECT * FROM " + tableName;
- SqlCeConnection cn = new SqlCeConnection(Data.Connection());
- SqlCeCommandBuilder scb = default(SqlCeCommandBuilder);
- SqlCeDataAdapter sda = new SqlCeDataAdapter(sql, cn);
- //sda.SelectCommand.Parameters.AddWithValue("@tableName", tableName);
- //sda.SelectCommand.Parameters.AddWithValue("@tableName", System.Data.SqlDbType.NVarChar).Value = tableName;
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ this.Validate();
+ if (dgvList.IsCurrentRowDirty || dgvList.IsCurrentCellDirty)
+ {
+ dgvList.CommitEdit(DataGridViewDataErrorContexts.Commit);
+ dgvList.EndEdit();
+ }
- //sda.SelectCommand.Parameters.Add(new SqlCeParameter
- //{
- // ParameterName = "@tableName"
- // , Value = tableName
- // , SqlDbType = System.Data.SqlDbType.NVarChar
- // , Size = 50
- //});
+ string tableName = Ribbon.AppVariables.TableName;
+ string sql = "SELECT * FROM " + tableName;
+ SqlCeConnection cn = new SqlCeConnection(Data.Connection());
+ SqlCeCommandBuilder scb = default(SqlCeCommandBuilder);
+ SqlCeDataAdapter sda = new SqlCeDataAdapter(sql, cn);
+ //TODO: use this parameterized query...
+ //sda.SelectCommand.Parameters.AddWithValue("@tableName", tableName);
+ //sda.SelectCommand.Parameters.AddWithValue("@tableName", System.Data.SqlDbType.NVarChar).Value = tableName;
+ //sda.SelectCommand.Parameters.Add(new SqlCeParameter
+ //{
+ // ParameterName = "@tableName"
+ // , Value = tableName
+ // , SqlDbType = System.Data.SqlDbType.NVarChar
+ // , Size = 50
+ //});
- sda.TableMappings.Add("Table", tableName);
- scb = new SqlCeCommandBuilder(sda);
- switch (tableName)
- {
- case "TableAlias":
- sda.Update(Data.TableAliasTable);
- Data.CreateTableAliasTable();
- break;
- case "DateFormat":
- sda.Update(Data.DateFormatTable);
- Data.CreateDateFormatTable();
- break;
- }
- Ribbon.ribbonref.InvalidateRibbon();
+ sda.TableMappings.Add("Table", tableName);
+ scb = new SqlCeCommandBuilder(sda);
+ switch (tableName)
+ {
+ case "TableAlias":
+ sda.Update(Data.TableAliasTable);
+ Data.CreateTableAliasTable();
+ break;
+ case "DateFormat":
+ sda.Update(Data.DateFormatTable);
+ Data.CreateDateFormatTable();
+ break;
+ case "TimeFormat":
+ sda.Update(Data.TimeFormatTable);
+ Data.CreateDateFormatTable();
+ break;
+ }
+ Ribbon.ribbonref.InvalidateRibbon();
- }
+ }
+ catch (Exception ex)
+ {
+ ErrorHandler.DisplayMessage(ex);
+ }
- catch (Exception ex)
- {
- ErrorHandler.DisplayMessage(ex);
+ }
- }
-
- }
-
- }
+ }
}
diff --git a/CS/TaskPane/TableData.resx b/CS/TaskPane/TableData.resx
index 5da7a24..79b9acf 100644
--- a/CS/TaskPane/TableData.resx
+++ b/CS/TaskPane/TableData.resx
@@ -117,7 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+ 17, 17
\ No newline at end of file
diff --git a/CS/ThisAddIn.Designer.cs b/CS/ThisAddIn.Designer.cs
index 4742348..92703f1 100644
--- a/CS/ThisAddIn.Designer.cs
+++ b/CS/ThisAddIn.Designer.cs
@@ -21,10 +21,10 @@ public sealed partial class ThisAddIn : Microsoft.Office.Tools.AddInBase {
internal Microsoft.Office.Tools.SmartTagCollection VstoSmartTags;
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
private global::System.Object missing = global::System.Type.Missing;
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
internal Microsoft.Office.Interop.Excel.Application Application;
///
@@ -37,7 +37,7 @@ public ThisAddIn(global::Microsoft.Office.Tools.Excel.ApplicationFactory factory
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void Initialize() {
base.Initialize();
@@ -52,7 +52,7 @@ protected override void Initialize() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void FinishInitialization() {
this.InternalStartup();
@@ -61,7 +61,7 @@ protected override void FinishInitialization() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void InitializeDataBindings() {
this.BeginInitialization();
@@ -71,7 +71,7 @@ protected override void InitializeDataBindings() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeCachedData() {
if ((this.DataHost == null)) {
@@ -84,14 +84,14 @@ private void InitializeCachedData() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeData() {
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void BindToData() {
}
@@ -119,7 +119,7 @@ private bool IsCached(string MemberName) {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void BeginInitialization() {
this.BeginInit();
@@ -129,7 +129,7 @@ private void BeginInitialization() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void EndInitialization() {
this.VstoSmartTags.EndInit();
@@ -139,7 +139,7 @@ private void EndInitialization() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeControls() {
this.CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this);
@@ -148,7 +148,7 @@ private void InitializeControls() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void InitializeComponents() {
}
@@ -162,7 +162,7 @@ private bool NeedsFill(string MemberName) {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void OnShutdown() {
this.VstoSmartTags.Dispose();
@@ -173,7 +173,7 @@ protected override void OnShutdown() {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
internal sealed partial class Globals {
///
@@ -226,7 +226,7 @@ internal static ThisRibbonCollection Ribbons {
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "14.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "17.0.0.0")]
internal sealed partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonCollectionBase {
///
diff --git a/CS/ThisAddIn.Designer.xml b/CS/ThisAddIn.Designer.xml
index db6197e..35659d3 100644
--- a/CS/ThisAddIn.Designer.xml
+++ b/CS/ThisAddIn.Designer.xml
@@ -1,5 +1,5 @@
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/CS/app.config b/CS/app.config
index 4b77df2..68b2094 100644
--- a/CS/app.config
+++ b/CS/app.config
@@ -20,11 +20,11 @@
2
-
+ dd-mmm-yyyy
-
- mm:ss.0
+
+ h:mm:ss AM/PMNULL
@@ -38,44 +38,17 @@
0
-
- True
-
-
- True
-
- True
-
-
- True
-
-
- True
-
-
- C:\Temp
-
-
- True
-
-
- True
-
-
- True
+ FalseSCRIPT
-
- True
-
- ,
+ ;
- https://raw.githubusercontent.com/aduguid/ScriptHelp/master/publish/
+ https://raw.githubusercontent.com/Excel-projects/Script-Help/master/publish/
@@ -89,14 +62,14 @@
True
-
+ True
-
+ True
- https://github.com/aduguid/ScriptHelp/blob/master/README.md
+ https://github.com/Excel-projects/Script-Help/blob/master/README.md
@@ -105,10 +78,16 @@
TableStyleMedium15
- 07/31/2017 13:05:00
+ 01/31/2021 13:05:00
+
+
+ https://github.com/Excel-projects/Script-Help/issues/new
-
- https://github.com/aduguid/ScriptHelp/issues/new
+
+ False
+
+
+ mm:ss.0
@@ -139,5 +118,5 @@
-
+
diff --git a/CS/packages.config b/CS/packages.config
index 8195521..2c8be7b 100644
--- a/CS/packages.config
+++ b/CS/packages.config
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/CS/packages/log4net.2.0.14/.signature.p7s b/CS/packages/log4net.2.0.14/.signature.p7s
new file mode 100644
index 0000000..990e4c2
Binary files /dev/null and b/CS/packages/log4net.2.0.14/.signature.p7s differ
diff --git a/CS/packages/log4net.2.0.14/lib/net20/log4net.dll b/CS/packages/log4net.2.0.14/lib/net20/log4net.dll
new file mode 100644
index 0000000..d01d062
Binary files /dev/null and b/CS/packages/log4net.2.0.14/lib/net20/log4net.dll differ
diff --git a/CS/packages/log4net.2.0.8/lib/net20-full/log4net.xml b/CS/packages/log4net.2.0.14/lib/net20/log4net.xml
similarity index 97%
rename from CS/packages/log4net.2.0.8/lib/net20-full/log4net.xml
rename to CS/packages/log4net.2.0.14/lib/net20/log4net.xml
index d7d0c54..5af20a3 100644
--- a/CS/packages/log4net.2.0.8/lib/net20-full/log4net.xml
+++ b/CS/packages/log4net.2.0.14/lib/net20/log4net.xml
@@ -55,38 +55,38 @@
An example configuration to log to the above table:
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
@@ -96,2434 +96,2321 @@
Gert DriesenLance Nehring
-
+
+
+ Initializes a new instance of the class.
+
+
+ Public default constructor to initialize a new instance of this class.
+
+
+
- Abstract base class implementation of that
- buffers events in a fixed size buffer.
+ Gets or sets the database connection string that is used to connect to
+ the database.
+
+ The database connection string used to connect to the database.
+
- This base class should be used by appenders that need to buffer a
- number of events before logging them. For example the
- buffers events and then submits the entire contents of the buffer to
- the underlying database in one go.
-
-
- Subclasses should override the
- method to deliver the buffered events.
-
- The BufferingAppenderSkeleton maintains a fixed size cyclic
- buffer of events. The size of the buffer is set using
- the property.
-
- A is used to inspect
- each event as it arrives in the appender. If the
- triggers, then the current buffer is sent immediately
- (see ). Otherwise the event
- is stored in the buffer. For example, an evaluator can be used to
- deliver the events immediately when an ERROR event arrives.
-
-
- The buffering appender can be configured in a mode.
- By default the appender is NOT lossy. When the buffer is full all
- the buffered events are sent with .
- If the property is set to true then the
- buffer will not be sent when it is full, and new events arriving
- in the appender will overwrite the oldest event in the buffer.
- In lossy mode the buffer will only be sent when the
- triggers. This can be useful behavior when you need to know about
- ERROR events but not about events with a lower level, configure an
- evaluator that will trigger when an ERROR event arrives, the whole
- buffer will be sent which gives a history of events leading up to
- the ERROR event.
+ The connections string is specific to the connection type.
+ See for more information.
- Nicko Cadell
- Gert Driesen
+ Connection string for MS Access via ODBC:
+ "DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb"
+
+ Another connection string for MS Access via ODBC:
+ "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;"
+
+ Connection string for MS Access via OLE DB:
+ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;"
+
-
+
- Abstract base class implementation of .
+ The appSettings key from App.Config that contains the connection string.
+
+
+
+
+ The connectionStrings key from App.Config that contains the connection string.
+
+
+ This property requires at least .NET 2.0.
+
+
+
+
+ Gets or sets the type name of the connection
+ that should be created.
+
+ The type name of the connection.
+
- This class provides the code for common functionality, such
- as support for threshold filtering and support for general filters.
+ The type name of the ADO.NET provider to use.
- Appenders can also implement the interface. Therefore
- they would require that the method
- be called after the appenders properties have been configured.
+ The default is to use the OLE DB provider.
- Nicko Cadell
- Gert Driesen
+ Use the OLE DB Provider. This is the default value.
+ System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Use the MS SQL Server Provider.
+ System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Use the ODBC Provider.
+ Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral
+ This is an optional package that you can download from
+ http://msdn.microsoft.com/downloads
+ search for ODBC .NET Data Provider.
+
+ Use the Oracle Provider.
+ System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ This is an optional package that you can download from
+ http://msdn.microsoft.com/downloads
+ search for .NET Managed Provider for Oracle.
+
-
+
- Implement this interface for your own strategies for printing log statements.
+ Gets or sets the command text that is used to insert logging events
+ into the database.
+
+ The command text used to insert logging events into the database.
+
- Implementors should consider extending the
- class which provides a default implementation of this interface.
+ Either the text of the prepared statement or the
+ name of the stored procedure to execute to write into
+ the database.
- Appenders can also implement the interface. Therefore
- they would require that the method
- be called after the appenders properties have been configured.
+ The property determines if
+ this text is a prepared statement or a stored procedure.
+
+
+ If this property is not set, the command text is retrieved by invoking
+ .
- Nicko Cadell
- Gert Driesen
-
+
- Closes the appender and releases resources.
+ Gets or sets the command type to execute.
+
+ The command type to execute.
+
- Releases any resources allocated within the appender such as file handles,
- network connections, etc.
+ This value may be either (System.Data.CommandType.Text) to specify
+ that the is a prepared statement to execute,
+ or (System.Data.CommandType.StoredProcedure) to specify that the
+ property is the name of a stored procedure
+ to execute.
- It is a programming error to append to a closed appender.
+ The default value is (System.Data.CommandType.Text).
-
+
- Log the logging event in Appender specific way.
+ Should transactions be used to insert logging events in the database.
- The event to log
+
+ true if transactions should be used to insert logging events in
+ the database, otherwise false. The default value is true.
+
- This method is called to log a message into this appender.
+ Gets or sets a value that indicates whether transactions should be used
+ to insert logging events in the database.
+
+
+ When set a single transaction will be used to insert the buffered events
+ into the database. Otherwise each event will be inserted without using
+ an explicit transaction.
-
+
- Gets or sets the name of this appender.
+ Gets or sets the used to call the NetSend method.
- The name of the appender.
+
+ The used to call the NetSend method.
+
- The name uniquely identifies the appender.
+
+ Unless a specified here for this appender
+ the is queried for the
+ security context to use. The default behavior is to use the security context
+ of the current thread.
+
-
+
- Interface for appenders that support bulk logging.
+ Should this appender try to reconnect to the database on error.
+
+ true if the appender should try to reconnect to the database after an
+ error has occurred, otherwise false. The default value is false,
+ i.e. not to try to reconnect.
+
- This interface extends the interface to
- support bulk logging of objects. Appenders
- should only implement this interface if they can bulk log efficiently.
+ The default behaviour is for the appender not to try to reconnect to the
+ database if an error occurs. Subsequent logging events are discarded.
+
+
+ To force the appender to attempt to reconnect to the database set this
+ property to true.
+
+ When the appender attempts to connect to the database there may be a
+ delay of up to the connection timeout specified in the connection string.
+ This delay will block the calling application's thread.
+ Until the connection can be reestablished this potential delay may occur multiple times.
+
- Nicko Cadell
-
+
- Log the array of logging events in Appender specific way.
+ Gets or sets the underlying .
- The events to log
+
+ The underlying .
+
-
- This method is called to log an array of events into this appender.
-
+ creates a to insert
+ logging events into a database. Classes deriving from
+ can use this property to get or set this . Use the
+ underlying returned from if
+ you require access beyond that which provides.
-
+
- Interface used to delay activate a configured object.
+ Initialize the appender based on the options set
- This allows an object to defer activation of its options until all
- options have been set. This is required for components which have
- related options that remain ambiguous until all are set.
+ This is part of the delayed object
+ activation scheme. The method must
+ be called on this object after the configuration properties have
+ been set. Until is called this
+ object is in an undefined state and must not be used.
- If a component implements this interface then the method
- must be called by the container after its all the configured properties have been set
- and before the component can be used.
+ If any of the configuration properties are modified then
+ must be called again.
- Nicko Cadell
-
+
- Activate the options that were previously set with calls to properties.
+ Override the parent method to close the database
- This allows an object to defer activation of its options until all
- options have been set. This is required for components which have
- related options that remain ambiguous until all are set.
-
-
- If a component implements this interface then this method must be called
- after its properties have been set before the component can be used.
+ Closes the database command and database connection.
-
-
- Interface that can be implemented by Appenders that buffer logging data and expose a method.
-
-
-
+
- Flushes any buffered log data.
+ Inserts the events into the database.
+ The events to insert into the database.
- Appenders that implement the method must do so in a thread-safe manner: it can be called concurrently with
- the method.
-
- Typically this is done by locking on the Appender instance, e.g.:
-
-
-
-
- The parameter is only relevant for appenders that process logging events asynchronously,
- such as .
+ Insert all the events specified in the
+ array into the database.
- The maximum time to wait for logging events to be flushed.
- True if all logging events were flushed successfully, else false.
-
-
-
- Initial buffer size
-
-
-
-
- Maximum buffer size before it is recycled
-
-
+
- Default constructor
+ Adds a parameter to the command.
+ The parameter to add to the command.
- Empty default constructor
+
+ Adds a parameter to the ordered list of command parameters.
+
-
+
- Finalizes this appender by calling the implementation's
- method.
+ Writes the events to the database using the transaction specified.
+ The transaction that the events will be executed under.
+ The array of events to insert into the database.
- If this appender has not been closed then the Finalize method
- will call .
+ The transaction argument can be null if the appender has been
+ configured not to use transactions. See
+ property for more information.
-
+
- Initialize the appender based on the options set
+ Prepare entire database command object to be executed.
-
-
- This is part of the delayed object
- activation scheme. The method must
- be called on this object after the configuration properties have
- been set. Until is called this
- object is in an undefined state and must not be used.
-
-
- If any of the configuration properties are modified then
- must be called again.
-
-
+ The command to prepare.
-
+
- Closes the appender and release resources.
+ Formats the log message into database statement text.
+ The event being logged.
-
- Release any resources allocated within the appender such as file handles,
- network connections, etc.
-
-
- It is a programming error to append to a closed appender.
-
-
- This method cannot be overridden by subclasses. This method
- delegates the closing of the appender to the
- method which must be overridden in the subclass.
-
+ This method can be overridden by subclasses to provide
+ more control over the format of the database statement.
+
+ Text that can be passed to a .
+
-
+
- Performs threshold checks and invokes filters before
- delegating actual logging to the subclasses specific
- method.
+ Creates an instance used to connect to the database.
- The event to log.
-
- This method cannot be overridden by derived classes. A
- derived class should override the method
- which is called by this method.
-
-
- The implementation of this method is as follows:
-
-
-
-
-
- Checks that the severity of the
- is greater than or equal to the of this
- appender.
-
-
-
- Checks that the chain accepts the
- .
-
-
-
-
- Calls and checks that
- it returns true.
-
-
-
-
- If all of the above steps succeed then the
- will be passed to the abstract method.
-
+ This method is called whenever a new IDbConnection is needed (i.e. when a reconnect is necessary).
+ The of the object.
+ The connectionString output from the ResolveConnectionString method.
+ An instance with a valid connection string.
-
+
- Performs threshold checks and invokes filters before
- delegating actual logging to the subclasses specific
- method.
+ Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey
+ property.
- The array of events to log.
-
- This method cannot be overridden by derived classes. A
- derived class should override the method
- which is called by this method.
-
-
- The implementation of this method is as follows:
-
-
-
-
-
- Checks that the severity of the
- is greater than or equal to the of this
- appender.
-
-
-
- Checks that the chain accepts the
- .
-
-
-
-
- Calls and checks that
- it returns true.
-
-
-
-
- If all of the above steps succeed then the
- will be passed to the method.
-
+ ConnectiongStringName is only supported on .NET 2.0 and higher.
+ Additional information describing the connection string.
+ A connection string used to connect to the database.
-
+
- Test if the logging event should we output by this appender
+ Retrieves the class type of the ADO.NET provider.
- the event to test
- true if the event should be output, false if the event should be ignored
- This method checks the logging event against the threshold level set
- on this appender and also against the filters specified on this
- appender.
-
-
- The implementation of this method is as follows:
+ Gets the Type of the ADO.NET provider to use to connect to the
+ database. This method resolves the type specified in the
+ property.
-
-
-
- Checks that the severity of the
- is greater than or equal to the of this
- appender.
-
-
-
- Checks that the chain accepts the
- .
-
-
-
+ Subclasses can override this method to return a different type
+ if necessary.
+ The of the ADO.NET provider
-
+
- Adds a filter to the end of the filter chain.
+ Connects to the database.
+
+
+
+
+ Cleanup the existing connection.
- the filter to add to this appender
-
- The Filters are organized in a linked list.
-
-
- Setting this property causes the new filter to be pushed onto the
- back of the filter chain.
-
+ Calls the IDbConnection's method.
-
+
- Clears the filter list for this appender.
+ The list of objects.
- Clears the filter list for this appender.
+ The list of objects.
-
+
- Checks if the message level is below this appender's threshold.
+ The security context to use for privileged calls
- to test against.
-
-
- If there is no threshold set, then the return value is always true.
-
-
-
- true if the meets the
- requirements of this appender.
-
-
+
- Is called when the appender is closed. Derived classes should override
- this method if resources need to be released.
+ The that will be used
+ to insert logging events into a database.
-
-
- Releases any resources allocated within the appender such as file handles,
- network connections, etc.
-
-
- It is a programming error to append to a closed appender.
-
-
-
+
- Subclasses of should implement this method
- to perform actual logging.
+ Database connection string.
- The event to append.
-
-
- A subclass must implement this method to perform
- logging of the .
-
- This method will be called by
- if all the conditions listed for that method are met.
-
-
- To restrict the logging of events in the appender
- override the method.
-
-
-
+
- Append a bulk array of logging events.
+ The appSettings key from App.Config that contains the connection string.
- the array of logging events
-
-
- This base class implementation calls the
- method for each element in the bulk array.
-
-
- A sub class that can better process a bulk array of events should
- override this method in addition to .
-
-
-
+
- Called before as a precondition.
+ The connectionStrings key from App.Config that contains the connection string.
+
+
+
+
+ String type name of the type name.
+
+
+
+
+ The text of the command.
+
+
+
+
+ The command type.
+
+
+
+
+ Indicates whether to use transactions when writing to the database.
+
+
+
+
+ Indicates whether to reconnect when a connection is lost.
+
+
+
+
+ The fully qualified type of the AdoNetAppender class.
-
- This method is called by
- before the call to the abstract method.
-
-
- This method can be overridden in a subclass to extend the checks
- made before the event is passed to the method.
-
-
- A subclass should ensure that they delegate this call to
- this base class if it is overridden.
-
+ Used by the internal logger to record the Type of the
+ log message.
- true if the call to should proceed.
-
+
- Renders the to a string.
+ Parameter type used by the .
- The event to render.
- The event rendered as a string.
- Helper method to render a to
- a string. This appender must have a
- set to render the to
- a string.
-
- If there is exception data in the logging event and
- the layout does not process the exception, this method
- will append the exception text to the rendered string.
+ This class provides the basic database parameter properties
+ as defined by the interface.
-
- Where possible use the alternative version of this method
- .
- That method streams the rendering onto an existing Writer
- which can give better performance if the caller already has
- a open and ready for writing.
+ This type can be subclassed to provide database specific
+ functionality. The two methods that are called externally are
+ and .
-
+
- Renders the to a string.
+ Initializes a new instance of the class.
- The event to render.
- The TextWriter to write the formatted event to
-
- Helper method to render a to
- a string. This appender must have a
- set to render the to
- a string.
-
- If there is exception data in the logging event and
- the layout does not process the exception, this method
- will append the exception text to the rendered string.
-
-
- Use this method in preference to
- where possible. If, however, the caller needs to render the event
- to a string then does
- provide an efficient mechanism for doing so.
-
+ Default constructor for the AdoNetAppenderParameter class.
-
+
- Flushes any buffered log data.
+ Gets or sets the name of this parameter.
+
+ The name of this parameter.
+
- This implementation doesn't flush anything and always returns true
+
+ The name of this parameter. The parameter name
+ must match up to a named parameter to the SQL stored procedure
+ or prepared statement.
+
- True if all logging events were flushed successfully, else false.
-
+
- The layout of this appender.
+ Gets or sets the database type for this parameter.
+
+ The database type for this parameter.
+
- See for more information.
+
+ The database type for this parameter. This property should
+ be set to the database type from the
+ enumeration. See .
+
+
+ This property is optional. If not specified the ADO.NET provider
+ will attempt to infer the type from the value.
+
+
-
+
- The name of this appender.
+ Gets or sets the precision for this parameter.
+
+ The precision for this parameter.
+
- See for more information.
+
+ The maximum number of digits used to represent the Value.
+
+
+ This property is optional. If not specified the ADO.NET provider
+ will attempt to infer the precision from the value.
+
+
-
+
- The level threshold of this appender.
+ Gets or sets the scale for this parameter.
+
+ The scale for this parameter.
+
- There is no level threshold filtering by default.
+ The number of decimal places to which Value is resolved.
- See for more information.
+ This property is optional. If not specified the ADO.NET provider
+ will attempt to infer the scale from the value.
+
-
+
- It is assumed and enforced that errorHandler is never null.
+ Gets or sets the size for this parameter.
+
+ The size for this parameter.
+
- It is assumed and enforced that errorHandler is never null.
+ The maximum size, in bytes, of the data within the column.
- See for more information.
+ This property is optional. If not specified the ADO.NET provider
+ will attempt to infer the size from the value.
+
+
+ For BLOB data types like VARCHAR(max) it may be impossible to infer the value automatically, use -1 as the size in this case.
+
-
+
- The first filter in the filter chain.
+ Gets or sets the to use to
+ render the logging event into an object for this
+ parameter.
+
+ The used to render the
+ logging event into an object for this parameter.
+
- Set to null initially.
+ The that renders the value for this
+ parameter.
- See for more information.
+ The can be used to adapt
+ any into a
+ for use in the property.
-
+
- The last filter in the filter chain.
+ Prepare the specified database command object.
+ The command to prepare.
- See for more information.
+
+ Prepares the database command object by adding
+ this parameter to its collection of parameters.
+
-
+
- Flag indicating if this appender is closed.
+ Renders the logging event and set the parameter value in the command.
+ The command containing the parameter.
+ The event to be rendered.
- See for more information.
+
+ Renders the logging event using this parameters layout
+ object. Sets the value of the parameter on the command object.
+
-
+
- The guard prevents an appender from repeatedly calling its own DoAppend method
+ The name of this parameter.
-
+
- StringWriter used to render events
+ The database type for this parameter.
-
+
- The fully qualified type of the AppenderSkeleton class.
+ Flag to infer type rather than use the DbType
-
- Used by the internal logger to record the Type of the
- log message.
-
-
+
- Gets or sets the threshold of this appender.
+ The precision for this parameter.
+
+
+
+
+ The scale for this parameter.
+
+
+
+
+ The size for this parameter.
+
+
+
+
+ The to use to render the
+ logging event into an object for this parameter.
+
+
+
+
+ Appends logging events to the terminal using ANSI color escape sequences.
-
- The threshold of the appender.
-
- All log events with lower level than the threshold level are ignored
- by the appender.
+ AnsiColorTerminalAppender appends log events to the standard output stream
+ or the error output stream using a layout specified by the
+ user. It also allows the color of a specific level of message to be set.
+
+ This appender expects the terminal to understand the VT100 control set
+ in order to interpret the color codes. If the terminal or console does not
+ understand the control codes the behavior is not defined.
+
- In configuration files this option is specified by setting the
- value of the option to a level
- string, such as "DEBUG", "INFO" and so on.
+ By default, all output is written to the console's standard output stream.
+ The property can be set to direct the output to the
+ error stream.
+
+
+ NOTE: This appender writes each message to the System.Console.Out or
+ System.Console.Error that is set at the time the event is appended.
+ Therefore it is possible to programmatically redirect the output of this appender
+ (for example NUnit does this to capture program output). While this is the desired
+ behavior of this appender it may have security implications in your application.
+
+
+ When configuring the ANSI colored terminal appender, a mapping should be
+ specified to map a logging level to a color. For example:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The Level is the standard log4net logging level and ForeColor and BackColor can be any
+ of the following values:
+
+ Blue
+ Green
+ Red
+ White
+ Yellow
+ Purple
+ Cyan
+
+ These color values cannot be combined together to make new colors.
+
+
+ The attributes can be any combination of the following:
+
+ Brightforeground is brighter
+ Dimforeground is dimmer
+ Underscoremessage is underlined
+ Blinkforeground is blinking (does not work on all terminals)
+ Reverseforeground and background are reversed
+ Hiddenoutput is hidden
+ Strikethroughmessage has a line through it
+
+ While any of these attributes may be combined together not all combinations
+ work well together, for example setting both Bright and Dim attributes makes
+ no sense.
+ Patrick Wagstrom
+ Nicko Cadell
-
+
- Gets or sets the for this appender.
+ The enum of possible display attributes
- The of the appender
- The provides a default
- implementation for the property.
+ The following flags can be combined together to
+ form the ANSI color attributes.
+
-
+
- The filter chain.
+ text is bright
- The head of the filter chain filter chain.
-
-
- Returns the head Filter. The Filters are organized in a linked list
- and so all Filters on this Appender are available through the result.
-
-
-
+
- Gets or sets the for this appender.
+ text is dim
- The layout of the appender.
-
-
- See for more information.
-
-
-
-
+
- Gets or sets the name of this appender.
+ text is underlined
- The name of the appender.
-
-
- The name uniquely identifies the appender.
-
-
-
+
- Tests if this appender requires a to be set.
+ text is blinking
-
- In the rather exceptional case, where the appender
- implementation admits a layout but can also work without it,
- then the appender should return true.
-
-
- This default implementation always returns false.
-
+ Not all terminals support this attribute
-
- true if the appender requires a layout object, otherwise false.
-
-
+
- The default buffer size.
+ text and background colors are reversed
-
- The default size of the cyclic buffer used to store events.
- This is set to 512 by default.
-
-
+
- Initializes a new instance of the class.
+ text is hidden
-
-
- Protected default constructor to allow subclassing.
-
-
-
+
- Initializes a new instance of the class.
+ text is displayed with a strikethrough
- the events passed through this appender must be
- fixed by the time that they arrive in the derived class' SendBuffer method.
-
-
- Protected constructor to allow subclassing.
-
-
- The should be set if the subclass
- expects the events delivered to be fixed even if the
- is set to zero, i.e. when no buffering occurs.
-
-
-
+
- Flushes any buffered log data.
+ text color is light
- The maximum time to wait for logging events to be flushed.
- True if all logging events were flushed successfully, else false.
-
+
- Flush the currently buffered events
+ The enum of possible foreground or background color values for
+ use with the color mapping method
- Flushes any events that have been buffered.
-
-
- If the appender is buffering in mode then the contents
- of the buffer will NOT be flushed to the appender.
+ The output can be in one for the following ANSI colors.
+
-
+
- Flush the currently buffered events
+ color is black
- set to true to flush the buffer of lossy events
-
-
- Flushes events that have been buffered. If is
- false then events will only be flushed if this buffer is non-lossy mode.
-
-
- If the appender is buffering in mode then the contents
- of the buffer will only be flushed if is true.
- In this case the contents of the buffer will be tested against the
- and if triggering will be output. All other buffered
- events will be discarded.
-
-
- If is true then the buffer will always
- be emptied by calling this method.
-
-
-
+
- Initialize the appender based on the options set
+ color is red
-
-
- This is part of the delayed object
- activation scheme. The method must
- be called on this object after the configuration properties have
- been set. Until is called this
- object is in an undefined state and must not be used.
-
-
- If any of the configuration properties are modified then
- must be called again.
-
-
-
+
- Close this appender instance.
+ color is green
-
-
- Close this appender instance. If this appender is marked
- as not then the remaining events in
- the buffer must be sent when the appender is closed.
-
-
-
+
- This method is called by the method.
+ color is yellow
- the event to log
-
-
- Stores the in the cyclic buffer.
-
-
- The buffer will be sent (i.e. passed to the
- method) if one of the following conditions is met:
-
-
-
- The cyclic buffer is full and this appender is
- marked as not lossy (see )
-
-
- An is set and
- it is triggered for the
- specified.
-
-
-
- Before the event is stored in the buffer it is fixed
- (see ) to ensure that
- any data referenced by the event will be valid when the buffer
- is processed.
-
-
-
-
-
- Sends the contents of the buffer.
-
- The first logging event.
- The buffer containing the events that need to be send.
-
-
- The subclass must override .
-
-
-
-
-
- Sends the events.
-
- The events that need to be send.
-
-
- The subclass must override this method to process the buffered events.
-
-
-
+
- The size of the cyclic buffer used to hold the logging events.
+ color is blue
-
- Set to by default.
-
-
+
- The cyclic buffer used to store the logging events.
+ color is magenta
-
+
- The triggering event evaluator that causes the buffer to be sent immediately.
+ color is cyan
-
- The object that is used to determine if an event causes the entire
- buffer to be sent immediately. This field can be null, which
- indicates that event triggering is not to be done. The evaluator
- can be set using the property. If this appender
- has the ( property) set to
- true then an must be set.
-
-
+
- Indicates if the appender should overwrite events in the cyclic buffer
- when it becomes full, or if the buffer should be flushed when the
- buffer is full.
+ color is white
-
- If this field is set to true then an must
- be set.
-
-
+
- The triggering event evaluator filters discarded events.
+ Initializes a new instance of the class.
- The object that is used to determine if an event that is discarded should
- really be discarded or if it should be sent to the appenders.
- This field can be null, which indicates that all discarded events will
- be discarded.
+ The instance of the class is set up to write
+ to the standard output stream.
-
+
- Value indicating which fields in the event should be fixed
+ Target is the value of the console output stream.
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
- By default all fields are fixed
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
-
-
- The events delivered to the subclass must be fixed.
-
-
-
+
- Gets or sets a value that indicates whether the appender is lossy.
+ Add a mapping of level to color
-
- true if the appender is lossy, otherwise false. The default is false.
-
+ The mapping to add
- This appender uses a buffer to store logging events before
- delivering them. A triggering event causes the whole buffer
- to be send to the remote sink. If the buffer overruns before
- a triggering event then logging events could be lost. Set
- to false to prevent logging events
- from being lost.
+ Add a mapping to this appender.
+ Each mapping defines the foreground and background colours
+ for a level.
- If is set to true then an
- must be specified.
-
+
- Gets or sets the size of the cyclic buffer used to hold the
- logging events.
+ This method is called by the method.
-
- The size of the cyclic buffer used to hold the logging events.
-
+ The event to log.
- The option takes a positive integer
- representing the maximum number of logging events to collect in
- a cyclic buffer. When the is reached,
- oldest events are deleted as new events are added to the
- buffer. By default the size of the cyclic buffer is 512 events.
+ Writes the event to the console.
- If the is set to a value less than
- or equal to 1 then no buffering will occur. The logging event
- will be delivered synchronously (depending on the
- and properties). Otherwise the event will
- be buffered.
+ The format of the output will depend on the appender's layout.
-
+
- Gets or sets the that causes the
- buffer to be sent immediately.
+ This appender requires a to be set.
-
- The that causes the buffer to be
- sent immediately.
-
+ true
- The evaluator will be called for each event that is appended to this
- appender. If the evaluator triggers then the current buffer will
- immediately be sent (see ).
+ This appender requires a to be set.
- If is set to true then an
- must be specified.
-
+
- Gets or sets the value of the to use.
+ Initialize the options for this appender
-
- The value of the to use.
-
- The evaluator will be called for each event that is discarded from this
- appender. If the evaluator triggers then the current buffer will immediately
- be sent (see ).
+ Initialize the level to color mappings set on this appender.
-
+
- Gets or sets a value indicating if only part of the logging event data
- should be fixed.
+ The to use when writing to the Console
+ standard output stream.
-
- true if the appender should only fix part of the logging event
- data, otherwise false. The default is false.
-
- Setting this property to true will cause only part of the
- event data to be fixed and serialized. This will improve performance.
-
-
- See for more information.
+ The to use when writing to the Console
+ standard output stream.
-
+
- Gets or sets a the fields that will be fixed in the event
+ The to use when writing to the Console
+ standard error output stream.
-
- The event fields that will be fixed before the event is buffered
-
- The logging event needs to have certain thread specific values
- captured before it can be buffered. See
- for details.
+ The to use when writing to the Console
+ standard error output stream.
-
-
-
- Initializes a new instance of the class.
+
+
+ Flag to write output to the error stream rather than the standard output stream
-
- Public default constructor to initialize a new instance of this class.
-
-
+
- Initialize the appender based on the options set
+ Mapping from level object to color value
+
+
+
+
+ Ansi code to reset terminal
+
+
+
+
+ A class to act as a mapping between the level that a logging call is made at and
+ the color it should be displayed as.
- This is part of the delayed object
- activation scheme. The method must
- be called on this object after the configuration properties have
- been set. Until is called this
- object is in an undefined state and must not be used.
-
-
- If any of the configuration properties are modified then
- must be called again.
+ Defines the mapping between a level and the color it should be displayed in.
-
+
- Override the parent method to close the database
+ The mapped foreground color for the specified level
- Closes the database command and database connection.
+ Required property.
+ The mapped foreground color for the specified level
-
+
- Inserts the events into the database.
+ The mapped background color for the specified level
- The events to insert into the database.
- Insert all the events specified in the
- array into the database.
+ Required property.
+ The mapped background color for the specified level
-
+
- Adds a parameter to the command.
+ The color attributes for the specified level
- The parameter to add to the command.
- Adds a parameter to the ordered list of command parameters.
+ Required property.
+ The color attributes for the specified level
-
+
- Writes the events to the database using the transaction specified.
+ Initialize the options for the object
- The transaction that the events will be executed under.
- The array of events to insert into the database.
- The transaction argument can be null if the appender has been
- configured not to use transactions. See
- property for more information.
+ Combine the and together
+ and append the attributes.
-
+
- Formats the log message into database statement text.
+ The combined , and
+ suitable for setting the ansi terminal color.
- The event being logged.
-
- This method can be overridden by subclasses to provide
- more control over the format of the database statement.
-
-
- Text that can be passed to a .
-
-
+
- Creates an instance used to connect to the database.
+ A strongly-typed collection of objects.
-
- This method is called whenever a new IDbConnection is needed (i.e. when a reconnect is necessary).
-
- The of the object.
- The connectionString output from the ResolveConnectionString method.
- An instance with a valid connection string.
+ Nicko Cadell
-
+
- Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey
- property.
+ Supports type-safe iteration over a .
-
- ConnectiongStringName is only supported on .NET 2.0 and higher.
-
- Additional information describing the connection string.
- A connection string used to connect to the database.
+
-
+
- Retrieves the class type of the ADO.NET provider.
+ Gets the current element in the collection.
-
-
- Gets the Type of the ADO.NET provider to use to connect to the
- database. This method resolves the type specified in the
- property.
-
-
- Subclasses can override this method to return a different type
- if necessary.
-
-
- The of the ADO.NET provider
-
+
- Connects to the database.
-
+ Advances the enumerator to the next element in the collection.
+
+
+ true if the enumerator was successfully advanced to the next element;
+ false if the enumerator has passed the end of the collection.
+
+
+ The collection was modified after the enumerator was created.
+
-
+
- Cleanup the existing connection.
+ Sets the enumerator to its initial position, before the first element in the collection.
-
- Calls the IDbConnection's method.
-
-
+
- The list of objects.
+ Creates a read-only wrapper for a AppenderCollection instance.
-
-
- The list of objects.
-
-
+ list to create a readonly wrapper arround
+
+ An AppenderCollection wrapper that is read-only.
+
-
+
- The security context to use for privileged calls
+ An empty readonly static AppenderCollection
-
+
- The that will be used
- to insert logging events into a database.
+ Initializes a new instance of the AppenderCollection class
+ that is empty and has the default initial capacity.
-
+
- Database connection string.
+ Initializes a new instance of the AppenderCollection class
+ that has the specified initial capacity.
+
+ The number of elements that the new AppenderCollection is initially capable of storing.
+
-
+
- The appSettings key from App.Config that contains the connection string.
+ Initializes a new instance of the AppenderCollection class
+ that contains elements copied from the specified AppenderCollection.
+ The AppenderCollection whose elements are copied to the new collection.
-
+
- The connectionStrings key from App.Config that contains the connection string.
+ Initializes a new instance of the AppenderCollection class
+ that contains elements copied from the specified array.
+ The array whose elements are copied to the new list.
-
+
- String type name of the type name.
+ Initializes a new instance of the AppenderCollection class
+ that contains elements copied from the specified collection.
+ The collection whose elements are copied to the new list.
-
+
- The text of the command.
+ Type visible only to our subclasses
+ Used to access protected constructor
+
-
+
- The command type.
+ A value
-
+
- Indicates whether to use transactions when writing to the database.
+ Allow subclasses to avoid our default constructors
+
+
-
+
- Indicates whether to reconnect when a connection is lost.
+ Gets the number of elements actually contained in the AppenderCollection.
-
+
- The fully qualified type of the AdoNetAppender class.
+ Copies the entire AppenderCollection to a one-dimensional
+ array.
-
- Used by the internal logger to record the Type of the
- log message.
-
+ The one-dimensional array to copy to.
-
+
- Gets or sets the database connection string that is used to connect to
- the database.
+ Copies the entire AppenderCollection to a one-dimensional
+ array, starting at the specified index of the target array.
-
- The database connection string used to connect to the database.
-
-
-
- The connections string is specific to the connection type.
- See for more information.
-
-
- Connection string for MS Access via ODBC:
- "DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb"
-
- Another connection string for MS Access via ODBC:
- "Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;"
-
- Connection string for MS Access via OLE DB:
- "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;"
-
+ The one-dimensional array to copy to.
+ The zero-based index in at which copying begins.
-
+
- The appSettings key from App.Config that contains the connection string.
+ Gets a value indicating whether access to the collection is synchronized (thread-safe).
+ false, because the backing type is an array, which is never thread-safe.
-
+
- The connectionStrings key from App.Config that contains the connection string.
+ Gets an object that can be used to synchronize access to the collection.
-
- This property requires at least .NET 2.0.
-
-
+
- Gets or sets the type name of the connection
- that should be created.
+ Gets or sets the at the specified index.
-
- The type name of the connection.
-
-
-
- The type name of the ADO.NET provider to use.
-
-
- The default is to use the OLE DB provider.
-
-
- Use the OLE DB Provider. This is the default value.
- System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Use the MS SQL Server Provider.
- System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- Use the ODBC Provider.
- Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral
- This is an optional package that you can download from
- http://msdn.microsoft.com/downloads
- search for ODBC .NET Data Provider.
-
- Use the Oracle Provider.
- System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- This is an optional package that you can download from
- http://msdn.microsoft.com/downloads
- search for .NET Managed Provider for Oracle.
-
+ The zero-based index of the element to get or set.
+
+ is less than zero
+ -or-
+ is equal to or greater than .
+
-
+
- Gets or sets the command text that is used to insert logging events
- into the database.
+ Adds a to the end of the AppenderCollection.
-
- The command text used to insert logging events into the database.
-
-
-
- Either the text of the prepared statement or the
- name of the stored procedure to execute to write into
- the database.
-
-
- The property determines if
- this text is a prepared statement or a stored procedure.
-
-
- If this property is not set, the command text is retrieved by invoking
- .
-
-
+ The to be added to the end of the AppenderCollection.
+ The index at which the value has been added.
-
+
- Gets or sets the command type to execute.
+ Removes all elements from the AppenderCollection.
-
- The command type to execute.
-
-
-
- This value may be either (System.Data.CommandType.Text) to specify
- that the is a prepared statement to execute,
- or (System.Data.CommandType.StoredProcedure) to specify that the
- property is the name of a stored procedure
- to execute.
-
-
- The default value is (System.Data.CommandType.Text).
-
-
-
+
- Should transactions be used to insert logging events in the database.
+ Creates a shallow copy of the .
-
- true if transactions should be used to insert logging events in
- the database, otherwise false. The default value is true.
-
-
-
- Gets or sets a value that indicates whether transactions should be used
- to insert logging events in the database.
-
-
- When set a single transaction will be used to insert the buffered events
- into the database. Otherwise each event will be inserted without using
- an explicit transaction.
-
-
+ A new with a shallow copy of the collection data.
-
+
- Gets or sets the used to call the NetSend method.
+ Determines whether a given is in the AppenderCollection.
-
- The used to call the NetSend method.
-
-
-
- Unless a specified here for this appender
- the is queried for the
- security context to use. The default behavior is to use the security context
- of the current thread.
-
-
+ The to check for.
+ true if is found in the AppenderCollection; otherwise, false.
-
+
- Should this appender try to reconnect to the database on error.
+ Returns the zero-based index of the first occurrence of a
+ in the AppenderCollection.
-
- true if the appender should try to reconnect to the database after an
- error has occurred, otherwise false. The default value is false,
- i.e. not to try to reconnect.
-
-
-
- The default behaviour is for the appender not to try to reconnect to the
- database if an error occurs. Subsequent logging events are discarded.
-
-
- To force the appender to attempt to reconnect to the database set this
- property to true.
-
-
- When the appender attempts to connect to the database there may be a
- delay of up to the connection timeout specified in the connection string.
- This delay will block the calling application's thread.
- Until the connection can be reestablished this potential delay may occur multiple times.
-
-
+ The to locate in the AppenderCollection.
+
+ The zero-based index of the first occurrence of
+ in the entire AppenderCollection, if found; otherwise, -1.
+
-
+
- Gets or sets the underlying .
+ Inserts an element into the AppenderCollection at the specified index.
-
- The underlying .
-
-
- creates a to insert
- logging events into a database. Classes deriving from
- can use this property to get or set this . Use the
- underlying returned from if
- you require access beyond that which provides.
-
+ The zero-based index at which should be inserted.
+ The to insert.
+
+ is less than zero
+ -or-
+ is equal to or greater than .
+
-
+
- Parameter type used by the .
+ Removes the first occurrence of a specific from the AppenderCollection.
-
-
- This class provides the basic database parameter properties
- as defined by the interface.
-
- This type can be subclassed to provide database specific
- functionality. The two methods that are called externally are
- and .
-
-
+ The to remove from the AppenderCollection.
+
+ The specified was not found in the AppenderCollection.
+
-
+
- Initializes a new instance of the class.
+ Removes the element at the specified index of the AppenderCollection.
-
- Default constructor for the AdoNetAppenderParameter class.
-
+ The zero-based index of the element to remove.
+
+ is less than zero
+ -or-
+ is equal to or greater than .
+
-
+
- Prepare the specified database command object.
+ Gets a value indicating whether the collection has a fixed size.
- The command to prepare.
-
-
- Prepares the database command object by adding
- this parameter to its collection of parameters.
-
-
+ true if the collection has a fixed size; otherwise, false. The default is false
-
+
- Renders the logging event and set the parameter value in the command.
+ Gets a value indicating whether the IList is read-only.
- The command containing the parameter.
- The event to be rendered.
-
-
- Renders the logging event using this parameters layout
- object. Sets the value of the parameter on the command object.
-
-
+ true if the collection is read-only; otherwise, false. The default is false
-
+
- The name of this parameter.
+ Returns an enumerator that can iterate through the AppenderCollection.
+ An for the entire AppenderCollection.
-
+
- The database type for this parameter.
+ Gets or sets the number of elements the AppenderCollection can contain.
-
+
- Flag to infer type rather than use the DbType
+ Adds the elements of another AppenderCollection to the current AppenderCollection.
+ The AppenderCollection whose elements should be added to the end of the current AppenderCollection.
+ The new of the AppenderCollection.
-
+
- The precision for this parameter.
+ Adds the elements of a array to the current AppenderCollection.
+ The array whose elements should be added to the end of the AppenderCollection.
+ The new of the AppenderCollection.
-
+
- The scale for this parameter.
+ Adds the elements of a collection to the current AppenderCollection.
+ The collection whose elements should be added to the end of the AppenderCollection.
+ The new of the AppenderCollection.
-
+
- The size for this parameter.
+ Sets the capacity to the actual number of elements.
-
+
- The to use to render the
- logging event into an object for this parameter.
+ Return the collection elements as an array
+ the array
-
+
+
+ is less than zero
+ -or-
+ is equal to or greater than .
+
+
+
+
+ is less than zero
+ -or-
+ is equal to or greater than .
+
+
+
- Gets or sets the name of this parameter.
+ Supports simple iteration over a .
-
- The name of this parameter.
-
-
-
- The name of this parameter. The parameter name
- must match up to a named parameter to the SQL stored procedure
- or prepared statement.
-
-
+
-
+
- Gets or sets the database type for this parameter.
+ Initializes a new instance of the Enumerator class.
-
- The database type for this parameter.
-
-
-
- The database type for this parameter. This property should
- be set to the database type from the
- enumeration. See .
-
-
- This property is optional. If not specified the ADO.NET provider
- will attempt to infer the type from the value.
-
-
-
+
-
+
- Gets or sets the precision for this parameter.
+ Gets the current element in the collection.
+
+
+
+
+ Advances the enumerator to the next element in the collection.
+
+
+ true if the enumerator was successfully advanced to the next element;
+ false if the enumerator has passed the end of the collection.
+
+
+ The collection was modified after the enumerator was created.
+
+
+
+
+ Sets the enumerator to its initial position, before the first element in the collection.
+
+
+
+
+
+
+
+ Abstract base class implementation of .
-
- The precision for this parameter.
-
- The maximum number of digits used to represent the Value.
+ This class provides the code for common functionality, such
+ as support for threshold filtering and support for general filters.
- This property is optional. If not specified the ADO.NET provider
- will attempt to infer the precision from the value.
+ Appenders can also implement the interface. Therefore
+ they would require that the method
+ be called after the appenders properties have been configured.
-
+ Nicko Cadell
+ Gert Driesen
-
+
- Gets or sets the scale for this parameter.
+ Default constructor
-
- The scale for this parameter.
-
-
- The number of decimal places to which Value is resolved.
-
-
- This property is optional. If not specified the ADO.NET provider
- will attempt to infer the scale from the value.
-
+ Empty default constructor
-
-
+
- Gets or sets the size for this parameter.
+ Finalizes this appender by calling the implementation's
+ method.
-
- The size for this parameter.
-
- The maximum size, in bytes, of the data within the column.
-
-
- This property is optional. If not specified the ADO.NET provider
- will attempt to infer the size from the value.
-
-
- For BLOB data types like VARCHAR(max) it may be impossible to infer the value automatically, use -1 as the size in this case.
+ If this appender has not been closed then the Finalize method
+ will call .
-
-
+
- Gets or sets the to use to
- render the logging event into an object for this
- parameter.
+ Gets or sets the threshold of this appender.
- The used to render the
- logging event into an object for this parameter.
+ The threshold of the appender.
- The that renders the value for this
- parameter.
+ All log events with lower level than the threshold level are ignored
+ by the appender.
- The can be used to adapt
- any into a
- for use in the property.
+ In configuration files this option is specified by setting the
+ value of the option to a level
+ string, such as "DEBUG", "INFO" and so on.
-
+
- Appends logging events to the terminal using ANSI color escape sequences.
+ Gets or sets the for this appender.
+ The of the appender
- AnsiColorTerminalAppender appends log events to the standard output stream
- or the error output stream using a layout specified by the
- user. It also allows the color of a specific level of message to be set.
-
-
- This appender expects the terminal to understand the VT100 control set
- in order to interpret the color codes. If the terminal or console does not
- understand the control codes the behavior is not defined.
-
-
- By default, all output is written to the console's standard output stream.
- The property can be set to direct the output to the
- error stream.
-
-
- NOTE: This appender writes each message to the System.Console.Out or
- System.Console.Error that is set at the time the event is appended.
- Therefore it is possible to programmatically redirect the output of this appender
- (for example NUnit does this to capture program output). While this is the desired
- behavior of this appender it may have security implications in your application.
-
-
- When configuring the ANSI colored terminal appender, a mapping should be
- specified to map a logging level to a color. For example:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- The Level is the standard log4net logging level and ForeColor and BackColor can be any
- of the following values:
-
- Blue
- Green
- Red
- White
- Yellow
- Purple
- Cyan
-
- These color values cannot be combined together to make new colors.
-
-
- The attributes can be any combination of the following:
-
- Brightforeground is brighter
- Dimforeground is dimmer
- Underscoremessage is underlined
- Blinkforeground is blinking (does not work on all terminals)
- Reverseforeground and background are reversed
- Hiddenoutput is hidden
- Strikethroughmessage has a line through it
-
- While any of these attributes may be combined together not all combinations
- work well together, for example setting both Bright and Dim attributes makes
- no sense.
+ The provides a default
+ implementation for the property.
- Patrick Wagstrom
- Nicko Cadell
-
+
- The to use when writing to the Console
- standard output stream.
+ The filter chain.
+ The head of the filter chain filter chain.
- The to use when writing to the Console
- standard output stream.
+ Returns the head Filter. The Filters are organized in a linked list
+ and so all Filters on this Appender are available through the result.
-
+
- The to use when writing to the Console
- standard error output stream.
+ Gets or sets the for this appender.
+ The layout of the appender.
- The to use when writing to the Console
- standard error output stream.
+ See for more information.
+
-
-
- Ansi code to reset terminal
-
-
-
+
- Initializes a new instance of the class.
+ Initialize the appender based on the options set
- The instance of the class is set up to write
- to the standard output stream.
+
+ This is part of the delayed object
+ activation scheme. The method must
+ be called on this object after the configuration properties have
+ been set. Until is called this
+ object is in an undefined state and must not be used.
+
+
+ If any of the configuration properties are modified then
+ must be called again.
+
-
+
- Add a mapping of level to color
+ Gets or sets the name of this appender.
- The mapping to add
+ The name of the appender.
- Add a mapping to this appender.
- Each mapping defines the foreground and background colours
- for a level.
+ The name uniquely identifies the appender.
-
+
- This method is called by the method.
+ Closes the appender and release resources.
- The event to log.
- Writes the event to the console.
+ Release any resources allocated within the appender such as file handles,
+ network connections, etc.
- The format of the output will depend on the appender's layout.
+ It is a programming error to append to a closed appender.
-
-
-
-
- Initialize the options for this appender
-
-
- Initialize the level to color mappings set on this appender.
+ This method cannot be overridden by subclasses. This method
+ delegates the closing of the appender to the
+ method which must be overridden in the subclass.
-
-
- Flag to write output to the error stream rather than the standard output stream
-
-
-
-
- Mapping from level object to color value
-
-
-
+
- Target is the value of the console output stream.
+ Performs threshold checks and invokes filters before
+ delegating actual logging to the subclasses specific
+ method.
-
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
-
+ The event to log.
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
-
+ This method cannot be overridden by derived classes. A
+ derived class should override the method
+ which is called by this method.
+
+
+ The implementation of this method is as follows:
+
+
+
+
+
+ Checks that the severity of the
+ is greater than or equal to the of this
+ appender.
+
+
+
+ Checks that the chain accepts the
+ .
+
+
+
+
+ Calls and checks that
+ it returns true.
+
+
+
+
+ If all of the above steps succeed then the
+ will be passed to the abstract method.
+
-
+
- This appender requires a to be set.
+ Performs threshold checks and invokes filters before
+ delegating actual logging to the subclasses specific
+ method.
- true
+ The array of events to log.
- This appender requires a to be set.
+ This method cannot be overridden by derived classes. A
+ derived class should override the method
+ which is called by this method.
+
+
+ The implementation of this method is as follows:
+
+
+
+
+
+ Checks that the severity of the
+ is greater than or equal to the of this
+ appender.
+
+
+
+ Checks that the chain accepts the
+ .
+
+
+
+
+ Calls and checks that
+ it returns true.
+
+
+
+
+ If all of the above steps succeed then the
+ will be passed to the method.
-
+
- The enum of possible display attributes
+ Test if the logging event should we output by this appender
+ the event to test
+ true if the event should be output, false if the event should be ignored
- The following flags can be combined together to
- form the ANSI color attributes.
+ This method checks the logging event against the threshold level set
+ on this appender and also against the filters specified on this
+ appender.
+
+
+ The implementation of this method is as follows:
+
+
+
+
+
+ Checks that the severity of the
+ is greater than or equal to the of this
+ appender.
+
+
+
+ Checks that the chain accepts the
+ .
+
+
+
-
-
-
-
- text is bright
-
-
-
-
- text is dim
-
-
-
- text is underlined
-
-
-
+
- text is blinking
+ Adds a filter to the end of the filter chain.
+ the filter to add to this appender
- Not all terminals support this attribute
+
+ The Filters are organized in a linked list.
+
+
+ Setting this property causes the new filter to be pushed onto the
+ back of the filter chain.
+
-
-
- text and background colors are reversed
-
-
-
-
- text is hidden
-
-
-
-
- text is displayed with a strikethrough
-
-
-
-
- text color is light
-
-
-
+
- The enum of possible foreground or background color values for
- use with the color mapping method
+ Clears the filter list for this appender.
- The output can be in one for the following ANSI colors.
+ Clears the filter list for this appender.
-
-
-
-
- color is black
-
-
-
-
- color is red
-
-
-
-
- color is green
-
-
-
-
- color is yellow
-
-
-
-
- color is blue
-
-
-
-
- color is magenta
-
-
-
-
- color is cyan
-
-
-
- color is white
-
-
-
+
- A class to act as a mapping between the level that a logging call is made at and
- the color it should be displayed as.
+ Checks if the message level is below this appender's threshold.
+ to test against.
- Defines the mapping between a level and the color it should be displayed in.
+ If there is no threshold set, then the return value is always true.
+
+ true if the meets the
+ requirements of this appender.
+
-
+
- An entry in the
+ Is called when the appender is closed. Derived classes should override
+ this method if resources need to be released.
- This is an abstract base class for types that are stored in the
- object.
+ Releases any resources allocated within the appender such as file handles,
+ network connections, etc.
+
+
+ It is a programming error to append to a closed appender.
- Nicko Cadell
-
+
- Default protected constructor
+ Subclasses of should implement this method
+ to perform actual logging.
+ The event to append.
- Default protected constructor
+ A subclass must implement this method to perform
+ logging of the .
+
+ This method will be called by
+ if all the conditions listed for that method are met.
+
+
+ To restrict the logging of events in the appender
+ override the method.
-
+
- Initialize any options defined on this entry
+ Append a bulk array of logging events.
+ the array of logging events
- Should be overridden by any classes that need to initialise based on their options
+ This base class implementation calls the
+ method for each element in the bulk array.
+
+
+ A sub class that can better process a bulk array of events should
+ override this method in addition to .
-
+
- The level that is the key for this mapping
+ Called before as a precondition.
-
- The that is the key for this mapping
-
- Get or set the that is the key for this
- mapping subclass.
+ This method is called by
+ before the call to the abstract method.
+
+
+ This method can be overridden in a subclass to extend the checks
+ made before the event is passed to the method.
+
+
+ A subclass should ensure that they delegate this call to
+ this base class if it is overridden.
+ true if the call to should proceed.
-
+
- Initialize the options for the object
+ Renders the to a string.
+ The event to render.
+ The event rendered as a string.
- Combine the and together
- and append the attributes.
+ Helper method to render a to
+ a string. This appender must have a
+ set to render the to
+ a string.
+
+ If there is exception data in the logging event and
+ the layout does not process the exception, this method
+ will append the exception text to the rendered string.
+
+
+ Where possible use the alternative version of this method
+ .
+ That method streams the rendering onto an existing Writer
+ which can give better performance if the caller already has
+ a open and ready for writing.
-
+
- The mapped foreground color for the specified level
+ Renders the to a string.
+ The event to render.
+ The TextWriter to write the formatted event to
- Required property.
- The mapped foreground color for the specified level
+ Helper method to render a to
+ a string. This appender must have a
+ set to render the to
+ a string.
+
+ If there is exception data in the logging event and
+ the layout does not process the exception, this method
+ will append the exception text to the rendered string.
+
+
+ Use this method in preference to
+ where possible. If, however, the caller needs to render the event
+ to a string then does
+ provide an efficient mechanism for doing so.
-
+
- The mapped background color for the specified level
+ Tests if this appender requires a to be set.
- Required property.
- The mapped background color for the specified level
+ In the rather exceptional case, where the appender
+ implementation admits a layout but can also work without it,
+ then the appender should return true.
+
+
+ This default implementation always returns false.
+
+ true if the appender requires a layout object, otherwise false.
+
-
+
- The color attributes for the specified level
+ Flushes any buffered log data.
-
- Required property.
- The color attributes for the specified level
-
+ This implementation doesn't flush anything and always returns true
+ True if all logging events were flushed successfully, else false.
-
+
- The combined , and
- suitable for setting the ansi terminal color.
+ The layout of this appender.
+
+ See for more information.
+
-
+
- A strongly-typed collection of objects.
+ The name of this appender.
- Nicko Cadell
+
+ See for more information.
+
-
+
- Creates a read-only wrapper for a AppenderCollection instance.
+ The level threshold of this appender.
- list to create a readonly wrapper arround
-
- An AppenderCollection wrapper that is read-only.
-
+
+
+ There is no level threshold filtering by default.
+
+
+ See for more information.
+
+
-
+
- An empty readonly static AppenderCollection
+ It is assumed and enforced that errorHandler is never null.
+
+
+ It is assumed and enforced that errorHandler is never null.
+
+
+ See for more information.
+
+
-
+
- Initializes a new instance of the AppenderCollection class
- that is empty and has the default initial capacity.
+ The first filter in the filter chain.
+
+
+ Set to null initially.
+
+
+ See for more information.
+
+
-
+
- Initializes a new instance of the AppenderCollection class
- that has the specified initial capacity.
+ The last filter in the filter chain.
-
- The number of elements that the new AppenderCollection is initially capable of storing.
-
+
+ See for more information.
+
-
+
- Initializes a new instance of the AppenderCollection class
- that contains elements copied from the specified AppenderCollection.
+ Flag indicating if this appender is closed.
- The AppenderCollection whose elements are copied to the new collection.
+
+ See for more information.
+
-
+
- Initializes a new instance of the AppenderCollection class
- that contains elements copied from the specified array.
+ The guard prevents an appender from repeatedly calling its own DoAppend method
- The array whose elements are copied to the new list.
-
+
- Initializes a new instance of the AppenderCollection class
- that contains elements copied from the specified collection.
+ StringWriter used to render events
- The collection whose elements are copied to the new list.
-
+
- Allow subclasses to avoid our default constructors
+ Initial buffer size
-
-
-
+
- Copies the entire AppenderCollection to a one-dimensional
- array.
+ Maximum buffer size before it is recycled
- The one-dimensional array to copy to.
-
+
- Copies the entire AppenderCollection to a one-dimensional
- array, starting at the specified index of the target array.
+ The fully qualified type of the AppenderSkeleton class.
- The one-dimensional array to copy to.
- The zero-based index in at which copying begins.
+
+ Used by the internal logger to record the Type of the
+ log message.
+
-
+
- Adds a to the end of the AppenderCollection.
+
+ Appends log events to the ASP.NET system.
+
- The to be added to the end of the AppenderCollection.
- The index at which the value has been added.
+
+
+ Diagnostic information and tracing messages that you specify are appended to the output
+ of the page that is sent to the requesting browser. Optionally, you can view this information
+ from a separate trace viewer (Trace.axd) that displays trace information for every page in a
+ given application.
+
+
+ Trace statements are processed and displayed only when tracing is enabled. You can control
+ whether tracing is displayed to a page, to the trace viewer, or both.
+
+
+ The logging event is passed to the or
+ method depending on the level of the logging event.
+ The event's logger name is the default value for the category parameter of the Write/Warn method.
+
+
+ Nicko Cadell
+ Gert Driesen
+ Ron Grabowski
-
+
- Removes all elements from the AppenderCollection.
+ Initializes a new instance of the class.
+
+
+ Default constructor.
+
+
-
+
- Creates a shallow copy of the .
+ Write the logging event to the ASP.NET trace
- A new with a shallow copy of the collection data.
+ the event to log
+
+
+ Write the logging event to the ASP.NET trace
+ HttpContext.Current.Trace
+ ().
+
+
-
+
- Determines whether a given is in the AppenderCollection.
+ This appender requires a to be set.
- The to check for.
- true if is found in the AppenderCollection; otherwise, false.
-
-
-
- Returns the zero-based index of the first occurrence of a
- in the AppenderCollection.
-
- The to locate in the AppenderCollection.
-
- The zero-based index of the first occurrence of
- in the entire AppenderCollection, if found; otherwise, -1.
-
+ true
+
+
+ This appender requires a to be set.
+
+
-
+
- Inserts an element into the AppenderCollection at the specified index.
+ The category parameter sent to the Trace method.
- The zero-based index at which should be inserted.
- The to insert.
-
- is less than zero
- -or-
- is equal to or greater than .
-
+
+
+ Defaults to %logger which will use the logger name of the current
+ as the category parameter.
+
+
+
+
-
+
- Removes the first occurrence of a specific from the AppenderCollection.
+ Defaults to %logger
- The to remove from the AppenderCollection.
-
- The specified was not found in the AppenderCollection.
-
-
+
- Removes the element at the specified index of the AppenderCollection.
+ Abstract base class implementation of that
+ buffers events in a fixed size buffer.
- The zero-based index of the element to remove.
-
- is less than zero
- -or-
- is equal to or greater than .
-
+
+
+ This base class should be used by appenders that need to buffer a
+ number of events before logging them.
+ For example the
+ buffers events and then submits the entire contents of the buffer to
+ the underlying database in one go.
+
+
+ Subclasses should override the
+ method to deliver the buffered events.
+
+ The BufferingAppenderSkeleton maintains a fixed size cyclic
+ buffer of events. The size of the buffer is set using
+ the property.
+
+ A is used to inspect
+ each event as it arrives in the appender. If the
+ triggers, then the current buffer is sent immediately
+ (see ). Otherwise the event
+ is stored in the buffer. For example, an evaluator can be used to
+ deliver the events immediately when an ERROR event arrives.
+
+
+ The buffering appender can be configured in a mode.
+ By default the appender is NOT lossy. When the buffer is full all
+ the buffered events are sent with .
+ If the property is set to true then the
+ buffer will not be sent when it is full, and new events arriving
+ in the appender will overwrite the oldest event in the buffer.
+ In lossy mode the buffer will only be sent when the
+ triggers. This can be useful behavior when you need to know about
+ ERROR events but not about events with a lower level, configure an
+ evaluator that will trigger when an ERROR event arrives, the whole
+ buffer will be sent which gives a history of events leading up to
+ the ERROR event.
+
+
+ Nicko Cadell
+ Gert Driesen
-
+
- Returns an enumerator that can iterate through the AppenderCollection.
+ Initializes a new instance of the class.
- An for the entire AppenderCollection.
+
+
+ Protected default constructor to allow subclassing.
+
+
-
+
- Adds the elements of another AppenderCollection to the current AppenderCollection.
+ Initializes a new instance of the class.
- The AppenderCollection whose elements should be added to the end of the current AppenderCollection.
- The new of the AppenderCollection.
+ the events passed through this appender must be
+ fixed by the time that they arrive in the derived class' SendBuffer method.
+
+
+ Protected constructor to allow subclassing.
+
+
+ The should be set if the subclass
+ expects the events delivered to be fixed even if the
+ is set to zero, i.e. when no buffering occurs.
+
+
-
+
- Adds the elements of a array to the current AppenderCollection.
+ Gets or sets a value that indicates whether the appender is lossy.
- The array whose elements should be added to the end of the AppenderCollection.
- The new of the AppenderCollection.
+
+ true if the appender is lossy, otherwise false. The default is false.
+
+
+
+ This appender uses a buffer to store logging events before
+ delivering them. A triggering event causes the whole buffer
+ to be send to the remote sink. If the buffer overruns before
+ a triggering event then logging events could be lost. Set
+ to false to prevent logging events
+ from being lost.
+
+ If is set to true then an
+ must be specified.
+
-
+
- Adds the elements of a collection to the current AppenderCollection.
+ Gets or sets the size of the cyclic buffer used to hold the
+ logging events.
- The collection whose elements should be added to the end of the AppenderCollection.
- The new of the AppenderCollection.
+
+ The size of the cyclic buffer used to hold the logging events.
+
+
+
+ The option takes a positive integer
+ representing the maximum number of logging events to collect in
+ a cyclic buffer. When the is reached,
+ oldest events are deleted as new events are added to the
+ buffer. By default the size of the cyclic buffer is 512 events.
+
+
+ If the is set to a value less than
+ or equal to 1 then no buffering will occur. The logging event
+ will be delivered synchronously (depending on the
+ and properties). Otherwise the event will
+ be buffered.
+
+
-
+
- Sets the capacity to the actual number of elements.
+ Gets or sets the that causes the
+ buffer to be sent immediately.
+
+ The that causes the buffer to be
+ sent immediately.
+
+
+
+ The evaluator will be called for each event that is appended to this
+ appender. If the evaluator triggers then the current buffer will
+ immediately be sent (see ).
+
+ If is set to true then an
+ must be specified.
+
-
+
- Return the collection elements as an array
+ Gets or sets the value of the to use.
- the array
-
-
-
- is less than zero
- -or-
- is equal to or greater than .
-
-
-
-
- is less than zero
- -or-
- is equal to or greater than .
-
+
+ The value of the to use.
+
+
+
+ The evaluator will be called for each event that is discarded from this
+ appender. If the evaluator triggers then the current buffer will immediately
+ be sent (see ).
+
+
-
+
- Gets the number of elements actually contained in the AppenderCollection.
+ Gets or sets a value indicating if only part of the logging event data
+ should be fixed.
+
+ true if the appender should only fix part of the logging event
+ data, otherwise false. The default is false.
+
+
+
+ Setting this property to true will cause only part of the
+ event data to be fixed and serialized. This will improve performance.
+
+
+ See for more information.
+
+
-
+
- Gets a value indicating whether access to the collection is synchronized (thread-safe).
+ Gets or sets a the fields that will be fixed in the event
- false, because the backing type is an array, which is never thread-safe.
+
+ The event fields that will be fixed before the event is buffered
+
+
+
+ The logging event needs to have certain thread specific values
+ captured before it can be buffered. See
+ for details.
+
+
+
-
+
- Gets an object that can be used to synchronize access to the collection.
+ Flushes any buffered log data.
+ The maximum time to wait for logging events to be flushed.
+ True if all logging events were flushed successfully, else false.
-
+
- Gets or sets the at the specified index.
+ Flush the currently buffered events
- The zero-based index of the element to get or set.
-
- is less than zero
- -or-
- is equal to or greater than .
-
+
+
+ Flushes any events that have been buffered.
+
+
+ If the appender is buffering in mode then the contents
+ of the buffer will NOT be flushed to the appender.
+
+
-
+
- Gets a value indicating whether the collection has a fixed size.
+ Flush the currently buffered events
- true if the collection has a fixed size; otherwise, false. The default is false
+ set to true to flush the buffer of lossy events
+
+
+ Flushes events that have been buffered. If is
+ false then events will only be flushed if this buffer is non-lossy mode.
+
+
+ If the appender is buffering in mode then the contents
+ of the buffer will only be flushed if is true.
+ In this case the contents of the buffer will be tested against the
+ and if triggering will be output. All other buffered
+ events will be discarded.
+
+
+ If is true then the buffer will always
+ be emptied by calling this method.
+
+
-
+
- Gets a value indicating whether the IList is read-only.
+ Initialize the appender based on the options set
- true if the collection is read-only; otherwise, false. The default is false
+
+
+ This is part of the delayed object
+ activation scheme. The method must
+ be called on this object after the configuration properties have
+ been set. Until is called this
+ object is in an undefined state and must not be used.
+
+
+ If any of the configuration properties are modified then
+ must be called again.
+
+
-
+
- Gets or sets the number of elements the AppenderCollection can contain.
+ Close this appender instance.
+
+
+ Close this appender instance. If this appender is marked
+ as not then the remaining events in
+ the buffer must be sent when the appender is closed.
+
+
-
+
- Supports type-safe iteration over a .
+ This method is called by the method.
-
+ the event to log
+
+
+ Stores the in the cyclic buffer.
+
+
+ The buffer will be sent (i.e. passed to the
+ method) if one of the following conditions is met:
+
+
+
+ The cyclic buffer is full and this appender is
+ marked as not lossy (see )
+
+
+ An is set and
+ it is triggered for the
+ specified.
+
+
+
+ Before the event is stored in the buffer it is fixed
+ (see ) to ensure that
+ any data referenced by the event will be valid when the buffer
+ is processed.
+
+
-
+
- Advances the enumerator to the next element in the collection.
+ Sends the contents of the buffer.
-
- true if the enumerator was successfully advanced to the next element;
- false if the enumerator has passed the end of the collection.
-
-
- The collection was modified after the enumerator was created.
-
+ The first logging event.
+ The buffer containing the events that need to be send.
+
+
+ The subclass must override .
+
+
-
+
- Sets the enumerator to its initial position, before the first element in the collection.
+ Sends the events.
+ The events that need to be send.
+
+
+ The subclass must override this method to process the buffered events.
+
+
-
+
- Gets the current element in the collection.
+ The default buffer size.
+
+ The default size of the cyclic buffer used to store events.
+ This is set to 512 by default.
+
-
+
- Type visible only to our subclasses
- Used to access protected constructor
+ The size of the cyclic buffer used to hold the logging events.
-
+
+ Set to by default.
+
-
+
- A value
+ The cyclic buffer used to store the logging events.
-
+
- Supports simple iteration over a .
+ The triggering event evaluator that causes the buffer to be sent immediately.
-
+
+ The object that is used to determine if an event causes the entire
+ buffer to be sent immediately. This field can be null, which
+ indicates that event triggering is not to be done. The evaluator
+ can be set using the property. If this appender
+ has the ( property) set to
+ true then an must be set.
+
-
+
- Initializes a new instance of the Enumerator class.
+ Indicates if the appender should overwrite events in the cyclic buffer
+ when it becomes full, or if the buffer should be flushed when the
+ buffer is full.
-
+
+ If this field is set to true then an must
+ be set.
+
-
+
- Advances the enumerator to the next element in the collection.
+ The triggering event evaluator filters discarded events.
-
- true if the enumerator was successfully advanced to the next element;
- false if the enumerator has passed the end of the collection.
-
-
- The collection was modified after the enumerator was created.
-
+
+ The object that is used to determine if an event that is discarded should
+ really be discarded or if it should be sent to the appenders.
+ This field can be null, which indicates that all discarded events will
+ be discarded.
+
-
+
- Sets the enumerator to its initial position, before the first element in the collection.
+ Value indicating which fields in the event should be fixed
+
+ By default all fields are fixed
+
-
+
- Gets the current element in the collection.
+ The events delivered to the subclass must be fixed.
-
-
-
-
+
-
- Appends log events to the ASP.NET system.
-
+ Buffers events and then forwards them to attached appenders.
- Diagnostic information and tracing messages that you specify are appended to the output
- of the page that is sent to the requesting browser. Optionally, you can view this information
- from a separate trace viewer (Trace.axd) that displays trace information for every page in a
- given application.
-
-
- Trace statements are processed and displayed only when tracing is enabled. You can control
- whether tracing is displayed to a page, to the trace viewer, or both.
+ The events are buffered in this appender until conditions are
+ met to allow the appender to deliver the events to the attached
+ appenders. See for the
+ conditions that cause the buffer to be sent.
-
- The logging event is passed to the or
- method depending on the level of the logging event.
- The event's logger name is the default value for the category parameter of the Write/Warn method.
+ The forwarding appender can be used to specify different
+ thresholds and filters for the same appender at different locations
+ within the hierarchy.
Nicko CadellGert Driesen
- Ron Grabowski
-
+
- Initializes a new instance of the class.
+ Initializes a new instance of the class.
@@ -2531,209 +2418,56 @@
-
+
- Write the logging event to the ASP.NET trace
+ Closes the appender and releases resources.
- the event to log
- Write the logging event to the ASP.NET trace
- HttpContext.Current.Trace
- ().
+ Releases any resources allocated within the appender such as file handles,
+ network connections, etc.
+
+
+ It is a programming error to append to a closed appender.
-
-
- Defaults to %logger
-
-
-
+
- This appender requires a to be set.
+ Send the events.
- true
+ The events that need to be send.
- This appender requires a to be set.
+ Forwards the events to the attached appenders.
-
+
- The category parameter sent to the Trace method.
+ Adds an to the list of appenders of this
+ instance.
+ The to add to this appender.
- Defaults to %logger which will use the logger name of the current
- as the category parameter.
-
-
-
-
-
-
-
- Buffers events and then forwards them to attached appenders.
-
-
-
- The events are buffered in this appender until conditions are
- met to allow the appender to deliver the events to the attached
- appenders. See for the
- conditions that cause the buffer to be sent.
-
- The forwarding appender can be used to specify different
- thresholds and filters for the same appender at different locations
- within the hierarchy.
-
-
- Nicko Cadell
- Gert Driesen
-
-
-
- Interface for attaching appenders to objects.
-
-
-
- Interface for attaching, removing and retrieving appenders.
+ If the specified is already in the list of
+ appenders, then it won't be added again.
- Nicko Cadell
- Gert Driesen
-
+
- Attaches an appender.
+ Gets the appenders contained in this appender as an
+ .
- The appender to add.
-
- Add the specified appender. The implementation may
- choose to allow or deny duplicate appenders.
-
+ If no appenders can be found, then an
+ is returned.
-
-
-
- Gets an attached appender with the specified name.
-
- The name of the appender to get.
- The appender with the name specified, or null if no appender with the
- specified name is found.
+ A collection of the appenders in this appender.
-
-
- Returns an attached appender with the specified.
- If no appender with the specified name is found null will be
- returned.
-
-
-
-
-
- Removes all attached appenders.
-
-
-
- Removes and closes all attached appenders
-
-
-
-
-
- Removes the specified appender from the list of attached appenders.
-
- The appender to remove.
- The appender removed from the list
-
-
- The appender removed is not closed.
- If you are discarding the appender you must call
- on the appender removed.
-
-
-
-
-
- Removes the appender with the specified name from the list of appenders.
-
- The name of the appender to remove.
- The appender removed from the list
-
-
- The appender removed is not closed.
- If you are discarding the appender you must call
- on the appender removed.
-
-
-
-
-
- Gets all attached appenders.
-
-
- A collection of attached appenders.
-
-
-
- Gets a collection of attached appenders.
- If there are no attached appenders the
- implementation should return an empty
- collection rather than null.
-
-
-
-
-
- Initializes a new instance of the class.
-
-
-
- Default constructor.
-
-
-
-
-
- Closes the appender and releases resources.
-
-
-
- Releases any resources allocated within the appender such as file handles,
- network connections, etc.
-
-
- It is a programming error to append to a closed appender.
-
-
-
-
-
- Send the events.
-
- The events that need to be send.
-
-
- Forwards the events to the attached appenders.
-
-
-
-
-
- Adds an to the list of appenders of this
- instance.
-
- The to add to this appender.
-
-
- If the specified is already in the list of
- appenders, then it won't be added again.
-
-
@@ -2788,19 +2522,6 @@
Implementation of the interface
-
-
- Gets the appenders contained in this appender as an
- .
-
-
- If no appenders can be found, then an
- is returned.
-
-
- A collection of the appenders in this appender.
-
-
Appends logging events to the console.
@@ -2831,13 +2552,13 @@
-
-
-
+
+
+
-
-
+
+
@@ -2858,63 +2579,107 @@
Rick HobbsNicko Cadell
-
+
- The to use when writing to the Console
- standard output stream.
+ The enum of possible color values for use with the color mapping method
- The to use when writing to the Console
- standard output stream.
+ The following flags can be combined together to
+ form the colors.
+
-
+
- The to use when writing to the Console
- standard error output stream.
+ color is blue
+
+
+
+
+ color is green
+
+
+
+
+ color is red
+
+
+
+
+ color is white
+
+
+
+
+ color is yellow
+
+
+
+
+ color is purple
+
+
+
+
+ color is cyan
+
+
+
+
+ color is intensified
-
-
- The to use when writing to the Console
- standard error output stream.
-
-
- Initializes a new instance of the class.
+ Initializes a new instance of the class.
- The instance of the class is set up to write
+ The instance of the class is set up to write
to the standard output stream.
- Initializes a new instance of the class
+ Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
- The instance of the class is set up to write
+ The instance of the class is set up to write
to the standard output stream.
- Initializes a new instance of the class
+ Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
flag set to true to write to the console error stream
- When is set to true, output is written to
+ When is set to true, output is written to
the standard error output stream. Otherwise, output is written to the standard
output stream.
+
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
+
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
+
+
Add a mapping of level to color - done by the config file
@@ -2942,6 +2707,17 @@
+
+
+ This appender requires a to be set.
+
+ true
+
+
+ This appender requires a to be set.
+
+
+
Initialize the options for this appender
@@ -2952,104 +2728,49 @@
-
-
- Flag to write output to the error stream rather than the standard output stream
-
-
-
-
- Mapping from level object to color value
-
-
-
+
- The console output stream writer to write to
+ The to use when writing to the Console
+ standard output stream.
- This writer is not thread safe.
+ The to use when writing to the Console
+ standard output stream.
-
+
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
+ The to use when writing to the Console
+ standard error output stream.
-
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
-
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
+ The to use when writing to the Console
+ standard error output stream.
-
+
- This appender requires a to be set.
+ Flag to write output to the error stream rather than the standard output stream
- true
-
-
- This appender requires a to be set.
-
-
-
+
- The enum of possible color values for use with the color mapping method
+ Mapping from level object to color value
+
+
+
+
+ The console output stream writer to write to
- The following flags can be combined together to
- form the colors.
+ This writer is not thread safe.
-
-
-
-
- color is blue
-
-
-
-
- color is green
-
-
-
-
- color is red
-
-
-
-
- color is white
-
-
-
-
- color is yellow
-
-
-
-
- color is purple
-
-
-
-
- color is cyan
-
-
-
-
- color is intensified
-
@@ -3062,16 +2783,6 @@
-
-
- Initialize the options for the object
-
-
-
- Combine the and together.
-
-
-
The mapped foreground color for the specified level
@@ -3094,6 +2805,16 @@
+
+
+ Initialize the options for the object
+
+
+
+ Combine the and together.
+
+
+
The combined and suitable for
@@ -3126,63 +2847,55 @@
Nicko CadellGert Driesen
-
-
- The to use when writing to the Console
- standard output stream.
-
-
-
- The to use when writing to the Console
- standard output stream.
-
-
-
-
-
- The to use when writing to the Console
- standard error output stream.
-
-
-
- The to use when writing to the Console
- standard error output stream.
-
-
-
- Initializes a new instance of the class.
+ Initializes a new instance of the class.
- The instance of the class is set up to write
+ The instance of the class is set up to write
to the standard output stream.
- Initializes a new instance of the class
+ Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
- The instance of the class is set up to write
+ The instance of the class is set up to write
to the standard output stream.
- Initializes a new instance of the class
+ Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
flag set to true to write to the console error stream
- When is set to true, output is written to
+ When is set to true, output is written to
the standard error output stream. Otherwise, output is written to the standard
output stream.
+
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
+
+
+ Target is the value of the console output stream.
+ This is either "Console.Out" or "Console.Error".
+
+
+
This method is called by the method.
@@ -3197,30 +2910,38 @@
-
+
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
+ This appender requires a to be set.
-
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
-
+ true
- Target is the value of the console output stream.
- This is either "Console.Out" or "Console.Error".
+ This appender requires a to be set.
-
+
- This appender requires a to be set.
+ The to use when writing to the Console
+ standard output stream.
- true
- This appender requires a to be set.
+ The to use when writing to the Console
+ standard output stream.
+
+
+
+
+
+ The to use when writing to the Console
+ standard error output stream.
+
+
+
+ The to use when writing to the Console
+ standard error output stream.
@@ -3244,7 +2965,7 @@
- Initializes a new instance of the .
+ Initializes a new instance of the .
@@ -3254,7 +2975,7 @@
- Initializes a new instance of the
+ Initializes a new instance of the
with a specified layout.
The layout to use with this appender.
@@ -3264,48 +2985,6 @@
-
-
- Flushes any buffered log data.
-
- The maximum time to wait for logging events to be flushed.
- True if all logging events were flushed successfully, else false.
-
-
-
- Writes the logging event to the system.
-
- The event to log.
-
-
- Writes the logging event to the system.
- If is true then the
- is called.
-
-
-
-
-
- Immediate flush means that the underlying writer or output stream
- will be flushed at the end of each append operation.
-
-
-
- Immediate flush is slower but ensures that each append request is
- actually written. If is set to
- false, then there is a good chance that the last few
- logs events are not actually written to persistent media if and
- when the application crashes.
-
-
- The default value is true.
-
-
-
-
- Defaults to a with %logger as the pattern.
-
-
Gets or sets a value that indicates whether the appender will
@@ -3339,6 +3018,26 @@
+
+
+ Flushes any buffered log data.
+
+ The maximum time to wait for logging events to be flushed.
+ True if all logging events were flushed successfully, else false.
+
+
+
+ Writes the logging event to the system.
+
+ The event to log.
+
+
+ Writes the logging event to the system.
+ If is true then the
+ is called.
+
+
+
This appender requires a to be set.
@@ -3350,15 +3049,37 @@
-
+
- Writes events to the system event log.
+ Immediate flush means that the underlying writer or output stream
+ will be flushed at the end of each append operation.
- The appender will fail if you try to write using an event source that doesn't exist unless it is running with local administrator privileges.
- See also http://logging.apache.org/log4net/release/faq.html#trouble-EventLog
-
+ Immediate flush is slower but ensures that each append request is
+ actually written. If is set to
+ false, then there is a good chance that the last few
+ logs events are not actually written to persistent media if and
+ when the application crashes.
+
+
+ The default value is true.
+
+
+
+
+ Defaults to a with %logger as the pattern.
+
+
+
+
+ Writes events to the system event log.
+
+
+
+ The appender will fail if you try to write using an event source that doesn't exist unless it is running with local administrator privileges.
+ See also http://logging.apache.org/log4net/release/faq.html#trouble-EventLog
+
The EventID of the event log entry can be
set using the EventID property ()
@@ -3404,7 +3125,7 @@
- Initializes a new instance of the class.
+ Initializes a new instance of the class.
@@ -3414,16 +3135,63 @@
- Initializes a new instance of the class
- with the specified .
+ Initializes a new instance of the class
+ with the specified .
- The to use with this appender.
+ The to use with this appender.
Obsolete constructor.
+
+
+ The name of the log where messages will be stored.
+
+
+ The string name of the log where messages will be stored.
+
+
+ This is the name of the log as it appears in the Event Viewer
+ tree. The default value is to log into the Application
+ log, this is where most applications write their events. However
+ if you need a separate log for your application (or applications)
+ then you should set the appropriately.
+ This should not be used to distinguish your event log messages
+ from those of other applications, the
+ property should be used to distinguish events. This property should be
+ used to group together events into a single log.
+
+
+
+
+
+ Property used to set the Application name. This appears in the
+ event logs when logging.
+
+
+ The string used to distinguish events from different sources.
+
+
+ Sets the event log source property.
+
+
+
+
+ This property is used to return the name of the computer to use
+ when accessing the event logs. Currently, this is the current
+ computer, denoted by a dot "."
+
+
+ The string name of the machine holding the event log that
+ will be logged into.
+
+
+ This property cannot be changed. It is currently set to '.'
+ i.e. the local machine. This may be changed in future.
+
+
Add a mapping of level to - done by the config file
@@ -3436,6 +3204,51 @@
+
+
+ Gets or sets the used to write to the EventLog.
+
+
+ The used to write to the EventLog.
+
+
+
+ The system security context used to write to the EventLog.
+
+
+ Unless a specified here for this appender
+ the is queried for the
+ security context to use. The default behavior is to use the security context
+ of the current thread.
+
+
+
+
+
+ Gets or sets the EventId to use unless one is explicitly specified via the LoggingEvent's properties.
+
+
+
+ The EventID of the event log entry will normally be
+ set using the EventID property ()
+ on the .
+ This property provides the fallback value which defaults to 0.
+
+
+
+
+
+ Gets or sets the Category to use unless one is explicitly specified via the LoggingEvent's properties.
+
+
+
+ The Category of the event log entry will normally be
+ set using the Category property ()
+ on the .
+ This property provides the fallback value which defaults to 0.
+
+
+
Initialize the appender based on the options set
@@ -3480,6 +3293,17 @@
+
+
+ This appender requires a to be set.
+
+ true
+
+
+ This appender requires a to be set.
+
+
+
Get the equivalent for a
@@ -3531,6 +3355,28 @@
The event category to use unless one is explicitly specified via the LoggingEvent's properties.
+
+
+ A class to act as a mapping between the level that a logging call is made at and
+ the color it should be displayed as.
+
+
+
+ Defines the mapping between a level and its event log entry type.
+
+
+
+
+
+ The for this entry
+
+
+
+ Required property.
+ The for this entry
+
+
+
The fully qualified type of the EventLogAppender class.
@@ -3603,501 +3449,500 @@
-
+
- The name of the log where messages will be stored.
+ Appends logging events to a file.
-
- The string name of the log where messages will be stored.
-
- This is the name of the log as it appears in the Event Viewer
- tree. The default value is to log into the Application
- log, this is where most applications write their events. However
- if you need a separate log for your application (or applications)
- then you should set the appropriately.
- This should not be used to distinguish your event log messages
- from those of other applications, the
- property should be used to distinguish events. This property should be
- used to group together events into a single log.
+
+ Logging events are sent to the file specified by
+ the property.
+
+
+ The file can be opened in either append or overwrite mode
+ by specifying the property.
+ If the file path is relative it is taken as relative from
+ the application base directory. The file encoding can be
+ specified by setting the property.
+
+
+ The layout's and
+ values will be written each time the file is opened and closed
+ respectively. If the property is
+ then the file may contain multiple copies of the header and footer.
+
+
+ This appender will first try to open the file for writing when
+ is called. This will typically be during configuration.
+ If the file cannot be opened for writing the appender will attempt
+ to open the file again each time a message is logged to the appender.
+ If the file cannot be opened for writing when a message is logged then
+ the message will be discarded by this appender.
+
+
+ The supports pluggable file locking models via
+ the property.
+ The default behavior, implemented by
+ is to obtain an exclusive write lock on the file until this appender is closed.
+ The alternative models only hold a
+ write lock while the appender is writing a logging event ()
+ or synchronize by using a named system wide Mutex ().
+
+
+ All locking strategies have issues and you should seriously consider using a different strategy that
+ avoids having multiple processes logging to the same file.
+ Nicko Cadell
+ Gert Driesen
+ Rodrigo B. de Oliveira
+ Douglas de la Torre
+ Niall Daley
-
+
- Property used to set the Application name. This appears in the
- event logs when logging.
+ Write only that uses the
+ to manage access to an underlying resource.
-
- The string used to distinguish events from different sources.
-
-
- Sets the event log source property.
-
-
+
- This property is used to return the name of the computer to use
- when accessing the event logs. Currently, this is the current
- computer, denoted by a dot "."
+ True asynchronous writes are not supported, the implementation forces a synchronous write.
-
- The string name of the machine holding the event log that
- will be logged into.
-
-
- This property cannot be changed. It is currently set to '.'
- i.e. the local machine. This may be changed in future.
-
-
+
- Gets or sets the used to write to the EventLog.
+ Locking model base class
-
- The used to write to the EventLog.
-
- The system security context used to write to the EventLog.
-
-
- Unless a specified here for this appender
- the is queried for the
- security context to use. The default behavior is to use the security context
- of the current thread.
+ Base class for the locking models available to the derived loggers.
-
+
- Gets or sets the EventId to use unless one is explicitly specified via the LoggingEvent's properties.
+ Open the output file
+ The filename to use
+ Whether to append to the file, or overwrite
+ The encoding to use
- The EventID of the event log entry will normally be
- set using the EventID property ()
- on the .
- This property provides the fallback value which defaults to 0.
+ Open the file specified and prepare for logging.
+ No writes will be made until is called.
+ Must be called before any calls to ,
+ and .
-
+
- Gets or sets the Category to use unless one is explicitly specified via the LoggingEvent's properties.
+ Close the file
- The Category of the event log entry will normally be
- set using the Category property ()
- on the .
- This property provides the fallback value which defaults to 0.
+ Close the file. No further writes will be made.
-
+
- This appender requires a to be set.
+ Initializes all resources used by this locking model.
- true
-
-
- This appender requires a to be set.
-
-
-
+
- A class to act as a mapping between the level that a logging call is made at and
- the color it should be displayed as.
+ Disposes all resources that were initialized by this locking model.
+
+
+
+
+ Acquire the lock on the file
+ A stream that is ready to be written to.
- Defines the mapping between a level and its event log entry type.
+ Acquire the lock on the file in preparation for writing to it.
+ Return a stream pointing to the file.
+ must be called to release the lock on the output file.
-
+
- The for this entry
+ Release the lock on the file
- Required property.
- The for this entry
+ Release the lock on the file. No further writes will be made to the
+ stream until is called again.
-
+
- Appends logging events to a file.
+ Gets or sets the for this LockingModel
+
+ The for this LockingModel
+
- Logging events are sent to the file specified by
- the property.
-
-
- The file can be opened in either append or overwrite mode
- by specifying the property.
- If the file path is relative it is taken as relative from
- the application base directory. The file encoding can be
- specified by setting the property.
-
-
- The layout's and
- values will be written each time the file is opened and closed
- respectively. If the property is
- then the file may contain multiple copies of the header and footer.
-
-
- This appender will first try to open the file for writing when
- is called. This will typically be during configuration.
- If the file cannot be opened for writing the appender will attempt
- to open the file again each time a message is logged to the appender.
- If the file cannot be opened for writing when a message is logged then
- the message will be discarded by this appender.
+ The file appender this locking model is attached to and working on
+ behalf of.
- The supports pluggable file locking models via
- the property.
- The default behavior, implemented by
- is to obtain an exclusive write lock on the file until this appender is closed.
- The alternative models only hold a
- write lock while the appender is writing a logging event ()
- or synchronize by using a named system wide Mutex ().
+ The file appender is used to locate the security context and the error handler to use.
- All locking strategies have issues and you should seriously consider using a different strategy that
- avoids having multiple processes logging to the same file.
+ The value of this property will be set before is
+ called.
- Nicko Cadell
- Gert Driesen
- Rodrigo B. de Oliveira
- Douglas de la Torre
- Niall Daley
-
+
- Sends logging events to a .
+ Helper method that creates a FileStream under CurrentAppender's SecurityContext.
- An Appender that writes to a .
+ Typically called during OpenFile or AcquireLock.
- This appender may be used stand alone if initialized with an appropriate
- writer, however it is typically used as a base class for an appender that
- can open a to write to.
+ If the directory portion of the does not exist, it is created
+ via Directory.CreateDirecctory.
- Nicko Cadell
- Gert Driesen
- Douglas de la Torre
+
+
+
+
-
+
- Initializes a new instance of the class.
+ Helper method to close under CurrentAppender's SecurityContext.
-
- Default constructor.
-
+ Does not set to null.
+
-
+
- Initializes a new instance of the class and
- sets the output destination to a new initialized
- with the specified .
+ Hold an exclusive lock on the output file
- The layout to use with this appender.
- The to output to.
- Obsolete constructor.
+ Open the file once for writing and hold it open until is called.
+ Maintains an exclusive lock on the file during this time.
-
+
- Initializes a new instance of the class and sets
- the output destination to the specified .
+ Open the file specified and prepare for logging.
- The layout to use with this appender
- The to output to
-
- The must have been previously opened.
-
+ The filename to use
+ Whether to append to the file, or overwrite
+ The encoding to use
- Obsolete constructor.
+ Open the file specified and prepare for logging.
+ No writes will be made until is called.
+ Must be called before any calls to ,
+ and .
-
+
- This method determines if there is a sense in attempting to append.
+ Close the file
- This method checks if an output target has been set and if a
- layout has been set.
+ Close the file. No further writes will be made.
- false if any of the preconditions fail.
-
+
- This method is called by the
- method.
+ Acquire the lock on the file
- The event to log.
+ A stream that is ready to be written to.
- Writes a log statement to the output stream if the output stream exists
- and is writable.
-
-
- The format of the output will depend on the appender's layout.
+ Does nothing. The lock is already taken
-
+
- This method is called by the
- method.
+ Release the lock on the file
- The array of events to log.
- This method writes all the bulk logged events to the output writer
- before flushing the stream.
+ Does nothing. The lock will be released when the file is closed.
-
+
- Close this appender instance. The underlying stream or writer is also closed.
+ Initializes all resources used by this locking model.
-
- Closed appenders cannot be reused.
-
-
+
- Writes the footer and closes the underlying .
+ Disposes all resources that were initialized by this locking model.
-
-
- Writes the footer and closes the underlying