This commit is contained in:
CortexCore 2024-04-29 11:34:11 +08:00
commit 4db0176004
17 changed files with 1282 additions and 0 deletions

575
.gitignore vendored Normal file
View File

@ -0,0 +1,575 @@
# ---> Unity
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Recordings can get excessive in size
/[Rr]ecordings/
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
*.app
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
# ---> JetBrains
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# ---> VisualStudio
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
# custom
.idea
.plastic
.vscode
/Assets/StreamingAssets/yoo
yoo/
Bundles/
Profiler/

175
samples/idis_query.json Normal file
View File

@ -0,0 +1,175 @@
{
"message": "success",
"status": 1,
"data": {
"prefixType": 4,
"metaDataInfo": {
"industryCategory": "制造业",
"industrySpecific": "通用设备制造业",
"itemVOS": [
{
"minLength": "0",
"enName": "productName",
"type": "string",
"chName": "产品名称",
"maxLength": "200"
},
{
"minLength": "0",
"enName": "batchNo",
"type": "string",
"chName": "批次号",
"maxLength": "100"
},
{
"minLength": "0",
"enName": "categoryName",
"type": "string",
"chName": "应用行业",
"maxLength": "100"
},
{
"minLength": "0",
"enName": "remark",
"type": "string",
"chName": "产品简介",
"maxLength": "500"
},
{
"minLength": "0",
"enName": "CPU",
"type": "string",
"chName": "CPU",
"maxLength": "50"
},
{
"minLength": "0",
"enName": "RAMROM",
"type": "string",
"chName": "内存",
"maxLength": "50"
},
{
"minLength": "0",
"enName": "Interface",
"type": "string",
"chName": "接口",
"maxLength": "50"
},
{
"minLength": "0",
"enName": "screenName",
"type": "string",
"chName": "显示屏",
"maxLength": "100"
},
{
"minLength": "0",
"enName": "positionSystem",
"type": "string",
"chName": "定位系统",
"maxLength": "100"
},
{
"minLength": "0",
"enName": "temperature",
"type": "string",
"chName": "工作温度",
"maxLength": "100"
}
],
"prefix": "88.111.1315",
"name": "工业级手持PDA",
"description": "适用于工业级手持PDA描述产品的规格特性",
"id": 3744,
"version": "工业级手持PDA",
"createDate": "2023-09-05 17:21:57",
"entName": "中国信息通信院"
},
"pmsReg": true,
"titleBarInfo": {
"count": "764",
"handle": "88.111.1315/PX2R217049T1",
"type": 4
},
"idData": [
{
"index": 0,
"type": "string",
"name": "标识",
"realVal": "88.111.1315/PX2R217049T1",
"references": null
},
{
"index": 2,
"type": "string",
"name": "产品名称",
"realVal": "工业级手持终端PDA-ATUPX200",
"references": null
},
{
"index": 3,
"type": "string",
"name": "批次号",
"realVal": "ATU-PX200MI04",
"references": null
},
{
"index": 4,
"type": "string",
"name": "应用行业",
"realVal": "制造业",
"references": null
},
{
"index": 5,
"type": "string",
"name": "产品简介",
"realVal": "工业级手持PDA现场采集的优质智能工具适用于仓储、零售、生产制造、物流等场景助力企业数字化快速进阶。",
"references": null
},
{
"index": 6,
"type": "string",
"name": "CPU",
"realVal": "Cortex™-A53八核2.0GHz",
"references": null
},
{
"index": 7,
"type": "string",
"name": "内存",
"realVal": "4GB+64GB",
"references": null
},
{
"index": 8,
"type": "string",
"name": "接口",
"realVal": "Type-c接口",
"references": null
},
{
"index": 9,
"type": "string",
"name": "显示屏",
"realVal": "4英寸工业级耐低温IPS显示屏",
"references": null
},
{
"index": 10,
"type": "string",
"name": "定位系统",
"realVal": "GPS、北斗、GLONASS",
"references": null
},
{
"index": 11,
"type": "string",
"name": "工作温度",
"realVal": "-20℃至+50℃",
"references": null
}
]
}
}

View File

@ -0,0 +1,8 @@
{
"handle": "88.123.99/202404281606",
"templateVersion": "1.0",
"value": {
"key1": "value1",
"key2": "value2"
}
}

17
src/IDIS.Model.asmdef Normal file
View File

@ -0,0 +1,17 @@
{
"name": "IDIS.Model",
"rootNamespace": "",
"references": [
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
"GUID:f51ebe6a0ceec4240a699833d6309b23"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

14
src/Models/IDIS_Code.cs Normal file
View File

@ -0,0 +1,14 @@
namespace IDIS.Models
{
/// <summary>
/// IDIS的编码常量
/// </summary>
public static class IDIS_Code
{
/// <summary>
/// 标识码的正则表达式,例如88.123.99/CN20230915
/// </summary>
public const string AddressRegex = @"^\d{1,3}\.\d{1,3}\.\d{1,3}/[A-Za-z0-9]{1,32}$";
public const string Prefix = @"^\d{1,3}\.\d{1,3}\.\d{1,3}$";
}
}

26
src/Models/IDIS_Data.cs Normal file
View File

@ -0,0 +1,26 @@
using System;
using Newtonsoft.Json;
namespace IDIS.Models
{
public record IDIS_Data
{
[JsonProperty("prefixType")]
public int PrefixType { get; set; }
[JsonProperty("metaDataInfo")]
public IDIS_MetaDataInfo MetaDataInfo { get; set; } = new();
[JsonProperty("pmsReg")]
public bool PmsReg { get; set; }
[JsonProperty("titleBarInfo")]
public TitleBarInfo TitleBarInfo { get; set; } = new();
[JsonProperty("IdData")]
public IDIS_IdData[] IdData { get; set; }=Array.Empty<IDIS_IdData>();
}
}

52
src/Models/IDIS_IdData.cs Normal file
View File

@ -0,0 +1,52 @@
using System;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace IDIS.Models
{
/// <summary>
/// 标识的格式
/// </summary>
[Serializable]
public class IDIS_IdData
{
public IDIS_IdData(int index,string type,string name, string realVal)
{
Index = index;
Type = type;
Name = name;
RealVal = realVal;
}
/// <summary>
/// 索引,通常用于排序
/// </summary>
[JsonProperty("index")]
public int Index { get; set; }
/// <summary>
/// 记录的名称,通常为中文
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary>
/// 值类型,例如string,url,site
/// </summary>
[JsonProperty("type")]
public string Type { get; set; }
/// <summary>
/// 值
/// </summary>
[JsonProperty("realVal")]
public string RealVal { get; set; }
/// <summary>
/// 值的引用
/// </summary>
[JsonProperty("references")]
public string[] References { get; set; } = Array.Empty<string>();
}
}

View File

@ -0,0 +1,28 @@
using Newtonsoft.Json;
namespace IDIS.Models
{
public class IDIS_ItemVOS
{
public IDIS_ItemVOS(string minLength, string enName, string type, string chName, string maxLength)
{
MinLength = minLength;
EnName = enName;
Type = type;
ChName = chName;
MaxLength = maxLength;
}
[JsonProperty("minLength")]
public string MinLength { get; set; }
[JsonProperty("enName")]
public string EnName { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("chName")]
public string ChName { get; set; }
[JsonProperty("maxLength")]
public string MaxLength { get; set; }
}
}

View File

@ -0,0 +1,28 @@
using System;
using Newtonsoft.Json;
namespace IDIS.Models
{
public class IDIS_MetaDataInfo
{
public IDIS_MetaDataInfo()
{
}
public IDIS_MetaDataInfo(string industryCategory, string industrySpecific)
{
IndustryCategory = industryCategory;
IndustrySpecific = industrySpecific;
}
[JsonProperty("industryCategory")]
public string IndustryCategory { get; set; } = nameof(IndustryCategory);
[JsonProperty("industrySpecific")]
public string IndustrySpecific { get; set; } = nameof(IndustrySpecific);
[JsonProperty("itemVOS")]
public IDIS_ItemVOS[] ItemVOS { get; set; } = Array.Empty<IDIS_ItemVOS>();
}
}

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace IDIS.Models;
/// <summary>
/// 用于序列化的注册数据结构
/// </summary>
public class IDIS_Register_Data
{
[JsonProperty("handle")]
public required string Handle;
[JsonProperty("templateVersion")]
public required string TemplateVersion;
[JsonProperty("value")]
public required Dictionary<string, object> Value;
}

106
src/Models/IDIS_Response.cs Normal file
View File

@ -0,0 +1,106 @@
using System;
using IDIS.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace IDIS
{
public class IDIS_Response
{
public static IDIS_Response CreateFromJson(string json)
{
var value = new IDIS_Response();
var jObject = JObject.Parse(json);
if(jObject.TryGetValue(nameof(Message), out var message))
value.Message = message.Value<string>();
if(jObject.TryGetValue(nameof(Status), out var status))
value.Status = status.Value<int>();
value.jObject = jObject;
return value;
}
public static IDIS_Response CreateFromJsonAs<T>(string json)
{
var value = CreateFromJson(json);
try
{
if (value.jObject is not null && value.Status is 1 && value.jObject.TryGetValue("data", out var data))
{
value.Data = data.ToObject<T>();
}
}
catch (Exception)
{
return value;
}
return value;
}
public IDIS_Response()
{
}
public IDIS_Response(string message)
{
Message = message;
}
public IDIS_Response(object data)
{
Data = data;
}
public IDIS_Response(string message, object data)
{
Message = message;
Data = data;
}
public IDIS_Response(string message,int status, object data)
{
Message = message;
Status = status;
Data = data;
}
public IDIS_Response(string message,Enum status, object data)
{
Message = message;
Status =(int)Convert.ChangeType(status,typeof(int));
Data = data;
}
/// <summary>
/// 信息
/// </summary>
[JsonProperty("message")]
public string Message { get; set; } = "success";
[JsonProperty("status")]
public int Status { get; set; } = 1;
[JsonProperty("data")]
public object Data { get; set; } = true;
[JsonIgnore] private JObject jObject;
public T As<T>()
{
if (Data is T value)
{
return value;
}
throw new InvalidOperationException("Data is not of type T");
}
public bool TryAs<T>(out T value)
{
switch (Data)
{
case T _value:
value = _value;
return true;
case null when jObject?.TryGetValue("data", out var data) is true:
value = data.Value<T>();
return true;
default:
value = default!;
return false;
}
}
}
}

View File

@ -0,0 +1,49 @@
using System;
using Newtonsoft.Json;
namespace IDIS.Models
{
/// <summary>
/// 标识模板
/// </summary>
public class IDIS_Template
{
public IDIS_Template()
{
}
public IDIS_Template(string prefix, string version)
{
Prefix = prefix;
Version = version;
}
/// <summary>
/// 前缀,例如 88.123.99
/// <para>必填</para>
/// </summary>
[JsonProperty("prefix")]
public string Prefix { get; set; } = nameof(IDIS_Template);
/// <summary>
/// 模板版本
/// <para>必填</para>
/// </summary>
[JsonProperty("version")]
public string Version { get; set; } = "alpha-1.0";
/// <summary>
/// 描述
/// <para>非必填</para>
/// </summary>
[JsonProperty("description")]
public string Description { get; set; } = string.Empty;
/// <summary>
/// 模板内容
/// <para>必填</para>
/// </summary>
[JsonProperty("items")]
public IDIS_Template_Item[] Items { get; set; } = Array.Empty<IDIS_Template_Item>();
}
}

View File

@ -0,0 +1,24 @@
using System;
using Newtonsoft.Json;
namespace IDIS.Models
{
/// <summary>
/// 基于IDIS v1的标识模板值
/// </summary>
public class IDIS_Template_Item
{
public IDIS_Template_Item(){}
public IDIS_Template_Item(string name,string idType)
{
Name = name;
IdType = idType;
}
[JsonProperty("name")]
public string Name { get; set; } = string.Empty;
[JsonProperty("idType")]
public string IdType { get; set; } = string.Empty;
[JsonProperty("metaData")]
public IDIS_Template_Item_MetaData[] MetaData { get; set; } = Array.Empty<IDIS_Template_Item_MetaData>();
}
}

View File

@ -0,0 +1,23 @@
using System;
using Newtonsoft.Json;
namespace IDIS
{
public class IDIS_Template_Item_MetaData
{
public IDIS_Template_Item_MetaData()
{
}
public IDIS_Template_Item_MetaData(string type)
{
Type = type;
}
[JsonProperty("type")] public string Type { get; set; } = nameof(String);
[JsonProperty("minLength")]
public int MinLength { get; set; }
[JsonProperty("maxLength")]
public int MaxLength { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using Newtonsoft.Json;
namespace IDIS.Models
{
public class TitleBarInfo
{
public TitleBarInfo()
{
Handle = $"88.123.99/{DateTime.Now.Ticks}";
}
public TitleBarInfo(string handle)
{
Handle = handle;
}
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("handle")]
public string Handle { get; set; }
[JsonProperty("type")]
public int Type { get; set; }
}
}

View File

@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using IDIS.Models;
namespace IDIS.Services
{
/// <summary>
/// 标识解析节点的接口定义,包括了:增删改查,连接状态的回调
/// </summary>
public interface IDIS_Service
{
/// <summary>
/// 已连接到服务的回调
/// </summary>
event Action OnConnected;
/// <summary>
/// 连接失败的回调
/// </summary>
event Action<string> OnConnectFailure;
/// <summary>
/// 断开连接的回调
/// </summary>
event Action OnDisconnected;
/// <summary>
/// 基于标识模板注册标识
/// </summary>
/// <param name="handle">标识码</param>
/// <param name="templateVersion">标识模板</param>
/// <param name="value">值,通常为字典</param>
/// <returns></returns>
UniTask<IDIS_Response> RegisterAsync(string handle, string templateVersion,IDictionary<string,object> value);
/// <summary>
/// 异步删除标识
/// </summary>
/// <param name="code">标识码</param>
/// <returns>是否删除成功</returns>
UniTask<IDIS_Response> DeleteAsync(string code);
/// <summary>
/// 异步删除标识
/// </summary>
/// <param name="code">标识码</param>
/// <param name="index">标识索引</param>
/// <returns></returns>
UniTask<IDIS_Response> DeleteIdDataAsync(string code, int index);
/// <summary>
/// 更新标识值
/// </summary>
/// <param name="code">标识码</param>
/// <param name="value">需要更新的标识列表</param>
/// <returns></returns>
UniTask<IDIS_Response> UpdateAsync(string code, IDictionary<string,object> value);
/// <summary>
/// 异步解析标识
/// </summary>
/// <param name="code">标识码</param>
/// <returns><see cref="IDIS_Response"/></returns>
UniTask<IDIS_Response> QueryAsync(string code);
/// <summary>
/// 标识码是否已注册
/// </summary>
/// <param name="code">标识码</param>
/// <returns>是否已注册</returns>
UniTask<bool> IsExistAsync(string code);
}
}

View File

@ -0,0 +1,44 @@
using System;
using Cysharp.Threading.Tasks;
using IDIS.Models;
namespace IDIS.Services
{
/// <summary>
/// 标识模板服务
/// </summary>
public interface IDIS_TemplateService
{
event Action<IDIS_Template> OnTemplateCreated;
event Action<IDIS_Template> OnTemplateDeleted;
/// <summary>
/// 查询数据模板
/// </summary>
/// <param name="prefix">前缀</param>
/// <param name="version">模板版本</param>
/// <returns></returns>
UniTask<IDIS_Response> QueryAsync(string prefix, string version);
/// <summary>
/// 获取所有数据模板
/// </summary>
/// <returns></returns>
UniTask<IDIS_Response> ToArrayAsync();
/// <summary>
/// 保存数据模板
/// <para>模板不存在时为会新增模板信息</para>
/// </summary>
/// <param name="template">模板信息</param>
/// <returns></returns>
UniTask<IDIS_Response> SaveAsync(IDIS_Template template);
/// <summary>
/// 删除数据模板
/// </summary>
/// <param name="prefix"></param>
/// <param name="version"></param>
/// <returns></returns>
UniTask<IDIS_Response> DeleteAsync (string prefix, string version);
}
}