upd
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 17s

This commit is contained in:
2026-05-26 14:02:32 +03:00
parent bf51924adb
commit eb6235bd3e
41 changed files with 1509 additions and 61 deletions
+46
View File
@@ -0,0 +1,46 @@
using System.Net;
using System.Text;
namespace sync_time_hik
{
internal class Program
{
static async Task Main(string[] args)
{
#if DEBUG
args = new string[1];
args[0] = "172.16.50.13";
#endif
string baseUrlU = $"http://{args[0]}";
var credCacheU = new CredentialCache();
credCacheU.Add(new Uri(baseUrlU), "Digest", new NetworkCredential("admin", "4NUDZhJ7"));
using (var handler = new HttpClientHandler
{
Credentials = credCacheU,
ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true
})
using (var httpClient = new HttpClient(handler))
{
string requestUrl = $"{baseUrlU}/ISAPI/System/time";
string xmlBody = $@"<?xml version=""1.0"" encoding=""UTF-8""?><Time><timeMode>manual</timeMode><localTime>{DateTime.Now:yyyy-MM-ddTHH:mm:ss}</localTime><timeZone>CST-3:00:00</timeZone></Time>";
// Создаем контент для PUT запроса
var content = new StringContent(xmlBody, Encoding.UTF8, "application/xml");
// Выполняем PUT запрос
var response = await httpClient.PutAsync(requestUrl, content);
response.EnsureSuccessStatusCode();
var r = response.ReasonPhrase;
if (r.StartsWith("OK"))
{
Console.WriteLine("0");
}
else Console.WriteLine("1");
}
#if DEBUG
Console.ReadKey();
#endif
}
}
}
+10
View File
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>