diff --git a/src/KFlearning.Core/API/FlutterGitClient.cs b/src/KFlearning.Core/API/FlutterGitClient.cs index 2d478af..01621fa 100644 --- a/src/KFlearning.Core/API/FlutterGitClient.cs +++ b/src/KFlearning.Core/API/FlutterGitClient.cs @@ -4,7 +4,6 @@ using System.IO; using System.Linq; using System.Net.Http; -using System.Net.Http.Headers; using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -19,6 +18,8 @@ public interface IFlutterGitClient public class FlutterGitClient : IFlutterGitClient { + public const string DefaultFlutterVersion = "1.22.6"; + private static readonly HttpClient Client; static FlutterGitClient() @@ -32,28 +33,21 @@ static FlutterGitClient() public async Task GetLatestFlutterVersion() { - try - { - var response = await Client.GetAsync("https://api.github.com/repos/flutter/flutter/git/refs/tags"); - response.EnsureSuccessStatusCode(); + var response = await Client.GetAsync("https://api.github.com/repos/flutter/flutter/git/refs/tags"); + response.EnsureSuccessStatusCode(); - var serializer = new JsonSerializer(); - using (var bodyReader = new StreamReader(await response.Content.ReadAsStreamAsync(), Encoding.UTF8)) - using (var jsonReader = new JsonTextReader(bodyReader)) + var serializer = new JsonSerializer(); + using (var bodyReader = new StreamReader(await response.Content.ReadAsStreamAsync(), Encoding.UTF8)) + using (var jsonReader = new JsonTextReader(bodyReader)) + { + var tags = serializer.Deserialize>(jsonReader); + var latest = tags?.LastOrDefault(x => !x.Ref.Contains("pre")); + if (latest == null) { - var tags = serializer.Deserialize>(jsonReader); - var latest = tags?.LastOrDefault(x => !x.Ref.Contains("pre")); - if (latest == null) - { - throw new KFlearningException("Tidak dapat menemukan versi Flutter! Silakan download manual."); - } - - return GetVersionFromTag(latest.Ref); + throw new KFlearningException("Tidak dapat menemukan versi Flutter! Silakan download manual."); } - } - catch (Exception) - { - return "1.22.6"; + + return GetVersionFromTag(latest.Ref); } } @@ -67,7 +61,7 @@ private string GetVersionFromTag(string tag) return tag.Split('/').Last(); } - public partial class FlutterGitTag + public class FlutterGitTag { [JsonProperty("ref")] public string Ref { get; set; } diff --git a/src/KFlearning.Core/Native/NativeConstants.cs b/src/KFlearning.Core/Native/NativeConstants.cs index b41413e..189756d 100644 --- a/src/KFlearning.Core/Native/NativeConstants.cs +++ b/src/KFlearning.Core/Native/NativeConstants.cs @@ -2,11 +2,26 @@ { internal static class NativeConstants { - public const string UacRegistryKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System"; - public const string UacRegistryValue = "EnableLUA"; - public static uint STANDARD_RIGHTS_READ = 0x00020000; public static uint TOKEN_QUERY = 0x0008; public static uint TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY; + + public const string UacRegistryKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System"; + public const string UacRegistryValue = "EnableLUA"; + + public const string SystemPoliciesKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System"; + public const string ActiveDesktopKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop"; + public const string ExplorerKey = @"Software\Microsoft\Windows\Current Version\Policies\Explorer"; + public const string StoragePoliciesKey = @"SYSTEM\Current Control Set\Control\StorageDevicePolicies"; + public const string DesktopKey = @"Control Panel\Desktop"; + + public const string NoChangingWallPaper = "NoChangingWallPaper"; + public const string Wallpaper = "Wallpaper"; + public const string WallpaperStyle = "WallpaperStyle"; + public const string NoDispCPL = "NoDispCPL"; + public const string DisableRegistryTools = "DisableRegistryTools"; + public const string DisableTaskMgr = "DisableTaskMgr"; + public const string WriteProtect = "WriteProtect"; + public const string NoControlPanel = "NoControlPanel"; } } \ No newline at end of file diff --git a/src/KFlearning.Core/Remoting/KFServer.cs b/src/KFlearning.Core/Remoting/KFServer.cs index aa69334..2061acd 100644 --- a/src/KFlearning.Core/Remoting/KFServer.cs +++ b/src/KFlearning.Core/Remoting/KFServer.cs @@ -23,10 +23,9 @@ public class KFServer : IKFServer private const string KFserverProcessName = "kfserver"; private readonly IPathManager _pathManager; - + public bool IsRunning => Process.GetProcessesByName(KFserverProcessName).Length > 0; - public KFServer(IPathManager pathManager) { _pathManager = pathManager; @@ -41,6 +40,7 @@ public void Start(string servePath) CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden }; + Process.Start(startInfo); } @@ -51,7 +51,7 @@ public void Stop() foreach (var process in Process.GetProcessesByName(KFserverProcessName)) { process.Kill(); - process?.Dispose(); + process.Dispose(); } } catch (Exception) @@ -63,12 +63,16 @@ public void Stop() public ServerInfo GetInfo() { if (!NetworkInterface.GetIsNetworkAvailable()) + { throw new KFlearningException("Komputer ini tidak terhubung ke jaringan."); + } var hosts = Dns.GetHostEntry(Dns.GetHostName()); var address = hosts.AddressList.FirstOrDefault(x => x.AddressFamily == AddressFamily.InterNetwork); if (address == null) + { throw new KFlearningException("Tidak dapat menemukan IP komputer."); + } return new ServerInfo { @@ -92,7 +96,7 @@ protected virtual void Dispose(bool disposing) public void Dispose() { - Dispose(disposing: true); + Dispose(true); GC.SuppressFinalize(this); } diff --git a/src/KFlearning.Core/Remoting/RemoteShutdownServer.cs b/src/KFlearning.Core/Remoting/RemoteShutdownServer.cs index ee37d0a..0f23f83 100644 --- a/src/KFlearning.Core/Remoting/RemoteShutdownServer.cs +++ b/src/KFlearning.Core/Remoting/RemoteShutdownServer.cs @@ -72,6 +72,7 @@ private void ReceiveCallback(IAsyncResult ar) private void ProcessMessage(string message, IPAddress server) { if (!message.StartsWith(MessageShutdown)) return; + var cluster = message.Split('|')[1]; ShutdownRequested?.Invoke(this, new ShutdownRequestedEventArgs { Address = server, Clusster = cluster }); } diff --git a/src/KFlearning.Core/Services/PathManager.cs b/src/KFlearning.Core/Services/PathManager.cs index b56efca..dc4801b 100644 --- a/src/KFlearning.Core/Services/PathManager.cs +++ b/src/KFlearning.Core/Services/PathManager.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Reflection; namespace KFlearning.Core.Services @@ -33,9 +32,7 @@ private enum PathName #region Properies public bool IsVscodeInstalled => _cachedPaths.ContainsKey(PathName.Vscode); - public bool IsKfMingwInstalled => _cachedPaths.ContainsKey(PathName.KFmingw); - public bool IsFlutterInstalled => _cachedPaths.ContainsKey(PathName.Flutter); #endregion diff --git a/src/KFlearning.Core/Services/ProcessManager.cs b/src/KFlearning.Core/Services/ProcessManager.cs index c2fecfd..5109410 100644 --- a/src/KFlearning.Core/Services/ProcessManager.cs +++ b/src/KFlearning.Core/Services/ProcessManager.cs @@ -22,33 +22,33 @@ public bool IsProcessElevated() { if (!IsUacEnabled()) { - WindowsIdentity identity = WindowsIdentity.GetCurrent(); - WindowsPrincipal principal = new WindowsPrincipal(identity); - bool result = principal.IsInRole(WindowsBuiltInRole.Administrator) - || principal.IsInRole(0x200); //Domain Administrator + var identity = WindowsIdentity.GetCurrent(); + var principal = new WindowsPrincipal(identity); + var result = principal.IsInRole(WindowsBuiltInRole.Administrator) + || principal.IsInRole(0x200); //Domain Administrator return result; } if (!NativeMethods.OpenProcessToken(Process.GetCurrentProcess().Handle, NativeConstants.TOKEN_READ, - out TokenSafeHandle tokenHandle)) + out var tokenHandle)) { throw new Win32Exception(); } using (tokenHandle) { - int elevationResultSize = Marshal.SizeOf(Enum.GetUnderlyingType(typeof(TOKEN_ELEVATION_TYPE))); - IntPtr elevationTypePtr = Marshal.AllocHGlobal(elevationResultSize); + var elevationResultSize = Marshal.SizeOf(Enum.GetUnderlyingType(typeof(TOKEN_ELEVATION_TYPE))); + var elevationTypePtr = Marshal.AllocHGlobal(elevationResultSize); try { - bool success = NativeMethods.GetTokenInformation(tokenHandle, + var success = NativeMethods.GetTokenInformation(tokenHandle, TOKEN_INFORMATION_CLASS.TokenElevationType, elevationTypePtr, (uint) elevationResultSize, - out uint _); + out _); if (success) { var elevationResult = (TOKEN_ELEVATION_TYPE) Marshal.ReadInt32(elevationTypePtr); - bool isProcessAdmin = elevationResult == TOKEN_ELEVATION_TYPE.TokenElevationTypeFull; + var isProcessAdmin = elevationResult == TOKEN_ELEVATION_TYPE.TokenElevationTypeFull; return isProcessAdmin; } else @@ -66,7 +66,7 @@ public bool IsProcessElevated() public bool IsUacEnabled() { - using (RegistryKey uacKey = Registry.LocalMachine.OpenSubKey(NativeConstants.UacRegistryKey, false)) + using (var uacKey = Registry.LocalMachine.OpenSubKey(NativeConstants.UacRegistryKey, false)) { return uacKey != null && uacKey.GetValue(NativeConstants.UacRegistryValue).Equals(1); } diff --git a/src/KFlearning.Core/Services/ProcessWatcher.cs b/src/KFlearning.Core/Services/ProcessWatcher.cs index cee7351..e420cb2 100644 --- a/src/KFlearning.Core/Services/ProcessWatcher.cs +++ b/src/KFlearning.Core/Services/ProcessWatcher.cs @@ -17,6 +17,7 @@ public interface IProcessWatcher public class ProcessWatcher : IProcessWatcher { private const double PollingInterval = 5 * 60 * 1000; + private readonly object _lock = new object(); private readonly Timer _timer; private DateTime _lastCheck; @@ -33,6 +34,7 @@ public ProcessWatcher() public void Start() { if (_timer.Enabled) return; + TotalSeconds = 0; _lastCheck = DateTime.Now; _timer.Start(); @@ -41,6 +43,7 @@ public void Start() public void Stop() { if (!_timer.Enabled) return; + _timer_Elapsed(null, null); _timer.Stop(); } diff --git a/src/KFlearning.Core/Services/SystemInfoService.cs b/src/KFlearning.Core/Services/SystemInfoService.cs index 5c34cfc..4ed7b22 100644 --- a/src/KFlearning.Core/Services/SystemInfoService.cs +++ b/src/KFlearning.Core/Services/SystemInfoService.cs @@ -31,47 +31,40 @@ public class SystemInfoService : ISystemInfoService public void Query() { - try - { - if (_isLoaded) return; - - // build device ID - string deviceId = ""; - - // OS info - var queryObj = SearchWmi("root\\CIMV2", "SELECT * FROM Win32_OperatingSystem"); - OS = queryObj["Caption"].ToString(); - OSVersion = queryObj["Version"].ToString(); - Architecture = queryObj["OSArchitecture"].ToString(); - RAM = Convert.ToDouble(queryObj["TotalVisibleMemorySize"].ToString()); - deviceId = queryObj["TotalVisibleMemorySize"].ToString(); + if (_isLoaded) return; - // CPU info - queryObj = SearchWmi("root\\CIMV2", "SELECT * FROM Win32_Processor"); - CPU = queryObj["Name"].ToString(); - deviceId += queryObj["ProcessorId"].ToString(); + // build device ID + string deviceId = ""; - // Logical disk - queryObj = SearchWmi("root\\CIMV2", "SELECT * FROM Win32_LogicalDisk"); - deviceId += queryObj["VolumeSerialNumber"].ToString(); + // OS info + var queryObj = SearchWmi("root\\CIMV2", "SELECT * FROM Win32_OperatingSystem"); + OS = queryObj["Caption"].ToString(); + OSVersion = queryObj["Version"].ToString(); + Architecture = queryObj["OSArchitecture"].ToString(); + RAM = Convert.ToDouble(queryObj["TotalVisibleMemorySize"].ToString()); + deviceId = queryObj["TotalVisibleMemorySize"].ToString(); - // hash the info - using (var hasher = new SHA256CryptoServiceProvider()) - { - var bytes = Encoding.UTF8.GetBytes(deviceId); - var hashed = hasher.ComputeHash(bytes); - var hex = new StringBuilder(hashed.Length * 2); + // CPU info + queryObj = SearchWmi("root\\CIMV2", "SELECT * FROM Win32_Processor"); + CPU = queryObj["Name"].ToString(); + deviceId += queryObj["ProcessorId"].ToString(); - foreach (byte b in hashed) hex.AppendFormat("{0:x2}", b); - DeviceId = hex.ToString(); - } + // Logical disk + queryObj = SearchWmi("root\\CIMV2", "SELECT * FROM Win32_LogicalDisk"); + deviceId += queryObj["VolumeSerialNumber"].ToString(); - _isLoaded = true; - } - catch (Exception) + // hash the info + using (var hasher = new SHA256CryptoServiceProvider()) { - // ignore + var bytes = Encoding.UTF8.GetBytes(deviceId); + var hashed = hasher.ComputeHash(bytes); + var hex = new StringBuilder(hashed.Length * 2); + + foreach (byte b in hashed) hex.AppendFormat("{0:x2}", b); + DeviceId = hex.ToString(); } + + _isLoaded = true; } private ManagementBaseObject SearchWmi(string scope, string query) diff --git a/src/KFlearning.Core/Services/SystemSettingsService.cs b/src/KFlearning.Core/Services/SystemSettingsService.cs new file mode 100644 index 0000000..b5e1ae0 --- /dev/null +++ b/src/KFlearning.Core/Services/SystemSettingsService.cs @@ -0,0 +1,72 @@ +using KFlearning.Core.Extensions; +using KFlearning.Core.Native; +using Microsoft.Win32; + +namespace KFlearning.Core.Services +{ + public interface ISystemTweaker + { + string WallpaperPath { get; set; } + bool LockWallpaper { get; set; } + bool LockDesktop { get; set; } + bool LockUsbCopying { get; set; } + bool LockRegistryEditor { get; set; } + bool LockTaskManager { get; set; } + bool LockControlPanel { get; set; } + + void Query(); + void Apply(); + } + + public class SystemSettingsService : ISystemTweaker + { + public string WallpaperPath { get; set; } + public bool LockWallpaper { get; set; } + public bool LockDesktop { get; set; } + public bool LockUsbCopying { get; set; } + public bool LockRegistryEditor { get; set; } + public bool LockTaskManager { get; set; } + public bool LockControlPanel { get; set; } + + public void Query() + { + using (var systemKey = Registry.CurrentUser.OpenSubKey(NativeConstants.SystemPoliciesKey)) + using (var desktopKey = Registry.CurrentUser.OpenSubKey(NativeConstants.DesktopKey)) + using (var explorerKey = Registry.CurrentUser.OpenSubKey(NativeConstants.ExplorerKey)) + using (var storageKey = Registry.LocalMachine.OpenSubKey(NativeConstants.StoragePoliciesKey)) + using (var activeDesktopKey = Registry.CurrentUser.OpenSubKey(NativeConstants.ActiveDesktopKey)) + { + LockWallpaper = activeDesktopKey.GetIntValue(NativeConstants.NoChangingWallPaper) == 1; + WallpaperPath = systemKey.GetStringValue(NativeConstants.Wallpaper) ?? desktopKey.GetStringValue(NativeConstants.Wallpaper); + LockDesktop = systemKey.GetIntValue(NativeConstants.NoDispCPL) == 1; + LockRegistryEditor = systemKey.GetIntValue(NativeConstants.DisableRegistryTools) == 1; + LockTaskManager = systemKey.GetIntValue(NativeConstants.DisableTaskMgr) == 1; + LockUsbCopying = storageKey.GetIntValue(NativeConstants.WriteProtect) == 1; + LockControlPanel = explorerKey.GetIntValue(NativeConstants.NoControlPanel) == 1; + } + } + + public void Apply() + { + using (var systemKey = Registry.CurrentUser.CreateSubKey(NativeConstants.SystemPoliciesKey)) + using (var desktopKey = Registry.CurrentUser.CreateSubKey(NativeConstants.DesktopKey)) + using (var explorerKey = Registry.CurrentUser.CreateSubKey(NativeConstants.ExplorerKey)) + using (var storageKey = Registry.LocalMachine.CreateSubKey(NativeConstants.StoragePoliciesKey)) + using (var activeDesktopKey = Registry.CurrentUser.CreateSubKey(NativeConstants.ActiveDesktopKey)) + { + activeDesktopKey?.SetValue(NativeConstants.NoChangingWallPaper, LockWallpaper ? 1 : 0, + RegistryValueKind.DWord); + desktopKey?.SetValue(NativeConstants.Wallpaper, WallpaperPath, RegistryValueKind.String); + systemKey?.SetValue(NativeConstants.Wallpaper, WallpaperPath, RegistryValueKind.String); + systemKey?.SetValue(NativeConstants.WallpaperStyle, 0, RegistryValueKind.DWord); + systemKey?.SetValue(NativeConstants.NoDispCPL, LockDesktop ? 1 : 0, RegistryValueKind.DWord); + systemKey?.SetValue(NativeConstants.DisableRegistryTools, LockRegistryEditor ? 1 : 0, + RegistryValueKind.DWord); + systemKey?.SetValue(NativeConstants.DisableTaskMgr, LockTaskManager ? 1 : 0, RegistryValueKind.DWord); + storageKey?.SetValue(NativeConstants.WriteProtect, LockUsbCopying ? 1 : 0, RegistryValueKind.DWord); + explorerKey?.SetValue(NativeConstants.NoControlPanel, LockControlPanel ? 1 : 0, + RegistryValueKind.DWord); + } + } + } +} \ No newline at end of file diff --git a/src/KFlearning.Core/Services/SystemTweaker.cs b/src/KFlearning.Core/Services/SystemTweaker.cs deleted file mode 100644 index 8d8c24c..0000000 --- a/src/KFlearning.Core/Services/SystemTweaker.cs +++ /dev/null @@ -1,83 +0,0 @@ -using KFlearning.Core.Extensions; -using Microsoft.Win32; - -namespace KFlearning.Core.Services -{ - public interface ISystemTweaker - { - string WallpaperPath { get; set; } - bool LockWallpaper { get; set; } - bool LockDesktop { get; set; } - bool LockUsbCopying { get; set; } - bool LockRegistryEditor { get; set; } - bool LockTaskManager { get; set; } - bool LockControlPanel { get; set; } - - void Query(); - void Apply(); - } - - public class SystemTweaker : ISystemTweaker - { - private const string SystemPoliciesKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System"; - private const string ActiveDesktopKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop"; - private const string ExplorerKey = @"Software\Microsoft\Windows\Current Version\Policies\Explorer"; - private const string StoragePoliciesKey = @"SYSTEM\Current Control Set\Control\StorageDevicePolicies"; - private const string DesktopKey = @"Control Panel\Desktop"; - - private const string NoChangingWallPaper = "NoChangingWallPaper"; - private const string Wallpaper = "Wallpaper"; - private const string WallpaperStyle = "WallpaperStyle"; - private const string NoDispCPL = "NoDispCPL"; - private const string DisableRegistryTools = "DisableRegistryTools"; - private const string DisableTaskMgr = "DisableTaskMgr"; - private const string WriteProtect = "WriteProtect"; - private const string NoControlPanel = "NoControlPanel"; - - public string WallpaperPath { get; set; } - public bool LockWallpaper { get; set; } - public bool LockDesktop { get; set; } - public bool LockUsbCopying { get; set; } - public bool LockRegistryEditor { get; set; } - public bool LockTaskManager { get; set; } - public bool LockControlPanel { get; set; } - - public void Query() - { - using (var systemKey = Registry.CurrentUser.OpenSubKey(SystemPoliciesKey)) - using (var desktopKey = Registry.CurrentUser.OpenSubKey(DesktopKey)) - using (var explorerKey = Registry.CurrentUser.OpenSubKey(ExplorerKey)) - using (var storageKey = Registry.LocalMachine.OpenSubKey(StoragePoliciesKey)) - using (var activeDesktopKey = Registry.CurrentUser.OpenSubKey(ActiveDesktopKey)) - { - LockWallpaper = activeDesktopKey.GetIntValue(NoChangingWallPaper) == 1; - WallpaperPath = systemKey.GetStringValue(Wallpaper) ?? desktopKey.GetStringValue(Wallpaper); - LockDesktop = systemKey.GetIntValue(NoDispCPL) == 1; - LockRegistryEditor = systemKey.GetIntValue(DisableRegistryTools) == 1; - LockTaskManager = systemKey.GetIntValue(DisableTaskMgr) == 1; - LockUsbCopying = storageKey.GetIntValue(WriteProtect) == 1; - LockControlPanel = explorerKey.GetIntValue(NoControlPanel) == 1; - } - } - - public void Apply() - { - using (var systemKey = Registry.CurrentUser.CreateSubKey(SystemPoliciesKey)) - using (var desktopKey = Registry.CurrentUser.CreateSubKey(DesktopKey)) - using (var explorerKey = Registry.CurrentUser.CreateSubKey(ExplorerKey)) - using (var storageKey = Registry.LocalMachine.CreateSubKey(StoragePoliciesKey)) - using (var activeDesktopKey = Registry.CurrentUser.CreateSubKey(ActiveDesktopKey)) - { - activeDesktopKey?.SetValue(NoChangingWallPaper, LockWallpaper ? 1 : 0, RegistryValueKind.DWord); - desktopKey?.SetValue(Wallpaper, WallpaperPath, RegistryValueKind.String); - systemKey?.SetValue(Wallpaper, WallpaperPath, RegistryValueKind.String); - systemKey?.SetValue(WallpaperStyle, 0, RegistryValueKind.DWord); - systemKey?.SetValue(NoDispCPL, LockDesktop ? 1 : 0, RegistryValueKind.DWord); - systemKey?.SetValue(DisableRegistryTools, LockRegistryEditor ? 1 : 0, RegistryValueKind.DWord); - systemKey?.SetValue(DisableTaskMgr, LockTaskManager ? 1 : 0, RegistryValueKind.DWord); - storageKey?.SetValue(WriteProtect, LockUsbCopying ? 1 : 0, RegistryValueKind.DWord); - explorerKey?.SetValue(NoControlPanel, LockControlPanel ? 1 : 0, RegistryValueKind.DWord); - } - } - } -} \ No newline at end of file diff --git a/src/KFlearning/Services/FlutterInstallService.cs b/src/KFlearning/Services/FlutterInstallService.cs index 5fcb266..d690c19 100644 --- a/src/KFlearning/Services/FlutterInstallService.cs +++ b/src/KFlearning/Services/FlutterInstallService.cs @@ -1,13 +1,11 @@ using System; -using System.Diagnostics; using System.IO; -using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; +using Castle.Core.Logging; using Ionic.Zip; using KFlearning.Core.API; -using KFlearning.Core.Extensions; using KFlearning.Core.Services; namespace KFlearning.Services @@ -30,6 +28,7 @@ public class FlutterInstallService : IFlutterInstallService { private readonly WebClient _webClient; private readonly IFlutterGitClient _flutterService; + private readonly ILogger _logger; private CancellationTokenSource _cancellationSource; private string _downloadPath = ""; @@ -41,12 +40,13 @@ public class FlutterInstallService : IFlutterInstallService public string FlutterVersion { get; private set; } public string InstallPath { get; set; } - public FlutterInstallService(IFlutterGitClient flutterService, WebClient webClient, IPathManager pathManager) + public FlutterInstallService(IFlutterGitClient flutterService, WebClient webClient, IPathManager pathManager, ILogger logger) { InstallPath = pathManager.GetPath(PathKind.FlutterInstallDirectory); _flutterService = flutterService; _webClient = webClient; + _logger = logger; _webClient.DownloadProgressChanged += WebClient_DownloadProgressChanged; } @@ -71,6 +71,7 @@ public void PreparationStep() try { FlutterVersion = await _flutterService.GetLatestFlutterVersion(); + _logger.DebugFormat("Flutter version is {0}", FlutterVersion); OnInstallReady(this, new FlutterInstallReadyEventArgs { Ready = true @@ -78,6 +79,7 @@ public void PreparationStep() } catch (Exception ex) { + _logger.Error("Can't check for Flutter version.", ex); OnInstallReady(this, new FlutterInstallReadyEventArgs { Ready = false,