public override string ToString() { const string format = "{0} -----> {1}"; if (!FileName.EndsWithAny(styleExtensions)) { return(Phrase.HasValue() ? format.FormatWith(Phrase, DisplayPath) : FileName); } if (!Phrase.HasValue()) { return(FileName); } var splittedDisplayPath = DisplayPath.Split('\\'); if (splittedDisplayPath.Length <= 4) { return(format.FormatWith(Phrase, DisplayPath)); } var path = splittedDisplayPath.Skip(splittedDisplayPath.Length - 3).Aggregate((a, b) => a + "\\" + b); return(format.FormatWith(Phrase, path)); }
public override string ToString() { if (FileName.EndsWithAny(new[] { ".less", ".css", ".scss" })) { if (Phrase.HasValue() == false) { return(FileName); } var splittedDisplayPath = DisplayPath.Split('\\'); if (splittedDisplayPath.Length == 4 || splittedDisplayPath.Length < 4) { return("{0} -----> {1}".FormatWith(Phrase, DisplayPath)); } else { var path = splittedDisplayPath.Skip(splittedDisplayPath.Length - 3).Aggregate((a, b) => a + "\\" + b); return("{0} -----> {1}".FormatWith(Phrase, path)); } } else { return(Phrase.HasValue() ? "{0} -----> {1}".FormatWith(Phrase, DisplayPath) : FileName); } }
public int CompareTo(Item other) { if (ReferenceEquals(this, other)) { return(0); } if (ReferenceEquals(null, other)) { return(1); } var extension1 = Path.GetExtension(FullPath)?.ToLower(); var extension2 = Path.GetExtension(other.FullPath)?.ToLower(); if (extension1 == null || extension2 == null) { return(0); } var result = string.Compare(extension1, extension2, StringComparison.CurrentCultureIgnoreCase); if (result == 0) { var a = HasSearchKeywordInFileName(Words, FullPath); var b = HasSearchKeywordInFileName(other.Words, other.FullPath); if (a && b) { if (Phrase.HasValue() == other.Phrase.HasValue()) { if (this.IsMSharp() == other.IsMSharp()) { result = string.Compare(FullPath, other.FullPath, StringComparison.Ordinal); } else { return(this.IsMSharp() ? -1 : 1); } } else { return(Phrase.HasValue() ? -1 : 1); } } else if (a) { return(-1); } else { return(1); } } else if (styleExtensions.Contains(extension1) || styleExtensions.Contains(extension2)) { return(extension1.EndsWith(".css") && (extension2.EndsWithAny(styleExtensions)) ? 1 : -1); } return(result); }