123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //using System;
- //using System.Collections.Generic;
- //using System.Globalization;
- //using System.IO;
- //using System.Text;
- //using System.Text.RegularExpressions;
- //namespace Ips.Library.Entity
- //{
- // public class AdcFile
- // {
- // public static string FolderFormatString = "yyyyMMdd_HH";
- // public static string FileTimeFormatString = "yyyyMMddHHmmss";
- // public static string DefaultFileNameFmt = "{0:yyyyMMddHHmmss}_T{1}_F{2}_B{3:###0000000}_N{4}.dat";
- // public AdcFile() { }
- // public AdcFile(
- // DateTime sigTime,
- // int chNum,
- // long freqPoint,
- // int bandWidth,
- // string sigName)
- // {
- // SigTime = sigTime;
- // ChNum = chNum;
- // FreqPoint = freqPoint;
- // BandWidth = bandWidth;
- // SigName = sigName;
- // }
- // /// <summary>
- // /// 信号时间
- // /// </summary>
- // public DateTime SigTime { get; set; }
- // /// <summary>
- // /// 通道编号
- // /// </summary>
- // public int ChNum { get; set; }
- // /// <summary>
- // /// 信号频点(Hz)
- // /// </summary>
- // public long FreqPoint { get; set; }
- // /// <summary>
- // /// 信号带宽(Hz)
- // /// </summary>
- // public int BandWidth { get; set; }
- // /// <summary>
- // /// 信号名称
- // /// </summary>
- // public string SigName { get; set; }
- // public string GetFolderName() => SigTime.ToString(FolderFormatString);
- // public virtual string GetFileName()
- // {
- // StringBuilder sb = new StringBuilder(SigTime.ToString(FileTimeFormatString));
- // if (ChNum > 0)
- // {
- // sb.AppendFormat("_T{0}", ChNum);
- // }
- // if (FreqPoint > 0)
- // {
- // sb.AppendFormat("_F{0}", FreqPoint);
- // }
- // if (BandWidth > 0)
- // {
- // sb.AppendFormat("_B{0:###0000000}", BandWidth);
- // }
- // if (!string.IsNullOrWhiteSpace(SigName))
- // {
- // sb.AppendFormat("_N{0}", SigName);
- // }
- // sb.Append(".dat");
- // return sb.ToString();
- // }
- // public string GetFullName(string rootDir)
- // {
- // string fullName;
- // string folderName = GetFolderName();
- // string fileName = GetFileName();
- // if (string.IsNullOrWhiteSpace(rootDir))
- // {
- // fullName = Path.Combine(folderName, fileName);
- // }
- // else
- // {
- // fullName = Path.Combine(rootDir, folderName, fileName);
- // }
- // return fullName;
- // }
- // public static AdcFile Parse(string fileName)
- // {
- // if (string.IsNullOrWhiteSpace(fileName)) return null;
- // var nameItems = fileName.Split("_", StringSplitOptions.RemoveEmptyEntries);
- // if (nameItems.Length == 0) return null;
- // var result = new AdcFile();
- // if (DateTime.TryParseExact(nameItems[0], FileTimeFormatString, CultureInfo.CurrentCulture, DateTimeStyles.None, out DateTime sigTime))
- // {
- // result.SigTime = sigTime;
- // }
- // foreach (var item in nameItems)
- // {
- // char key = item[0];
- // string val = item.Substring(1);
- // switch (key)
- // {
- // case 'T':
- // result.ChNum = int.TryParse(val, out int _chnum) ? _chnum : 0;
- // break;
- // case 'F':
- // result.FreqPoint = long.TryParse(val, out long _freqpoint) ? _freqpoint : 0;
- // break;
- // case 'B':
- // result.BandWidth = int.TryParse(val, out int _bandwidth) ? _bandwidth : 0;
- // break;
- // case 'N':
- // result.SigName = val;
- // break;
- // }
- // }
- // return result;
- // }
- // }
- //}
|