diff --git a/Notepad/.vs/Notepad/v16/.suo b/Notepad/.vs/Notepad/v16/.suo index 59f720d..47115db 100644 Binary files a/Notepad/.vs/Notepad/v16/.suo and b/Notepad/.vs/Notepad/v16/.suo differ diff --git a/Notepad/Notepad v2/Form1.Designer.cs b/Notepad/Notepad v2/Form1.Designer.cs index e866c1e..7bbf80a 100644 --- a/Notepad/Notepad v2/Form1.Designer.cs +++ b/Notepad/Notepad v2/Form1.Designer.cs @@ -65,6 +65,8 @@ namespace Notatnik this.pogrubienieToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.kursywaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.podkreślenieToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.updateSeparator = new System.Windows.Forms.ToolStripSeparator(); + this.updateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); @@ -76,8 +78,6 @@ namespace Notatnik this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog(); this.colorDialog1 = new System.Windows.Forms.ColorDialog(); this.colorDialog2 = new System.Windows.Forms.ColorDialog(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.updateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.panel1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout(); @@ -513,7 +513,7 @@ namespace Notatnik this.pogrubienieToolStripMenuItem, this.kursywaToolStripMenuItem, this.podkreślenieToolStripMenuItem, - this.toolStripSeparator4, + this.updateSeparator, this.updateToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(185, 292); @@ -611,6 +611,21 @@ namespace Notatnik this.podkreślenieToolStripMenuItem.Text = "Podkreślenie"; this.podkreślenieToolStripMenuItem.Click += new System.EventHandler(this.podkreślenieToolStripMenuItem_Click); // + // updateSeparator + // + this.updateSeparator.Name = "updateSeparator"; + this.updateSeparator.Size = new System.Drawing.Size(181, 6); + this.updateSeparator.Visible = false; + // + // updateToolStripMenuItem + // + this.updateToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); + this.updateToolStripMenuItem.Name = "updateToolStripMenuItem"; + this.updateToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.updateToolStripMenuItem.Text = "Update!"; + this.updateToolStripMenuItem.Visible = false; + this.updateToolStripMenuItem.Click += new System.EventHandler(this.updateToolStripMenuItem_Click); + // // openFileDialog1 // this.openFileDialog1.Filter = "Plik tekstowy (*.txt)|*.txt|Tekst sformatowany (*.rtf)|*.rtf|Strona HTML (*.html)" + @@ -669,20 +684,6 @@ namespace Notatnik this.printPreviewDialog1.Name = "printPreviewDialog1"; this.printPreviewDialog1.Visible = false; // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(181, 6); - // - // updateToolStripMenuItem - // - this.updateToolStripMenuItem.Enabled = false; - this.updateToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); - this.updateToolStripMenuItem.Name = "updateToolStripMenuItem"; - this.updateToolStripMenuItem.Size = new System.Drawing.Size(184, 22); - this.updateToolStripMenuItem.Text = "Update!"; - this.updateToolStripMenuItem.Click += new System.EventHandler(this.updateToolStripMenuItem_Click); - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -757,7 +758,7 @@ namespace Notatnik private System.Windows.Forms.Button button15; private System.Windows.Forms.Button button16; private System.Windows.Forms.Button button17; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripSeparator updateSeparator; private System.Windows.Forms.ToolStripMenuItem updateToolStripMenuItem; } } diff --git a/Notepad/Notepad v2/Form1.cs b/Notepad/Notepad v2/Form1.cs index 49ab1d8..f3db066 100644 --- a/Notepad/Notepad v2/Form1.cs +++ b/Notepad/Notepad v2/Form1.cs @@ -10,6 +10,7 @@ using System.Windows.Forms; using System.IO; using System.Net; using System.Net.NetworkInformation; +using System.Diagnostics; namespace Notatnik { @@ -383,26 +384,28 @@ namespace Notatnik void checkUpdate() { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; string urlVersion = "https://raw.githubusercontent.com/KrzysiekSiemv/Notepad/main/version.txt"; WebClient webClient = new WebClient(); Stream stream = webClient.OpenRead(urlVersion); StreamReader reader = new StreamReader(stream); - String content = reader.ReadToEnd(); + string content = reader.ReadLine(); if(Application.ProductVersion != content) { toolStripStatusLabel1.Text = "Jest dostępna nowa wersja! Jeżeli chcesz zainstalować, wybierz w Context Menu: Pobierz update!"; statusStrip1.BackColor = Color.FromArgb(255, 202, 81, 0); - updateToolStripMenuItem.Enabled = true; + updateSeparator.Visible = true; + updateToolStripMenuItem.Visible = true; } } private void updateToolStripMenuItem_Click(object sender, EventArgs e) { - Update update = new Update(); - update.Show(); + Process.Start("updater.exe"); + this.Close(); } } } diff --git a/Notepad/Notepad v2/Notepad v2.csproj b/Notepad/Notepad v2/Notepad v2.csproj index 82fc17f..1ac75da 100644 --- a/Notepad/Notepad v2/Notepad v2.csproj +++ b/Notepad/Notepad v2/Notepad v2.csproj @@ -27,7 +27,7 @@ Krzysztof %27KrzysiekSiemv%27 Smaga Notepad 0 - 1.0.0.%2a + 1.0.2.%2a false true diff --git a/Notepad/Notepad v2/Properties/AssemblyInfo.cs b/Notepad/Notepad v2/Properties/AssemblyInfo.cs index a2ce30c..390d42a 100644 --- a/Notepad/Notepad v2/Properties/AssemblyInfo.cs +++ b/Notepad/Notepad v2/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki // przy użyciu symbolu „*”, tak jak pokazano poniżej: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1.0")] -[assembly: AssemblyFileVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyFileVersion("1.0.2.0")] diff --git a/Notepad/Notepad v2/Update.Designer.cs b/Notepad/Notepad v2/Update.Designer.cs index 15cffb3..d2d35d9 100644 --- a/Notepad/Notepad v2/Update.Designer.cs +++ b/Notepad/Notepad v2/Update.Designer.cs @@ -92,6 +92,7 @@ namespace Notatnik this.button1.TabIndex = 6; this.button1.Text = "Update"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // progressBar1 // diff --git a/Notepad/Notepad v2/Update.cs b/Notepad/Notepad v2/Update.cs index 416d6eb..1a7d2e9 100644 --- a/Notepad/Notepad v2/Update.cs +++ b/Notepad/Notepad v2/Update.cs @@ -38,5 +38,10 @@ namespace Notatnik { webClient.DownloadFile("https://github.com/KrzysiekSiemv/Notepad/releases/download/" + content + "/Notatnik.exe", Path.GetTempPath() + "\\Notatnik\\NotatnikUpdate.exe"); } + + private void button1_Click(object sender, EventArgs e) + { + + } } } diff --git a/Notepad/Notepad v2/bin/Debug/Notatnik.exe b/Notepad/Notepad v2/bin/Debug/Notatnik.exe index bffd618..83282db 100644 Binary files a/Notepad/Notepad v2/bin/Debug/Notatnik.exe and b/Notepad/Notepad v2/bin/Debug/Notatnik.exe differ diff --git a/Notepad/Notepad v2/bin/Debug/Notatnik.pdb b/Notepad/Notepad v2/bin/Debug/Notatnik.pdb index 631f2f0..f01b248 100644 Binary files a/Notepad/Notepad v2/bin/Debug/Notatnik.pdb and b/Notepad/Notepad v2/bin/Debug/Notatnik.pdb differ diff --git a/Notepad/Notepad v2/bin/Release/Notatnik.exe b/Notepad/Notepad v2/bin/Release/Notatnik.exe index ca1509d..321d018 100644 Binary files a/Notepad/Notepad v2/bin/Release/Notatnik.exe and b/Notepad/Notepad v2/bin/Release/Notatnik.exe differ diff --git a/Notepad/Notepad v2/obj/Debug/Notatnik.Update.resources b/Notepad/Notepad v2/obj/Debug/Notatnik.Update.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/Notepad/Notepad v2/obj/Debug/Notatnik.Update.resources differ diff --git a/Notepad/Notepad v2/obj/Debug/Notatnik.exe b/Notepad/Notepad v2/obj/Debug/Notatnik.exe index bffd618..83282db 100644 Binary files a/Notepad/Notepad v2/obj/Debug/Notatnik.exe and b/Notepad/Notepad v2/obj/Debug/Notatnik.exe differ diff --git a/Notepad/Notepad v2/obj/Debug/Notatnik.pdb b/Notepad/Notepad v2/obj/Debug/Notatnik.pdb index 631f2f0..f01b248 100644 Binary files a/Notepad/Notepad v2/obj/Debug/Notatnik.pdb and b/Notepad/Notepad v2/obj/Debug/Notatnik.pdb differ diff --git a/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.CoreCompileInputs.cache b/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.CoreCompileInputs.cache index f5b326d..f937ffa 100644 --- a/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.CoreCompileInputs.cache +++ b/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -49ddf053a8af5d6e9369e6d3a8e96ccab85129ad +75f58dc4ce47ae60a4b7e2aa90a185fab752a7be diff --git a/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.FileListAbsolute.txt b/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.FileListAbsolute.txt index 2b69db5..10069de 100644 --- a/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.FileListAbsolute.txt +++ b/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.FileListAbsolute.txt @@ -18,3 +18,4 @@ C:\Users\Krzysiek\Documents\GitHub\Notepad\Notepad\Notepad v2\obj\Debug\Notepad C:\Users\Krzysiek\Documents\GitHub\Notepad\Notepad\Notepad v2\obj\Debug\Notepad v2.csproj.CoreCompileInputs.cache C:\Users\Krzysiek\Documents\GitHub\Notepad\Notepad\Notepad v2\obj\Debug\Notatnik.exe C:\Users\Krzysiek\Documents\GitHub\Notepad\Notepad\Notepad v2\obj\Debug\Notatnik.pdb +C:\Users\Krzysiek\Documents\GitHub\Notepad\Notepad\Notepad v2\obj\Debug\Notatnik.Update.resources diff --git a/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.GenerateResource.cache b/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.GenerateResource.cache index 97b4c01..234b2f4 100644 Binary files a/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.GenerateResource.cache and b/Notepad/Notepad v2/obj/Debug/Notepad v2.csproj.GenerateResource.cache differ diff --git a/Notepad/Notepad v2/obj/Debug/Notepad v2.csprojAssemblyReference.cache b/Notepad/Notepad v2/obj/Debug/Notepad v2.csprojAssemblyReference.cache index 9b81105..bfe8805 100644 Binary files a/Notepad/Notepad v2/obj/Debug/Notepad v2.csprojAssemblyReference.cache and b/Notepad/Notepad v2/obj/Debug/Notepad v2.csprojAssemblyReference.cache differ diff --git a/Notepad/Notepad v2/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/Notepad/Notepad v2/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll index 1a10902..dc48112 100644 Binary files a/Notepad/Notepad v2/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll and b/Notepad/Notepad v2/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/Notepad/Notepad v2/obj/Release/Notatnik.exe b/Notepad/Notepad v2/obj/Release/Notatnik.exe index ca1509d..321d018 100644 Binary files a/Notepad/Notepad v2/obj/Release/Notatnik.exe and b/Notepad/Notepad v2/obj/Release/Notatnik.exe differ diff --git a/Notepad/Notepad v2/obj/Release/Notepad v2.csproj.GenerateResource.cache b/Notepad/Notepad v2/obj/Release/Notepad v2.csproj.GenerateResource.cache index 2d0789b..f226365 100644 Binary files a/Notepad/Notepad v2/obj/Release/Notepad v2.csproj.GenerateResource.cache and b/Notepad/Notepad v2/obj/Release/Notepad v2.csproj.GenerateResource.cache differ diff --git a/Notepad/Notepad v2/obj/Release/Notepad v2.csprojAssemblyReference.cache b/Notepad/Notepad v2/obj/Release/Notepad v2.csprojAssemblyReference.cache index bda9875..4181560 100644 Binary files a/Notepad/Notepad v2/obj/Release/Notepad v2.csprojAssemblyReference.cache and b/Notepad/Notepad v2/obj/Release/Notepad v2.csprojAssemblyReference.cache differ diff --git a/NotepadUpdater/.vs/NotepadUpdater/v16/.suo b/NotepadUpdater/.vs/NotepadUpdater/v16/.suo new file mode 100644 index 0000000..38b5756 Binary files /dev/null and b/NotepadUpdater/.vs/NotepadUpdater/v16/.suo differ diff --git a/NotepadUpdater/NotepadUpdater.sln b/NotepadUpdater/NotepadUpdater.sln new file mode 100644 index 0000000..a4500fe --- /dev/null +++ b/NotepadUpdater/NotepadUpdater.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30907.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotepadUpdater", "NotepadUpdater\NotepadUpdater.csproj", "{DB683BDF-4745-440D-8052-03484A7C3A8A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DB683BDF-4745-440D-8052-03484A7C3A8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB683BDF-4745-440D-8052-03484A7C3A8A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB683BDF-4745-440D-8052-03484A7C3A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB683BDF-4745-440D-8052-03484A7C3A8A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {919ED6E3-A138-494D-A849-F2F81832E63F} + EndGlobalSection +EndGlobal diff --git a/NotepadUpdater/NotepadUpdater/App.config b/NotepadUpdater/NotepadUpdater/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NotepadUpdater/NotepadUpdater/Form1.Designer.cs b/NotepadUpdater/NotepadUpdater/Form1.Designer.cs new file mode 100644 index 0000000..451c8d3 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Form1.Designer.cs @@ -0,0 +1,142 @@ + +namespace NotepadUpdater +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.richTextBox1 = new System.Windows.Forms.RichTextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(81, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Obecna wersja:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(23, 35); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(71, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Nowa wersja:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(100, 13); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(31, 13); + this.label3.TabIndex = 2; + this.label3.Text = "1.0.2"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(100, 35); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(31, 13); + this.label4.TabIndex = 3; + this.label4.Text = "1.0.3"; + // + // richTextBox1 + // + this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.richTextBox1.Location = new System.Drawing.Point(12, 61); + this.richTextBox1.Name = "richTextBox1"; + this.richTextBox1.ReadOnly = true; + this.richTextBox1.Size = new System.Drawing.Size(417, 157); + this.richTextBox1.TabIndex = 5; + this.richTextBox1.Text = ""; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(330, 19); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(99, 23); + this.button1.TabIndex = 6; + this.button1.Text = "Update"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(12, 224); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(417, 23); + this.progressBar1.TabIndex = 7; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(441, 259); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.button1); + this.Controls.Add(this.richTextBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(457, 298); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(457, 298); + this.Name = "Form1"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Update notatnika"; + this.Load += new System.EventHandler(this.Form1_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.RichTextBox richTextBox1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ProgressBar progressBar1; + } +} \ No newline at end of file diff --git a/NotepadUpdater/NotepadUpdater/Form1.cs b/NotepadUpdater/NotepadUpdater/Form1.cs new file mode 100644 index 0000000..144e106 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Form1.cs @@ -0,0 +1,91 @@ +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; +using System.Diagnostics; +using System.Net; +using System.IO; + +namespace NotepadUpdater +{ + public partial class Form1 : Form + { + WebClient webClient; + string contentVersion; + + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; + string urlVersion = "https://raw.githubusercontent.com/KrzysiekSiemv/Notepad/main/version.txt"; + string urlChangelog = "https://raw.githubusercontent.com/KrzysiekSiemv/Notepad/main/changelog.txt"; + + webClient = new WebClient(); + + Stream streamVersion = webClient.OpenRead(urlVersion); + Stream streamChangelog = webClient.OpenRead(urlChangelog); + + StreamReader readerVersion = new StreamReader(streamVersion); + StreamReader readerChangelog = new StreamReader(streamChangelog); + + contentVersion = readerVersion.ReadToEnd(); + string contentChangelog = readerChangelog.ReadToEnd(); + + FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo("Notatnik.exe"); + + label3.Text = fileVersionInfo.ProductVersion; + label4.Text = contentVersion; + + richTextBox1.Text = contentChangelog; + } + + void downloadUpdate() + { + string urlDownload = "https://raw.githubusercontent.com/KrzysiekSiemv/Notepad/main/changelog.txt"; + Stream streamDownload = webClient.OpenRead(urlDownload); + StreamReader readerDownload = new StreamReader(streamDownload); + string contentDownload = readerDownload.ReadToEnd(); + + File.Delete("Notatnik.exe"); + + webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); + webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); + + webClient.DownloadFileAsync(new Uri(contentDownload), "Notatnik.exe"); + } + + void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) + { + double bytesIn = double.Parse(e.BytesReceived.ToString()); + double totalBytes = double.Parse(e.TotalBytesToReceive.ToString()); + double percentage = bytesIn / totalBytes * 100; + progressBar1.Value = int.Parse(Math.Truncate(percentage).ToString()); + } + void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) + { + if (MessageBox.Show("Aktualizacja została ukończona. Czy chcesz włączyć notatnik?", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + Process.Start("Notatnik.exe"); + this.Close(); + } + else + { + this.Close(); + } + } + + private void button1_Click(object sender, EventArgs e) + { + downloadUpdate(); + } + } +} diff --git a/NotepadUpdater/NotepadUpdater/Form1.resx b/NotepadUpdater/NotepadUpdater/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NotepadUpdater/NotepadUpdater/NotepadUpdater.csproj b/NotepadUpdater/NotepadUpdater/NotepadUpdater.csproj new file mode 100644 index 0000000..f798879 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/NotepadUpdater.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {DB683BDF-4745-440D-8052-03484A7C3A8A} + WinExe + NotepadUpdater + NotepadUpdater + v4.5 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + 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/NotepadUpdater/NotepadUpdater/Program.cs b/NotepadUpdater/NotepadUpdater/Program.cs new file mode 100644 index 0000000..270099d --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace NotepadUpdater +{ + static class Program + { + /// + /// Główny punkt wejścia dla aplikacji. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/NotepadUpdater/NotepadUpdater/Properties/AssemblyInfo.cs b/NotepadUpdater/NotepadUpdater/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..5e0b582 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Ogólne informacje o zestawie są kontrolowane poprzez następujący +// zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje +// powiązane z zestawem. +[assembly: AssemblyTitle("NotepadUpdater")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NotepadUpdater")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne +// dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z +// COM, ustaw wartość true dla atrybutu ComVisible tego typu. +[assembly: ComVisible(false)] + +// Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM +[assembly: Guid("db683bdf-4745-440d-8052-03484a7c3a8a")] + +// Informacje o wersji zestawu zawierają następujące cztery wartości: +// +// Wersja główna +// Wersja pomocnicza +// Numer kompilacji +// Poprawka +// +// Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki +// przy użyciu symbolu „*”, tak jak pokazano poniżej: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NotepadUpdater/NotepadUpdater/Properties/Resources.Designer.cs b/NotepadUpdater/NotepadUpdater/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bf3fbbf --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Properties/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// Ten kod został wygenerowany przez narzędzie. +// Wersja środowiska uruchomieniowego: 4.0.30319.42000 +// +// Modyfikacje tego pliku mogą spowodować niewłaściwe zachowanie i zostaną utracone +// w przypadku ponownego wygenerowania kodu. +// +//------------------------------------------------------------------------------ + + +namespace NotepadUpdater.Properties +{ + /// + /// Silnie typizowana klasa zasobów do wyszukiwania zlokalizowanych ciągów itd. + /// + // Ta klasa została automatycznie wygenerowana za pomocą klasy StronglyTypedResourceBuilder + // przez narzędzie, takie jak ResGen lub Visual Studio. + // Aby dodać lub usunąć składowe, edytuj plik ResX, a następnie ponownie uruchom narzędzie ResGen + // z opcją /str lub ponownie skompiluj projekt programu 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() + { + } + + /// + /// Zwraca buforowane wystąpienie składnika ResourceManager używane przez tę klasę. + /// + [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("NotepadUpdater.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Przesłania właściwość CurrentUICulture bieżącego wątku dla wszystkich + /// przypadków przeszukiwania zasobów za pomocą tej silnie typizowanej klasy zasobów. + /// + [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/NotepadUpdater/NotepadUpdater/Properties/Resources.resx b/NotepadUpdater/NotepadUpdater/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/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/NotepadUpdater/NotepadUpdater/Properties/Settings.Designer.cs b/NotepadUpdater/NotepadUpdater/Properties/Settings.Designer.cs new file mode 100644 index 0000000..80f0c83 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Properties/Settings.Designer.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// 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 NotepadUpdater.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/NotepadUpdater/NotepadUpdater/Properties/Settings.settings b/NotepadUpdater/NotepadUpdater/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/NotepadUpdater/NotepadUpdater/bin/Debug/Notatnik.exe b/NotepadUpdater/NotepadUpdater/bin/Debug/Notatnik.exe new file mode 100644 index 0000000..62ff2d4 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/bin/Debug/Notatnik.exe differ diff --git a/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.exe b/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.exe new file mode 100644 index 0000000..8bf9187 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.exe differ diff --git a/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.exe.config b/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.exe.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.pdb b/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.pdb new file mode 100644 index 0000000..45a619f Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/bin/Debug/NotepadUpdater.pdb differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs b/NotepadUpdater/NotepadUpdater/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs new file mode 100644 index 0000000..e5dc9b8 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")] diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/NotepadUpdater/NotepadUpdater/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..241bdc3 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/NotepadUpdater/NotepadUpdater/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..1e11542 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.Form1.resources b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.Form1.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.Form1.resources differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.Properties.Resources.resources b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.Properties.Resources.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.Properties.Resources.resources differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.CoreCompileInputs.cache b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..f5b326d --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +49ddf053a8af5d6e9369e6d3a8e96ccab85129ad diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.FileListAbsolute.txt b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..2c09944 --- /dev/null +++ b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.FileListAbsolute.txt @@ -0,0 +1,10 @@ +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\bin\Debug\NotepadUpdater.exe.config +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\bin\Debug\NotepadUpdater.exe +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\bin\Debug\NotepadUpdater.pdb +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.csprojAssemblyReference.cache +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.Properties.Resources.resources +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.csproj.GenerateResource.cache +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.csproj.CoreCompileInputs.cache +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.exe +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.pdb +C:\Users\Krzysiek\source\repos\NotepadUpdater\NotepadUpdater\obj\Debug\NotepadUpdater.Form1.resources diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.GenerateResource.cache b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.GenerateResource.cache new file mode 100644 index 0000000..bc7c7cd Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csproj.GenerateResource.cache differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csprojAssemblyReference.cache b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csprojAssemblyReference.cache new file mode 100644 index 0000000..4c4ceaf Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.csprojAssemblyReference.cache differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.exe b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.exe new file mode 100644 index 0000000..8bf9187 Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.exe differ diff --git a/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.pdb b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.pdb new file mode 100644 index 0000000..45a619f Binary files /dev/null and b/NotepadUpdater/NotepadUpdater/obj/Debug/NotepadUpdater.pdb differ