static void Main(string[] args)
        {
            string RootDirectory  = @"C:\Users\mpound\Desktop\140215";
            string ImageDirectory = RootDirectory;//RootDirectory.Remove(RootDirectory.LastIndexOf("\\"));

            Dictionary <string, string> FileTagMap = new Dictionary <string, string>();

            using (StreamReader strm = new StreamReader(RootDirectory + "\\mapped.txt"))
            {
                while (!strm.EndOfStream)
                {
                    string   line  = strm.ReadLine();
                    string[] parts = line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries);

                    string fullPath = ImageDirectory + "\\" + parts[0];

                    string cropPath = fullPath.Insert(fullPath.LastIndexOf("\\") + 1, "crop\\");


                    string tag = parts[1].Replace("\"", "");

                    FileTagMap.Add(fullPath, tag);
                }
            }

            #region DB connect and test
            byte[] key = Encoding.ASCII.GetBytes("ght29cj8f230f30d");
            byte[] IV  = Encoding.ASCII.GetBytes("a32fg32bnds2df90");
            byte[] enc = new byte[] { 138, 208, 147, 69, 17, 213, 75, 13, 125, 185, 237, 113, 181, 64, 221, 16 };

            ConnectionParams cp = new ConnectionParams()
            {
                Server   = "ssbmb.nottingham.ac.uk",
                Database = "arab_rootnav",
                Port     = "3306",
                Source   = ConnectionSource.MySQLDatabase,
                Username = "******",
                Password = "******"//DecryptStringFromBytes_Aes(enc, key, IV)
            };

            System.Console.Write("Connecting to database: ");

            MySQLDatabaseManager manager = new MySQLDatabaseManager();
            manager.Open(cp.ToMySQLConnectionString());


            string       imagesTableCheckString  = "SELECT TABLE_NAME as name FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" + manager.Connection.Database + "'";
            MySqlCommand imagesTableCheckCommand = new MySqlCommand(imagesTableCheckString, manager.Connection as MySqlConnection);
            bool         confirmedImageDB        = false;
            using (MySqlDataReader Reader = imagesTableCheckCommand.ExecuteReader())
            {
                while (Reader.Read())
                {
                    if (Reader["name"] as String == "images")
                    {
                        confirmedImageDB = true;
                    }
                }
            }

            if (manager.IsOpen)
            {
                System.Console.WriteLine("Done");
            }
            else
            {
                System.Console.WriteLine("Could not connect");
            }

            if (!confirmedImageDB)
            {
                Console.WriteLine("Updating database to include image table");

                string creationString = "CREATE TABLE IF NOT EXISTS images(" +
                                        "Tag CHAR(64) NOT NULL, " +
                                        "Stamp TIMESTAMP NOT NULL, " +
                                        "Image LONGBLOB, " +
                                        "CONSTRAINT pk_image_one PRIMARY KEY (Tag, Stamp) " +
                                        ") ENGINE=INNODB";

                MySqlCommand creationCommand = new MySqlCommand(creationString, manager.Connection as MySqlConnection);
                int          success         = creationCommand.ExecuteNonQuery();
            }

            #endregion

            foreach (var kvp in FileTagMap)
            {
                string file = kvp.Key;
                string tag  = kvp.Value;

                // if (file != @"I:\Michael\Savannah Rialto DH panel exps\RSDH08 (Marcus) HN vs LN\22\crop\10001.JPG") continue;

                if (tag != "#N/A")
                {
                    byte[] image = File.ReadAllBytes(file);
                    InjectImageIntoDB(tag, image, manager.Connection as MySqlConnection);
                    Console.WriteLine("Inserted " + tag);
                }
            }


            //byte[] jpg = File.ReadAllBytes(@"C:\Users\mpound\Desktop\0002.jpg");
            //string tag = "mp1,0002,test";

            /******************************/
        }