public ge_search findSearchTerms(ge_search dic, string table, ge_log_workbook wb, string[] sheets) { List <ge_search> gs_wb = new List <ge_search>(); foreach (string sheet in sheets) { ge_search gs_ws = findSearchTerms(dic, table, wb, sheet); gs_wb.Add(gs_ws); } ge_search gs_ret = new ge_search(); gs_ret.name = "logger header created:" + DateTime.Now; foreach (ge_search gs in gs_wb) { foreach (search_item si in gs.search_items) { gs_ret.search_items.Add(si); } search_table st = gs.search_tables.Where(e => e.name.Contains(table)).FirstOrDefault(); if (st != null) { gs_ret.search_tables.Add(st); } } gs_ret.SplitItemsToArrayItems(); gs_ret.setFoundTableValues(); return(gs_ret); }
public int data_start_row(int NotFoundVal = -1) { search_table st = st = search_tables[0]; if (st == null) { return(-1); } int line_start = find_row("data_start", NotFoundVal); if (line_start == NotFoundVal) { line_start = find_row(st.header.search_item_name, NotFoundVal); // line_start = line_start + 1; } if (line_start == NotFoundVal) { line_start = find_row("header", NotFoundVal); line_start = line_start + 1; } return(line_start); }
public value_header getFoundHeader(string db_name, int table = 0) { search_table st = search_tables[table]; value_header db_col = st.headers.Find(c => c.found != NOT_FOUND && c.db_name == db_name); return(db_col); }
private int findChannelCol(search_table st, string[] array_names = null) { int colChannel = NOT_FOUND; array_item ai2 = null; if (array_items == null) { return(NOT_FOUND); } if (array_names == null) { array_names = new string [] { "CalibrationFactors", "Logger channel" }; } foreach (string array_name in array_names) { ai2 = array_items.Find(a => a.name == array_name); if (ai2 != null) { break; } } if (ai2 == null) { return(NOT_FOUND); } foreach (value_header vh in st.headers) { for (int i = 0; i < ai2.values.Length; i++) { if (ai2.values[i] != null) { if (vh.name == ai2.values[i]) { colChannel = i; break; } } } } return(colChannel); }
public void setFoundTableValues(search_table st = null) { if (array_items == null) { return; } if (st == null) { if (search_tables.Count >= 1) { st = search_tables[0]; } else { return; } } int colChannel = findChannelCol(st); if (colChannel == NOT_FOUND && st.array_offset != NOT_FOUND) { colChannel = st.array_offset; } if (colChannel == NOT_FOUND) { return; } foreach (array_item ai in array_items) { foreach (search_item si in search_items) { if (si.name == ai.name && ai.values.Length >= colChannel) { si.value2 = ai.values[colChannel]; } } } }