protected void add_info(string info_name, INFO_TYPE info_type) { if (!_info_table.ContainsKey(info_name)) { _info_table.Add(info_name, new info(info_name, info_type)); } }
public info(string name, INFO_TYPE info_type) { this.name = name; this.info_type = info_type; if (info_type == INFO_TYPE.MULTI_LINE_STRING) { _multiline = new Queue <string>(); } }
public static INFO_TYPE what(Queue <string> val) { INFO_TYPE retval = INFO_TYPE.INVALID; int string_line_cnt = 0; foreach (var line in val) { string trimmed_line = line.Trim(); if (trimmed_line.Length > 0) { string_line_cnt++; } } if (1 == string_line_cnt) { string trimmed_line = ""; foreach (var line in val) { trimmed_line = line.Trim(); if (trimmed_line.Length > 0) { break; } } // double.TryParse can parse both long and double. // Thus, it tries long type first. if (long.TryParse(trimmed_line, out long long_result)) { retval = INFO_TYPE.LONG; } // and then, it tries double else if (double.TryParse(trimmed_line, out double double_result)) { retval = INFO_TYPE.DOUBLE; } } // If it fails to parse it long / double type, // it is multiline string. if (INFO_TYPE.INVALID == retval) { retval = INFO_TYPE.MULTI_LINE_STRING; } return(retval); }
public static extern IntPtr SlmGetInfoEasy( SLM_HANDLE_INDEX SlmHandle, INFO_TYPE InfoType, INFO_FORMAT_TYPE Format);