Update 20260717
This commit is contained in:
+35
-8
@@ -1,29 +1,54 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace APICLI
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static string logfile = "";
|
||||
static string errorlog = "";
|
||||
static string oklog = "";
|
||||
static string loglevel = "";
|
||||
static void WriteLog (string message, string filename, int erroor)
|
||||
{
|
||||
switch (loglevel.ToUpper())
|
||||
{
|
||||
case "ALL":
|
||||
}
|
||||
message=DateTime.Now.ToString("yyyyMMdd_HHmms") + "_" + message;
|
||||
System.IO.File.WriteAllText(filename,message);
|
||||
Console.WriteLine (message);
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
DirectoryInfo d = new DirectoryInfo(args[0].ToString());
|
||||
string ApiUrl = Properties.Settings.Default.resturi + args[0].ToString();
|
||||
|
||||
logfile = args[1].ToString();
|
||||
errorlog = args[2].ToString();
|
||||
oklog = args[3].ToString();
|
||||
loglevel = args[4].ToString();
|
||||
|
||||
FileInfo[] files = d.GetFiles("*.json");
|
||||
foreach (FileInfo file in files)
|
||||
{
|
||||
WriteLog("Processing file: " + file.FullName, logfile, 0);
|
||||
try
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
// 🔐 Bearer Token
|
||||
string json = System.IO.File.ReadAllText(args[1].ToString());
|
||||
string ApiUrl = Properties.Settings.Default.resturi + args[0].ToString();
|
||||
|
||||
|
||||
string json = System.IO.File.ReadAllText(file.FullName.ToString());
|
||||
client.DefaultRequestHeaders.Accept.Clear();
|
||||
client.DefaultRequestHeaders.Accept.Add(
|
||||
new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
@@ -54,6 +79,8 @@ namespace APICLI
|
||||
// Logging
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user