public void AddLevel() { FMT newLevel = new FMT(LastLevel); newLevel.block = LastLevel.block; stack.Add(newLevel); }
public FMT(FMT a) { bold = a.bold; italic = a.italic; underline = a.underline; fontSize = a.fontSize; }
public void Read(BinaryReader input) { param_key_offset = input.ReadUInt16(); param_data_fmt = (FMT)input.ReadUInt16().SwapByteOrder(); param_data_len = input.ReadUInt32(); param_data_max_len = input.ReadUInt32(); param_data_offset = input.ReadUInt32(); }
public FMTChange RemoveLevel() { if (stack.Count > 1) { FMT last = LastLevel; stack.RemoveAt(stack.Count - 1); return(new FMTChange(last, LastLevel)); } else { LastLevel.bold = false; LastLevel.italic = false; LastLevel.fontSize = 24; } return(new FMTChange()); }
public FMTChange(FMT oldLevel, FMT newLevel) { if (oldLevel.bold != newLevel.bold) { boldChanged = true; bold = newLevel.bold; } if (oldLevel.italic != newLevel.italic) { italicChanged = true; italic = newLevel.italic; } if (oldLevel.fontSize != newLevel.fontSize) { fontSizeChanged = true; fontSize = newLevel.fontSize; } }
public void Read(BinaryReader input) { param_key_offset = input.ReadUInt16(); param_data_fmt = (FMT) input.ReadUInt16().SwapByteOrder(); param_data_len = input.ReadUInt32(); param_data_max_len = input.ReadUInt32(); param_data_offset = input.ReadUInt32(); }
void setlinecount() { int offset = 0; byte[] buffer = new byte[1024 * 1024]; var lineCount = 0; if (binary) { long length = basestream.Length; while (basestream.Position < length) { var ans = binlog.ReadMessageTypeOffset(basestream, length); if (ans.MsgType == 0 && ans.Offset == 0) { continue; } byte type = ans.Item1; messageindex[type].Add((uint)(ans.Item2)); messageindexline[type].Add((uint)lineCount); linestartoffset.Add((uint)(ans.Item2)); lineCount++; } _count = lineCount; // build fmt line database to pre seed the FMT message messageindexline[128].ForEach(a => dflog.FMTLine(this[(int)a])); } else { // first line starts at 0 linestartoffset.Add(0); long length = basestream.Length; while (basestream.Position < length) { offset = 0; long startpos = basestream.Position; int read = basestream.Read(buffer, offset, buffer.Length); while (read > 0) { if (buffer[offset] == '\n') { linestartoffset.Add((uint)(startpos + 1 + offset)); lineCount++; } offset++; read--; } } _count = lineCount; // create msg cache int b = 0; foreach (var item in this) { var idx = item.IndexOf(','); if (idx <= 0) { continue; } var msgtype = item.Substring(0, idx); if (msgtype == "FMT") { dflog.FMTLine(item); } if (dflog.logformat.ContainsKey(msgtype)) { var type = (byte)dflog.logformat[msgtype].Id; messageindex[type].Add(linestartoffset[b]); messageindexline[type].Add((uint)b); } b++; } } // build fmt line database using type foreach (var item in GetEnumeratorType("FMT")) { try { if (item.items == null || item.items.Length == 0) { continue; } FMT[int.Parse(item["Type"])] = ( int.Parse(item["Length"].Trim()), item["Name"].Trim(), item["Format"].Trim(), item.items.Skip(dflog.FindMessageOffset("FMT", "Columns")).Aggregate((s, s1) => s.Trim() + "," + s1.Trim()) .TrimStart(',')); dflog.FMTLine(this[item.lineno]); } catch { } } foreach (var item in GetEnumeratorType("FMTU")) { try { if (item.items == null || item.items.Length == 0) { continue; } FMTU[int.Parse(item["FmtType"])] = new Tuple <string, string>(item["UnitIds"].Trim(), item["MultIds"].Trim()); if (item["UnitIds"].Trim().Contains("#")) { InstanceType[int.Parse(item["FmtType"])] = (item["UnitIds"].Trim().IndexOf("#"), new List <string>()); } } catch { } } foreach (var b in InstanceType) { if (!FMT.ContainsKey(b.Key)) { continue; } int a = 0; foreach (var item in GetEnumeratorType(FMT[b.Key].name)) { var instancevalue = item.raw[b.Value.index + 1].ToString(); if (!b.Value.value.Contains(instancevalue)) { b.Value.value.Add(instancevalue); } if (a > 2000) { break; } a++; } } foreach (var item in GetEnumeratorType("UNIT")) { try { Unit[(char)int.Parse(item["Id"])] = item["Label"].Trim(); } catch { } } foreach (var item in GetEnumeratorType("MULT")) { try { Mult[(char)int.Parse(item["Id"])] = item["Mult"].Trim(); } catch { } } BuildUnitMultiList(); // used to set the firmware type foreach (var item in GetEnumeratorType(new[] { "MSG", "PARM" })) { // must be the string version to do the firmware type detection - binarylog var line = this[(int)item.lineno]; //Console.WriteLine(); } // try get gps time - when a dfitem is created and no valid gpstime has been establish the messages are parsed to get a valid gpstime // here we just force the parsing of gps messages to get the valid board time to gps time offset int gpsa = 0; foreach (var item in GetEnumeratorType(new[] { "GPS", "GPS2", "GPSB" })) { gpsa++; int status = 0; if (int.TryParse(item["Status"], out status)) { if (status >= 3) { break; } } // get first gps time if (gpsa > 2000) { break; } } indexcachelineno = -1; }
public void Write(EndianBinaryWriter er) { er.Write(Signature, Encoding.ASCII, false); FMT.Write(er); DATA.Write(er); }
public FMT(FMT a) { bold = a.bold; italic = a.italic; fontSize = a.fontSize; }