コード例 #1
0
        internal static void PrepareComparerNavigation(KnowledgeBase KB, IOutputService output)
        {
            string title = "KBDoctor - Prepare Comparer Navigation Files";

            output.StartSection("KBDoctor", title);
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            string directoryArg = Utility.NvgComparerDirectory(KB);
            string fechahora    = String.Format("{0:yyyy-MM-dd-HHmm}", DateTime.Now);
            string newDir       = directoryArg + @"\NVG-" + fechahora + @"\";

            try
            {
                Directory.CreateDirectory(newDir);
                Utility.WriteXSLTtoDir(KB);
                string   pathspcdir = Utility.SpcDirectory(KB);
                string[] paths      = Directory.GetDirectories(Utility.SpcDirectory(KB), "NVG", System.IO.SearchOption.AllDirectories);
                foreach (string d in paths)
                {
                    KBDoctorOutput.Message("Procesando directorio: " + d);
                    string generator = d.Replace(Utility.SpcDirectory(KB), "");
                    generator = generator.Replace("NVG_", "");
                    generator = @"\" + generator.Replace(@"\", "_") + "_";
                    generator = generator.Replace("NVG_", "");

                    ProcesoDir(KB, d, newDir, generator, output);
                }

                stopWatch.Stop();
                // Get the elapsed time as a TimeSpan value.
                TimeSpan ts = stopWatch.Elapsed;

                // Format and display the TimeSpan value.
                string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                                                   ts.Hours, ts.Minutes, ts.Seconds,
                                                   ts.Milliseconds / 10);

                KBDoctorOutput.Message(title + " elepsed time: " + elapsedTime);
                output.EndSection("KBDoctor", title, true);
            }
            catch (Exception e) {
                output.AddErrorLine(e.Message);
            }
        }