mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-02 02:44:41 +00:00
Refactor confused format detection method names
This commit is contained in:
@@ -33,13 +33,13 @@ public class FormatDetector
|
||||
//new DockerfileDetector(),
|
||||
];
|
||||
|
||||
public static IConfusedFormatDetector ResolveConfusedFormat(string path, string text)
|
||||
public static IFormatDetector Confuse(string path, string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text)) return null;
|
||||
|
||||
return Instance.TextDetectors
|
||||
.Where(detector => detector is IConfusedFormatDetector && detector.Detect(path, text))
|
||||
.FirstOrDefault() as IConfusedFormatDetector;
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public static IFormatDetector Detect(string path, string text)
|
||||
|
@@ -49,7 +49,7 @@ public class HighlightingThemeManager
|
||||
var useFormatDetector = SettingHelper.Get("UseFormatDetector", true, "QuickLook.Plugin.TextViewer");
|
||||
var highlightingTheme = GetDefinitionByExtension(nameof(Dark), extension);
|
||||
|
||||
if (useFormatDetector && FormatDetector.ResolveConfusedFormat(path, text) is IConfusedFormatDetector confusedFormatDetector)
|
||||
if (useFormatDetector && FormatDetector.Confuse(path, text) is IFormatDetector confusedFormatDetector)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(confusedFormatDetector.Extension))
|
||||
{
|
||||
@@ -77,7 +77,7 @@ public class HighlightingThemeManager
|
||||
}
|
||||
}
|
||||
|
||||
// Unsupported highlighting
|
||||
// The unsupported highlighting will be fallback to not highlighted text
|
||||
highlightingTheme ??= GetDefinitionByExtension(nameof(Dark), ".txt")
|
||||
?? GetDefinitionByExtension(nameof(Light), ".txt")
|
||||
?? HighlightingTheme.Default;
|
||||
|
Reference in New Issue
Block a user