public line(sub_string sub, Tuple<int, int>[] idx_in_line) { sub_ = sub; Debug.Assert(idx_in_line.Length == (int) info_type.max); string msg = sub.msg; // ... indexes a short can hold Debug.Assert(msg.Length < 65536); for (int part_idx = 0; part_idx < idx_in_line.Length; ++part_idx) { var index = idx_in_line[part_idx]; parts[part_idx * 2] = parts[part_idx * 2 + 1] = -1; if (index.Item1 >= 0) if ((index.Item2 >= 0 && msg.Length >= index.Item1 + index.Item2) || (index.Item2 < 0 && msg.Length >= index.Item1)) { short start, len; if (index.Item2 >= 0) { start = (short) index.Item1; len = (short) index.Item2; } else { start = (short) index.Item1; len = (short) (msg.Length - index.Item1); } bool needs_trim = part_idx != (int) info_type.msg; if (needs_trim) while (len > 0) if (Char.IsWhiteSpace(msg[start + len - 1])) --len; else break; parts[part_idx * 2] = start; parts[part_idx * 2 + 1] = len; } } // normalize time - so that we can do proper comparisons when "Go to Line" var time_str = part(info_type.time); if (time_str != "") time = util.str_to_normalized_time(time_str); }
private line() { sub_ = new sub_string(null, 0); }
public line(sub_string sub, Tuple <int, int>[] idx_in_line, DateTime time) { sub_ = sub; Debug.Assert(idx_in_line.Length == (int)info_type.max); string msg = sub.msg; // ... indexes a short can hold Debug.Assert(msg.Length < 32768); for (int part_idx = 0; part_idx < idx_in_line.Length; ++part_idx) { var index = idx_in_line[part_idx]; parts[part_idx * 2] = parts[part_idx * 2 + 1] = -1; if (index.Item1 >= 0) { if ((index.Item2 >= 0 && msg.Length >= index.Item1 + index.Item2) || (index.Item2 < 0 && msg.Length >= index.Item1)) { short start, len; if (index.Item2 >= 0) { start = (short)index.Item1; len = (short)index.Item2; } else { start = (short)index.Item1; len = (short)(msg.Length - index.Item1); } if (part_idx == (int)info_type.msg) { if (index.Item2 == -1) { // 1.8.4 - allow merging several lines into one (that is, merging line X+1 to X; in this case, // the length needs to be "variable") len = -1; } } bool needs_trim = part_idx != (int)info_type.msg; if (needs_trim) { while (len > 0) { if (Char.IsWhiteSpace(msg[start + len - 1])) { --len; } else { break; } } } parts[part_idx * 2] = start; parts[part_idx * 2 + 1] = len; } } } if (time != DateTime.MinValue) { this.time = time; } else { // normalize time - so that we can do proper comparisons when "Go to Line" var time_str = part(info_type.time); var date_str = part(info_type.date); if (time_str != "") { this.time = util.str_to_normalized_datetime(date_str, time_str); } } }
public line(sub_string sub, Tuple <int, int>[] idx_in_line) : this(sub, idx_in_line, DateTime.MinValue) { }
public line(sub_string sub, Tuple<int, int>[] idx_in_line) : this(sub, idx_in_line, DateTime.MinValue) { }
public line(sub_string sub, Tuple<int, int>[] idx_in_line, DateTime time ) { sub_ = sub; Debug.Assert(idx_in_line.Length == (int) info_type.max); string msg = sub.msg; // ... indexes a short can hold Debug.Assert(msg.Length < 32768); for (int part_idx = 0; part_idx < idx_in_line.Length; ++part_idx) { var index = idx_in_line[part_idx]; parts[part_idx * 2] = parts[part_idx * 2 + 1] = -1; if (index.Item1 >= 0) if ((index.Item2 >= 0 && msg.Length >= index.Item1 + index.Item2) || (index.Item2 < 0 && msg.Length >= index.Item1)) { short start, len; if (index.Item2 >= 0) { start = (short) index.Item1; len = (short) index.Item2; } else { start = (short) index.Item1; len = (short) (msg.Length - index.Item1); } if ( part_idx == (int)info_type.msg) if (index.Item2 == -1) // 1.8.4 - allow merging several lines into one (that is, merging line X+1 to X; in this case, // the length needs to be "variable") len = -1; bool needs_trim = part_idx != (int) info_type.msg; if (needs_trim) while (len > 0) if (Char.IsWhiteSpace(msg[start + len - 1])) --len; else break; parts[part_idx * 2] = start; parts[part_idx * 2 + 1] = len; } } if (time != DateTime.MinValue) this.time = time; else { // normalize time - so that we can do proper comparisons when "Go to Line" var time_str = part(info_type.time); var date_str = part(info_type.date); if (time_str != "") this.time = util.str_to_normalized_datetime(date_str, time_str); } }