From 001179c114111d98c7c23d6acbacf91b1c396488 Mon Sep 17 00:00:00 2001 From: Robert Orso Date: Wed, 3 Nov 2021 10:55:57 +0100 Subject: [PATCH 1/2] Allow for OpenMode and Share Mode arguments on existing files --- .gitignore | 4 ++++ FastColoredTextBox/FastColoredTextBox.cs | 6 ++++-- FastColoredTextBox/FileTextSource.cs | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index bdc3535f..255976dd 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,7 @@ Generated_Code #added for RIA/Silverlight projects _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML +/.vs/VSWorkspaceState.json +/.vs/slnx.sqlite +/.vs/ProjectSettings.json +/FastColoredTextBox/FastColoredTextBox.sln diff --git a/FastColoredTextBox/FastColoredTextBox.cs b/FastColoredTextBox/FastColoredTextBox.cs index 9af2ff3c..6ce56fed 100644 --- a/FastColoredTextBox/FastColoredTextBox.cs +++ b/FastColoredTextBox/FastColoredTextBox.cs @@ -7550,13 +7550,15 @@ public void OpenFile(string fileName) /// /// /// - public void OpenBindingFile(string fileName, Encoding enc) + /// + /// + public void OpenBindingFile(string fileName, Encoding enc, System.IO.FileAccess openMode = System.IO.FileAccess.ReadWrite, System.IO.FileShare shareMode = System.IO.FileShare.None) { var fts = new FileTextSource(this); try { InitTextSource(fts); - fts.OpenFile(fileName, enc); + fts.OpenFile(fileName, enc, openMode, shareMode); IsChanged = false; OnVisibleRangeChanged(); } diff --git a/FastColoredTextBox/FileTextSource.cs b/FastColoredTextBox/FileTextSource.cs index b8b76a0b..9a604636 100644 --- a/FastColoredTextBox/FileTextSource.cs +++ b/FastColoredTextBox/FileTextSource.cs @@ -69,7 +69,7 @@ private void UnloadUnusedLines() #endif } - public void OpenFile(string fileName, Encoding enc) + public void OpenFile(string fileName, Encoding enc, System.IO.FileAccess openMode = System.IO.FileAccess.ReadWrite, System.IO.FileShare shareMode = System.IO.FileShare.None) { Clear(); @@ -79,7 +79,7 @@ public void OpenFile(string fileName, Encoding enc) SaveEOL = Environment.NewLine; //read lines of file - fs = new FileStream(fileName, FileMode.Open); + fs = new FileStream(fileName, FileMode.Open, openMode, shareMode); var length = fs.Length; //read signature enc = DefineEncoding(enc, fs); From 3650a6e8894f115fbb0b4bc11be6a163e37dd643 Mon Sep 17 00:00:00 2001 From: Robert Orso Date: Wed, 3 Nov 2021 11:22:27 +0100 Subject: [PATCH 2/2] Allow for OpenMode and Share Mode arguments on existing files --- .gitignore | 7 ++--- FastColoredTextBoxVS2019.sln | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 FastColoredTextBoxVS2019.sln diff --git a/.gitignore b/.gitignore index 255976dd..2a0580c2 100644 --- a/.gitignore +++ b/.gitignore @@ -106,7 +106,6 @@ Generated_Code #added for RIA/Silverlight projects _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML -/.vs/VSWorkspaceState.json -/.vs/slnx.sqlite -/.vs/ProjectSettings.json -/FastColoredTextBox/FastColoredTextBox.sln + +# Visual Studio 2015/2017 cache/options directory +.vs/ diff --git a/FastColoredTextBoxVS2019.sln b/FastColoredTextBoxVS2019.sln new file mode 100644 index 00000000..32b950a0 --- /dev/null +++ b/FastColoredTextBoxVS2019.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2019 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "Tester\Tester.csproj", "{EBE443EE-F4C7-49E6-AC22-959CA62FAA05}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastColoredTextBox", "FastColoredTextBox\FastColoredTextBox.csproj", "{6DD14A85-CCFC-4774-BD26-0F5772512319}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TesterVB", "TesterVB\TesterVB.vbproj", "{3EF3A5A0-2365-41FD-97A0-254A2CFC6577}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Debug|Any CPU.ActiveCfg = Debug|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Debug|x86.ActiveCfg = Debug|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Debug|x86.Build.0 = Debug|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Release|Any CPU.ActiveCfg = Release|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Release|Mixed Platforms.Build.0 = Release|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Release|x86.ActiveCfg = Release|x86 + {EBE443EE-F4C7-49E6-AC22-959CA62FAA05}.Release|x86.Build.0 = Release|x86 + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Debug|x86.ActiveCfg = Debug|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Release|Any CPU.Build.0 = Release|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {6DD14A85-CCFC-4774-BD26-0F5772512319}.Release|x86.ActiveCfg = Release|Any CPU + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Debug|Any CPU.ActiveCfg = Debug|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Debug|x86.ActiveCfg = Debug|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Debug|x86.Build.0 = Debug|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Release|Any CPU.ActiveCfg = Release|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Release|Mixed Platforms.Build.0 = Release|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Release|x86.ActiveCfg = Release|x86 + {3EF3A5A0-2365-41FD-97A0-254A2CFC6577}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal