Пример #1
0
 internal static void InitializeDateAttributeSilent(TDMSAttributes attributes, string name, string value)
 {
     try {
         InitializeDateAttribute(attributes, name, value);
     }
     catch (Exception ex) {
         LogManager.GetLogger("TdmsContext.InitializeDateAttributeSilent").Debug($"Error. attName: {name}, value: {value}, ex: {ex.Message}, stack: {ex.StackTrace}");
     }
 }
Пример #2
0
        internal static void InitializeDateAttribute(TDMSAttributes attributes, string name, string value)
        {
            var attribute = attributes[name];

            if (attribute == null)
            {
                return;
            }
            attribute.Value = Convert.ToDateTime(value);
        }
 /// <summary>
 /// Invokes TdmsAttribute from TDMSAttributes collection by name in silent mode
 /// </summary>
 /// <param name="attributes">source TDMSAttributes collection</param>
 /// <param name="name">goal AttributeDefName to be found</param>
 /// <returns></returns>
 public static TDMSAttribute GetAttributeSilent(TDMSAttributes attributes, string name)
 {
     try
     {
         return(GetAttribute(attributes, name));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Пример #4
0
        internal static void InitializeAttribute(TDMSAttributes attributes, string name, string value)
        {
            var attr = attributes.FirstOrDefault(a => a.AttributeDefName.Equals(name));

            try {
                if (attr != null)
                {
                    attr.Value = value;
                }
            }
            catch (Exception) {
                LogManager.GetLogger("TdmsContext.InitializeAttribute").Debug($"Error. attName: {name}, value: {value}");
            }
        }
        public static string GetAttributeValueAsString(TDMSAttributes attributes, string name)
        {
            var attribute = GetAttributeSilent(attributes, name);

            if (attribute == null)
            {
                return(string.Empty);
            }

            var value = attribute.Value;

            if (value == null)
            {
                return(string.Empty);
            }

            return(attribute.Value.ToString());
        }
Пример #6
0
        internal static void InitializeDateAttributeBycicle(TDMSAttributes attributes, string name, string value)
        {
            var date = Utility.ConvertToDateTime(value);

            attributes[name].Value = date;
        }
 /// <summary>
 /// Invokes TdmsAttribute from TDMSAttributes collection by name
 /// </summary>
 /// <param name="attributes">source TDMSAttributes collection</param>
 /// <param name="name">goal AttributeDefName to be found</param>
 /// <returns></returns>
 public static TDMSAttribute GetAttribute(TDMSAttributes attributes, string name)
 {
     return(attributes.FirstOrDefault(attr => attr.AttributeDefName.Equals(name)));
 }
Пример #8
0
 public TdmsCorrectionActionsFactoryFromTdmsObject(TDMSObject tdmsObject, NppMaps nppMaps)
 {
     this.tdmsObject = tdmsObject;
     NppMaps         = nppMaps;
     this.attributes = this.tdmsObject.Attributes;
 }