/* * DTS.Export.File.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using System; using System.Collections.Generic; using System.Text; using DTS.Common.Utilities; using DTS.Common.Utilities.DotNetProgrammingConstructs; namespace DTS.Serialization { /// /// Basic representation of a DTS export file. /// public abstract partial class File : Exceptional { /// /// property controling whether to adjust filtered data by one sample or not /// this is used by various write methods which in turn call the actual filtered method /// TDC when it software filters ends up including an extra sample, this preserves that behavior /// public static bool UseLegacyTDCSoftwareFiltering { get; set; } = false; public int DefaultEncoding { get; set; } = Encoding.UTF8.CodePage; public Common.Enums.IsoViewMode ISOViewMode { get; set; } /// /// Initialize an instance of the DTS.Export.File class. /// /// /// /// The format name of this file. /// /// public File(string formatName) { try { FormatName = formatName; } catch (System.Exception ex) { throw new Exception("encountered problem constructing " + GetType().FullName, ex); } } /// /// Get the string name of this file's format. /// public string FormatName { get => _FormatName.Value; private set => _FormatName.Value = value; } private readonly Property _FormatName = new Property( typeof(File).Name + ".File.FormatName", null, false ); /// /// Get/set the base export directory path for events. /// public static string BaseExportDirectory { get => _BaseExportDirectory.Value; set => _BaseExportDirectory.Value = value; } private static readonly Property _BaseExportDirectory = new Property( typeof(File).Namespace + ".BaseExportDirectory", null, false ); /// /// If the specified path string doesn't end with a backslash, add one. /// /// /// /// The path to be trailing-backslash checked. /// /// /// /// The original path if it already ended with a backslash; /// otherwise, the original path string appended with a backslash. /// /// protected string EnsureTrailingBackslashOnPathString(string path) { try { return path.EndsWith("\\", StringComparison.OrdinalIgnoreCase) ? path : path + "\\"; } catch (System.Exception ex) { throw new Exception("encountered problem trailing backslash on path string " + (null != path ? "\"" + path + "\"" : "<>") + " to valid standard path string", ex); } } private readonly Dictionary _EUUnfilteredDataForLinearizedChannels = new Dictionary(); public virtual void SetEUData(string channelID, FilteredData fd) { _EUUnfilteredDataForLinearizedChannels[channelID] = fd; } public virtual FilteredData GetEUData(string channelID) { return _EUUnfilteredDataForLinearizedChannels[channelID]; } public virtual int GetChannelNumberFromChannelFileName(string channelFileName) { return -1; } //19044 overridden in TDAS.File and SliceRaw.File } }