|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using Flurl.Http;
|
|
|
|
|
|
|
|
|
|
|
|
#region << 版 本 注 释 >>
|
|
|
|
|
|
/*--------------------------------------------------------------------
|
|
|
|
|
|
* 版权所有 (c) 2026 WenJY 保留所有权利。
|
|
|
|
|
|
* CLR版本:4.0.30319.42000
|
|
|
|
|
|
* 机器名称:T14-GEN3-7895
|
|
|
|
|
|
* 命名空间:Sln.Wcs.HikRoBotSdk.Config
|
|
|
|
|
|
* 唯一标识:c1ac02e9-7ad4-4356-8043-2cf04a09ede8
|
|
|
|
|
|
*
|
|
|
|
|
|
* 创建者:WenJY
|
|
|
|
|
|
* 电子邮箱:
|
|
|
|
|
|
* 创建时间:2026-02-25 14:42:08
|
|
|
|
|
|
* 版本:V1.0.0
|
|
|
|
|
|
* 描述:
|
|
|
|
|
|
*
|
|
|
|
|
|
*--------------------------------------------------------------------
|
|
|
|
|
|
* 修改人:
|
|
|
|
|
|
* 时间:
|
|
|
|
|
|
* 修改说明:
|
|
|
|
|
|
*
|
|
|
|
|
|
* 版本:V1.0.0
|
|
|
|
|
|
*--------------------------------------------------------------------*/
|
|
|
|
|
|
#endregion << 版 本 注 释 >>
|
|
|
|
|
|
namespace Sln.Wcs.HikRoBotSdk.Config
|
|
|
|
|
|
{
|
|
|
|
|
|
public class HikRoBotConfig
|
|
|
|
|
|
{
|
|
|
|
|
|
public readonly string api = "";
|
|
|
|
|
|
public readonly string contentType = "";
|
|
|
|
|
|
public readonly string userAgent="";
|
|
|
|
|
|
public readonly string xlrRequestId="";//随机生成
|
|
|
|
|
|
public readonly string xlrVersion="";
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 注入海康 SDK 配置参数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="configuration"></param>
|
|
|
|
|
|
/// <exception cref="Exception"></exception>IConfiguration configuration
|
|
|
|
|
|
public HikRoBotConfig(IConfiguration configuration)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (string.IsNullOrEmpty(configuration["HikRoBot_Url"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("HikRoBot_Url 配置不正确,请检查Apollo配置.");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(configuration["HikRoBot_Content-Type"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("HikRoBot_Content-Type 配置不正确,请检查Apollo配置.");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(configuration["HikRoBot_User-Agent"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("HikRoBot_User-Agent 配置不正确,请检查Apollo配置.");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(configuration["HikRoBot_X-lr-version"]))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("HikRoBot_X-lr-version 配置不正确,请检查Apollo配置.");
|
|
|
|
|
|
}
|
|
|
|
|
|
api = configuration["HikRoBot_Url"];
|
|
|
|
|
|
contentType = configuration["HikRoBot_ContentType"];
|
|
|
|
|
|
userAgent = configuration["HikRoBot_User-Agent"];
|
|
|
|
|
|
xlrVersion = configuration["HikRoBot_X-lr-version"];
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|