Advtools.ADVpki.Program.ParseCommandLine C# (CSharp) Метод

ParseCommandLine() приватный статический Метод

private static ParseCommandLine ( string args ) : ProgramOptions
args string
Результат ProgramOptions
        private static ProgramOptions ParseCommandLine(string[] args)
        {
            ProgramOptions options = new ProgramOptions();
            if(!options.ParseCommandLine(args))
                return null;

            if(string.IsNullOrWhiteSpace(options.AuthorityName) && options.Usage != CertificatesAuthority.Usage.Authority)
            {
                Console.WriteLine("Invalid name of the certificate authority");
                Console.WriteLine();
                options.ShowUsage();
                return null;
            }

            if(string.IsNullOrWhiteSpace(options.CertificateName) && string.IsNullOrWhiteSpace(options.Pkcs10File))
            {
                Console.WriteLine("Please provide a name for the certificate or the name of a PKCS#10 file");
                Console.WriteLine();
                options.ShowUsage();
                return null;
            }

            if(!string.IsNullOrWhiteSpace(options.CertificateName) && !string.IsNullOrWhiteSpace(options.Pkcs10File))
            {
                Console.WriteLine("Please provide either a name for the certificate or the name of a PKCS#10 file but not both");
                Console.WriteLine();
                options.ShowUsage();
                return null;
            }

            return options;
        }