public void Main( [Name(null), Alias(null)] string application, [Alias("src")] string source, [Alias("dest")] string destination, [Alias("inc")] string include, [Alias("exc")] string exclude, [Alias("reginc")] string regexInclude, [Alias("regexc")] string regexExclude) { this.Title = string.Format("Copy from {0} to {1}", source, destination); this.sourceText.Text = source; this.destinationText.Text = destination; ThreadPool.SetMaxThreads(30, 30); List<string> sources = new List<string>(); List<string> destinations = new List<string>(); if (!string.IsNullOrEmpty(include)) { foreach (string inc in include.Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries)) { sources.Add(System.IO.Path.Combine(source, inc)); destinations.Add(System.IO.Path.Combine(destination, inc)); } } if (sources.Count == 0) { sources.Add(source); destinations.Add(destination); } List<string> excludes = new List<string>(); if(!string.IsNullOrEmpty(exclude)) { foreach(string exc in exclude.Split(new char[]{','}, StringSplitOptions.RemoveEmptyEntries)) { excludes.Add(System.IO.Path.Combine(source, exc)); } } commandUI = new MultiThreadCopyCommandUI(sources.ToArray(), destinations.ToArray(), excludes.ToArray(), regexInclude, regexExclude, 10); commandUI.Command.Complete += new EventHandler(commandUI_Complete); commandUI.Command.Error += new EventHandler<GX.Patterns.ErrorEventArgs>(Command_Error); monitor = new MultiThreadCopyCommandProgressMonitor(commandUI.Command); gridContainer.Children.Add(commandUI); DispatcherTimer timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.ApplicationIdle, TimerUpdate, this.Dispatcher); }
void UpdateSpeed(MultiThreadCopyCommandProgressMonitor monitor, EventArgs e) { this.transferedText.Text = monitor.TransferedSize.FormatSize(); }