//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; // } // /// // /// 信号时间 // /// // public DateTime SigTime { get; set; } // /// // /// 通道编号 // /// // public int ChNum { get; set; } // /// // /// 信号频点(Hz) // /// // public long FreqPoint { get; set; } // /// // /// 信号带宽(Hz) // /// // public int BandWidth { get; set; } // /// // /// 信号名称 // /// // 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; // } // } //}