private int rhComparisonCommand(ITextCommand c1, ITextCommand c2) { return c1.ToString().CompareTo(c2.ToString()); }
private void module_CommandReceived(IModuleClient sender, ITextCommand c) { Command cmd = c as Command; if (c == null) return; // A command has been received so it is stored commandsPending.Produce(cmd); if (sender == virtualModule) Log.WriteLine(6, "<- [" + c.Source.Name + "]: " + c.ToString()); else Log.WriteLine(5, "<- [" + c.Source.Name + "]: " + c.ToString()); }
private ListViewItem CreateRedirectionListItem(ITextCommand command, ITextResponse response) { ListViewItem item; int index; if (command == null) { item = new ListViewItem("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Unknown#"); item.BackColor = Color.Red; return item; } if ((response == null) && (command.Response != null)) response = command.Response; item = new ListViewItem(command.ToString()); index = lvwRedirectionHistory.Items.Count; item.Tag = command; if (response != null) item.SubItems.Add(response.ToString()); else item.SubItems.Add("#Corrupt#"); item.SubItems.Add(command.Source.Name); item.SubItems.Add(command.Destination.Name); item.SubItems.Add(command.SentTime.ToString()); if (response != null) { item.SubItems.Add(response.ArrivalTime.ToString()); item.SubItems.Add(response.FailReason.ToString()); item.SubItems.Add((response.SentStatus == SentStatus.SentSuccessfull ? "Yes" : "No")); if (response.FailReason == ResponseFailReason.ExecutedButNotSucceded) { if (index % 2 == 0) item.BackColor = Color.Lime; else item.BackColor = Color.LightGreen; } else if (response.SentStatus != SentStatus.SentSuccessfull) { if (index % 2 == 0) item.BackColor = Color.LightYellow; else item.BackColor = Color.LightGoldenrodYellow; } else if (response.FailReason != ResponseFailReason.None) { if (index % 2 == 0) item.BackColor = Color.LightPink; else item.BackColor = Color.LightSalmon; } else { if (index % 2 == 0) item.BackColor = Color.White; else item.BackColor = Color.WhiteSmoke; } } else { item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Corrupt#"); item.SubItems.Add("#Unknown#"); } return item; }