private void OpenFile(string filename) { var file = new W3StringFile(); try { var stream = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read)); file.Read(stream); stream.Close(); } catch (Exception) { return; } foreach (var item in file.block1) { if (!Lines.ContainsKey(item.str_id)) { Lines.Add(item.str_id, new List <W3StringBlock1>()); } Lines[item.str_id].Add(item); } foreach (var item in file.block2) { if (!Keys.ContainsKey(item.str_id)) { Keys.Add(item.str_id, true); } } }
private void OpenFile(string filename) { var file = new W3StringFile(); try { var stream = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read)); file.Read(stream); stream.Close(); } catch (Exception) { //MessageBox.Show(string.Format("There was an error trying to open {0}.", filename), "Opening file failed."); return; } foreach (var item in file.block1) { if (!Lines.ContainsKey(item.str_id)) { Lines.Add(item.str_id, new List <W3StringBlock1>()); } Lines[item.str_id].Add(item); } foreach (var item in file.block2) { if (!Keys.ContainsKey(item.str_id)) { Keys.Add(item.str_id, true); } } }
private Line CreateLine(int key) { Debug.AssertFormat(!Lines.ContainsKey(key), "Could not create line: {0}", key); Line value = new Line(); Lines.Add(key, value); return(value); }
public int GetTotalLines(OperationGroups operation) { if (!Lines.ContainsKey(operation)) { return(0); } return(Lines[operation].Values.Sum()); }
public double GetSpeedLinesPerHour(OperationGroups operation) { if (!Lines.ContainsKey(operation)) { return(0.0); } return(Lines[operation].Values.Sum() / OperationTimes[operation].TotalHours); }
public string GetString(uint id) { if (Lines != null && Lines.ContainsKey(id)) { var list = Lines[id]; return(list[list.Count - 1].str); } return(null); }
private void SetLine(int key, Line value) { Debug.AssertFormat(Lines.ContainsKey(key), "Could not set line: {0}", key); if (value == null) { Lines.Remove(key); } else { Lines[key] = value; } }
public void AddLine(DateTime timestamp, int lineNumber, int messageId) { var timestampGroup = new DateTime(timestamp.AddSeconds(-(timestamp.Second)).Ticks); if (Lines.ContainsKey(timestampGroup)) { Lines[timestampGroup].Add(new ParsedLine(lineNumber, messageId, timestamp)); } else { Lines[timestampGroup] = new List <ParsedLine>(); Lines[timestampGroup].Add(new ParsedLine(lineNumber, messageId, timestamp)); } }
private Line FindLine(int key) { return(Lines.ContainsKey(key) ? Lines[key] : null); }