Exemplo n.º 1
0
 private static void GenerateTemplate(CompareScenario cs)
 {
     using (StreamWriter sw = new StreamWriter(cs.TemplateName))
     {
         sw.Write(Templates.CompareReportSettings.Replace("***TARGETDB***", cs.TargetDB).Replace("***TARGETSVR***", cs.TargetSvr).Replace("***SOURCEDB***", cs.SourceDB).Replace("***SOURCESVR***", cs.SourceSvr).Replace("***REPORTFILE***", cs.ReportPath));
     }
 }
Exemplo n.º 2
0
        private static void Compare(CompareScenario cs)
        {
            try
            {
                GenerateTemplate(cs);

                Console.WriteLine();
                Console.WriteLine("Comparing " + cs.TargetDB + " on " + cs.TargetSvr + " to " + cs.SourceDB + " on " + cs.SourceSvr + "...");
                ExecuteDBGhost(cs.TemplateName);
                CleanUp(cs.TemplateName);
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.Write(ex.Message);
                Console.WriteLine();
            }
        }
Exemplo n.º 3
0
        private static void FinalizeReport(CompareScenario cs)
        {
            try
            {
                if (File.Exists(cs.ReportPath))
                {
                    StringBuilder sb = new StringBuilder();
                    using (StreamReader sr = new StreamReader(cs.ReportPath))
                    {
                        string line = sr.ReadLine();
                        while (line != null)
                        {
                            if (!line.Contains("...Checking for"))
                            {
                                int start = line.IndexOf("...");
                                sb.AppendLine(line.Remove(0, start + 3).Replace("source:", cs.SourceDB + "|" + cs.SourceSvr + ":").Replace("target:", cs.TargetDB + "|" + cs.TargetSvr + ":").Replace(" the target ", " " + cs.TargetDB + "|" + cs.TargetSvr + " ").Replace(" the source ", " " + cs.SourceDB + "|" + cs.SourceSvr + " "));
                            }

                            line = sr.ReadLine();
                        }
                    }

                    Console.WriteLine();
                    Console.WriteLine("RESULTS:");
                    Console.WriteLine();
                    Console.Write(sb.ToString());
                    Console.WriteLine();

                    CleanUp(cs.ReportPath);
                }
                else
                {
                    Console.WriteLine();
                    Console.WriteLine("Could not find generated report file.  " + cs.ReportPath);
                    Console.WriteLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.Write(ex.Message);
                Console.WriteLine();
            }
        }