From ae6554556053b157e0a79c17df7640eaacef68cd Mon Sep 17 00:00:00 2001
From: Vichingo455 <59311016+Vichingo455@users.noreply.github.com>
Date: Mon, 7 Mar 2022 16:12:44 +0100
Subject: [PATCH] Bug fixes
---
Notepad Setup/App.config | 6 +
Notepad Setup/Form1.Designer.cs | 40 +++++
Notepad Setup/Form1.cs | 20 +++
Notepad Setup/Notepad Setup.csproj | 99 +++++++++++
Notepad Setup/Program.cs | 22 +++
Notepad Setup/Properties/AssemblyInfo.cs | 36 ++++
.../Properties/Resources.Designer.cs | 71 ++++++++
Notepad Setup/Properties/Resources.resx | 117 +++++++++++++
Notepad Setup/Properties/Settings.Designer.cs | 30 ++++
Notepad Setup/Properties/Settings.settings | 7 +
Notepad/Form1.Designer.cs | 78 +++++++--
Notepad/Form1.cs | 164 +++++++++++++++++-
Notepad/Notepad.csproj | 24 ++-
Notepad/Properties/app.manifest | 73 ++++++++
14 files changed, 770 insertions(+), 17 deletions(-)
create mode 100644 Notepad Setup/App.config
create mode 100644 Notepad Setup/Form1.Designer.cs
create mode 100644 Notepad Setup/Form1.cs
create mode 100644 Notepad Setup/Notepad Setup.csproj
create mode 100644 Notepad Setup/Program.cs
create mode 100644 Notepad Setup/Properties/AssemblyInfo.cs
create mode 100644 Notepad Setup/Properties/Resources.Designer.cs
create mode 100644 Notepad Setup/Properties/Resources.resx
create mode 100644 Notepad Setup/Properties/Settings.Designer.cs
create mode 100644 Notepad Setup/Properties/Settings.settings
create mode 100644 Notepad/Properties/app.manifest
diff --git a/Notepad Setup/App.config b/Notepad Setup/App.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/Notepad Setup/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Notepad Setup/Form1.Designer.cs b/Notepad Setup/Form1.Designer.cs
new file mode 100644
index 0000000..30317d9
--- /dev/null
+++ b/Notepad Setup/Form1.Designer.cs
@@ -0,0 +1,40 @@
+namespace Notepad_Setup
+{
+ partial class Form1
+ {
+ ///
+ /// Variabile di progettazione necessaria.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Pulire le risorse in uso.
+ ///
+ /// ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Codice generato da Progettazione Windows Form
+
+ ///
+ /// Metodo necessario per il supporto della finestra di progettazione. Non modificare
+ /// il contenuto del metodo con l'editor di codice.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Text = "Form1";
+ }
+
+ #endregion
+ }
+}
+
diff --git a/Notepad Setup/Form1.cs b/Notepad Setup/Form1.cs
new file mode 100644
index 0000000..6dfa1a4
--- /dev/null
+++ b/Notepad Setup/Form1.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Notepad_Setup
+{
+ public partial class Form1 : Form
+ {
+ public Form1()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Notepad Setup/Notepad Setup.csproj b/Notepad Setup/Notepad Setup.csproj
new file mode 100644
index 0000000..e4e6567
--- /dev/null
+++ b/Notepad Setup/Notepad Setup.csproj
@@ -0,0 +1,99 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {22DC98A6-CB73-465F-8705-B83CF7492702}
+ WinExe
+ Notepad_Setup
+ Notepad Setup
+ v4.5.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ true
+
+
+ 635D9B916F398DEC4D61A283C8622C270F51A285
+
+
+ Notepad_TemporaryKey.pfx
+
+
+ true
+
+
+ Notepad_TemporaryKey.pfx
+
+
+ http://timestamp.digicert.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.cs
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Notepad Setup/Program.cs b/Notepad Setup/Program.cs
new file mode 100644
index 0000000..7145496
--- /dev/null
+++ b/Notepad Setup/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Notepad_Setup
+{
+ internal static class Program
+ {
+ ///
+ /// Punto di ingresso principale dell'applicazione.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
diff --git a/Notepad Setup/Properties/AssemblyInfo.cs b/Notepad Setup/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..d38b52f
--- /dev/null
+++ b/Notepad Setup/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Le informazioni generali relative a un assembly sono controllate dal seguente
+// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
+// associate a un assembly.
+[assembly: AssemblyTitle("Notepad Setup")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Vichingo455")]
+[assembly: AssemblyProduct("Notepad Setup")]
+[assembly: AssemblyCopyright("Copyright © Vichingo455 2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
+// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
+// COM, impostare su true l'attributo ComVisible per tale tipo.
+[assembly: ComVisible(false)]
+
+// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
+[assembly: Guid("22dc98a6-cb73-465f-8705-b83cf7492702")]
+
+// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
+//
+// Versione principale
+// Versione secondaria
+// Numero di build
+// Revisione
+//
+// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
+// usando l'asterisco '*' come illustrato di seguito:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Notepad Setup/Properties/Resources.Designer.cs b/Notepad Setup/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..b09fe07
--- /dev/null
+++ b/Notepad Setup/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// Codice generato da uno strumento.
+// Versione runtime:4.0.30319.42000
+//
+// Le modifiche apportate a questo file possono causare un comportamento non corretto e andranno perse se
+// il codice viene rigenerato.
+//
+//------------------------------------------------------------------------------
+
+namespace Notepad_Setup.Properties
+{
+
+
+ ///
+ /// Classe di risorse fortemente tipizzata per la ricerca di stringhe localizzate e così via.
+ ///
+ // Questa classe è stata generata automaticamente dalla classe StronglyTypedResourceBuilder
+ // tramite uno strumento quale ResGen o Visual Studio.
+ // Per aggiungere o rimuovere un membro, modificare il file .ResX, quindi eseguire di nuovo ResGen
+ // con l'opzione /str oppure ricompilare il progetto VS.
+ [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()
+ {
+ }
+
+ ///
+ /// Restituisce l'istanza di ResourceManager memorizzata nella cache e usata da questa classe.
+ ///
+ [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("Notepad_Setup.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Esegue l'override della proprietà CurrentUICulture del thread corrente per tutte
+ /// le ricerche di risorse che utilizzano questa classe di risorse fortemente tipizzata.
+ ///
+ [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/Notepad Setup/Properties/Resources.resx b/Notepad Setup/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Notepad Setup/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/Notepad Setup/Properties/Settings.Designer.cs b/Notepad Setup/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..d746b56
--- /dev/null
+++ b/Notepad Setup/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 Notepad_Setup.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/Notepad Setup/Properties/Settings.settings b/Notepad Setup/Properties/Settings.settings
new file mode 100644
index 0000000..3964565
--- /dev/null
+++ b/Notepad Setup/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Notepad/Form1.Designer.cs b/Notepad/Form1.Designer.cs
index e55ba91..fef8d0f 100644
--- a/Notepad/Form1.Designer.cs
+++ b/Notepad/Form1.Designer.cs
@@ -39,7 +39,12 @@
this.saveFileWithNameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.alwaysOnTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.checkForUpdatesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.giveAFeedbackToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.aboutWindowsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@@ -51,7 +56,8 @@
this.text_area.Location = new System.Drawing.Point(-2, 29);
this.text_area.Multiline = true;
this.text_area.Name = "text_area";
- this.text_area.Size = new System.Drawing.Size(803, 421);
+ this.text_area.ScrollBars = System.Windows.Forms.ScrollBars.Both;
+ this.text_area.Size = new System.Drawing.Size(1057, 546);
this.text_area.TabIndex = 0;
//
// menuStrip1
@@ -59,10 +65,11 @@
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
- this.viewToolStripMenuItem});
+ this.viewToolStripMenuItem,
+ this.helpToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
- this.menuStrip1.Size = new System.Drawing.Size(800, 28);
+ this.menuStrip1.Size = new System.Drawing.Size(1054, 28);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
@@ -132,31 +139,77 @@
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.aboutToolStripMenuItem});
+ this.alwaysOnTopToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
- this.viewToolStripMenuItem.Size = new System.Drawing.Size(30, 24);
- this.viewToolStripMenuItem.Text = "?";
- this.viewToolStripMenuItem.Click += new System.EventHandler(this.viewToolStripMenuItem_Click);
+ this.viewToolStripMenuItem.Size = new System.Drawing.Size(55, 24);
+ this.viewToolStripMenuItem.Text = "View";
+ this.viewToolStripMenuItem.Click += new System.EventHandler(this.viewToolStripMenuItem_Click_1);
+ //
+ // alwaysOnTopToolStripMenuItem
+ //
+ this.alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
+ this.alwaysOnTopToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
+ this.alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(210, 26);
+ this.alwaysOnTopToolStripMenuItem.Text = "Always on top";
+ this.alwaysOnTopToolStripMenuItem.Click += new System.EventHandler(this.alwaysOnTopToolStripMenuItem_Click);
+ //
+ // helpToolStripMenuItem
+ //
+ this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.checkForUpdatesToolStripMenuItem,
+ this.giveAFeedbackToolStripMenuItem,
+ this.aboutToolStripMenuItem,
+ this.aboutWindowsToolStripMenuItem});
+ this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
+ this.helpToolStripMenuItem.Size = new System.Drawing.Size(30, 24);
+ this.helpToolStripMenuItem.Text = "?";
+ this.helpToolStripMenuItem.Click += new System.EventHandler(this.viewToolStripMenuItem_Click);
+ //
+ // checkForUpdatesToolStripMenuItem
+ //
+ this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
+ this.checkForUpdatesToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F10;
+ this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
+ this.checkForUpdatesToolStripMenuItem.Text = "Check for updates";
+ this.checkForUpdatesToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdatesToolStripMenuItem_Click);
+ //
+ // giveAFeedbackToolStripMenuItem
+ //
+ this.giveAFeedbackToolStripMenuItem.Name = "giveAFeedbackToolStripMenuItem";
+ this.giveAFeedbackToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F8;
+ this.giveAFeedbackToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
+ this.giveAFeedbackToolStripMenuItem.Text = "Give a feedback";
+ this.giveAFeedbackToolStripMenuItem.Click += new System.EventHandler(this.giveAFeedbackToolStripMenuItem_Click);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F1;
- this.aboutToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
+ this.aboutToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
//
+ // aboutWindowsToolStripMenuItem
+ //
+ this.aboutWindowsToolStripMenuItem.Name = "aboutWindowsToolStripMenuItem";
+ this.aboutWindowsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F1)));
+ this.aboutWindowsToolStripMenuItem.Size = new System.Drawing.Size(265, 26);
+ this.aboutWindowsToolStripMenuItem.Text = "About Windows";
+ this.aboutWindowsToolStripMenuItem.Visible = false;
+ this.aboutWindowsToolStripMenuItem.Click += new System.EventHandler(this.aboutWindowsToolStripMenuItem_Click);
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.ClientSize = new System.Drawing.Size(1054, 575);
this.Controls.Add(this.text_area);
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Notepad";
+ this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
@@ -173,10 +226,15 @@
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem newWindowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveFileWithNameToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem alwaysOnTopToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem giveAFeedbackToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem aboutWindowsToolStripMenuItem;
}
}
diff --git a/Notepad/Form1.cs b/Notepad/Form1.cs
index db499ce..d8200ef 100644
--- a/Notepad/Form1.cs
+++ b/Notepad/Form1.cs
@@ -10,11 +10,17 @@ using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Diagnostics;
+using System.Net;
namespace Notepad
{
public partial class Form1 : Form
{
+ // Update strings
+ private readonly string _releaseURL = "https://raw.githubusercontent.com/Vichingo455/Notepad/master/latest.txt";
+ public Version CurrentVersion = new Version(Application.ProductVersion);
+ public Version LatestVersion;
+
public Form1()
{
InitializeComponent();
@@ -39,9 +45,16 @@ namespace Notepad
try
{
text_area.Text = File.ReadAllText(fileName);
+ Global.savefilename = fileName;
}
catch (Exception ex)
- { MessageBox.Show(ex.Message, this.Text); }
+ {
+ var dialog = MessageBox.Show("The following exception occured: " + ex.Message + "\nDo you want to send a crash report", this.Text + " - Critical error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialog == DialogResult.Yes)
+ {
+ Program.SendCrashReport(ex);
+ }
+ }
}
}
}
@@ -70,7 +83,13 @@ namespace Notepad
Global.savefilename = fileName;
}
catch (Exception ex)
- { MessageBox.Show(ex.Message, this.Text); }
+ {
+ var dialog = MessageBox.Show("The following exception occured: " + ex.Message + "\nDo you want to send a crash report", this.Text + " - Critical error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialog == DialogResult.Yes)
+ {
+ Program.SendCrashReport(ex);
+ }
+ }
}
}
}
@@ -81,7 +100,13 @@ namespace Notepad
File.WriteAllText(Global.savefilename, text_area.Text);
}
catch (Exception ex)
- { MessageBox.Show(ex.Message, this.Text); }
+ {
+ var dialog = MessageBox.Show("The following exception occured: " + ex.Message + "\nDo you want to send a crash report", this.Text + " - Critical error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialog == DialogResult.Yes)
+ {
+ Program.SendCrashReport(ex);
+ }
+ }
}
}
@@ -102,7 +127,13 @@ namespace Notepad
Global.savefilename = fileName;
}
catch (Exception ex)
- { MessageBox.Show(ex.Message, this.Text); }
+ {
+ var dialog = MessageBox.Show("The following exception occured: " + ex.Message + "\nDo you want to send a crash report", this.Text + " - Critical error",MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
+ if (dialog == DialogResult.Yes)
+ {
+ Program.SendCrashReport(ex);
+ }
+ }
}
}
}
@@ -119,11 +150,134 @@ namespace Notepad
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
- MessageBox.Show("", Text);
+ MessageBox.Show("Notepad\nVersion " + Program.GetCurrentVersionTostring() + "\nMaded by Vichingo455\nCopyright (C) 2022 Vichingo455. All rights reserved.\n\n\nReleased under GPL 3.0 License: you are free to\n- Modify\n- Use for business\n- Distribute\n- Use at home\n\nBut you have:\n- No liability\n- No warranty", Text);
+ }
+ ///
+ /// Check for updates
+ ///
+ public void CheckUpdates()
+ {
+ try
+ {
+ WebRequest hreq = WebRequest.Create(_releaseURL);
+ hreq.Timeout = 10000;
+ hreq.Headers.Set("Cache-Control", "no-cache, no-store, must-revalidate");
+
+ WebResponse hres = hreq.GetResponse();
+ StreamReader sr = new StreamReader(hres.GetResponseStream());
+
+ LatestVersion = new Version(sr.ReadToEnd().Trim());
+
+ // Done and dispose!
+ sr.Dispose();
+ hres.Dispose();
+ }
+ catch (Exception ex)
+ {
+ var dialog = MessageBox.Show("The following exception occured: " + ex.Message + "\nDo you want to send a crash report", this.Text + " - Critical error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialog == DialogResult.Yes)
+ {
+ Program.SendCrashReport(ex);
+ }
+ }
+
+ var equals = LatestVersion.CompareTo(CurrentVersion);
+
+ if (equals == 0)
+ {
+ // Up-to-date
+ MessageBox.Show("The program is up-to-date",Text,MessageBoxButtons.OK);
+ }
+ else if (equals < 0)
+ {
+ MessageBox.Show("You are using an unofficial release of Notepad", Text, MessageBoxButtons.OK); // Unofficial
+ }
+ else // New release available!
+ {
+ if (MessageBox.Show("This new version is available:" + " " + LatestVersion + ". You are using the version" + " " + CurrentVersion + ". Do you want to open the download website?", Text, MessageBoxButtons.YesNo) == DialogResult.Yes) // New release available!
+ {
+ Process.Start("https://github.com/Vichingo455/Notepad/releases/tag/" + LatestVersion);
+ }
+ }
+ }
+
+ private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ CheckUpdates();
+ }
+
+ private void viewToolStripMenuItem_Click_1(object sender, EventArgs e)
+ {
+
+ }
+
+ private void alwaysOnTopToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (alwaysOnTopToolStripMenuItem.Checked == true)
+ {
+ TopMost = false;
+ alwaysOnTopToolStripMenuItem.Checked = false;
+ }
+ else
+ {
+ TopMost = true;
+ alwaysOnTopToolStripMenuItem.Checked = true;
+ }
+ }
+
+ private void giveAFeedbackToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ Process.Start("https://forms.gle/crZF4YJ6eiAzQ8ic8");
+ }
+
+ private void resetTransparencyToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ Opacity = 100;
+ }
+
+ private void toolStripTextBox1_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void applyToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+
+ }
+
+ private void Form1_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ private void aboutWindowsToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ string windir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
+ if (File.Exists(windir + @"\System32\winver.exe"))
+ {
+ Process.Start(windir + @"\System32\winver.exe");
+ }
+ }
+ catch (Exception ex)
+ {
+ var dialog = MessageBox.Show("The following exception occured: " + ex.Message + "\nDo you want to send a crash report", this.Text + " - Critical error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
+ if (dialog == DialogResult.Yes)
+ {
+ Program.SendCrashReport(ex);
+ }
+ }
}
}
public class Global
{
public static string savefilename;
+ public static string transparency;
}
}
diff --git a/Notepad/Notepad.csproj b/Notepad/Notepad.csproj
index 4175b7e..fa4ae9c 100644
--- a/Notepad/Notepad.csproj
+++ b/Notepad/Notepad.csproj
@@ -14,7 +14,7 @@
true
false
publish\
- false
+ true
Disk
false
Foreground
@@ -23,9 +23,19 @@
false
false
false
+ https://github.com/Vichingo455/Notepad
+ en
+ Notepad
+ Vichingo455
+ Vichingo455 Tech
+ true
+ publish.htm
+ false
+ true
0
- 1.0.0.%2a
+ 1.0.0.0
false
+ true
true
@@ -70,6 +80,15 @@
http://timestamp.digicert.com
+
+ true
+
+
+ LocalIntranet
+
+
+ Properties\app.manifest
+
@@ -106,6 +125,7 @@
Resources.resx
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/Notepad/Properties/app.manifest b/Notepad/Properties/app.manifest
new file mode 100644
index 0000000..be8494a
--- /dev/null
+++ b/Notepad/Properties/app.manifest
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file