123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ToolsClassLibrary
- {
- /// <summary>
- /// 传输数据 配置文件管理
- /// </summary>
- /// <typeparam name="T"></typeparam>
- [Serializable]
- public class SocketData<T>
- {
- /// <summary>
- /// 文件名
- /// </summary>
- public string FileKey
- {
- get;
- set;
- }
- /// <summary>
- /// string 测点ID
- /// double 测点数据
- /// </summary>
- public Dictionary<string,T> FileData
- {
- get;
- set;
- }
- /// <summary>
- /// 创建类本身
- /// </summary>
- /// <param name="fileName">CSV文件名</param>
- /// <param name="key">测点ID</param>
- /// <param name="val">测点数据</param>
- /// <returns></returns>
- public static SocketData<T> CreateUpdData(string fileName, string[] key, T[] val)
- {
- SocketData<T> date = new SocketData<T>();
- if (key.Length == val.Length)
- {
- date.FileKey = fileName;
- date.FileData = new Dictionary<string, T>();
- for (int i = 0; i < key.Length; i++)
- {
- date.FileData.Add(key[i], val[i]);
- }
- }
- return date;
- }
- }
- }
|