public void LoadSolutions() { Solutions = _slnDirInfo.GetFiles("*.sln").ToList(); if (!Solutions.Any()) { throw new InvalidOperationException("No .sln files found in specified directory."); } }
/// <summary> /// Attempts to add the given solution to the set. /// </summary> /// <param name="solution">Solution to add.</param> /// <returns>True if the solution was added. False otherwise.</returns> public bool SafeAdd(FuriganaSolution solution) { if (!solution.Check()) { // The specified solution is not valid. return(false); } if (Solutions.Any(s => s.Equals(solution))) { // We already have an equivalent solution. return(false); } // All is good. Solutions.Add(solution); return(true); }
public override string ToString() { if (!Solutions.Any()) { return("???"); } StringBuilder output = new StringBuilder(); for (int i = 0; i < Solutions.Count; i++) { FuriganaSolution a = Solutions[i]; if (i < Solutions.Count - 1) { output.Append(string.Format("{0}, ", a)); } else { output.Append(a.ToString()); } } return(output.ToString()); }
/// <summary> /// Gets a value indicating if the set contains at least one solution. /// </summary> public bool Any() { return(Solutions.Any()); }