private static bool parseArgs(string[] args) { for (int x = 0; x < args.Length; x++) { if (args[x] == "-a") { op = Op.Add; } if (args[x] == "-D") { op = Op.Delete; } if (args[x] == "-z") { op = Op.ListZones; } if (args[x] == "-l") { op = Op.List; } if (args[x] == "-A") { recordType = RRType.A; } if (args[x] == "-T") { recordType = RRType.TXT; } if (args[x] == "-C") { recordType = RRType.CNAME; } if (args[x] == "-h") { host = args[x + 1]; } if (args[x] == "-d") { domain = args[x + 1]; } if (args[x] == "-v") { value = args[x + 1]; } if (args[x] == "-q") { quiet = true; } if (args[x] == "-t") { ttl = int.Parse(args[x + 1]); } } if (op == null) { Console.WriteLine("You must specify an operation (-a, -D, -z or -l)."); return(false); } if (op == Op.Add && (recordType == null || String.IsNullOrEmpty(host) || String.IsNullOrEmpty(domain) || String.IsNullOrEmpty(value))) { Console.WriteLine("To add you must specify the domain (-d), host (-h), type (-A, -T or -C) and value (-v)."); return(false); } if (op == Op.Delete && (String.IsNullOrEmpty(host) || String.IsNullOrEmpty(domain))) { Console.WriteLine("To delete you must specify the domain (-d) and host (-h)."); return(false); } if (op == Op.List && String.IsNullOrEmpty(domain)) { Console.WriteLine("To list you must specify the domain (-d)."); return(false); } return(true); }