private static void PrintResults(WinSCP.SynchronizationResult result) { Log(string.Format("Sync complete : Downloads {0} : Uploads {1} : Removed {2} : Failures {3}", result.Downloads.Count, result.Uploads.Count, result.Removals.Count, result.Failures.Count)); }
private static bool ParseSync(string[] args) { if (args.Contains("connect")) { _settings = new SyncSettings(); if (!args.Contains("-n")) { SyncStorage.LoadSettings(_settings); } Connect(); return(true); } if (_sync != null && _sync.IsConnected) { if (args.Contains("disconnect")) { Disconnect(); Log("Session disconnected!"); return(true); } if (args.Contains("execute") | args.Contains("exec") | args.Contains("->")) { return(ParseArguments(args, (x) => { var result = _sync.Execute(x); Log(string.Format(result.IsSuccess ? string.Format("({0}>\"{1}\")", _settings.Hostname, (result.Output != null ? result.Output : "")) : "Execution Failed: \"{0}\"", result.ErrorOutput), result.IsSuccess ? SyncLog.LogType.Info : SyncLog.LogType.Error); })); } if (args.Contains("sync")) { return(ParseArguments(args, (x) => { if (x.Length == 3) { WinSCP.SynchronizationResult result = null; if (x.Contains("--local")) { result = _sync.Synchronize(WinSCP.SynchronizationMode.Local, x[1], x[2], x.Length == 4 ? x[3] : ""); } if (x.Contains("--remote")) { } if (x.Contains("--both")) { } PrintResults(result); } else { Log("Command: \"sync -l\" has missing parameters!", SyncLog.LogType.Error); } })); } } return(false); }