/// <summary> /// Picks latest label from the provided group and returns its name. /// </summary> /// <param name="Labels">Labels to chose from.</param> /// <param name="bVerifyContent">If the method should skip labels that has no tagged files in it.</param> /// <returns>The name of the label. If none was valid returns null.</returns> public static string PickLatest(P4Label[] Labels, bool bVerifyContent) { if (Labels.Length == 0) { return null; } var OrderedLabels = Labels.OrderByDescending((Label) => Label.Date); if (bVerifyContent) { foreach (var Label in OrderedLabels) { if (P4.ValidateLabelContent(Label.Name)) { return Label.Name; } } // Haven't found valid label. return null; } return OrderedLabels.First().Name; }
/// <summary> /// Prints the labels. /// </summary> /// <param name="Labels">Labels to print.</param> /// <param name="Ticks">Print ticks along with label name?</param> public void Print(P4Label[] Labels, bool Ticks) { foreach(var Label in Labels.OrderByDescending((Label) => Label.Date)) { Log(Label.Name + (Ticks ? (" " + Label.Date.Ticks.ToString()) : "")); } }