Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                ParserResult <Options> result = Parser.Default.ParseArguments <Options>(args);
                if (result.Tag != ParserResultType.Parsed)
                {
                    throw new Exception("Invalid inputs!" + result.ToString());
                }

                Options options = ((Parsed <Options>)result).Value;

                if (options.EditCredentialsFile != null)
                {
                    string filepath = options.EditCredentialsFile;
                    EnterCredentialsMenu(filepath);
                }
                else if (options.SourcePath == null || options.SourcePath == "" || options.DestinationPath == null || options.DestinationPath == "")
                {
                    throw new Exception("Invalid inputs! Must provide source and destination folders!");
                }
                else
                {
                    PerformBackup(options);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }