/// <summary> /// 构建第一行 /// </summary> /// <param name="Sp3Section"></param> /// <returns></returns> public static string BuildFirstLineSp3(Sp3Section Sp3Section) { StringBuilder sb = new StringBuilder(); sb.Append("* "); sb.Append(Sp3Section.Time.Year //四位数的年 + " " + Sp3Section.Time.Month.ToString("00") + " " + Sp3Section.Time.Day.ToString("00") + " " + Sp3Section.Time.Hour.ToString("00") + " " + Sp3Section.Time.Minute.ToString("00") + " " + Sp3Section.Time.Second.ToString("00.00000000")); return(sb.ToString()); }
/// <summary> /// 写入缓存 /// </summary> /// <param name="section"></param> public void Write(Sp3Section section) { //如果没有内容,且文件不存在,则先写入头部 if (StringBuilder.Length == 0 && !File.Exists(FilePath)) { this.StringBuilder.Append(HeaderText); } StringBuilder.AppendLine(BuildFirstLineSp3(section)); foreach (var record in section) { StringBuilder.Append(BuildSp3Record(record, "V")); } }