From d65c620943d5600e56c0382b0366a559fba2fa60 Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 14:06:05 +0800 Subject: [PATCH 01/24] Added start arguments. --- Entities/Entities.csproj | 1 + .../InstanceStartupArgumentsEntity.cs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 Entities/InstanceManagement/InstanceStartupArgumentsEntity.cs diff --git a/Entities/Entities.csproj b/Entities/Entities.csproj index ab9e67b..d82d947 100644 --- a/Entities/Entities.csproj +++ b/Entities/Entities.csproj @@ -72,6 +72,7 @@ + diff --git a/Entities/InstanceManagement/InstanceStartupArgumentsEntity.cs b/Entities/InstanceManagement/InstanceStartupArgumentsEntity.cs new file mode 100644 index 0000000..c83c2b4 --- /dev/null +++ b/Entities/InstanceManagement/InstanceStartupArgumentsEntity.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TerminologyLauncher.Entities.InstanceManagement +{ + public class InstanceStartupArgumentsEntity + { + public List JvmArguments { get; set; } + public List LibraryPathes { get; set; } + public String MainJarPath { get; set; } + public String MainClass { get; set; } + public String Version { get; set; } + public String AssetsDir { get; set; } + public String AssetIndex { get; set; } + public String UserProperties { get; set; } + public String UserType { get; set; } + public List TweakClass { get; set; } + + } +} From 5f93ddb41b33fb47de1de944751e96449f496928 Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 14:11:45 +0800 Subject: [PATCH 02/24] Put more information at handler if unexcept exception throwed. --- Core/Handlers/MainHandlers/AddInstanceHandler.cs | 2 +- Core/Handlers/MainHandlers/LaunchInstanceHandler.cs | 2 +- Core/Handlers/MainHandlers/UpdateApplicationHandler.cs | 2 +- Core/Handlers/MainHandlers/UpdateInstanceHandler.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/Handlers/MainHandlers/AddInstanceHandler.cs b/Core/Handlers/MainHandlers/AddInstanceHandler.cs index 57fed78..d1e687e 100644 --- a/Core/Handlers/MainHandlers/AddInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/AddInstanceHandler.cs @@ -63,7 +63,7 @@ public override void HandleEvent(object sender, EventArgs e) Logging.Logger.GetLogger() .ErrorFormat("Can not add this instance because {0}", ex.Message); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not launch", String.Format( - "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex.Message)); + "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex)); } finally diff --git a/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs b/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs index 3533979..ab4d61a 100644 --- a/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs @@ -49,7 +49,7 @@ public override void HandleEvent(object sender, EventArgs e) Logging.Logger.GetLogger() .Error(String.Format("Can not launch this instance because {0}", ex.Message)); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not launch", String.Format( - "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex.Message)); + "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex)); } finally { diff --git a/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs b/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs index 386fd6d..67fd555 100644 --- a/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs +++ b/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs @@ -33,7 +33,7 @@ public override void HandleEvent(object sender, EventArgs e) Logging.Logger.GetLogger() .Error(String.Format("Can not update because {0}", ex.Message)); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not launch", String.Format( - "Caused by an internal error, we can not update right now. Detail: {0}", ex.Message)); + "Caused by an internal error, we can not update right now. Detail: {0}", ex)); } finally { diff --git a/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs b/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs index c3dd714..5d18093 100644 --- a/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs @@ -59,7 +59,7 @@ public override void HandleEvent(object sender, EventArgs e) this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not update", String.Format( "Caused by an internal error, we can not update this instance right now.Detail:{0}", - ex.Message)); + ex)); } finally From 7b57a23fbf782ee12df2c37f52f70d70f6fa8f8e Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 14:12:14 +0800 Subject: [PATCH 03/24] Create folder bfore donwload file. --- Utils/DownloadUtils.cs | 4 ++++ Utils/ProgressSupportedDownloadUtils.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Utils/DownloadUtils.cs b/Utils/DownloadUtils.cs index 3e82737..0cf1228 100644 --- a/Utils/DownloadUtils.cs +++ b/Utils/DownloadUtils.cs @@ -16,6 +16,10 @@ public static void DownloadFile(String url, String path) using (var client = new WebClient()) { client.DownloadFile(url, tempFileInfo.FullName); + if (!Directory.Exists(Path.GetDirectoryName(path))) + { + Directory.CreateDirectory(Path.GetDirectoryName(path)); + } File.Copy(tempFileInfo.FullName, path, true); } } diff --git a/Utils/ProgressSupportedDownloadUtils.cs b/Utils/ProgressSupportedDownloadUtils.cs index d47a1f7..3fc77ef 100644 --- a/Utils/ProgressSupportedDownloadUtils.cs +++ b/Utils/ProgressSupportedDownloadUtils.cs @@ -49,6 +49,10 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa progress.Percent = o.ProgressPercentage; }; client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); + if (!Directory.Exists(Path.GetDirectoryName(path))) + { + Directory.CreateDirectory(Path.GetDirectoryName(path)); + } File.Copy(tempFileInfo.FullName, path, true); } } From 4b61d267a3d7a522b2ffe98ab2e76ada1869c177 Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 14:49:16 +0800 Subject: [PATCH 04/24] Fixed wrong message push. --- Core/Handlers/MainHandlers/AddInstanceHandler.cs | 4 ++-- Core/Handlers/MainHandlers/LaunchInstanceHandler.cs | 4 ++-- Core/Handlers/MainHandlers/UpdateApplicationHandler.cs | 4 ++-- Core/Handlers/MainHandlers/UpdateInstanceHandler.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Core/Handlers/MainHandlers/AddInstanceHandler.cs b/Core/Handlers/MainHandlers/AddInstanceHandler.cs index d1e687e..deaabbd 100644 --- a/Core/Handlers/MainHandlers/AddInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/AddInstanceHandler.cs @@ -61,9 +61,9 @@ public override void HandleEvent(object sender, EventArgs e) catch (Exception ex) { Logging.Logger.GetLogger() - .ErrorFormat("Can not add this instance because {0}", ex.Message); + .ErrorFormat("Can not add this instance because {0}", ex); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not launch", String.Format( - "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex)); + "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex.Message)); } finally diff --git a/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs b/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs index ab4d61a..1a190f2 100644 --- a/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/LaunchInstanceHandler.cs @@ -47,9 +47,9 @@ public override void HandleEvent(object sender, EventArgs e) catch (Exception ex) { Logging.Logger.GetLogger() - .Error(String.Format("Can not launch this instance because {0}", ex.Message)); + .Error(String.Format("Can not launch this instance because {0}", ex)); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not launch", String.Format( - "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex)); + "Caused by an internal error, we can not launch this instance right now. Detail: {0}", ex.Message)); } finally { diff --git a/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs b/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs index 67fd555..8d09294 100644 --- a/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs +++ b/Core/Handlers/MainHandlers/UpdateApplicationHandler.cs @@ -31,9 +31,9 @@ public override void HandleEvent(object sender, EventArgs e) { Logging.Logger.GetLogger() - .Error(String.Format("Can not update because {0}", ex.Message)); + .Error(String.Format("Can not update because {0}", ex)); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not launch", String.Format( - "Caused by an internal error, we can not update right now. Detail: {0}", ex)); + "Caused by an internal error, we can not update right now. Detail: {0}", ex.Message)); } finally { diff --git a/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs b/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs index 5d18093..bfaa1a1 100644 --- a/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs @@ -55,11 +55,11 @@ public override void HandleEvent(object sender, EventArgs e) } catch (Exception ex) { - Logging.Logger.GetLogger().ErrorFormat("Update instance {0} encountered an error:\n{1}", instance.InstanceName, ex.Message); + Logging.Logger.GetLogger().ErrorFormat("Update instance {0} encountered an error:\n{1}", instance.InstanceName, ex); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not update", String.Format( "Caused by an internal error, we can not update this instance right now.Detail:{0}", - ex)); + ex.Message)); } finally From 204adb4151476bbaa0e6cbbf0a548653653b707d Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 15:10:05 +0800 Subject: [PATCH 05/24] Merged functions whatever support progress. Continue fix. --- InstanceManagerSystem/InstanceManager.cs | 6 +- UnitTest/ProgressUnitTests.cs | 4 +- Updater/UpdateManager.cs | 4 +- Utils/DownloadUtils.cs | 71 +++++++++++++++++++++--- Utils/FolderUtils.cs | 3 + Utils/ProgressSupportedDownloadUtils.cs | 69 ----------------------- Utils/Utils.csproj | 1 - 7 files changed, 74 insertions(+), 84 deletions(-) delete mode 100644 Utils/ProgressSupportedDownloadUtils.cs diff --git a/InstanceManagerSystem/InstanceManager.cs b/InstanceManagerSystem/InstanceManager.cs index b159d98..4babda3 100644 --- a/InstanceManagerSystem/InstanceManager.cs +++ b/InstanceManagerSystem/InstanceManager.cs @@ -452,7 +452,7 @@ private void ReceiveOfficialFile(LeafNodeProgress progress, String instanceName, var downloadLink = repositoryFile.DownloadPath; var downloadTargetPositon = Path.Combine(this.GetInstanceRootFolder(instanceName).FullName, officialFile.LocalPath); Logger.GetLogger().Info(String.Format("Downloading file:{0} from remote url:{1}.", downloadTargetPositon, downloadLink)); - ProgressSupportedDownloadUtils.DownloadFile(progress, downloadLink, downloadTargetPositon, officialFile.Md5); + DownloadUtils.DownloadFile(progress, downloadLink, downloadTargetPositon, officialFile.Md5); Logger.GetLogger().Info(String.Format("Successfully downloaded file:{0} from remote url:{1}.", downloadTargetPositon, downloadLink)); } @@ -462,7 +462,7 @@ private void ReceiveCustomFile(LeafNodeProgress progress, String instanceName, C var downloadLink = customFile.DownloadLink; var downloadTargetPositon = Path.Combine(this.GetInstanceRootFolder(instanceName).FullName, customFile.LocalPath); Logger.GetLogger().Info(String.Format("Downloading file:{0} from remote url:{1}.", downloadTargetPositon, downloadLink)); - ProgressSupportedDownloadUtils.DownloadFile(progress, downloadLink, downloadTargetPositon, customFile.Md5); + DownloadUtils.DownloadFile(progress, downloadLink, downloadTargetPositon, customFile.Md5); Logger.GetLogger().Info(String.Format("Successfully downloaded file:{0} from remote url:{1}.", downloadTargetPositon, downloadLink)); } @@ -471,7 +471,7 @@ private void ReceiveEntirePackage(InternalNodeProgress progress, String instance var downloadLink = entirePackageFile.DownloadLink; var downloadTargetPositon = Path.Combine(this.GetInstanceRootFolder(instanceName).FullName, entirePackageFile.LocalPath ?? String.Empty); Logger.GetLogger().Info(String.Format("Downloading file:{0} from remote url:{1}.", downloadTargetPositon, downloadLink)); - ProgressSupportedDownloadUtils.DownloadZippedFile(progress, downloadLink, downloadTargetPositon, entirePackageFile.Md5); + DownloadUtils.DownloadZippedFile(progress, downloadLink, downloadTargetPositon, entirePackageFile.Md5); Logger.GetLogger().Info(String.Format("Successfully downloaded file:{0} then extracted to {1}.", downloadLink, downloadTargetPositon)); } diff --git a/UnitTest/ProgressUnitTests.cs b/UnitTest/ProgressUnitTests.cs index 818e7f3..52323fe 100644 --- a/UnitTest/ProgressUnitTests.cs +++ b/UnitTest/ProgressUnitTests.cs @@ -67,7 +67,7 @@ public void DownloadText() Console.WriteLine(progress.Percent); }; var content = - ProgressSupportedDownloadUtils.GetFileContent(progress.CreateNewLeafSubProgress(100D, String.Format("Downloading Text")), "http://baidu.com"); + DownloadUtils.GetFileContent(progress.CreateNewLeafSubProgress(100D, String.Format("Downloading Text")), "http://baidu.com"); // Console.WriteLine(content); } @@ -84,7 +84,7 @@ public void DownloadFileWithProgress() { downloadFile.Delete(); } - ProgressSupportedDownloadUtils.DownloadFile(progress.CreateNewLeafSubProgress(100D, "Downloading test file"), + DownloadUtils.DownloadFile(progress.CreateNewLeafSubProgress(100D, "Downloading test file"), "http://dldir1.qq.com/qqfile/qq/QQ7.4/15197/QQ7.4.exe", downloadFile.FullName); downloadFile.Refresh(); Assert.IsTrue(downloadFile.Exists); diff --git a/Updater/UpdateManager.cs b/Updater/UpdateManager.cs index 5d187c2..0f28320 100644 --- a/Updater/UpdateManager.cs +++ b/Updater/UpdateManager.cs @@ -48,7 +48,7 @@ public String FetchLatestVersionAndStartUpdate(InternalNodeProgress progress) - var updateTempFolder = Path.Combine(DownloadUtils.SystemTempFolder.FullName, + var updateTempFolder = Path.Combine(FolderUtils.SystemTempFolder.FullName, String.Format("TerminologyLauncher-{0}", update.LatestVersion.VersionNumber)); var updateBinaryFolder = Path.Combine(updateTempFolder, "Binary"); var updaterExecutorFile = Path.Combine( @@ -61,7 +61,7 @@ public String FetchLatestVersionAndStartUpdate(InternalNodeProgress progress) } progress.Percent = 10D; - ProgressSupportedDownloadUtils.DownloadZippedFile( + DownloadUtils.DownloadZippedFile( progress.CreateNewInternalSubProgress(80D, "Fetching update pack"), update.LatestVersion.DownloadLink, updateBinaryFolder, update.LatestVersion.Md5); diff --git a/Utils/DownloadUtils.cs b/Utils/DownloadUtils.cs index 0cf1228..4a7f901 100644 --- a/Utils/DownloadUtils.cs +++ b/Utils/DownloadUtils.cs @@ -3,22 +3,22 @@ using System.Net; using System.Text; using ICSharpCode.SharpZipLib.Zip; +using TerminologyLauncher.Utils.ProgressService; namespace TerminologyLauncher.Utils { public static class DownloadUtils { - public static readonly DirectoryInfo SystemTempFolder = new DirectoryInfo(Path.GetTempPath()); public static void DownloadFile(String url, String path) { - var tempFileInfo = new FileInfo(Path.Combine(SystemTempFolder.FullName, Guid.NewGuid().ToString("N"))); - + var tempFileInfo = new FileInfo(Path.Combine(FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N"))); + var targetFolderInfo = new DirectoryInfo(path); using (var client = new WebClient()) { client.DownloadFile(url, tempFileInfo.FullName); - if (!Directory.Exists(Path.GetDirectoryName(path))) + if (!targetFolderInfo.Exists) { - Directory.CreateDirectory(Path.GetDirectoryName(path)); + targetFolderInfo.Create(); } File.Copy(tempFileInfo.FullName, path, true); } @@ -33,9 +33,38 @@ public static void DownloadFile(String url, String path, String md5) } } + public static void DownloadFile(LeafNodeProgress progress, String url, String path) + { + + var tempFileInfo = new FileInfo(Path.Combine(FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N"))); + var targetFolderInfo = new DirectoryInfo(path); + using (var client = new WebClient()) + { + client.DownloadProgressChanged += (i, o) => + { + progress.Percent = o.ProgressPercentage; + }; + client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); + if (!targetFolderInfo.Exists) + { + targetFolderInfo.Create(); + } + File.Copy(tempFileInfo.FullName, targetFolderInfo.FullName, true); + } + } + + public static void DownloadFile(LeafNodeProgress progress, String url, String path, String md5) + { + DownloadFile(progress, url, path); + if (!Md5Utils.CheckFileMd5(path, md5)) + { + throw new Exception(String.Format("Md5 check for {0} refused!", path)); + } + } + public static void DownloadAndExtractZippedFile(String url, String path, String md5) { - var tempFileInfo = new FileInfo(Path.Combine(new[] { SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); + var tempFileInfo = new FileInfo(Path.Combine(new[] {FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); DownloadFile(url, tempFileInfo.FullName, md5); if (!Directory.Exists(path)) @@ -48,7 +77,7 @@ public static void DownloadAndExtractZippedFile(String url, String path, String public static void DownloadAndExtractZippedFile(String url, String path) { - var tempFileInfo = new FileInfo(Path.Combine(new[] { SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); + var tempFileInfo = new FileInfo(Path.Combine(new[] {FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); DownloadFile(url, tempFileInfo.FullName); if (!Directory.Exists(path)) @@ -67,6 +96,34 @@ public static String GetFileContent(String url) return client.DownloadString(url); } } + public static string GetFileContent(LeafNodeProgress progress, string url) + { + using (var client = new WebClient()) + { + client.Encoding = Encoding.UTF8; + client.DownloadProgressChanged += (i, o) => + { + progress.Percent = o.ProgressPercentage; + }; + + return client.DownloadStringTaskAsync(url).Result; + + } + } + + public static void DownloadZippedFile(InternalNodeProgress progress, String url, String path, String md5) + { + var tempFileInfo = new FileInfo(Path.Combine(new[] { FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); + DownloadFile(progress.CreateNewLeafSubProgress(90D, String.Format("Downloading zip file {0}", url)), url, tempFileInfo.FullName, md5); + + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + new FastZip().ExtractZip(tempFileInfo.FullName, path, null); + progress.Percent = 100D; + } } } diff --git a/Utils/FolderUtils.cs b/Utils/FolderUtils.cs index c1df467..687c764 100644 --- a/Utils/FolderUtils.cs +++ b/Utils/FolderUtils.cs @@ -1,10 +1,13 @@ using System; using System.IO; +using System.Reflection; namespace TerminologyLauncher.Utils { public static class FolderUtils { + public static readonly DirectoryInfo SystemTempFolder = new DirectoryInfo(Path.GetTempPath()); + public static readonly DirectoryInfo ExecutorFolder = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); public static void RecreateFolder(String path) { RecreateFolder(new DirectoryInfo(path)); diff --git a/Utils/ProgressSupportedDownloadUtils.cs b/Utils/ProgressSupportedDownloadUtils.cs deleted file mode 100644 index 3fc77ef..0000000 --- a/Utils/ProgressSupportedDownloadUtils.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.IO; -using System.Net; -using System.Text; -using ICSharpCode.SharpZipLib.Zip; -using TerminologyLauncher.Utils.ProgressService; - -namespace TerminologyLauncher.Utils -{ - public static class ProgressSupportedDownloadUtils - { - public static string GetFileContent(LeafNodeProgress progress, string url) - { - using (var client = new WebClient()) - { - client.Encoding = Encoding.UTF8; - client.DownloadProgressChanged += (i, o) => - { - progress.Percent = o.ProgressPercentage; - }; - - return client.DownloadStringTaskAsync(url).Result; - - } - } - - public static void DownloadZippedFile(InternalNodeProgress progress, String url, String path, String md5) - { - var tempFileInfo = new FileInfo(Path.Combine(new[] { DownloadUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); - DownloadFile(progress.CreateNewLeafSubProgress(90D, String.Format("Downloading zip file {0}", url)), url, tempFileInfo.FullName, md5); - - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - new FastZip().ExtractZip(tempFileInfo.FullName, path, null); - progress.Percent = 100D; - } - - public static void DownloadFile(LeafNodeProgress progress, String url, String path) - { - - var tempFileInfo = new FileInfo(Path.Combine(DownloadUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N"))); - using (var client = new WebClient()) - { - client.DownloadProgressChanged += (i, o) => - { - progress.Percent = o.ProgressPercentage; - }; - client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); - if (!Directory.Exists(Path.GetDirectoryName(path))) - { - Directory.CreateDirectory(Path.GetDirectoryName(path)); - } - File.Copy(tempFileInfo.FullName, path, true); - } - } - - public static void DownloadFile(LeafNodeProgress progress, String url, String path, String md5) - { - DownloadFile(progress, url, path); - if (!Md5Utils.CheckFileMd5(path, md5)) - { - throw new Exception(String.Format("Md5 check for {0} refused!", path)); - } - } - } -} diff --git a/Utils/Utils.csproj b/Utils/Utils.csproj index 5ef5fcc..fd29ec2 100644 --- a/Utils/Utils.csproj +++ b/Utils/Utils.csproj @@ -49,7 +49,6 @@ - From 85b45786c9275bc69f5873f4fee29e8b9cba7971 Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 15:29:18 +0800 Subject: [PATCH 06/24] Using file info to download file. --- Utils/DownloadUtils.cs | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Utils/DownloadUtils.cs b/Utils/DownloadUtils.cs index 4a7f901..6276730 100644 --- a/Utils/DownloadUtils.cs +++ b/Utils/DownloadUtils.cs @@ -12,15 +12,11 @@ public static class DownloadUtils public static void DownloadFile(String url, String path) { var tempFileInfo = new FileInfo(Path.Combine(FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N"))); - var targetFolderInfo = new DirectoryInfo(path); + var targetFileInfo = new FileInfo(path); using (var client = new WebClient()) { client.DownloadFile(url, tempFileInfo.FullName); - if (!targetFolderInfo.Exists) - { - targetFolderInfo.Create(); - } - File.Copy(tempFileInfo.FullName, path, true); + File.Copy(tempFileInfo.FullName, targetFileInfo.FullName, true); } } @@ -37,7 +33,7 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa { var tempFileInfo = new FileInfo(Path.Combine(FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N"))); - var targetFolderInfo = new DirectoryInfo(path); + var targetFileInfo = new FileInfo(path); using (var client = new WebClient()) { client.DownloadProgressChanged += (i, o) => @@ -45,11 +41,7 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa progress.Percent = o.ProgressPercentage; }; client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); - if (!targetFolderInfo.Exists) - { - targetFolderInfo.Create(); - } - File.Copy(tempFileInfo.FullName, targetFolderInfo.FullName, true); + File.Copy(tempFileInfo.FullName, targetFileInfo.FullName, true); } } @@ -64,7 +56,7 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa public static void DownloadAndExtractZippedFile(String url, String path, String md5) { - var tempFileInfo = new FileInfo(Path.Combine(new[] {FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); + var tempFileInfo = new FileInfo(Path.Combine(new[] { FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); DownloadFile(url, tempFileInfo.FullName, md5); if (!Directory.Exists(path)) @@ -77,7 +69,7 @@ public static void DownloadAndExtractZippedFile(String url, String path, String public static void DownloadAndExtractZippedFile(String url, String path) { - var tempFileInfo = new FileInfo(Path.Combine(new[] {FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); + var tempFileInfo = new FileInfo(Path.Combine(new[] { FolderUtils.SystemTempFolder.FullName, Guid.NewGuid().ToString("N") })); DownloadFile(url, tempFileInfo.FullName); if (!Directory.Exists(path)) From 30a8c0cdb7b2b73dc9f52043be1d516213c11378 Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 16:55:38 +0800 Subject: [PATCH 07/24] Fixed folder not found exception. --- Utils/DownloadUtils.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Utils/DownloadUtils.cs b/Utils/DownloadUtils.cs index 6276730..a7da5af 100644 --- a/Utils/DownloadUtils.cs +++ b/Utils/DownloadUtils.cs @@ -16,6 +16,10 @@ public static void DownloadFile(String url, String path) using (var client = new WebClient()) { client.DownloadFile(url, tempFileInfo.FullName); + if (targetFileInfo.Directory != null && !targetFileInfo.Directory.Exists) + { + targetFileInfo.Directory.Create(); + } File.Copy(tempFileInfo.FullName, targetFileInfo.FullName, true); } } @@ -41,6 +45,10 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa progress.Percent = o.ProgressPercentage; }; client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); + if (targetFileInfo.Directory != null && !targetFileInfo.Directory.Exists) + { + targetFileInfo.Directory.Create(); + } File.Copy(tempFileInfo.FullName, targetFileInfo.FullName, true); } } From 5bb6d897663ff5dc9104a89d59084780582a155f Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 17:01:30 +0800 Subject: [PATCH 08/24] Fixed progress bar cover progress percent. --- GUI/ProgressWindow.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GUI/ProgressWindow.xaml b/GUI/ProgressWindow.xaml index bf69891..2c9e34f 100644 --- a/GUI/ProgressWindow.xaml +++ b/GUI/ProgressWindow.xaml @@ -15,9 +15,9 @@ - - - + + + From 494ebcc7cbbe12bd833bc7ac49ad5040072bfc0e Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 17:19:59 +0800 Subject: [PATCH 09/24] Allow java and javaw. --- Core/Handlers/LoginHandlers/LoginHandler.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Core/Handlers/LoginHandlers/LoginHandler.cs b/Core/Handlers/LoginHandlers/LoginHandler.cs index 3fdae2d..a56e287 100644 --- a/Core/Handlers/LoginHandlers/LoginHandler.cs +++ b/Core/Handlers/LoginHandlers/LoginHandler.cs @@ -92,14 +92,20 @@ private void LoginSuccess() var result = this.Engine.UiControl.StartSingleLineInput("Request Java path", "Java Path"); if (result.Type == SingleLineInputResultType.CommonFinished) { - if (String.IsNullOrEmpty(result.InputLine) || !new FileInfo(result.InputLine).Exists || (new FileInfo(result.InputLine).Name.ToLower() != "java.exe")) + + try { - //try again. + var javaExe = new FileInfo(result.InputLine); + if (javaExe.Exists && (javaExe.Name == "java.exe" || javaExe.Name == "javaw.exe")) + { + this.Engine.InstanceManager.Config.SetConfig("javaPath", result.InputLine); + Logger.GetLogger().Info("Received java path from user. Pass."); + } } - else + catch (Exception) { - this.Engine.InstanceManager.Config.SetConfig("javaPath", result.InputLine); - Logger.GetLogger().Info("Received java path from user. Pass."); + + //ignore. } } else if (result.Type == SingleLineInputResultType.Canceled) From 8840d0250e6103289df77e0d19e96bb88fd0034f Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 20:24:41 +0800 Subject: [PATCH 10/24] Remove useless newline. --- Core/Handlers/MainHandlers/UpdateInstanceHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs b/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs index bfaa1a1..35fd027 100644 --- a/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs +++ b/Core/Handlers/MainHandlers/UpdateInstanceHandler.cs @@ -46,7 +46,7 @@ public override void HandleEvent(object sender, EventArgs e) } catch (WrongStateException ex) { - Logging.Logger.GetLogger().ErrorFormat("Update instance {0} encountered an error:\n{1}", instance.InstanceName, ex.Message); + Logging.Logger.GetLogger().ErrorFormat("Update instance {0} encountered an error: {1}", instance.InstanceName, ex.Message); this.Engine.UiControl.StartPopupWindow(this.Engine.UiControl.MajorWindow, "Can not update", String.Format( "Encounter an wrong state error. Detail:{0}", From 04b00ac4d58ab8fed94afe4d75d664bdca52299d Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 20:25:32 +0800 Subject: [PATCH 11/24] Throw real exception during progress supported downloading. --- Utils/DownloadUtils.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Utils/DownloadUtils.cs b/Utils/DownloadUtils.cs index a7da5af..86edda4 100644 --- a/Utils/DownloadUtils.cs +++ b/Utils/DownloadUtils.cs @@ -44,7 +44,14 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa { progress.Percent = o.ProgressPercentage; }; - client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); + try + { + client.DownloadFileTaskAsync(url, tempFileInfo.FullName).Wait(); + } + catch (AggregateException ex) + { + throw ex.GetBaseException(); + } if (targetFileInfo.Directory != null && !targetFileInfo.Directory.Exists) { targetFileInfo.Directory.Create(); From 99410dcf5d9b3c568c406d383e2c98af2b51f42c Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 12 Sep 2015 21:56:30 +0800 Subject: [PATCH 12/24] Log core version. --- Core/Engine.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Engine.cs b/Core/Engine.cs index 7f14b44..39704a4 100644 --- a/Core/Engine.cs +++ b/Core/Engine.cs @@ -45,7 +45,7 @@ public String CoreVersion public Process GameProcess { get; set; } public Engine() { - Logger.GetLogger().Info("Engine Initializing..."); + Logger.GetLogger().InfoFormat("Engine {0} Initializing...", this.CoreVersion); this.CoreConfig = new Config(new FileInfo("Configs/CoreConfig.json")); this.UiControl = new UiControl(); this.AuthServer = new AuthServer(this.CoreConfig.GetConfig("authConfig")); From 916c90e392a3834b8af78c9d523e6746d524ef2f Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sun, 13 Sep 2015 16:33:03 +0800 Subject: [PATCH 13/24] Large amount of gui refacotrs. Added select window. --- GUI/ConfigWindow.xaml | 4 +- GUI/ConsoleWindow.xaml | 8 + GUI/GUI.csproj | 16 +- GUI/LoginWindow.xaml | 6 +- GUI/MainWindow.xaml | 7 +- GUI/MainWindow.xaml.cs | 10 + GUI/PopupWindow.xaml | 4 +- GUI/ProgressWindow.xaml | 2 +- GUI/SingleLineInput/SingleLineInputResult.cs | 10 - .../SingleLineInputResultType.cs | 8 - GUI/Styles/Brushes.xaml | 5 +- GUI/Styles/CustomStyles.xaml | 81 +- .../SingleLineInputWindow.xaml | 6 +- .../SingleLineInputWindow.xaml.cs | 12 +- .../SingleSelect/SingleSelectWindow.xaml | 61 ++ .../SingleSelect/SingleSelectWindow.xaml.cs | 72 ++ GUI/ToolkitWindows/WindowResult.cs | 11 + GUI/ToolkitWindows/WindowResultType.cs | 8 + GUI/Toolkits/ObservableDictionary.cs | 801 ++++++++++++++++++ GUI/UiControl.xaml.cs | 9 +- 20 files changed, 1070 insertions(+), 71 deletions(-) delete mode 100644 GUI/SingleLineInput/SingleLineInputResult.cs delete mode 100644 GUI/SingleLineInput/SingleLineInputResultType.cs rename GUI/{ => ToolkitWindows}/SingleLineInput/SingleLineInputWindow.xaml (87%) rename GUI/{ => ToolkitWindows}/SingleLineInput/SingleLineInputWindow.xaml.cs (85%) create mode 100644 GUI/ToolkitWindows/SingleSelect/SingleSelectWindow.xaml create mode 100644 GUI/ToolkitWindows/SingleSelect/SingleSelectWindow.xaml.cs create mode 100644 GUI/ToolkitWindows/WindowResult.cs create mode 100644 GUI/ToolkitWindows/WindowResultType.cs create mode 100644 GUI/Toolkits/ObservableDictionary.cs diff --git a/GUI/ConfigWindow.xaml b/GUI/ConfigWindow.xaml index 7408e8c..3c45d1e 100644 --- a/GUI/ConfigWindow.xaml +++ b/GUI/ConfigWindow.xaml @@ -2,7 +2,5 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ConfigWindow" Height="300" Width="300"> - - - + diff --git a/GUI/ConsoleWindow.xaml b/GUI/ConsoleWindow.xaml index 81c249e..81c40d6 100644 --- a/GUI/ConsoleWindow.xaml +++ b/GUI/ConsoleWindow.xaml @@ -2,6 +2,14 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ConsoleWindow" Height="300" Width="300"> + + + + + + + + diff --git a/GUI/GUI.csproj b/GUI/GUI.csproj index 6656f8f..24cc7a1 100644 --- a/GUI/GUI.csproj +++ b/GUI/GUI.csproj @@ -74,7 +74,11 @@ Designer MSBuild:Compile - + + Designer + MSBuild:Compile + + Designer MSBuild:Compile @@ -104,6 +108,7 @@ ConsoleWindow.xaml + PopupWindow.xaml @@ -111,11 +116,14 @@ ProgressWindow.xaml - - - + + + SingleLineInputWindow.xaml + + SingleSelectWindow.xaml + UiControl.xaml Code diff --git a/GUI/LoginWindow.xaml b/GUI/LoginWindow.xaml index 16a6465..7751bc0 100644 --- a/GUI/LoginWindow.xaml +++ b/GUI/LoginWindow.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Terminology Launcher Login" Height="332" Width="490" WindowStartupLocation="CenterScreen" - Style="{DynamicResource CustomWindowStyle}" + Style="{DynamicResource TerminologyWindowStyle}" DataContext="{Binding RelativeSource={RelativeSource Self}}" > @@ -37,9 +37,9 @@ - + - + diff --git a/GUI/MainWindow.xaml b/GUI/MainWindow.xaml index 7f0017c..cea4fee 100644 --- a/GUI/MainWindow.xaml +++ b/GUI/MainWindow.xaml @@ -4,7 +4,7 @@ xmlns:account="clr-namespace:TerminologyLauncher.Entities.Account;assembly=TerminologyLauncher.Entities" xmlns:gui="clr-namespace:TerminologyLauncher.GUI" Title="MainWindow" Width="1194" Height="718" - Style="{DynamicResource CustomWindowStyle}" + Style="{DynamicResource TerminologyWindowStyle}" WindowStartupLocation="CenterScreen" DataContext="{Binding RelativeSource={RelativeSource Self}}" > @@ -33,7 +33,7 @@ - + @@ -66,11 +66,10 @@ DockPanel.Dock="Top" Name="InstanceListBox" SelectionChanged="Selector_OnSelectionChanged" - Style="{DynamicResource TransparentListBox}" + Style="{DynamicResource TerminologyListBox}" ItemContainerStyle="{DynamicResource TransparentListBoxItem}" SelectionMode="Single" SelectedItem="{Binding SelectInstance,Mode=OneWayToSource}" - Background="Transparent" FontSize="16" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding InstanceList}"> diff --git a/GUI/MainWindow.xaml.cs b/GUI/MainWindow.xaml.cs index b1a33f6..0d67bd6 100644 --- a/GUI/MainWindow.xaml.cs +++ b/GUI/MainWindow.xaml.cs @@ -25,6 +25,7 @@ public sealed partial class MainWindow : INotifyPropertyChanged private ObservableCollection InstanceListValue; private InstanceEntity SelectInstanceValue; private PlayerEntity PlayerValue; + private string CoreVersionValue; public PlayerEntity Player @@ -37,6 +38,15 @@ public PlayerEntity Player } } + public String CoreVersion + { + get { return this.CoreVersionValue; } + set + { + this.CoreVersionValue = value; + this.OnPropertyChanged(); + } + } public InstanceEntity SelectInstance { diff --git a/GUI/PopupWindow.xaml b/GUI/PopupWindow.xaml index 7f33cd3..3541b42 100644 --- a/GUI/PopupWindow.xaml +++ b/GUI/PopupWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Notice" Height="230" Width="430" - Style="{DynamicResource CustomWindowStyle}" + Style="{DynamicResource TerminologyWindowStyle}" WindowStartupLocation="CenterScreen" DataContext="{Binding RelativeSource={RelativeSource Self}}" > @@ -31,7 +31,7 @@ - + diff --git a/GUI/ProgressWindow.xaml b/GUI/ProgressWindow.xaml index 2c9e34f..3d8956f 100644 --- a/GUI/ProgressWindow.xaml +++ b/GUI/ProgressWindow.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ProgressWindow" Height="184" Width="592" - Style="{DynamicResource CustomWindowStyle}" + Style="{DynamicResource TerminologyWindowStyle}" WindowStartupLocation="CenterScreen" DataContext="{Binding RelativeSource={RelativeSource Self}}"> diff --git a/GUI/SingleLineInput/SingleLineInputResult.cs b/GUI/SingleLineInput/SingleLineInputResult.cs deleted file mode 100644 index f357f62..0000000 --- a/GUI/SingleLineInput/SingleLineInputResult.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace TerminologyLauncher.GUI.SingleLineInput -{ - public class SingleLineInputResult - { - public SingleLineInputResultType Type { get; set; } - public String InputLine { get; set; } - } -} diff --git a/GUI/SingleLineInput/SingleLineInputResultType.cs b/GUI/SingleLineInput/SingleLineInputResultType.cs deleted file mode 100644 index 5e17b02..0000000 --- a/GUI/SingleLineInput/SingleLineInputResultType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace TerminologyLauncher.GUI.SingleLineInput -{ - public enum SingleLineInputResultType - { - CommonFinished = 1, - Canceled = 2 - } -} diff --git a/GUI/Styles/Brushes.xaml b/GUI/Styles/Brushes.xaml index 787f719..49df38f 100644 --- a/GUI/Styles/Brushes.xaml +++ b/GUI/Styles/Brushes.xaml @@ -35,8 +35,9 @@ - - + + + diff --git a/GUI/Styles/CustomStyles.xaml b/GUI/Styles/CustomStyles.xaml index aa60cce..3694f88 100644 --- a/GUI/Styles/CustomStyles.xaml +++ b/GUI/Styles/CustomStyles.xaml @@ -4,7 +4,7 @@ - - - + - - + + - @@ -74,6 +74,36 @@ + + - diff --git a/GUI/packages.config b/GUI/packages.config new file mode 100644 index 0000000..3d854ac --- /dev/null +++ b/GUI/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/UnitTest/FileRepositoryUnitTest.cs b/UnitTest/FileRepositoryUnitTest.cs index bee15ce..6bcb30e 100644 --- a/UnitTest/FileRepositoryUnitTest.cs +++ b/UnitTest/FileRepositoryUnitTest.cs @@ -25,7 +25,7 @@ public void CommonDownloadTest() public void Md5Test() { var downloadFile = new FileInfo("QQ.exe"); - var md5 = Md5Utils.CalculateFileMd5(downloadFile.FullName); + var md5 = EncodeUtils.CalculateFileMd5(downloadFile.FullName); Console.WriteLine(md5); Assert.IsNotNull(md5); } diff --git a/Utils/DownloadUtils.cs b/Utils/DownloadUtils.cs index 86edda4..d212395 100644 --- a/Utils/DownloadUtils.cs +++ b/Utils/DownloadUtils.cs @@ -27,7 +27,7 @@ public static void DownloadFile(String url, String path) public static void DownloadFile(String url, String path, String md5) { DownloadFile(url, path); - if (!Md5Utils.CheckFileMd5(path, md5)) + if (!EncodeUtils.CheckFileMd5(path, md5)) { throw new Exception(String.Format("Md5 check for {0} refused!", path)); } @@ -63,7 +63,7 @@ public static void DownloadFile(LeafNodeProgress progress, String url, String pa public static void DownloadFile(LeafNodeProgress progress, String url, String path, String md5) { DownloadFile(progress, url, path); - if (!Md5Utils.CheckFileMd5(path, md5)) + if (!EncodeUtils.CheckFileMd5(path, md5)) { throw new Exception(String.Format("Md5 check for {0} refused!", path)); } diff --git a/Utils/Md5Utils.cs b/Utils/EncodeUtils.cs similarity index 77% rename from Utils/Md5Utils.cs rename to Utils/EncodeUtils.cs index a28ca50..6f52ea6 100644 --- a/Utils/Md5Utils.cs +++ b/Utils/EncodeUtils.cs @@ -5,7 +5,7 @@ namespace TerminologyLauncher.Utils { - public static class Md5Utils + public static class EncodeUtils { public static String CalculateFileMd5(String filePath) { @@ -49,6 +49,18 @@ public static Boolean CheckFileMd5(String filePath, String md5) { return CalculateFileMd5(filePath).ToUpper().Equals(md5.ToUpper()); } + + public static string Base64Encode(string plainText) + { + var plainTextBytes = Encoding.UTF8.GetBytes(plainText); + return Convert.ToBase64String(plainTextBytes); + } + + public static string Base64Decode(string base64EncodedData) + { + var base64EncodedBytes = Convert.FromBase64String(base64EncodedData); + return Encoding.UTF8.GetString(base64EncodedBytes); + } } diff --git a/Utils/Utils.csproj b/Utils/Utils.csproj index 7bedbfe..64a349c 100644 --- a/Utils/Utils.csproj +++ b/Utils/Utils.csproj @@ -46,7 +46,7 @@ - + From adee71f820c5f7b9e010a678e92d7643d590c4df Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 19 Sep 2015 20:23:33 +0900 Subject: [PATCH 18/24] Move json tools to Utils namespace. --- Entities/Entities.csproj | 3 --- {Entities => Utils}/SerializeUtils/ContractResolver.cs | 0 {Entities => Utils}/SerializeUtils/JsonConverter.cs | 0 {Entities => Utils}/SerializeUtils/SerializeSettings.cs | 0 Utils/Utils.csproj | 3 +++ 5 files changed, 3 insertions(+), 3 deletions(-) rename {Entities => Utils}/SerializeUtils/ContractResolver.cs (100%) rename {Entities => Utils}/SerializeUtils/JsonConverter.cs (100%) rename {Entities => Utils}/SerializeUtils/SerializeSettings.cs (100%) diff --git a/Entities/Entities.csproj b/Entities/Entities.csproj index 98190da..a1b01ff 100644 --- a/Entities/Entities.csproj +++ b/Entities/Entities.csproj @@ -75,9 +75,6 @@ - - - diff --git a/Entities/SerializeUtils/ContractResolver.cs b/Utils/SerializeUtils/ContractResolver.cs similarity index 100% rename from Entities/SerializeUtils/ContractResolver.cs rename to Utils/SerializeUtils/ContractResolver.cs diff --git a/Entities/SerializeUtils/JsonConverter.cs b/Utils/SerializeUtils/JsonConverter.cs similarity index 100% rename from Entities/SerializeUtils/JsonConverter.cs rename to Utils/SerializeUtils/JsonConverter.cs diff --git a/Entities/SerializeUtils/SerializeSettings.cs b/Utils/SerializeUtils/SerializeSettings.cs similarity index 100% rename from Entities/SerializeUtils/SerializeSettings.cs rename to Utils/SerializeUtils/SerializeSettings.cs diff --git a/Utils/Utils.csproj b/Utils/Utils.csproj index 64a349c..ddf8b5a 100644 --- a/Utils/Utils.csproj +++ b/Utils/Utils.csproj @@ -52,6 +52,9 @@ + + + From afd45df15bf44a704a6f7850a32f78bfa502b6a1 Mon Sep 17 00:00:00 2001 From: DeckerCHAN Date: Sat, 19 Sep 2015 21:04:59 +0900 Subject: [PATCH 19/24] Updated Config window. --- Entities/InstanceManagement/InstanceState.cs | 2 +- GUI/ConfigWindow.xaml | 6 - GUI/ConfigWindow.xaml.cs | 20 --- GUI/GUI.csproj | 4 +- GUI/Styles/Brushes.xaml | 1 + GUI/Styles/CustomStyles.xaml | 65 +++++++++- .../MultiConfig/ConfigWindow.xaml | 53 ++++++++ .../MultiConfig/ConfigWindow.xaml.cs | 119 ++++++++++++++++++ 8 files changed, 236 insertions(+), 34 deletions(-) delete mode 100644 GUI/ConfigWindow.xaml delete mode 100644 GUI/ConfigWindow.xaml.cs create mode 100644 GUI/ToolkitWindows/MultiConfig/ConfigWindow.xaml create mode 100644 GUI/ToolkitWindows/MultiConfig/ConfigWindow.xaml.cs diff --git a/Entities/InstanceManagement/InstanceState.cs b/Entities/InstanceManagement/InstanceState.cs index c9553fc..255602a 100644 --- a/Entities/InstanceManagement/InstanceState.cs +++ b/Entities/InstanceManagement/InstanceState.cs @@ -9,7 +9,7 @@ namespace TerminologyLauncher.Entities.InstanceManagement public enum InstanceState { Ok = 1, - Initialize = 2, + PerInitialized = 2, Update = 3 } } diff --git a/GUI/ConfigWindow.xaml b/GUI/ConfigWindow.xaml deleted file mode 100644 index 3c45d1e..0000000 --- a/GUI/ConfigWindow.xaml +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/GUI/ConfigWindow.xaml.cs b/GUI/ConfigWindow.xaml.cs deleted file mode 100644 index 3812e69..0000000 --- a/GUI/ConfigWindow.xaml.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Windows; - -namespace TerminologyLauncher.GUI -{ - /// - /// Interaction logic for ConfigWindow.xaml - /// - public partial class ConfigWindow : Window - { - public ConfigWindow() - { - InitializeComponent(); - } - - public void CrossThreadClose() - { - this.Dispatcher.Invoke(this.Close); - } - } -} diff --git a/GUI/GUI.csproj b/GUI/GUI.csproj index 8610e1e..7f7acc1 100644 --- a/GUI/GUI.csproj +++ b/GUI/GUI.csproj @@ -78,7 +78,7 @@ - + Designer MSBuild:Compile @@ -122,7 +122,7 @@ MSBuild:Compile Designer - + ConfigWindow.xaml diff --git a/GUI/Styles/Brushes.xaml b/GUI/Styles/Brushes.xaml index 49df38f..b1866fa 100644 --- a/GUI/Styles/Brushes.xaml +++ b/GUI/Styles/Brushes.xaml @@ -5,6 +5,7 @@ #333333 #595959 #3D3D3D + #8C8C8C #424242 #666666 diff --git a/GUI/Styles/CustomStyles.xaml b/GUI/Styles/CustomStyles.xaml index eb0e7d1..3fee246 100644 --- a/GUI/Styles/CustomStyles.xaml +++ b/GUI/Styles/CustomStyles.xaml @@ -608,7 +608,7 @@ Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" - Style="{DynamicResource HorisontalScrollBarStyle}" + Style="{DynamicResource HorizontalScrollBarStyle}" Background="Transparent"/> @@ -698,10 +698,65 @@ + + + + + -