diff --git a/V_EditorPro.sln b/V_EditorPro.sln new file mode 100644 index 0000000..b666329 --- /dev/null +++ b/V_EditorPro.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34902.65 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V_EditorPro", "V_EditorPro\V_EditorPro.csproj", "{640BD762-E2CC-4EFD-8748-80AE809CB5F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {640BD762-E2CC-4EFD-8748-80AE809CB5F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {640BD762-E2CC-4EFD-8748-80AE809CB5F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {640BD762-E2CC-4EFD-8748-80AE809CB5F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {640BD762-E2CC-4EFD-8748-80AE809CB5F3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E19AB131-3C7A-4FD3-BF03-8A3097EC5AD6} + EndGlobalSection +EndGlobal diff --git a/V_EditorPro/App.config b/V_EditorPro/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/V_EditorPro/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/V_EditorPro/MainForm.Designer.cs b/V_EditorPro/MainForm.Designer.cs new file mode 100644 index 0000000..7dd20fc --- /dev/null +++ b/V_EditorPro/MainForm.Designer.cs @@ -0,0 +1,119 @@ +using System; +using System.Windows.Forms; + +namespace V_EditorPro +{ + public partial class MainForm : Form + { + + + private void InitializeComponent() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.searchReplaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + + // MenuStrip + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem, + this.helpToolStripMenuItem + }); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(800, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + + // File Menu + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.saveToolStripMenuItem + }); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + + // Open + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.openToolStripMenuItem.Text = "Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + + // Save + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.saveToolStripMenuItem.Text = "Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + + // Edit Menu + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.searchReplaceToolStripMenuItem + }); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "Edit"; + + // Search/Replace + this.searchReplaceToolStripMenuItem.Name = "searchReplaceToolStripMenuItem"; + this.searchReplaceToolStripMenuItem.Size = new System.Drawing.Size(160, 22); + this.searchReplaceToolStripMenuItem.Text = "Search/Replace"; + this.searchReplaceToolStripMenuItem.Click += new System.EventHandler(this.searchReplaceToolStripMenuItem_Click); + + // Help Menu + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem + }); + this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; + this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.helpToolStripMenuItem.Text = "Help"; + + // About + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); + this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + + // RichTextBox + this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTextBox1.Location = new System.Drawing.Point(0, 24); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.Size = new System.Drawing.Size(800, 426); + this.richTextBox1.TabIndex = 1; + this.richTextBox1.Text = ""; + + // MainForm + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.richTextBox1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "MainForm"; + this.Text = "V_EditorPro"; + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem searchReplaceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; + private System.Windows.Forms.RichTextBox richTextBox1; + } +} \ No newline at end of file diff --git a/V_EditorPro/MainForm.cs b/V_EditorPro/MainForm.cs new file mode 100644 index 0000000..4054d63 --- /dev/null +++ b/V_EditorPro/MainForm.cs @@ -0,0 +1,71 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace V_EditorPro +{ + public partial class MainForm : Form + { + public MainForm() + { + InitializeComponent(); + this.KeyPreview = true; + this.KeyDown += new KeyEventHandler(MainForm_KeyDown); + } + + private void MainForm_KeyDown(object sender, KeyEventArgs e) + { + if (e.Control && e.KeyCode == Keys.O) + { + OpenFile(); + } + if (e.Control && e.KeyCode == Keys.S) + { + SaveFile(); + } + } + + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFile(); + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFile(); + } + + private void searchReplaceToolStripMenuItem_Click(object sender, EventArgs e) + { + using (SearchReplaceDialog searchReplaceDialog = new SearchReplaceDialog(richTextBox1)) + { + searchReplaceDialog.ShowDialog(); + } + } + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + MessageBox.Show($"V_EditorPro\nVersion 1.0\nOS: {RuntimeInformation.OSDescription}", "About"); + } + + private void OpenFile() + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + richTextBox1.Text = File.ReadAllText(openFileDialog.FileName); + } + } + + private void SaveFile() + { + SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.FileName = $"{DateTime.Now.ToString("yyyy-MM-dd")}.txt"; + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + File.WriteAllText(saveFileDialog.FileName, richTextBox1.Text); + } + } + } +} \ No newline at end of file diff --git a/V_EditorPro/Program.cs b/V_EditorPro/Program.cs new file mode 100644 index 0000000..7f080c3 --- /dev/null +++ b/V_EditorPro/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; +using V_EditorPro; + +namespace V_EditorPro +{ + internal static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/V_EditorPro/Properties/AssemblyInfo.cs b/V_EditorPro/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..af64ee4 --- /dev/null +++ b/V_EditorPro/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("V_EditorPro")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("V_EditorPro")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("640bd762-e2cc-4efd-8748-80ae809cb5f3")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/V_EditorPro/Properties/Resources.Designer.cs b/V_EditorPro/Properties/Resources.Designer.cs new file mode 100644 index 0000000..5d5089a --- /dev/null +++ b/V_EditorPro/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace V_EditorPro.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("V_EditorPro.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/V_EditorPro/Properties/Resources.resx b/V_EditorPro/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/V_EditorPro/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/V_EditorPro/Properties/Settings.Designer.cs b/V_EditorPro/Properties/Settings.Designer.cs new file mode 100644 index 0000000..c6be58c --- /dev/null +++ b/V_EditorPro/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace V_EditorPro.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/V_EditorPro/Properties/Settings.settings b/V_EditorPro/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/V_EditorPro/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/V_EditorPro/SearchReplaceDialog.cs b/V_EditorPro/SearchReplaceDialog.cs new file mode 100644 index 0000000..afdc15c --- /dev/null +++ b/V_EditorPro/SearchReplaceDialog.cs @@ -0,0 +1,118 @@ +using System; +using System.Windows.Forms; + +namespace V_EditorPro +{ + public partial class SearchReplaceDialog : Form + { + private RichTextBox _richTextBox; + + public SearchReplaceDialog(RichTextBox richTextBox) + { + InitializeComponent(); + _richTextBox = richTextBox; + } + + private void btnFindNext_Click(object sender, EventArgs e) + { + int startIndex = _richTextBox.SelectionStart + _richTextBox.SelectionLength; + int wordStartIndex = _richTextBox.Find(txtFind.Text, startIndex, RichTextBoxFinds.None); + if (wordStartIndex != -1) + { + _richTextBox.Select(wordStartIndex, txtFind.Text.Length); + _richTextBox.ScrollToCaret(); + } + else + { + MessageBox.Show("Text not found"); + } + } + + private void btnReplace_Click(object sender, EventArgs e) + { + if (_richTextBox.SelectedText == txtFind.Text) + { + _richTextBox.SelectedText = txtReplace.Text; + } + btnFindNext.PerformClick(); + } + + private void btnReplaceAll_Click(object sender, EventArgs e) + { + _richTextBox.Text = _richTextBox.Text.Replace(txtFind.Text, txtReplace.Text); + } + + private void InitializeComponent() + { + this.txtFind = new System.Windows.Forms.TextBox(); + this.txtReplace = new System.Windows.Forms.TextBox(); + this.btnFindNext = new System.Windows.Forms.Button(); + this.btnReplace = new System.Windows.Forms.Button(); + this.btnReplaceAll = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txtFind + // + this.txtFind.Location = new System.Drawing.Point(12, 12); + this.txtFind.Name = "txtFind"; + this.txtFind.Size = new System.Drawing.Size(200, 20); + this.txtFind.TabIndex = 0; + // + // txtReplace + // + this.txtReplace.Location = new System.Drawing.Point(12, 38); + this.txtReplace.Name = "txtReplace"; + this.txtReplace.Size = new System.Drawing.Size(200, 20); + this.txtReplace.TabIndex = 1; + // + // btnFindNext + // + this.btnFindNext.Location = new System.Drawing.Point(218, 10); + this.btnFindNext.Name = "btnFindNext"; + this.btnFindNext.Size = new System.Drawing.Size(75, 23); + this.btnFindNext.TabIndex = 2; + this.btnFindNext.Text = "Find Next"; + this.btnFindNext.UseVisualStyleBackColor = true; + this.btnFindNext.Click += new System.EventHandler(this.btnFindNext_Click); + // + // btnReplace + // + this.btnReplace.Location = new System.Drawing.Point(218, 36); + this.btnReplace.Name = "btnReplace"; + this.btnReplace.Size = new System.Drawing.Size(75, 23); + this.btnReplace.TabIndex = 3; + this.btnReplace.Text = "Replace"; + this.btnReplace.UseVisualStyleBackColor = true; + this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click); + // + // btnReplaceAll + // + this.btnReplaceAll.Location = new System.Drawing.Point(218, 65); + this.btnReplaceAll.Name = "btnReplaceAll"; + this.btnReplaceAll.Size = new System.Drawing.Size(75, 23); + this.btnReplaceAll.TabIndex = 4; + this.btnReplaceAll.Text = "Replace All"; + this.btnReplaceAll.UseVisualStyleBackColor = true; + this.btnReplaceAll.Click += new System.EventHandler(this.btnReplaceAll_Click); + // + // SearchReplaceDialog + // + this.ClientSize = new System.Drawing.Size(305, 100); + this.Controls.Add(this.btnReplaceAll); + this.Controls.Add(this.btnReplace); + this.Controls.Add(this.btnFindNext); + this.Controls.Add(this.txtReplace); + this.Controls.Add(this.txtFind); + this.Name = "SearchReplaceDialog"; + this.Text = "SearchReplaceDialog"; + this.ResumeLayout(false); + this.PerformLayout(); + } + + private System.Windows.Forms.TextBox txtFind; + private System.Windows.Forms.TextBox txtReplace; + private System.Windows.Forms.Button btnFindNext; + private System.Windows.Forms.Button btnReplace; + private System.Windows.Forms.Button btnReplaceAll; + } +} \ No newline at end of file diff --git a/V_EditorPro/V_EditorPro.csproj b/V_EditorPro/V_EditorPro.csproj new file mode 100644 index 0000000..c3cc9dc --- /dev/null +++ b/V_EditorPro/V_EditorPro.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {640BD762-E2CC-4EFD-8748-80AE809CB5F3} + WinExe + V_EditorPro + V_EditorPro + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + MainForm.cs + + + + + Form + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file