1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Minor enhancements to the TclKit download tool.

FossilOrigin-Name: 75e31b1d56781fc4d28aea6c7f1393a18fd34870a5beb92df81c088d61351b4a
This commit is contained in:
mistachkin
2019-11-25 00:07:03 +00:00
parent a2f142d079
commit fe293347ac
3 changed files with 37 additions and 16 deletions

View File

@ -167,7 +167,8 @@ namespace GetFile
string fileName = Path.GetFileName(
Process.GetCurrentProcess().MainModule.FileName);
Console.WriteLine(String.Format("usage: {0} <uri>", fileName));
Console.WriteLine(String.Format(
"usage: {0} <uri> [fileName]", fileName));
}
///////////////////////////////////////////////////////////////////////
@ -336,7 +337,7 @@ namespace GetFile
return (int)ExitCode.MissingArgs;
}
if (args.Length != 1)
if ((args.Length < 1) || (args.Length > 2))
{
Error(null, true);
return (int)ExitCode.WrongNumArgs;
@ -355,15 +356,26 @@ namespace GetFile
}
//
// NOTE: Attempt to extract the file name portion of the URI we
// just created.
// NOTE: If a file name was specified on the command line, try to
// use it (without its directory name); otherwise, fallback
// to using the file name portion of the URI.
//
string fileName = GetFileName(uri);
string fileName = (args.Length == 2) ?
Path.GetFileName(args[1]) : null;
if (fileName == null)
if (String.IsNullOrEmpty(fileName))
{
Error("Could not extract the file name from the URI.", false);
return (int)ExitCode.BadFileName;
//
// NOTE: Attempt to extract the file name portion of the URI
// we just created.
//
fileName = GetFileName(uri);
if (fileName == null)
{
Error("Could not extract file name from URI.", false);
return (int)ExitCode.BadFileName;
}
}
//
@ -381,6 +393,15 @@ namespace GetFile
try
{
//
// HACK: For use of the TLS 1.2 security protocol because some
// web servers fail without it. In order to support the
// .NET Framework 2.0+ at compilation time, must use its
// integer constant here.
//
ServicePointManager.SecurityProtocol =
(SecurityProtocolType)0xC00;
using (WebClient webClient = new WebClient())
{
//