72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
using System;
|
|
|
|
namespace MyApp // Note: actual namespace depends on the project name.
|
|
{
|
|
internal class Program
|
|
{
|
|
protected static string dataFolder = "";
|
|
protected static string archFolder = "";
|
|
protected static string reqName = "request.json";
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
string myLine = "--------------------------------------";
|
|
logInfo(myLine);
|
|
logInfo("LiMan data transfer");
|
|
logInfo(myLine);
|
|
|
|
//verifico di avere parametro x directory con contenuto...
|
|
if (args == null || args.Count() < 2)
|
|
{
|
|
logError("Warning: Missing args !!!");
|
|
logError("");
|
|
logError("Syntax: LiMan.Transfer data_folder archive_folder");
|
|
logError("data_folder: path to container for request.json file + *.zip file(s) to upload");
|
|
logError("archive_folder: where to put trasferred data");
|
|
logError("");
|
|
}
|
|
else
|
|
{
|
|
// verifico primo parametro
|
|
dataFolder = args[0];
|
|
archFolder = args[1];
|
|
if (!Directory.Exists(dataFolder))
|
|
{
|
|
logError("Error! data directory not found. Exiting");
|
|
}
|
|
else
|
|
{
|
|
// quella archivio se non ci fosse la creo
|
|
if (!Directory.Exists(archFolder))
|
|
{
|
|
Directory.CreateDirectory(archFolder);
|
|
}
|
|
|
|
// cerco il file di conf x invio
|
|
string fileName = Path.Combine(dataFolder, reqName);
|
|
if (!File.Exists(fileName))
|
|
{
|
|
logError("Missing conf file!");
|
|
}
|
|
else
|
|
{
|
|
// deserializzo conf
|
|
logInfo($"Found file {fileName}");
|
|
// invio richiesta ticket
|
|
|
|
// effettuo file upload
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected static void logInfo(string message)
|
|
{
|
|
Console.WriteLine(message);
|
|
}
|
|
protected static void logError(string message)
|
|
{
|
|
Console.WriteLine($"!!! {message}");
|
|
}
|
|
}
|
|
} |