// Apply button on properties tab private void ApplyButton_Click(object sender, EventArgs e) { if (this.configChanged && changedConfigs.Count > 0) { SetUnsetConfig r = TaskHandlers.SetConfig(changedConfigs); if (r.Error == String.Empty) { DisplayMessageBox.Info("Properties configured: " + String.Join(",", r.Properties), "CodeReady Containers - Settings Applied"); } else { DisplayMessageBox.Error(r.Error); } } if (this.configsNeedingUnset.Count > 0) { SetUnsetConfig r = TaskHandlers.UnsetConfig(configsNeedingUnset); if (r.Error == String.Empty) { DisplayMessageBox.Info("Properties unset: " + String.Join(",", r.Properties), "CodeReady Containers - Settings Applied"); } else { DisplayMessageBox.Error(r.Error); } } // Load the configs again and reset the change trackers getConfigurationAndResetChanged(); }
public static long SizeInBytes(string path) { long size = 0; var dirInfo = new DirectoryInfo(path); try { foreach (FileInfo fi in dirInfo.GetFiles("*", SearchOption.AllDirectories)) { size += fi.Length; } } catch (Exception e) { DisplayMessageBox.Error(string.Format("Unexpected Error, did you run 'crc setup'? Error: {0}", e.Message)); } return(size); }
private void StartDaemon() { var process = new Process(); process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.FileName = string.Format("{0}\\{1}\\crc.exe", Environment.GetEnvironmentVariable("ProgramW6432"), @"CodeReady Containers"); #if DEBUG process.StartInfo.FileName = string.Format("{0}\\bin\\crc.exe", Environment.GetEnvironmentVariable("GOPATH")); #endif process.StartInfo.Arguments = @"daemon --watchdog"; process.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); Console.WriteLine(process.StartInfo.FileName); try { process.Start(); System.IO.StreamWriter daemonStdinWriter = process.StandardInput; } catch (Exception e) { DisplayMessageBox.Error(string.Format("Cannot start the daemon, Check the logs and restart the application, Error: {0}", e.Message)); QuitApp(); } process.WaitForExit(); if (process.ExitCode == 2) { DisplayMessageBox.Error("Setup incomplete, Open a terminal, run 'crc setup', and start again this application."); } else { DisplayMessageBox.Error("Daemon crashed, check the logs and restart the application"); } QuitApp(); }