diff --git a/ElectronicObserver.sln b/ElectronicObserver.sln
index 92f5df99a..e2427899b 100644
--- a/ElectronicObserver.sln
+++ b/ElectronicObserver.sln
@@ -1,9 +1,12 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.28010.2003
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30503.244
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicObserver", "ElectronicObserver\ElectronicObserver.csproj", "{A9ABEC50-1BFC-4C69-87AE-C68DB6004F68}"
+ ProjectSection(ProjectDependencies) = postProject
+ {83DF5838-CF4B-430F-A1A7-0FE38C28CF00} = {83DF5838-CF4B-430F-A1A7-0FE38C28CF00}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Browser", "Browser\Browser.csproj", "{87A2B596-57D0-48BB-B522-895782D7A6FC}"
EndProject
@@ -16,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicObserverUpdater", "ElectronicObserverUpdater\ElectronicObserverUpdater.csproj", "{83DF5838-CF4B-430F-A1A7-0FE38C28CF00}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -38,6 +43,10 @@ Global
{C75532C4-765B-418E-B09B-46D36B2ABDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C75532C4-765B-418E-B09B-46D36B2ABDB1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {83DF5838-CF4B-430F-A1A7-0FE38C28CF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {83DF5838-CF4B-430F-A1A7-0FE38C28CF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {83DF5838-CF4B-430F-A1A7-0FE38C28CF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {83DF5838-CF4B-430F-A1A7-0FE38C28CF00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ElectronicObserver/Utility/SoftwareInformation.cs b/ElectronicObserver/Utility/SoftwareInformation.cs
index e96ed4545..29351635b 100644
--- a/ElectronicObserver/Utility/SoftwareInformation.cs
+++ b/ElectronicObserver/Utility/SoftwareInformation.cs
@@ -114,7 +114,11 @@ private static void DownloadStringCompleted(object sender, System.Net.DownloadSt
if (result == System.Windows.Forms.DialogResult.Yes)
{
- System.Diagnostics.Process.Start("http://electronicobserver.blog.fc2.com/");
+ //System.Diagnostics.Process.Start("http://electronicobserver.blog.fc2.com/");
+ var p = new System.Diagnostics.Process();
+ p.StartInfo.FileName = "ElectronicObserverUpdater.exe";
+ p.StartInfo.Arguments = version;
+ p.Start();
}
else if (result == System.Windows.Forms.DialogResult.Cancel)
diff --git a/ElectronicObserverUpdater/74eo.ico b/ElectronicObserverUpdater/74eo.ico
new file mode 100644
index 000000000..23ccb1204
Binary files /dev/null and b/ElectronicObserverUpdater/74eo.ico differ
diff --git a/ElectronicObserverUpdater/App.config b/ElectronicObserverUpdater/App.config
new file mode 100644
index 000000000..88fa4027b
--- /dev/null
+++ b/ElectronicObserverUpdater/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ElectronicObserverUpdater/ElectronicObserverUpdater.csproj b/ElectronicObserverUpdater/ElectronicObserverUpdater.csproj
new file mode 100644
index 000000000..7c14af0b9
--- /dev/null
+++ b/ElectronicObserverUpdater/ElectronicObserverUpdater.csproj
@@ -0,0 +1,94 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {83DF5838-CF4B-430F-A1A7-0FE38C28CF00}
+ WinExe
+ ElectronicObserverUpdater
+ ElectronicObserverUpdater
+ v4.5.2
+ 512
+ false
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ ..\ElectronicObserver\bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ 74eo.ico
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ FormUpdater.cs
+
+
+
+
+
+ FormUpdater.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/ElectronicObserverUpdater/Program.cs b/ElectronicObserverUpdater/Program.cs
new file mode 100644
index 000000000..a1136451f
--- /dev/null
+++ b/ElectronicObserverUpdater/Program.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ElectronicObserverUpdater
+{
+ static class Program
+ {
+ ///
+ /// 해당 애플리케이션의 주 진입점입니다.
+ ///
+ [STAThread]
+ static void Main(string[] args)
+ {
+ if (args[0] == "")
+ throw new ArgumentException("Argument was null");
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new FormUpdater(args[0]));
+ }
+ }
+}
diff --git a/ElectronicObserverUpdater/Properties/AssemblyInfo.cs b/ElectronicObserverUpdater/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..fd32f3bb4
--- /dev/null
+++ b/ElectronicObserverUpdater/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
+// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
+// 이러한 특성 값을 변경하세요.
+[assembly: AssemblyTitle("ElectronicObserverUpdater")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ElectronicObserverUpdater")]
+[assembly: AssemblyCopyright("Copyright © 2020 MisakaMOE")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
+// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
+// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
+[assembly: ComVisible(false)]
+
+// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
+[assembly: Guid("83df5838-cf4b-430f-a1a7-0fe38c28cf00")]
+
+// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
+//
+// 주 버전
+// 부 버전
+// 빌드 번호
+// 수정 버전
+//
+// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
+// 기본값으로 할 수 있습니다.
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/ElectronicObserverUpdater/Properties/Resources.Designer.cs b/ElectronicObserverUpdater/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..62351f429
--- /dev/null
+++ b/ElectronicObserverUpdater/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+//
+// 이 코드는 도구를 사용하여 생성되었습니다.
+// 런타임 버전:4.0.30319.42000
+//
+// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
+// 이러한 변경 내용이 손실됩니다.
+//
+//------------------------------------------------------------------------------
+
+namespace ElectronicObserverUpdater.Properties
+{
+
+
+ ///
+ /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
+ ///
+ // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
+ // 클래스에서 자동으로 생성되었습니다.
+ // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
+ // ResGen을 다시 실행하거나 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()
+ {
+ }
+
+ ///
+ /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
+ ///
+ [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("ElectronicObserverUpdater.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
+ /// 재정의합니다.
+ ///
+ [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/ElectronicObserverUpdater/Properties/Resources.resx b/ElectronicObserverUpdater/Properties/Resources.resx
new file mode 100644
index 000000000..af7dbebba
--- /dev/null
+++ b/ElectronicObserverUpdater/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/ElectronicObserverUpdater/Properties/Settings.Designer.cs b/ElectronicObserverUpdater/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..11b20e117
--- /dev/null
+++ b/ElectronicObserverUpdater/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 ElectronicObserverUpdater.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/ElectronicObserverUpdater/Properties/Settings.settings b/ElectronicObserverUpdater/Properties/Settings.settings
new file mode 100644
index 000000000..39645652a
--- /dev/null
+++ b/ElectronicObserverUpdater/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/ElectronicObserverUpdater/Utillity/ZipFileExtensions.cs b/ElectronicObserverUpdater/Utillity/ZipFileExtensions.cs
new file mode 100644
index 000000000..fbbf757fb
--- /dev/null
+++ b/ElectronicObserverUpdater/Utillity/ZipFileExtensions.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Compression;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ElectronicObserverUpdater.Utillity
+{
+ public static class ZipFileExtensions
+ {
+ ///
+ /// Extract zip file to directory.
+ /// this method doesn't generate root directory of zip file.
+ ///
+ /// Zip file
+ /// Destination Direcctory path
+ /// Progress receiver
+ /// overwrite?
+ public static void ExtractToDirectory(this ZipArchive source, string destinationDirectoryName, IProgress progress, bool overwrite)
+ {
+ if (source == null)
+ throw new ArgumentNullException(nameof(source));
+
+ if (destinationDirectoryName == null)
+ throw new ArgumentNullException(nameof(destinationDirectoryName));
+
+ // Rely on Directory.CreateDirectory for validation of destinationDirectoryName.
+ // Note that this will give us a good DirectoryInfo even if destinationDirectoryName exists:
+ DirectoryInfo di = Directory.CreateDirectory(destinationDirectoryName);
+ string destinationDirectoryFullPath = di.FullName;
+
+ int count = 0;
+ var root = source.Entries[0]?.FullName;
+ foreach (ZipArchiveEntry entry in source.Entries)
+ {
+ count++;
+ //Remove zip file Root directory from path.
+ var newName = entry.FullName.Substring(root.Length);
+ string fileDestinationPath = Path.Combine(destinationDirectoryFullPath, newName);
+
+ if (!fileDestinationPath.StartsWith(destinationDirectoryFullPath, StringComparison.OrdinalIgnoreCase))
+ throw new IOException("File is extracting to outside of the folder specified.");
+
+ //Report extracting progress.
+ var zipProgress = new ZipProgress(source.Entries.Count, count, entry.FullName);
+ progress.Report(zipProgress);
+
+ if (Path.GetFileName(fileDestinationPath).Length == 0)
+ {
+ // If it is a directory:
+ if (entry.Length != 0)
+ throw new IOException("Directory entry with data.");
+
+ Directory.CreateDirectory(fileDestinationPath);
+ }
+ else
+ {
+ // If it is a file:
+ // Create containing directory:
+ //Check if entry is root directory
+ if (!(fileDestinationPath == destinationDirectoryName))
+ {
+ Directory.CreateDirectory(Path.GetDirectoryName(fileDestinationPath));
+ entry.ExtractToFile(fileDestinationPath, overwrite: overwrite);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/ElectronicObserverUpdater/Utillity/ZipProgress.cs b/ElectronicObserverUpdater/Utillity/ZipProgress.cs
new file mode 100644
index 000000000..8851e6d73
--- /dev/null
+++ b/ElectronicObserverUpdater/Utillity/ZipProgress.cs
@@ -0,0 +1,34 @@
+namespace ElectronicObserverUpdater
+{
+ ///
+ /// This indicates extracting progress of zip file.
+ ///
+ public class ZipProgress
+ {
+ ///
+ /// Init ZipProgress object
+ ///
+ /// default total value
+ /// default progress value
+ /// currently working item
+ public ZipProgress(int total, int processed, string currentItem)
+ {
+ Total = total;
+ Processed = processed;
+ CurrentItem = currentItem;
+ }
+ ///
+ /// Total item count of zip file.
+ ///
+ public int Total { get; }
+ ///
+ /// Extracted item count of zip file.
+ ///
+ public int Processed { get; }
+ ///
+ /// The filename of currently extracting.
+ ///
+ public string CurrentItem { get; }
+ }
+
+}
\ No newline at end of file
diff --git a/ElectronicObserverUpdater/Window/FormUpdater.Designer.cs b/ElectronicObserverUpdater/Window/FormUpdater.Designer.cs
new file mode 100644
index 000000000..ad8bff8e8
--- /dev/null
+++ b/ElectronicObserverUpdater/Window/FormUpdater.Designer.cs
@@ -0,0 +1,88 @@
+namespace ElectronicObserverUpdater
+{
+ partial class FormUpdater
+ {
+ ///
+ /// 필수 디자이너 변수입니다.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// 사용 중인 모든 리소스를 정리합니다.
+ ///
+ /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form 디자이너에서 생성한 코드
+
+ ///
+ /// 디자이너 지원에 필요한 메서드입니다.
+ /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
+ ///
+ private void InitializeComponent()
+ {
+ this.progressBar = new System.Windows.Forms.ProgressBar();
+ this.labelStatus = new System.Windows.Forms.Label();
+ this.labelDescription = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // progressBar
+ //
+ this.progressBar.Location = new System.Drawing.Point(12, 29);
+ this.progressBar.Name = "progressBar";
+ this.progressBar.Size = new System.Drawing.Size(397, 23);
+ this.progressBar.TabIndex = 0;
+ //
+ // labelStatus
+ //
+ this.labelStatus.AutoSize = true;
+ this.labelStatus.Location = new System.Drawing.Point(12, 9);
+ this.labelStatus.Name = "labelStatus";
+ this.labelStatus.Size = new System.Drawing.Size(90, 12);
+ this.labelStatus.TabIndex = 1;
+ this.labelStatus.Text = "Downloading...";
+ //
+ // labelDescription
+ //
+ this.labelDescription.AutoSize = true;
+ this.labelDescription.Location = new System.Drawing.Point(10, 64);
+ this.labelDescription.Name = "labelDescription";
+ this.labelDescription.Size = new System.Drawing.Size(148, 12);
+ this.labelDescription.TabIndex = 2;
+ this.labelDescription.Text = "0.0 Byte / 10000000 Bytes";
+ //
+ // FormUpdater
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(421, 87);
+ this.Controls.Add(this.labelDescription);
+ this.Controls.Add(this.labelStatus);
+ this.Controls.Add(this.progressBar);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.MaximizeBox = false;
+ this.Name = "FormUpdater";
+ this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "ElectronicObserver Updater";
+ this.Load += new System.EventHandler(this.FormUpdater_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ProgressBar progressBar;
+ private System.Windows.Forms.Label labelStatus;
+ private System.Windows.Forms.Label labelDescription;
+ }
+}
+
diff --git a/ElectronicObserverUpdater/Window/FormUpdater.cs b/ElectronicObserverUpdater/Window/FormUpdater.cs
new file mode 100644
index 000000000..0610bb663
--- /dev/null
+++ b/ElectronicObserverUpdater/Window/FormUpdater.cs
@@ -0,0 +1,172 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.IO.Compression;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ElectronicObserverUpdater
+{
+ public partial class FormUpdater : Form
+ {
+ #region Variables/Fields
+ ///
+ /// Base Url of update file.
+ /// Two parameters should be replaced when download file.
+ ///
+ private static string BASE_URL = "https://github.com/andanteyk/ElectronicObserver/releases/download/v{0}/ElectronicObserver{1}.zip";
+ public string Version { get; set; } = "";
+ public bool IsSetBaseSize { get; private set; }
+
+ private string FileName { get; set; } = "";
+
+ public Progress _progress;
+
+ private delegate void CSafeSetText(string text);
+ private delegate void CSafeSetMaximum(int value);
+ private delegate void CSafeSetValue(int value);
+ private readonly CSafeSetText csst;
+ private readonly CSafeSetMaximum cssm;
+ private readonly WebClient wc;
+ #endregion
+
+ #region Invoke Methods
+ void CrossSafeSetTextMethod(string text)
+ {
+ if (labelDescription.InvokeRequired)
+ labelDescription.Invoke(csst, text);
+ else
+ labelDescription.Text = text;
+ }
+
+ void CrossSafeSetValueMethod(int value)
+ {
+ if (progressBar.InvokeRequired)
+ progressBar.Invoke(cssm, value);
+ else
+ progressBar.Value = value;
+ }
+ void CrossSafeSetMaximumMethod(int value)
+ {
+ if (progressBar.InvokeRequired)
+ progressBar.Invoke(cssm, value);
+ else
+ progressBar.Maximum = value;
+ }
+ #endregion
+
+ ///
+ /// Initializer of FormUpdater class
+ ///
+ /// current version. this should be {n}.{n}.{n}.{n} template. (ElectronicObserver.Utility.SoftwareInformation.VersionEnglish)
+ public FormUpdater(string v)
+ {
+ wc = new WebClient();
+ InitializeComponent();
+ Version = v;
+
+ _progress = new Progress();
+ _progress.ProgressChanged += Report;
+ }
+
+
+ private void FormUpdater_Load(object sender, EventArgs e)
+ {
+ KillEOProcess();
+
+ //turn on TLS/SSL Options
+ ServicePointManager.Expect100Continue = true;
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
+ ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
+
+ FileName = Version.Replace(".", string.Empty);
+ //If minor version exists
+ if(FileName.Length > 3)
+ {
+ FileName = FileName.Insert(3, "_");
+ }
+ string url = string.Format(BASE_URL, Version, FileName);
+ FileName = string.Format(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\{0}", System.IO.Path.GetFileName(url));
+ try
+ {
+ wc.DownloadFileCompleted += new AsyncCompletedEventHandler(FileDownloadCompleted);
+ wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(FileDownloadProgressChanged);
+ wc.DownloadFileAsync(new Uri(url), FileName);
+
+ progressBar.Value = 0;
+ labelStatus.Text = "Downloading...";
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, ex.GetType().FullName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
+ }
+ }
+
+ ///
+ /// Kill ElectronicObserver process before update.
+ ///
+ private void KillEOProcess()
+ {
+ Process[] processes = Process.GetProcessesByName("ElectronicObserver");
+ foreach(var p in processes)
+ {
+ p.Kill();
+ }
+ }
+
+ private void Report(object sender, ZipProgress zipProgress)
+ {
+ //Update value asynchronously
+ CrossSafeSetMaximumMethod(zipProgress.Total);
+ CrossSafeSetValueMethod(zipProgress.Processed);
+ CrossSafeSetTextMethod(zipProgress.CurrentItem);
+
+ if(zipProgress.Total == zipProgress.Processed)
+ {
+ var eo = "ElectronicObserver.exe";
+ var eoFile = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\ElectronicObserver.exe";
+ var result = MessageBox.Show("アップデートが完了しました。", "Updater", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ //When update completed, automatically start EO again.
+ if(result == DialogResult.OK)
+ {
+ if (System.IO.File.Exists(eo))
+ Process.Start(eo);
+ else
+ Process.Start(eoFile);
+ Application.Exit();
+ }
+ }
+ }
+
+ void FileDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
+ {
+ if (!IsSetBaseSize)
+ {
+ CrossSafeSetMaximumMethod((int)e.TotalBytesToReceive);
+ IsSetBaseSize = true;
+ }
+
+ CrossSafeSetValueMethod((int)e.BytesReceived);
+
+ CrossSafeSetTextMethod(String.Format("{0:N0} Bytes / {1:N0} Bytes ({2:P})", e.BytesReceived, e.TotalBytesToReceive, (Double)e.BytesReceived / (Double)e.TotalBytesToReceive));
+ }
+
+ void FileDownloadCompleted(object sender, AsyncCompletedEventArgs e)
+ {
+ //Extract File
+ labelStatus.Text = "Unzipping Files...";
+ ZipArchive zip = ZipFile.OpenRead(FileName);
+ //Extract zip asynchronously
+ Task.Run(() =>
+ {
+ Utillity.ZipFileExtensions.ExtractToDirectory(zip, System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), _progress, true);
+ });
+ }
+ }
+}
diff --git a/ElectronicObserverUpdater/Window/FormUpdater.resx b/ElectronicObserverUpdater/Window/FormUpdater.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/ElectronicObserverUpdater/Window/FormUpdater.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