Ejemplo n.º 1
0
        /// <summary>
        /// Processes the given folder definition object, printing any warnings.
        /// </summary>
        /// <param name="fd">The folder definition to use.</param>
        /// <param name="con">The Oracle connection to use.</param>
        /// <param name="codeSourceDirectory">The CodeSource directory to compare with.</param>
        private static void ProcessFolderDefinition(FolderDefinition fd, OracleConnection con, DirectoryInfo codeSourceDirectory)
        {
            Console.WriteLine(@"
#################################################
# " + fd.Name + @"
# ");

            DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(codeSourceDirectory.FullName, fd.Directory));
            OracleCommand command = con.CreateCommand();

            command.CommandText = fd.LoadStatement;

            foreach (FileInfo fileInfo in dirInfo.GetFiles(fd.Extension, SearchOption.AllDirectories))
            {
                command.Parameters.Clear();
                command.Parameters.Add("filename", fileInfo.Name);
                OracleDataReader reader = command.ExecuteReader();
                if (!reader.Read())
                {
                    Console.WriteLine($"{fd.Name} {fileInfo.Name} is new.");
                    reader.Close();
                    continue;
                }

                string databaseContents = CleanXmlSource(reader.GetOracleClob(0).Value);
                string fileContents     = CleanXmlSource(File.ReadAllText(fileInfo.FullName));

                if (databaseContents != fileContents)
                {
                    Console.WriteLine($"{fd.Name} {fileInfo.Name} will be updated.");
                }

                reader.Close();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Processes the given folder definition object, printing any warnings.
        /// </summary>
        /// <param name="fd">The folder definition to use.</param>
        /// <param name="con">The Oracle connection to use.</param>
        /// <param name="codeSourceDirectory">The CodeSource directory to compare with.</param>
        private static void ProcessFolderDefinition(FolderDefinition fd, OracleConnection con, DirectoryInfo codeSourceDirectory)
        {
            Console.WriteLine(@"
            #################################################
            # " + fd.Name + @"
            # ");

            DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(codeSourceDirectory.FullName, fd.Directory));
            OracleCommand command = con.CreateCommand();
            command.CommandText = fd.LoadStatement;

            foreach (FileInfo fileInfo in dirInfo.GetFiles(fd.Extension, SearchOption.AllDirectories))
            {
                command.Parameters.Clear();
                command.Parameters.Add("filename", fileInfo.Name);
                OracleDataReader reader = command.ExecuteReader();
                if (!reader.Read())
                {
                    Console.WriteLine($"{fd.Name} {fileInfo.Name} is new.");
                    reader.Close();
                    continue;
                }

                string databaseContents = CleanXmlSource(reader.GetOracleClob(0).Value);
                string fileContents = CleanXmlSource(File.ReadAllText(fileInfo.FullName));

                if (databaseContents != fileContents)
                {
                    Console.WriteLine($"{fd.Name} {fileInfo.Name} will be updated.");
                }

                reader.Close();
            }
        }