public Host(HostInfo info, Config config, PuttyProfile profile) { Info = info; _config = config; _profile = profile; _puttyLink = new PuttyLink(Info, config, profile); }
public PuttyLink(HostInfo host, Config config, PuttyProfile profile) { if (host == null) throw new ArgumentNullException("host"); if (config == null) throw new ArgumentNullException("config"); if (profile == null) throw new ArgumentNullException("profile"); Host = host; _config = config; _profile = profile; }
public static void Main(string[] args) { /*var enc = CryptoHelper.EncryptStringAes("Hello, World!...", "qwerty7"); var ret = CryptoHelper.DecryptStringAes(enc, "qwerty7");*/ // We can run single instance only here based on Visual Studio // Project Settings. So initialize instance to null here. Process instance = null; // If we are supposed to, check to see if we are the only instance of this // program running. if (Settings.Default.StartSingleInstanceOnly) instance = RunningInstance(); // If we are the only running instance of this program then continue. if (instance == null) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var startUpArgs = parseArgs(args); var startUpDlg = new StartUpDialog(); if (startUpDlg.DialogRequired && startUpDlg.ShowDialog() == DialogResult.Cancel) return; // Apply config var cfg = new Config { RestartEnabled = Settings.Default.Config_RestartEnabled, MaxAttemptsCount = Settings.Default.Config_MaxAttemptsCount, RestartDelay = Settings.Default.Config_RestartDelay, DelayInsteadStop = Settings.Default.Config_AfterMaxAttemptsMakeDelay, RestartHostsWithWarnings = Settings.Default.Config_RestartHostsWithWarnings, RestartHostsWithWarningsInterval = Settings.Default.Config_RestartHostsWithWarningsInterval }; Logger.SetThresholdForAppender(HostLogDelegateAppender, Settings.Default.Config_TraceDebug ? Level.Debug : Level.Info); var hm = new HostsManager<HostViewModel>(cfg, startUpDlg.Storage, startUpDlg.Filename, startUpDlg.Password); bool firstStart = true; // changeSource request handling while (true) { var mainForm = new MainForm(hm, firstStart && startUpArgs.Minimized); firstStart = false; Application.Run(mainForm); if (mainForm.ChangeSourceRequested) { startUpDlg = new StartUpDialog(); if (startUpDlg.ShowDialog() == DialogResult.Cancel) { return; } hm = new HostsManager<HostViewModel>( cfg, startUpDlg.Storage, startUpDlg.Filename, startUpDlg.Password); } else { break; } } } else { // We are not the only running instance of this program. So do this. HandleRunningInstance(instance); } }