Exemple #1
0
        static void Main(string[] args)
        {
            //Spaces in string are separated in different args, so first arg tells how many spaces are in file path.
            //second arg is parent id
            //third arg and following args is connection string (splitted because it contains spaces)
            //couple last arg is file path
            var numberOfSpacesInFileName = Convert.ToInt32(args[0]);

            var parentProcessId = args[1];

            var filePath = "";

            for (var j = args.Length - 1; j >= args.Length - 1 - numberOfSpacesInFileName; j--)
            {
                filePath = args[j] + " " + filePath;
            }


            var connectionString = args[2];
            var i = 3;

            while (i < args.Length - 1 - numberOfSpacesInFileName)
            {
                connectionString += " " + args[i];
                i++;
            }

            var dataDeleter = new DataDeleter();
            var deleteQuery = dataDeleter.GetDeleteQuery(File.ReadAllText(filePath));

            var parent = Process.GetProcessById(Convert.ToInt32(parentProcessId));

            parent.WaitForExit();

            dataDeleter.ExecuteDeleteQuery(connectionString, deleteQuery);
        }