private void cruncher_Progress(object sender, CruncherEventArgs e) { Cruncher cruncher = (Cruncher)sender; StringBuilder sb = new StringBuilder(); sb.AppendLine(Environment.NewLine + e.Result.FileName + " - using " + e.Result.Service); if (e.Result.HasError) { Output(e.Result.ErrorMessage); } else if (e.Result.SizeBefore > e.Result.SizeAfter) { sb.AppendLine("Before: " + e.Result.SizeBefore + " bytes"); sb.AppendLine("After: " + e.Result.SizeAfter + " bytes"); sb.AppendLine("Savings: " + e.Result.PercentSaved + "%"); optimized++; allBefore += e.Result.SizeBefore; allAfter += e.Result.SizeAfter; } else { sb.AppendLine("No optimization needed"); } Output(sb.ToString()); dte.StatusBar.Progress(true, e.Result.FileName, cruncher.Optimized, cruncher.Count); }
void cruncher_BeforeWritingFile(object sender, CruncherEventArgs e) { try { if (dte.SourceControl.IsItemUnderSCC(e.Result.FileName) && !dte.SourceControl.IsItemCheckedOut(e.Result.FileName)) { dte.SourceControl.CheckOutItem(e.Result.FileName); } } catch { // Do nothing } }