示例#1
0
        private static void Progress(object sender, NCldrBuilderProgressEventArgs args)
        {
            if (args.ProgressEventType == ProgressEventType.Added)
            {
                if (displayMode == DisplayMode.Diagnostics)
                {
                    long objectSize = GetObjectSize(args.AddedObject);
                    Console.WriteLine(String.Format(": {0} bytes", objectSize));
                    sectionTotalObjectSizes += objectSize;
                }
            }
            else
            {
                if (args.Section != previousSection)
                {
                    if (displayMode == DisplayMode.Diagnostics && previousSection != null)
                    {
                        Console.WriteLine(string.Format("Total size: {0} bytes", sectionTotalObjectSizes));
                    }

                    Console.WriteLine(String.Empty);
                    if (args.ProgressEventType == ProgressEventType.Adding)
                    {
                        Console.WriteLine(args.Section + "s");
                    }
                    else
                    {
                        Console.WriteLine(args.Section);
                    }

                    sectionTotalObjectSizes = 0;
                }

                if (displayMode == DisplayMode.Diagnostics)
                {
                    Console.Write("    " + args.Item);
                }
                else if (displayMode == DisplayMode.Verbose)
                {
                    Console.WriteLine("    " + args.Item);
                }
                else
                {
                    Console.Write(".");
                }

                previousSection = args.Section;
            }
        }
示例#2
0
        private void Progress(object sender, NCldrBuilderProgressEventArgs args)
        {
            if (args.ProgressEventType != ProgressEventType.Added)
            {
                if (args.Section != previousSection)
                {
                    Console.WriteLine(String.Empty);
                    if (args.ProgressEventType == ProgressEventType.Adding)
                    {
                        Progress(args.Section + "s...");
                    }
                    else
                    {
                        Progress(args.Section + "...");
                    }
                }

                previousSection = args.Section;

                Application.DoEvents();
            }
        }