Jelajahi Sumber

Продолжаем разбирать и чистить код.

Vieraw 1 tahun lalu
induk
melakukan
c2489f538e

+ 1 - 0
.gitignore

@@ -33,6 +33,7 @@ bld/
 [Ll]ogs/
 
 # Visual Studio 2015/2017 cache/options directory
+.idea/
 .vs/
 # Uncomment if you have tasks that create the project's static files in wwwroot
 #wwwroot/

+ 2 - 2
LauncherIcarus/Daemon/Configuration.cs

@@ -4,7 +4,7 @@
     {
         public static readonly Configuration Default = new Configuration()
         {
-            ServerIP = "http://192.168.183.129:5000",
+            ServerIp = "http://192.168.183.129:5000",
             LoginUrl = "/api/LoginAction",
             ListFileUrl = "/api/LauncherListDownloadFiles",
             LauncherNewsUrl = "/LauncherIndex",
@@ -18,7 +18,7 @@
             DownloadDir = "./DownloadFiles/"
         };
 
-        public string ServerIP { get; set; }
+        public string ServerIp { get; set; }
 
         public string LoginUrl { get; set; }
 

+ 0 - 32
LauncherIcarus/Daemon/EnvironmentHelper.cs

@@ -1,32 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace LauncherIcarus.Daemon
-{
-    public static class EnvironmentHelper
-    {
-        [DllImport("kernel32.dll")]
-        private static extern IntPtr GetCurrentProcess();
-
-        [DllImport("kernel32.dll")]
-        private static extern IntPtr GetModuleHandle(string moduleName);
-
-        [DllImport("kernel32")]
-        private static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
-
-        [DllImport("kernel32.dll")]
-        private static extern bool IsWow64Process(IntPtr hProcess, out bool wow64Process);
-
-        public static bool Is64BitOperatingSystem()
-        {
-            if (IntPtr.Size == 8)
-                return true;
-            IntPtr moduleHandle = EnvironmentHelper.GetModuleHandle("kernel32");
-            bool wow64Process;
-            return moduleHandle != IntPtr.Zero &&
-                   EnvironmentHelper.GetProcAddress(moduleHandle, "IsWow64Process") != IntPtr.Zero &&
-                   EnvironmentHelper.IsWow64Process(EnvironmentHelper.GetCurrentProcess(), out wow64Process) &
-                   wow64Process;
-        }
-    }
-}

+ 13 - 16
LauncherIcarus/Daemon/FileConfig.cs

@@ -5,31 +5,28 @@ namespace LauncherIcarus.Daemon
 {
     public class FileConfig
     {
-        private string AccountSetting = nameof(AccountSetting);
-        private string LauncherVersionSetting = nameof(LauncherVersionSetting);
-        private string RedistInstall = nameof(RedistInstall);
-        private string Language = nameof(Language);
+        private string _accountSetting = nameof(_accountSetting);
+        private string _launcherVersionSetting = nameof(_launcherVersionSetting);
+        private string _language = nameof(_language);
 
-        public void SetUsername(string Username) =>
-            File.WriteAllText(this.AccountSetting, Username + Environment.NewLine);
+        public void SetUsername(string username) =>
+            File.WriteAllText(_accountSetting, username + Environment.NewLine);
 
-        public string GetUsername() => File.Exists(this.AccountSetting)
-            ? File.ReadAllText(this.AccountSetting).Replace("\r\n", string.Empty)
+        public string GetUsername() => File.Exists(_accountSetting)
+            ? File.ReadAllText(_accountSetting).Replace("\r\n", string.Empty)
             : "";
 
         public void SetLauncherIsChecked(string text) =>
-            File.WriteAllText(this.LauncherVersionSetting, text + Environment.NewLine);
+            File.WriteAllText(_launcherVersionSetting, text + Environment.NewLine);
 
-        public string GetLauncherIsChecked() => File.Exists(this.LauncherVersionSetting)
-            ? File.ReadAllText(this.LauncherVersionSetting).Replace("\r\n", string.Empty)
+        public string GetLauncherIsChecked() => File.Exists(this._launcherVersionSetting)
+            ? File.ReadAllText(_launcherVersionSetting).Replace("\r\n", string.Empty)
             : "FALSE";
 
-        public void SetRedistIsInstaled() => File.WriteAllText(this.RedistInstall, "TRUE");
+        public void SetLanguage(string text) => File.WriteAllText(this._language, text + Environment.NewLine);
 
-        public void SetLanguage(string text) => File.WriteAllText(this.Language, text + Environment.NewLine);
-
-        public string GetLanguage() => File.Exists(this.Language)
-            ? File.ReadAllText(this.Language).Replace("\r\n", string.Empty)
+        public string GetLanguage() => File.Exists(_language)
+            ? File.ReadAllText(_language).Replace("\r\n", string.Empty)
             : "";
     }
 }

+ 6 - 6
LauncherIcarus/Daemon/HTTP/HttpRequest.cs

@@ -6,21 +6,21 @@ namespace LauncherIcarus.Daemon.HTTP
 {
     public class HttpRequest
     {
-        private readonly string _loginUrl = Configuration.Default.ServerIP + Configuration.Default.LoginUrl;
+        private readonly string _loginUrl = Configuration.Default.ServerIp + Configuration.Default.LoginUrl;
 
         private readonly string _getLauncherVersionUrl =
-            Configuration.Default.ServerIP + Configuration.Default.GetLauncherVersion;
+            Configuration.Default.ServerIp + Configuration.Default.GetLauncherVersion;
 
         private readonly string _updateLauncherVersionUrl =
-            Configuration.Default.ServerIP + Configuration.Default.UpdateLauncherVersion;
+            Configuration.Default.ServerIp + Configuration.Default.UpdateLauncherVersion;
 
         private readonly string _getLauncherFilesUrl =
-            Configuration.Default.ServerIP + Configuration.Default.ListFileUrl;
+            Configuration.Default.ServerIp + Configuration.Default.ListFileUrl;
 
         private readonly string _checkClientFiles =
-            Configuration.Default.ServerIP + Configuration.Default.CheckClientFiles;
+            Configuration.Default.ServerIp + Configuration.Default.CheckClientFiles;
 
-        private readonly string _getTranslate = Configuration.Default.ServerIP + Configuration.Default.GetTranslate;
+        private readonly string _getTranslate = Configuration.Default.ServerIp + Configuration.Default.GetTranslate;
 
         public async Task<string> LoginAsync(string accountName, string password)
         {

+ 22 - 19
LauncherIcarus/Daemon/SelectAllFocusBehavior.cs

@@ -7,45 +7,48 @@ namespace LauncherIcarus.Daemon
 {
     public class SelectAllFocusBehavior
     {
-        public static readonly DependencyProperty EnableProperty = DependencyProperty.RegisterAttached("Enable",
-            typeof(bool), typeof(SelectAllFocusBehavior),
-            (PropertyMetadata) new FrameworkPropertyMetadata((object) false,
-                new PropertyChangedCallback(SelectAllFocusBehavior.OnEnableChanged)));
+        public static readonly DependencyProperty EnableProperty = DependencyProperty.RegisterAttached(
+            "Enable",
+            typeof(bool),
+            typeof(SelectAllFocusBehavior),
+            new FrameworkPropertyMetadata(false, OnEnableChanged)
+        );
 
         public static bool GetEnable(FrameworkElement frameworkElement) =>
-            (bool) frameworkElement.GetValue(SelectAllFocusBehavior.EnableProperty);
+            (bool)frameworkElement.GetValue(EnableProperty);
 
         public static void SetEnable(FrameworkElement frameworkElement, bool value) =>
-            frameworkElement.SetValue(SelectAllFocusBehavior.EnableProperty, (object) value);
+            frameworkElement.SetValue(EnableProperty, value);
 
         private static void OnEnableChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
-            if (!(d is FrameworkElement frameworkElement) || !(e.NewValue is bool))
+            if (!(d is FrameworkElement frameworkElement) || !(e.NewValue is bool value))
+            {
                 return;
-            if ((bool) e.NewValue)
+            }
+
+            if (value)
             {
-                frameworkElement.GotFocus += new RoutedEventHandler(SelectAllFocusBehavior.SelectAll);
-                frameworkElement.PreviewMouseDown +=
-                    new MouseButtonEventHandler(SelectAllFocusBehavior.IgnoreMouseButton);
+                frameworkElement.GotFocus += SelectAll;
+                frameworkElement.PreviewMouseDown += IgnoreMouseButton;
             }
             else
             {
-                frameworkElement.GotFocus -= new RoutedEventHandler(SelectAllFocusBehavior.SelectAll);
-                frameworkElement.PreviewMouseDown -=
-                    new MouseButtonEventHandler(SelectAllFocusBehavior.IgnoreMouseButton);
+                frameworkElement.GotFocus -= SelectAll;
+                frameworkElement.PreviewMouseDown -= IgnoreMouseButton;
             }
         }
 
         private static void SelectAll(object sender, RoutedEventArgs e)
         {
-            FrameworkElement originalSource = e.OriginalSource as FrameworkElement;
+            var originalSource = e.OriginalSource as FrameworkElement;
             switch (originalSource)
             {
-                case TextBox _:
-                    ((TextBoxBase) originalSource).SelectAll();
+                case TextBox box:
+                    box.SelectAll();
                     break;
-                case PasswordBox _:
-                    ((PasswordBox) originalSource).SelectAll();
+                case PasswordBox box:
+                    box.SelectAll();
                     break;
             }
         }

+ 1 - 2
LauncherIcarus/LauncherIcarus.csproj

@@ -72,13 +72,12 @@
     <Compile Include="ResponseModel\ResponseListLauncherFiles.cs" />
     <Compile Include="ResponseModel\Files.cs" />
     <Compile Include="ResponseModel\ResponseLogin.cs" />
-    <Compile Include="ResponseModel\Accountinfos.cs" />
+    <Compile Include="ResponseModel\AccountInfo.cs" />
     <Compile Include="Model\AccountModel.cs" />
     <Compile Include="Model\MainViewModel.cs" />
     <Compile Include="Model\ViewModelBase.cs" />
     <Compile Include="Daemon\Crc32.cs" />
     <Compile Include="Daemon\EncryptionHelper.cs" />
-    <Compile Include="Daemon\EnvironmentHelper.cs" />
     <Compile Include="Daemon\FileConfig.cs" />
     <Compile Include="Daemon\Logger.cs" />
     <Compile Include="Daemon\SelectAllFocusBehavior.cs" />

TEMPAT SAMPAH
LauncherIcarus/LauncherIcarus.pdb


+ 156 - 144
LauncherIcarus/MainWindow.xaml.cs

@@ -7,10 +7,10 @@ using System;
 using System.Diagnostics;
 using System.IO;
 using System.IO.Compression;
+using System.Linq;
 using System.Net;
 using System.Threading.Tasks;
 using System.Windows;
-using System.Windows.Controls;
 using System.Windows.Input;
 
 namespace LauncherIcarus
@@ -20,7 +20,8 @@ namespace LauncherIcarus
         private readonly HttpRequest _httpRequest;
         private readonly MainViewModel _mainViewModel;
         private readonly FileConfig _fileConfig;
-        private DirectoryInfo _lDir;
+        private DirectoryInfo _currentDirectory;
+        private DirectoryInfo _parentDirectory;
 
         public MainWindow()
         {
@@ -49,9 +50,10 @@ namespace LauncherIcarus
                 _mainViewModel.IsLogged = false;
                 _mainViewModel.Lang = _fileConfig.GetLanguage();
                 DataContext = _mainViewModel;
-                wbSlide.Navigate(Configuration.Default.ServerIP + Configuration.Default.LauncherNewsUrl);
+                wbSlide.Navigate(Configuration.Default.ServerIp + Configuration.Default.LauncherNewsUrl);
                 AccountModel.Username = _fileConfig.GetUsername();
-                _lDir = new DirectoryInfo(Environment.CurrentDirectory);
+                _currentDirectory = new DirectoryInfo(Environment.CurrentDirectory);
+                _parentDirectory = _currentDirectory.Parent;
 
                 if (AccountModel.Username != "")
                 {
@@ -68,9 +70,14 @@ namespace LauncherIcarus
                     return;
                 }
 
+                if (_parentDirectory == null)
+                {
+                    throw new DirectoryNotFoundException();
+                }
+
                 Process.Start(new ProcessStartInfo
                 {
-                    WorkingDirectory = _lDir.Parent.FullName,
+                    WorkingDirectory = _parentDirectory.FullName,
                     FileName = "LauncherUpdater.exe",
                     CreateNoWindow = false
                 });
@@ -95,10 +102,10 @@ namespace LauncherIcarus
                 );
                 if (responseLogin?.Code == 0)
                 {
-                    _fileConfig.SetUsername(responseLogin.Accountinfo.Username);
+                    _fileConfig.SetUsername(responseLogin.AccountInfo.Username);
                     AccountModel.Token = responseLogin.Token;
-                    AccountModel.Username = responseLogin.Accountinfo.Username;
-                    AccountModel.Version = responseLogin.Accountinfo.Version;
+                    AccountModel.Username = responseLogin.AccountInfo.Username;
+                    AccountModel.Version = responseLogin.AccountInfo.Version;
                     _fileConfig.SetLauncherIsChecked(EncryptionHelper.Encrypt("FALSE"));
                     lblWellcome.Visibility = Visibility.Visible;
                     lblWellcome.Content = "Seja bem vindo " + AccountModel.Username;
@@ -135,7 +142,8 @@ namespace LauncherIcarus
                     return;
                 }
 
-                CheckClientFiles();
+                var task = CheckClientFiles();
+                task.Wait();
             }
         }
 
@@ -150,68 +158,66 @@ namespace LauncherIcarus
                     Directory.CreateDirectory(Configuration.Default.DownloadDir);
                 }
 
+                //TODO: Проверка версии лаунчера выглядит как бесполезная.
                 var getVersionResponse = JsonConvert.DeserializeObject<ResponseLauncherVersion>(
                     await httpRequest.GetLauncherVersionAsync(AccountModel.Token, AccountModel.Username)
                 );
                 var getLauncherListResponse = JsonConvert.DeserializeObject<ResponseListLauncherFiles>(
-                    await httpRequest.GetLauncherListFilesAsync(AccountModel.Token, getVersionResponse.UpdaterVersion.ToString())
+                    await httpRequest.GetLauncherListFilesAsync(
+                        AccountModel.Token, $"{getVersionResponse?.UpdaterVersion}"
+                    )
                 );
-                if (getLauncherListResponse.TotalBytes > 0.0)
+                if (getLauncherListResponse?.TotalBytes > 0.0)
                 {
-                    double totalDownloaded = 0.0;
+                    var totalDownloaded = 0.0;
                     mainWindow.progressBar.Width = 0.0;
                     mainWindow._mainViewModel.IsUpdating = true;
                     mainWindow.lblDownloadSpeed.Visibility = Visibility.Visible;
                     mainWindow.lblDownloadSpeedQtd.Visibility = Visibility.Visible;
                     mainWindow.lblFileDownloading.Visibility = Visibility.Visible;
                     mainWindow.lblFileDownloadingName.Visibility = Visibility.Visible;
-                    int LastVersion = 0;
-                    int ClientVersion = getVersionResponse.UpdaterVersion;
-                    mainWindow.lblTotalQtd.Content =
-                        (object) (Math.Round(getLauncherListResponse.TotalBytes / 1024.0, 2).ToString() + "MB");
-                    foreach (Files file in getLauncherListResponse.File)
+                    var lastVersion = 0;
+                    var clientVersion = getVersionResponse?.UpdaterVersion;
+                    mainWindow.lblTotalQtd.Content = Math.Round(getLauncherListResponse.TotalBytes / 1024.0, 2) + "MB";
+                    foreach (var file in getLauncherListResponse.File)
                     {
-                        LastVersion = (int) file.Version;
+                        lastVersion = (int)file.Version;
                         double num1;
-                        if (LastVersion > ClientVersion)
+                        if (lastVersion > clientVersion)
                         {
-                            Label lblAtualQtd = mainWindow.lblAtualQtd;
+                            var lblAtualQtd = mainWindow.lblAtualQtd;
                             num1 = Math.Round(file.Size / 1024.0, 2);
-                            string str = num1.ToString() + "MB";
-                            lblAtualQtd.Content = (object) str;
-                            int num2 = await mainWindow.DownloadArchiveAsync(file.Filename,
-                                Configuration.Default.DownloadDir, file.Url)
-                                ? 1
-                                : 0;
+                            var str = num1 + "MB";
+                            lblAtualQtd.Content = str;
                         }
 
-                        double num3 = file.Size / getLauncherListResponse.TotalBytes * 656.0;
+                        var num3 = file.Size / getLauncherListResponse.TotalBytes * 656.0;
                         totalDownloaded += file.Size;
-                        mainWindow.progressBar.Width += (double) (int) num3;
+                        mainWindow.progressBar.Width += (int)num3;
                         mainWindow.ExtractFiles();
-                        Label totalAtualizadoQtd = mainWindow.lblTotalAtualizadoQtd;
+                        var totalAtualizadoQtd = mainWindow.lblTotalAtualizadoQtd;
                         num1 = Math.Round(totalDownloaded / 1024.0, 2);
-                        string str1 = num1.ToString() + "MB";
-                        totalAtualizadoQtd.Content = (object) str1;
+                        var str1 = num1 + "MB";
+                        totalAtualizadoQtd.Content = str1;
                     }
 
+                    //TODO: Запись версии лаунчера выглядит как бесполезная.
                     JsonConvert.DeserializeObject<ResponseLauncherVersion>(
-                        await httpRequest.UpdateLauncherVersionAsync(AccountModel.Token, LastVersion.ToString(),
-                            AccountModel.Username));
+                        await httpRequest.UpdateLauncherVersionAsync(
+                            AccountModel.Token, lastVersion.ToString(), AccountModel.Username
+                        )
+                    );
                 }
 
                 mainWindow._mainViewModel.IsUpdating = false;
-                mainWindow.DataContext = (object) mainWindow._mainViewModel;
-                mainWindow.lblTotalQtd.Content = (object) "0.0MB";
-                mainWindow.lblTotalAtualizadoQtd.Content = (object) "0.0MB";
-                mainWindow.lblAtualQtd.Content = (object) "0.0MB";
+                mainWindow.DataContext = mainWindow._mainViewModel;
+                mainWindow.lblTotalQtd.Content = "0.0MB";
+                mainWindow.lblTotalAtualizadoQtd.Content = "0.0MB";
+                mainWindow.lblAtualQtd.Content = "0.0MB";
                 mainWindow.lblDownloadSpeed.Visibility = Visibility.Hidden;
                 mainWindow.lblDownloadSpeedQtd.Visibility = Visibility.Hidden;
                 mainWindow.lblFileDownloading.Visibility = Visibility.Hidden;
                 mainWindow.lblFileDownloadingName.Visibility = Visibility.Hidden;
-                httpRequest = (HttpRequest) null;
-                getVersionResponse = (ResponseLauncherVersion) null;
-                getLauncherListResponse = (ResponseListLauncherFiles) null;
             }
             catch (Exception ex)
             {
@@ -219,82 +225,82 @@ namespace LauncherIcarus
             }
         }
 
-        public async Task CheckClientFiles()
+        private async Task CheckClientFiles()
         {
-            MainWindow mainWindow = this;
+            var mainWindow = this;
             try
             {
                 mainWindow.progressBar.Width = 0.0;
                 mainWindow._mainViewModel.IsChecking = true;
-                double totalDownloaded = 0.0;
-                Crc32 c = new Crc32();
-                ResponseListLauncherFiles get =
-                    JsonConvert.DeserializeObject<ResponseListLauncherFiles>(
-                        await mainWindow._httpRequest.GetClientFilesCheckListAsync(AccountModel.Token));
-                if (get.TotalBytes > 0.0)
+                var totalDownloaded = 0.0;
+                var c = new Crc32();
+                var get = JsonConvert.DeserializeObject<ResponseListLauncherFiles>(
+                    await mainWindow._httpRequest.GetClientFilesCheckListAsync(AccountModel.Token)
+                );
+
+                if (get?.TotalBytes > 0.0)
                 {
-                    Label lblTotalQtd = mainWindow.lblTotalQtd;
-                    double num1 = Math.Round(get.TotalBytes / 1024.0, 2);
-                    string str1 = num1.ToString() + "MB";
-                    lblTotalQtd.Content = (object) str1;
+                    var lblTotalQtd = mainWindow.lblTotalQtd;
+                    var num1 = Math.Round(get.TotalBytes / 1024.0, 2);
+                    var str1 = num1 + "MB";
+                    lblTotalQtd.Content = str1;
                     mainWindow.lblDownloadSpeed.Visibility = Visibility.Visible;
                     mainWindow.lblDownloadSpeedQtd.Visibility = Visibility.Visible;
                     mainWindow.lblFileDownloading.Visibility = Visibility.Visible;
                     mainWindow.lblFileDownloadingName.Visibility = Visibility.Visible;
-                    foreach (Files k in get.File)
+                    foreach (var k in get.File)
                     {
-                        string filename = k.Filename;
-                        string empty = string.Empty;
-                        string path = mainWindow._lDir.Parent.FullName + "\\" + k.Filename.Replace("/", "\\");
-                        Label lblAtualQtd = mainWindow.lblAtualQtd;
+                        var filename = k.Filename;
+                        var empty = string.Empty;
+                        var path = _parentDirectory.FullName + "\\" + k.Filename.Replace("/", "\\");
+                        var lblAtualQtd = mainWindow.lblAtualQtd;
                         num1 = Math.Round(k.Size / 1024.0, 2);
-                        string str2 = num1.ToString() + "MB";
-                        lblAtualQtd.Content = (object) str2;
-                        if (System.IO.File.Exists(path))
+                        var str2 = num1 + "MB";
+                        lblAtualQtd.Content = str2;
+                        if (File.Exists(path))
                         {
-                            using (FileStream inputStream = System.IO.File.Open(path, FileMode.Open))
+                            using (var inputStream = File.Open(path, FileMode.Open))
                             {
-                                foreach (byte num2 in c.ComputeHash((Stream) inputStream))
+                                foreach (var num2 in c.ComputeHash(inputStream))
+                                {
                                     empty += num2.ToString("x2").ToLower();
+                                }
                             }
 
                             if (k.Crc32 != empty)
                             {
-                                int num3 = await mainWindow.DownloadArchiveAsync(filename,
-                                    mainWindow._lDir.Parent.FullName, k.Url)
+                                var num3 = await mainWindow
+                                    .DownloadArchiveAsync(filename, _parentDirectory.FullName, k.Url)
                                     ? 1
                                     : 0;
                             }
                         }
                         else
                         {
-                            int num4 = await mainWindow.DownloadArchiveAsync(filename, mainWindow._lDir.Parent.FullName,
-                                k.Url)
+                            var num4 = await mainWindow.DownloadArchiveAsync(filename, _parentDirectory.FullName, k.Url)
                                 ? 1
                                 : 0;
                         }
 
                         totalDownloaded += k.Size;
-                        double num5 = k.Size / get.TotalBytes * 656.0;
-                        Label totalAtualizadoQtd = mainWindow.lblTotalAtualizadoQtd;
+                        var num5 = k.Size / get.TotalBytes * 656.0;
+                        var totalAtualizadoQtd = mainWindow.lblTotalAtualizadoQtd;
                         num1 = Math.Round(totalDownloaded / 1024.0, 2);
-                        string str3 = num1.ToString() + "MB";
-                        totalAtualizadoQtd.Content = (object) str3;
+                        var str3 = num1 + "MB";
+                        totalAtualizadoQtd.Content = str3;
                         mainWindow.progressBar.Width += Math.Round(num5, 0);
                     }
                 }
 
                 mainWindow._mainViewModel.IsChecking = false;
-                mainWindow.DataContext = (object) mainWindow._mainViewModel;
-                mainWindow.lblTotalQtd.Content = (object) "0.0MB";
-                mainWindow.lblTotalAtualizadoQtd.Content = (object) "0.0MB";
-                mainWindow.lblAtualQtd.Content = (object) "0.0MB";
+                mainWindow.DataContext = mainWindow._mainViewModel;
+                mainWindow.lblTotalQtd.Content = "0.0MB";
+                mainWindow.lblTotalAtualizadoQtd.Content = "0.0MB";
+                mainWindow.lblAtualQtd.Content = "0.0MB";
                 mainWindow.lblDownloadSpeed.Visibility = Visibility.Hidden;
                 mainWindow.lblDownloadSpeedQtd.Visibility = Visibility.Hidden;
                 mainWindow.lblFileDownloading.Visibility = Visibility.Hidden;
                 mainWindow.lblFileDownloadingName.Visibility = Visibility.Hidden;
-                c = (Crc32) null;
-                get = (ResponseListLauncherFiles) null;
             }
             catch (Exception ex)
             {
@@ -307,55 +313,56 @@ namespace LauncherIcarus
             string downloadPath,
             string url)
         {
-            DateTime _startedAt = DateTime.Now;
-            DownloadProgressChangedEventHandler changedEventHandler = (DownloadProgressChangedEventHandler) ((s, e) =>
+            var startedAt = DateTime.Now;
+
+            void ChangedEventHandler(object s, DownloadProgressChangedEventArgs e)
             {
-                if (_startedAt == new DateTime())
+                if (startedAt == new DateTime())
                 {
-                    _startedAt = DateTime.Now;
+                    startedAt = DateTime.Now;
                 }
                 else
                 {
-                    TimeSpan timeSpan = DateTime.Now - _startedAt;
-                    if (timeSpan.TotalSeconds <= 0.0)
-                        return;
-                    this.lblDownloadSpeedQtd.Content = (object) string.Format("{0} MB/s",
-                        (object) Math.Round((double) e.BytesReceived / (timeSpan.TotalSeconds * 1000000.0), 2));
-                    this.lblFileDownloadingName.Content = (object) filename;
+                    var timeSpan = DateTime.Now - startedAt;
+                    if (timeSpan.TotalSeconds <= 0.0) return;
+                    lblDownloadSpeedQtd.Content =
+                        $"{Math.Round(e.BytesReceived / (timeSpan.TotalSeconds * 1000000.0), 2)} MB/s";
+                    lblFileDownloadingName.Content = filename;
                 }
-            });
-            DownloadDataCompletedEventHandler completedEventHandler =
-                (DownloadDataCompletedEventHandler) ((s, e) => { });
-            int num1 = filename.IndexOf("/");
-            string str = filename;
+            }
+
+            DownloadDataCompletedEventHandler completedEventHandler = (s, e) => { };
+            var num1 = filename.IndexOf("/", StringComparison.Ordinal);
             string fileName;
             if (num1 > 0)
             {
-                int num2 = 0;
-                string[] strArray = filename.Split(new string[1]
-                {
-                    "/"
-                }, StringSplitOptions.None);
+                var num2 = 0;
+                var strArray = filename.Split(new[] { "/" }, StringSplitOptions.None);
                 downloadPath += "\\";
-                for (int index = 0; index < strArray.Length - 1; ++index)
+                for (var index = 0; index < strArray.Length - 1; ++index)
                 {
                     downloadPath = downloadPath + strArray[index] + "\\";
                     num2 = index;
                 }
 
                 if (!Directory.Exists(downloadPath))
+                {
                     Directory.CreateDirectory(downloadPath);
+                }
+
                 fileName = downloadPath + strArray[num2 + 1].Replace("/", "\\");
                 Logger.WriteLog(filename);
             }
             else
+            {
                 fileName = downloadPath + filename;
+            }
 
-            using (WebClient webClient = new WebClient())
+            using (var webClient = new WebClient())
             {
-                webClient.DownloadProgressChanged += changedEventHandler;
+                webClient.DownloadProgressChanged += ChangedEventHandler;
                 webClient.DownloadDataCompleted += completedEventHandler;
-                await webClient.DownloadFileTaskAsync(new Uri(Configuration.Default.ServerIP + url), fileName);
+                await webClient.DownloadFileTaskAsync(new Uri(Configuration.Default.ServerIp + url), fileName);
             }
 
             return true;
@@ -365,32 +372,30 @@ namespace LauncherIcarus
         {
             try
             {
-                foreach (string file in Directory.GetFiles(Configuration.Default.DownloadDir, "*.zip"))
+                foreach (var file in Directory.GetFiles(Configuration.Default.DownloadDir, "*.zip"))
                 {
-                    using (ZipArchive zipArchive = ZipFile.Open(file, ZipArchiveMode.Read))
+                    using (var zipArchive = ZipFile.Open(file, ZipArchiveMode.Read))
                     {
-                        foreach (ZipArchiveEntry entry in zipArchive.Entries)
+                        foreach (var entry in zipArchive.Entries)
                         {
                             if (entry.Length > 0L || entry.Name != "")
                             {
-                                entry.ExtractToFile(Path.Combine(this._lDir.Parent.FullName, entry.FullName), true);
+                                entry.ExtractToFile(Path.Combine(_parentDirectory.FullName, entry.FullName), true);
                             }
                             else
                             {
-                                string[] strArray = entry.FullName.Split(new string[1]
+                                var strArray = entry.FullName.Split(new[] { "/" }, StringSplitOptions.None);
+                                var path2 = strArray.Aggregate("", (current, t) => current + t + "/");
+
+                                if (!Directory.Exists(Path.Combine(_parentDirectory.FullName, path2)))
                                 {
-                                    "/"
-                                }, StringSplitOptions.None);
-                                string path2 = "";
-                                for (int index = 0; index < strArray.Length; ++index)
-                                    path2 = path2 + strArray[index] + "/";
-                                if (!Directory.Exists(Path.Combine(this._lDir.Parent.FullName, path2)))
-                                    Directory.CreateDirectory(Path.Combine(this._lDir.Parent.FullName, path2));
+                                    Directory.CreateDirectory(Path.Combine(_parentDirectory.FullName, path2));
+                                }
                             }
                         }
                     }
 
-                    System.IO.File.Delete(file);
+                    File.Delete(file);
                 }
             }
             catch (Exception ex)
@@ -408,7 +413,7 @@ namespace LauncherIcarus
 
             try
             {
-                var folder = _lDir.Parent?.FullName.Replace("Launcher", "");
+                var folder = _parentDirectory.FullName.Replace("Launcher", "");
                 var sw = new StreamWriter(folder + @"\start.bat");
                 sw.WriteLine(
                     $"cd {folder} && start Bin64/Launcher.exe /i:{AccountModel.Token} /r:123456 /O /u:3913056 /m:P");
@@ -427,59 +432,64 @@ namespace LauncherIcarus
         private void Window_MouseMove(object sender, MouseEventArgs e)
         {
             if (e.LeftButton != MouseButtonState.Pressed)
+            {
                 return;
-            this.DragMove();
+            }
+
+            DragMove();
         }
 
         private async void cmbLanguage_DropDownClosed(object sender, EventArgs e)
         {
-            MainWindow mainWindow = this;
+            var mainWindow = this;
             try
             {
                 if (mainWindow._fileConfig.GetLanguage() != mainWindow._mainViewModel.Lang &&
                     mainWindow._mainViewModel.Lang != string.Empty)
                 {
                     mainWindow._fileConfig.SetLanguage(mainWindow._mainViewModel.Lang);
-                    HttpRequest httpRequest = new HttpRequest();
+                    var httpRequest = new HttpRequest();
                     if (!Directory.Exists(Configuration.Default.DownloadDir))
                         Directory.CreateDirectory(Configuration.Default.DownloadDir);
-                    ResponseListLauncherFiles listLauncherFiles =
-                        JsonConvert.DeserializeObject<ResponseListLauncherFiles>(
-                            await httpRequest.GetLauncherTranslateAsync());
-                    if (listLauncherFiles.TotalBytes > 0.0)
+                    var listLauncherFiles = JsonConvert.DeserializeObject<ResponseListLauncherFiles>(
+                        await httpRequest.GetLauncherTranslateAsync()
+                    );
+                    if (listLauncherFiles?.TotalBytes > 0.0)
                     {
-                        double totalDownloaded = 0.0;
+                        var totalDownloaded = 0.0;
                         mainWindow.progressBar.Width = 0.0;
                         mainWindow._mainViewModel.IsUpdating = true;
                         mainWindow.lblDownloadSpeed.Visibility = Visibility.Visible;
                         mainWindow.lblDownloadSpeedQtd.Visibility = Visibility.Visible;
                         mainWindow.lblFileDownloading.Visibility = Visibility.Visible;
                         mainWindow.lblFileDownloadingName.Visibility = Visibility.Visible;
-                        foreach (Files file in listLauncherFiles.File)
+                        foreach (var file in listLauncherFiles.File)
                         {
-                            if (file.Filename == mainWindow._mainViewModel.Lang.ToLower() + ".zip")
+                            if (file.Filename != mainWindow._mainViewModel.Lang.ToLower() + ".zip")
                             {
-                                var lblTotalQtd = mainWindow.lblTotalQtd;
-                                var num1 = Math.Round(file.Size / 1024.0, 2);
-                                var str1 = num1 + "MB";
-                                lblTotalQtd.Content = str1;
-                                Label lblAtualQtd = mainWindow.lblAtualQtd;
-                                num1 = Math.Round(file.Size / 1024.0, 2);
-                                var str2 = num1 + "MB";
-                                lblAtualQtd.Content = str2;
-                                var num2 = await mainWindow.DownloadArchiveAsync(file.Filename,
-                                    Configuration.Default.DownloadDir, file.Url)
-                                    ? 1
-                                    : 0;
-                                var num3 = file.Size / file.Size * 656.0;
-                                totalDownloaded += file.Size;
-                                mainWindow.progressBar.Width += (int) num3;
-                                mainWindow.ExtractFiles();
-                                var totalAtualizadoQtd = mainWindow.lblTotalAtualizadoQtd;
-                                num1 = Math.Round(totalDownloaded / 1024.0, 2);
-                                var str3 = num1 + "MB";
-                                totalAtualizadoQtd.Content = str3;
+                                continue;
                             }
+
+                            var lblTotalQtd = mainWindow.lblTotalQtd;
+                            var num1 = Math.Round(file.Size / 1024.0, 2);
+                            var str1 = num1 + "MB";
+                            lblTotalQtd.Content = str1;
+                            var lblAtualQtd = mainWindow.lblAtualQtd;
+                            num1 = Math.Round(file.Size / 1024.0, 2);
+                            var str2 = num1 + "MB";
+                            lblAtualQtd.Content = str2;
+                            var num2 = await mainWindow
+                                .DownloadArchiveAsync(file.Filename, Configuration.Default.DownloadDir, file.Url)
+                                ? 1
+                                : 0;
+                            var num3 = file.Size / file.Size * 656.0;
+                            totalDownloaded += file.Size;
+                            mainWindow.progressBar.Width += (int)num3;
+                            mainWindow.ExtractFiles();
+                            var totalAtualizadoQtd = mainWindow.lblTotalAtualizadoQtd;
+                            num1 = Math.Round(totalDownloaded / 1024.0, 2);
+                            var str3 = num1 + "MB";
+                            totalAtualizadoQtd.Content = str3;
                         }
                     }
 
@@ -494,7 +504,9 @@ namespace LauncherIcarus
                     mainWindow.lblFileDownloadingName.Visibility = Visibility.Hidden;
                 }
                 else
+                {
                     mainWindow.lblMsgStatus.Content = "Escolha um idioma para continuar!";
+                }
             }
             catch (Exception ex)
             {

+ 1 - 1
LauncherIcarus/ResponseModel/Accountinfos.cs → LauncherIcarus/ResponseModel/AccountInfo.cs

@@ -2,7 +2,7 @@
 
 namespace LauncherIcarus.ResponseModel
 {
-    public class Accountinfos
+    public class AccountInfo
     {
         [JsonProperty("AccountDBID")] public int AccountDBID { get; set; }
 

+ 1 - 1
LauncherIcarus/ResponseModel/ResponseLogin.cs

@@ -10,6 +10,6 @@ namespace LauncherIcarus.ResponseModel
 
         [JsonProperty("token")] public string Token { get; set; }
 
-        [JsonProperty("accountinfo")] public Accountinfos Accountinfo { get; set; }
+        [JsonProperty("accountinfo")] public AccountInfo AccountInfo { get; set; }
     }
 }

+ 0 - 4
LauncherIcarus/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs

@@ -1,4 +0,0 @@
-// <autogenerated />
-using System;
-using System.Reflection;
-[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

+ 0 - 62
LauncherIcarus/obj/Debug/GeneratedInternalTypeHelper.g.i.cs

@@ -1,62 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     Этот код создан программой.
-//     Исполняемая версия:4.0.30319.42000
-//
-//     Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
-//     повторной генерации кода.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace XamlGeneratedNamespace {
-    
-    
-    /// <summary>
-    /// GeneratedInternalTypeHelper
-    /// </summary>
-    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
-    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
-    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
-    public sealed class GeneratedInternalTypeHelper : System.Windows.Markup.InternalTypeHelper {
-        
-        /// <summary>
-        /// CreateInstance
-        /// </summary>
-        protected override object CreateInstance(System.Type type, System.Globalization.CultureInfo culture) {
-            return System.Activator.CreateInstance(type, ((System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic) 
-                            | (System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.CreateInstance)), null, null, culture);
-        }
-        
-        /// <summary>
-        /// GetPropertyValue
-        /// </summary>
-        protected override object GetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, System.Globalization.CultureInfo culture) {
-            return propertyInfo.GetValue(target, System.Reflection.BindingFlags.Default, null, null, culture);
-        }
-        
-        /// <summary>
-        /// SetPropertyValue
-        /// </summary>
-        protected override void SetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, object value, System.Globalization.CultureInfo culture) {
-            propertyInfo.SetValue(target, value, System.Reflection.BindingFlags.Default, null, null, culture);
-        }
-        
-        /// <summary>
-        /// CreateDelegate
-        /// </summary>
-        protected override System.Delegate CreateDelegate(System.Type delegateType, object target, string handler) {
-            return ((System.Delegate)(target.GetType().InvokeMember("_CreateDelegate", (System.Reflection.BindingFlags.InvokeMethod 
-                            | (System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)), null, target, new object[] {
-                        delegateType,
-                        handler}, null)));
-        }
-        
-        /// <summary>
-        /// AddEventHandler
-        /// </summary>
-        protected override void AddEventHandler(System.Reflection.EventInfo eventInfo, object target, System.Delegate handler) {
-            eventInfo.AddEventHandler(target, handler);
-        }
-    }
-}
-

+ 0 - 28
LauncherIcarus/obj/Debug/LauncherIcarus.csproj.FileListAbsolute.txt

@@ -1,28 +0,0 @@
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\LauncherIcarus.exe
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\LauncherIcarus.pdb
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\Newtonsoft.Json.dll
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Buffers.dll
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.IO.Hashing.dll
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Memory.dll
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Numerics.Vectors.dll
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Runtime.CompilerServices.Unsafe.dll
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\Newtonsoft.Json.xml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Buffers.xml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.IO.Hashing.xml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Memory.xml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Numerics.Vectors.xml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.csproj.AssemblyReference.cache
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.csproj.SuggestedBindingRedirects.cache
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\mainwindow.g.cs
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\GeneratedInternalTypeHelper.g.cs
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus_MarkupCompile.cache
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus_MarkupCompile.lref
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\mainwindow.baml
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.g.resources
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.Properties.Resources.resources
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.csproj.GenerateResource.cache
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.csproj.CoreCompileInputs.cache
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.csproj.CopyComplete
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.exe
-D:\Icarus\projeto launcher\projeto launcher\launcher\LauncherIcarus\obj\Debug\LauncherIcarus.pdb

+ 0 - 393
LauncherIcarus/obj/Debug/mainwindow.g.i.cs

@@ -1,393 +0,0 @@
-#pragma checksum "..\..\mainwindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "98827AEA7E413F10AF7A76BB0D59EB904127B1CB242DDEB670787DBEA6B03BF3"
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     Этот код создан программой.
-//     Исполняемая версия:4.0.30319.42000
-//
-//     Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
-//     повторной генерации кода.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-using LauncherIcarus.Daemon;
-using System;
-using System.Diagnostics;
-using System.Windows;
-using System.Windows.Automation;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Ink;
-using System.Windows.Input;
-using System.Windows.Markup;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Effects;
-using System.Windows.Media.Imaging;
-using System.Windows.Media.Media3D;
-using System.Windows.Media.TextFormatting;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Windows.Shell;
-
-
-namespace LauncherIcarus {
-    
-    
-    /// <summary>
-    /// MainWindow
-    /// </summary>
-    public partial class MainWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
-        
-        
-        #line 410 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Button buttonClose;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 417 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Button buttonMinimizer;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 423 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Button buttonAccess;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 430 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Button buttonStart;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 436 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Button buttonVerify;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 442 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Image inputUsername;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 444 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Image inputPassword;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 446 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.TextBox textUsername;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 450 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.PasswordBox textPassword;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 453 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Image progressBar;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 455 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblWellcome;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 457 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblTotalQtd;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 459 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label label_Copy1;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 461 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblAtualQtd;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 463 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label label_Copy3;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 465 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label label_Copy4;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 467 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblTotalAtualizadoQtd;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 469 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblMsgStatus;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 472 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblDownloadSpeedQtd;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 474 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblDownloadSpeed;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 476 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblFileDownloadingName;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 478 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.WebBrowser wbSlide;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 480 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.Label lblFileDownloading;
-        
-        #line default
-        #line hidden
-        
-        
-        #line 483 "..\..\mainwindow.xaml"
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
-        internal System.Windows.Controls.ComboBox cmbLanguage;
-        
-        #line default
-        #line hidden
-        
-        private bool _contentLoaded;
-        
-        /// <summary>
-        /// InitializeComponent
-        /// </summary>
-        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
-        public void InitializeComponent() {
-            if (_contentLoaded) {
-                return;
-            }
-            _contentLoaded = true;
-            System.Uri resourceLocater = new System.Uri("/LauncherIcarus;component/mainwindow.xaml", System.UriKind.Relative);
-            
-            #line 1 "..\..\mainwindow.xaml"
-            System.Windows.Application.LoadComponent(this, resourceLocater);
-            
-            #line default
-            #line hidden
-        }
-        
-        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal System.Delegate _CreateDelegate(System.Type delegateType, string handler) {
-            return System.Delegate.CreateDelegate(delegateType, this, handler);
-        }
-        
-        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
-        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
-        [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
-        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
-            switch (connectionId)
-            {
-            case 1:
-            
-            #line 5 "..\..\mainwindow.xaml"
-            ((LauncherIcarus.MainWindow)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Window_MouseMove);
-            
-            #line default
-            #line hidden
-            return;
-            case 2:
-            this.buttonClose = ((System.Windows.Controls.Button)(target));
-            
-            #line 410 "..\..\mainwindow.xaml"
-            this.buttonClose.Click += new System.Windows.RoutedEventHandler(this.buttonClose_Click);
-            
-            #line default
-            #line hidden
-            return;
-            case 3:
-            this.buttonMinimizer = ((System.Windows.Controls.Button)(target));
-            
-            #line 417 "..\..\mainwindow.xaml"
-            this.buttonMinimizer.Click += new System.Windows.RoutedEventHandler(this.buttonMinimizer_Click);
-            
-            #line default
-            #line hidden
-            return;
-            case 4:
-            this.buttonAccess = ((System.Windows.Controls.Button)(target));
-            
-            #line 423 "..\..\mainwindow.xaml"
-            this.buttonAccess.Click += new System.Windows.RoutedEventHandler(this.buttonAccess_Click);
-            
-            #line default
-            #line hidden
-            return;
-            case 5:
-            this.buttonStart = ((System.Windows.Controls.Button)(target));
-            
-            #line 430 "..\..\mainwindow.xaml"
-            this.buttonStart.Click += new System.Windows.RoutedEventHandler(this.buttonStart_Click);
-            
-            #line default
-            #line hidden
-            return;
-            case 6:
-            this.buttonVerify = ((System.Windows.Controls.Button)(target));
-            
-            #line 436 "..\..\mainwindow.xaml"
-            this.buttonVerify.Click += new System.Windows.RoutedEventHandler(this.buttonVerify_Click);
-            
-            #line default
-            #line hidden
-            return;
-            case 7:
-            this.inputUsername = ((System.Windows.Controls.Image)(target));
-            return;
-            case 8:
-            this.inputPassword = ((System.Windows.Controls.Image)(target));
-            return;
-            case 9:
-            this.textUsername = ((System.Windows.Controls.TextBox)(target));
-            return;
-            case 10:
-            this.textPassword = ((System.Windows.Controls.PasswordBox)(target));
-            return;
-            case 11:
-            this.progressBar = ((System.Windows.Controls.Image)(target));
-            return;
-            case 12:
-            this.lblWellcome = ((System.Windows.Controls.Label)(target));
-            return;
-            case 13:
-            this.lblTotalQtd = ((System.Windows.Controls.Label)(target));
-            return;
-            case 14:
-            this.label_Copy1 = ((System.Windows.Controls.Label)(target));
-            return;
-            case 15:
-            this.lblAtualQtd = ((System.Windows.Controls.Label)(target));
-            return;
-            case 16:
-            this.label_Copy3 = ((System.Windows.Controls.Label)(target));
-            return;
-            case 17:
-            this.label_Copy4 = ((System.Windows.Controls.Label)(target));
-            return;
-            case 18:
-            this.lblTotalAtualizadoQtd = ((System.Windows.Controls.Label)(target));
-            return;
-            case 19:
-            this.lblMsgStatus = ((System.Windows.Controls.Label)(target));
-            return;
-            case 20:
-            this.lblDownloadSpeedQtd = ((System.Windows.Controls.Label)(target));
-            return;
-            case 21:
-            this.lblDownloadSpeed = ((System.Windows.Controls.Label)(target));
-            return;
-            case 22:
-            this.lblFileDownloadingName = ((System.Windows.Controls.Label)(target));
-            return;
-            case 23:
-            this.wbSlide = ((System.Windows.Controls.WebBrowser)(target));
-            return;
-            case 24:
-            this.lblFileDownloading = ((System.Windows.Controls.Label)(target));
-            return;
-            case 25:
-            this.cmbLanguage = ((System.Windows.Controls.ComboBox)(target));
-            
-            #line 483 "..\..\mainwindow.xaml"
-            this.cmbLanguage.DropDownClosed += new System.EventHandler(this.cmbLanguage_DropDownClosed);
-            
-            #line default
-            #line hidden
-            return;
-            }
-            this._contentLoaded = true;
-        }
-    }
-}
-

+ 14 - 12
LauncherUpdater/Function/Logger.cs

@@ -7,25 +7,27 @@ namespace LauncherUpdater.Function
     {
         public static void WriteLog(string strLog)
         {
-            string path = Configuration.Default.LauncherDir + nameof(Logger);
+            var path = Configuration.Default.LauncherDir + nameof(Logger);
             Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName, "Top-Level Folder");
             Directory.CreateDirectory(path);
-            string str = path + "/Log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".txt";
-            FileInfo fileInfo = new FileInfo(str);
-            DirectoryInfo directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);
+            var str = path + "/Log-" + DateTime.Today.ToString("MM-dd-yyyy") + ".txt";
+            var fileInfo = new FileInfo(str);
+            var directoryInfo = new DirectoryInfo(fileInfo.DirectoryName);
             if (!directoryInfo.Exists)
+            {
                 directoryInfo.Create();
-            StreamWriter streamWriter = new StreamWriter(fileInfo.Exists
-                ? (Stream) new FileStream(str, FileMode.Append)
-                : (Stream) fileInfo.Create());
+            }
+
+            var streamWriter =
+                new StreamWriter(fileInfo.Exists ? new FileStream(str, FileMode.Append) : fileInfo.Create());
             streamWriter.WriteLine("\r\nLog Entry : ");
-            DateTime now = DateTime.Now;
-            string longTimeString = now.ToLongTimeString();
+            var now = DateTime.Now;
+            var longTimeString = now.ToLongTimeString();
             now = DateTime.Now;
-            string longDateString = now.ToLongDateString();
-            streamWriter.WriteLine("{0} {1}", (object) longTimeString, (object) longDateString);
+            var longDateString = now.ToLongDateString();
+            streamWriter.WriteLine("{0} {1}", longTimeString, longDateString);
             streamWriter.WriteLine("  :");
-            streamWriter.WriteLine("  :{0}", (object) strLog);
+            streamWriter.WriteLine("  :{0}", strLog);
             streamWriter.WriteLine("-------------------------------");
             streamWriter.Close();
         }

TEMPAT SAMPAH
LauncherUpdater/LauncherUpdater.pdb


+ 7 - 6
LauncherUpdater/MainWindow.xaml.cs

@@ -14,7 +14,7 @@ using System.Windows.Markup;
 
 namespace LauncherUpdater
 {
-    public partial class MainWindow : Window, IComponentConnector
+    public partial class MainWindow : Window
     {
         private readonly HttpRequest _httpRequest;
         private readonly FileConfig _fileConfig;
@@ -24,7 +24,8 @@ namespace LauncherUpdater
             _httpRequest = new HttpRequest();
             _fileConfig = new FileConfig();
             InitializeComponent();
-            CheckLauncherFiles();
+            var task = CheckLauncherFiles();
+            task.Wait();
         }
 
         private async Task CheckLauncherFiles()
@@ -68,7 +69,7 @@ namespace LauncherUpdater
 
                         if (file.Crc32 != hash)
                         {
-                            await DownloadArchiveAsync(file.Filename, Configuration.Default.LauncherDir, file.Url);
+                            await DownloadAsync(file.Filename, Configuration.Default.LauncherDir, file.Url);
                         }
 
                         var num3 = file.Size / launcherFiles.TotalBytes * 370.0;
@@ -92,10 +93,10 @@ namespace LauncherUpdater
             }
         }
 
-        private static async Task DownloadArchiveAsync(string filename, string downloadPath, string url)
+        private static async Task DownloadAsync(string filename, string downloadPath, string url)
         {
-            var changedEventHandler = (DownloadProgressChangedEventHandler) ((s, e) => { });
-            var completedEventHandler = (DownloadDataCompletedEventHandler) ((s, e) => { });
+            var changedEventHandler = (DownloadProgressChangedEventHandler)((s, e) => { });
+            var completedEventHandler = (DownloadDataCompletedEventHandler)((s, e) => { });
             using (var webClient = new WebClient())
             {
                 webClient.DownloadProgressChanged += changedEventHandler;

+ 0 - 4
LauncherUpdater/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs

@@ -1,4 +0,0 @@
-// <autogenerated />
-using System;
-using System.Reflection;
-[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]