Пример #1
0
        public async void Check()
        {
            if (!CanCheck())
            {
                return;
            }

            IsRunning = true;
            try
            {
                await Task.Run(() =>
                {
                    var watch    = Stopwatch.StartNew();
                    var comparer = new Comparer(Configuration, (IProgressReporter)this);

                    AddMessage(string.Format("Comparing {0} files ", Submissions.Count));
                    var compareResult = comparer.Compare(Submissions.Select(i => i.Submission).ToArray());
                    AddMessage(string.Format("  finished; time: {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    AddMessage("Creating statistics");
                    var result  = OSPCResult.Create(compareResult);
                    var friends = new OSPC.FriendFinder(Configuration);
                    friends.Find(result, compareResult);
                    AddMessage(string.Format("  finished; time: {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    AddMessage("Creating reports");
                    var html = new OSPC.Reporter.Html.HtmlReporter(HtmlReportPath, (IProgressReporter)this);
                    html.Create(this.Configuration, result);
                    System.Diagnostics.Process.Start(System.IO.Path.Combine(html.OutPath, "index.html"));
                    AddMessage(string.Format("  finished in total {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    SaveUserSettings();
                });
            }
            finally
            {
                IsRunning = false;
            }
        }
Пример #2
0
        public async void Check()
        {
            if (!CanCheck()) return;

            IsRunning = true;
            try
            {
                await Task.Run(() =>
                {
                    var watch = Stopwatch.StartNew();
                    var comparer = new Comparer(Configuration, (IProgressReporter)this);

                    AddMessage(string.Format("Comparing {0} files ", Submissions.Count));
                    var compareResult = comparer.Compare(Submissions.Select(i => i.Submission).ToArray());
                    AddMessage(string.Format("  finished; time: {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    AddMessage("Creating statistics");
                    var result = OSPCResult.Create(compareResult);
                    var friends = new OSPC.FriendFinder(Configuration);
                    friends.Find(result, compareResult);
                    AddMessage(string.Format("  finished; time: {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    AddMessage("Creating reports");
                    var html = new OSPC.Reporter.Html.HtmlReporter(HtmlReportPath, (IProgressReporter)this);
                    html.Create(this.Configuration, result);
                    System.Diagnostics.Process.Start(System.IO.Path.Combine(html.OutPath, "index.html"));
                    AddMessage(string.Format("  finished in total {0:n2} sec.", watch.Elapsed.TotalSeconds));

                    SaveUserSettings();
                });
            }
            finally
            {
                IsRunning = false;
            }
        }