Skip to content

Commit 96afa29

Browse files
TheBestPessimistTheBestPessimist
authored andcommitted
cleanup + warnings
1 parent 9debba9 commit 96afa29

File tree

1 file changed

+19
-29
lines changed

1 file changed

+19
-29
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ public static string GetPathWithActionKeyword(string path, ResultType type, stri
3838

3939
var keyword = usePathSearchActionKeyword ? pathSearchActionKeyword : searchActionKeyword;
4040

41-
var formatted_path = path;
41+
var formattedPath = path;
4242

4343
if (type == ResultType.Folder)
4444
// the separator is needed so when navigating the folder structure contents of the folder are listed
45-
formatted_path = path.EndsWith(Constants.DirectorySeparator) ? path : path + Constants.DirectorySeparator;
45+
formattedPath = path.EndsWith(Constants.DirectorySeparator) ? path : path + Constants.DirectorySeparator;
4646

47-
return $"{keyword}{formatted_path}";
47+
return $"{keyword}{formattedPath}";
4848
}
4949

5050
public static string GetAutoCompleteText(string title, Query query, string path, ResultType resultType)
@@ -70,7 +70,7 @@ internal static Result CreateFolderResult(string title, string subtitle, string
7070
{
7171
return new Result
7272
{
73-
Title = title + _addScoreInDebug(score),
73+
Title = title,
7474
IcoPath = path,
7575
SubTitle = subtitle,
7676
AutoCompleteText = GetAutoCompleteText(title, query, path, ResultType.Folder),
@@ -109,7 +109,6 @@ internal static Result CreateDriveSpaceDisplayResult(string path, string actionK
109109
var progressBarColor = "#26a0da";
110110
var title = string.Empty; // hide title when use progress bar,
111111
var driveLetter = path[..1].ToUpper();
112-
var driveName = driveLetter + ":\\";
113112
DriveInfo drv = new DriveInfo(driveLetter);
114113
var freespace = ToReadableSize(drv.AvailableFreeSpace, 2);
115114
var totalspace = ToReadableSize(drv.TotalSize, 2);
@@ -130,7 +129,7 @@ internal static Result CreateDriveSpaceDisplayResult(string path, string actionK
130129
Score = 500,
131130
ProgressBar = progressValue,
132131
ProgressBarColor = progressBarColor,
133-
Action = c =>
132+
Action = _ =>
134133
{
135134
_openFolder(path);
136135
return true;
@@ -145,7 +144,7 @@ private static string ToReadableSize(long pDrvSize, int pi)
145144
{
146145
int mok = 0;
147146
double drvSize = pDrvSize;
148-
string Space = "Byte";
147+
string space = "Byte";
149148

150149
while (drvSize > 1024.0)
151150
{
@@ -154,23 +153,23 @@ private static string ToReadableSize(long pDrvSize, int pi)
154153
}
155154

156155
if (mok == 1)
157-
Space = "KB";
156+
space = "KB";
158157
else if (mok == 2)
159-
Space = " MB";
158+
space = " MB";
160159
else if (mok == 3)
161-
Space = " GB";
160+
space = " GB";
162161
else if (mok == 4)
163-
Space = " TB";
162+
space = " TB";
164163

165-
var returnStr = $"{Convert.ToInt32(drvSize)}{Space}";
164+
var returnStr = $"{Convert.ToInt32(drvSize)}{space}";
166165
if (mok != 0)
167166
{
168167
returnStr = pi switch
169168
{
170-
1 => $"{drvSize:F1}{Space}",
171-
2 => $"{drvSize:F2}{Space}",
172-
3 => $"{drvSize:F3}{Space}",
173-
_ => $"{Convert.ToInt32(drvSize)}{Space}"
169+
1 => $"{drvSize:F1}{space}",
170+
2 => $"{drvSize:F2}{space}",
171+
3 => $"{drvSize:F3}{space}",
172+
_ => $"{Convert.ToInt32(drvSize)}{space}"
174173
};
175174
}
176175

@@ -202,11 +201,11 @@ internal static Result CreateOpenCurrentFolderResult(string path, string actionK
202201

203202
internal static Result CreateFileResult(string filePath, Query query, int score = 0, bool windowsIndexed = false)
204203
{
205-
Result.PreviewInfo preview = IsMedia(Path.GetExtension(filePath))
204+
Result.PreviewInfo preview = _isMedia(Path.GetExtension(filePath))
206205
? new Result.PreviewInfo { IsMedia = true, PreviewImagePath = filePath, }
207206
: Result.PreviewInfo.Default;
208207

209-
var title = Path.GetFileName(filePath) + _addScoreInDebug(score);
208+
var title = Path.GetFileName(filePath);
210209

211210
var result = new Result
212211
{
@@ -250,7 +249,7 @@ internal static Result CreateFileResult(string filePath, Query query, int score
250249
return result;
251250
}
252251

253-
public static bool IsMedia(string extension)
252+
private static bool _isMedia(string extension)
254253
{
255254
if (string.IsNullOrEmpty(extension))
256255
{
@@ -302,16 +301,7 @@ private static void _incrementEverythingRunCounterIfNeeded(string fileOrFolder)
302301
_ = Task.Run(() => EverythingApi.IncrementRunCounterAsync(fileOrFolder));
303302
}
304303

305-
private static string _addScoreInDebug(int score)
306-
{
307-
#if DEBUG
308-
return $" ➡️ {score}";
309-
#else
310-
return "";
311-
#endif
312-
}
313-
314-
public static readonly string[] MediaExtensions = { ".jpg", ".png", ".avi", ".mkv", ".bmp", ".gif", ".wmv", ".mp3", ".flac", ".mp4" };
304+
private static readonly string[] MediaExtensions = { ".jpg", ".png", ".avi", ".mkv", ".bmp", ".gif", ".wmv", ".mp3", ".flac", ".mp4" };
315305
}
316306

317307
public enum ResultType

0 commit comments

Comments
 (0)