Skip to content

Commit 7f233db

Browse files
committed
refactor for code quality
1 parent e9b9dce commit 7f233db

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

FoliCon/Models/Constants/MediaTypes.cs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace FoliCon.Models.Constants;
22

3+
[Localizable(false)]
34
public static class MediaTypes
45
{
56
public const string Game = "Game";

FoliCon/Modules/TMDB/TmdbDataTransformer.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,11 @@ public void ResultPicked(dynamic result, string resultType, string fullFolderPat
269269

270270
private static string PrepareRating(string resultType, string rating, dynamic result)
271271
{
272-
if (!string.IsNullOrWhiteSpace(rating) || resultType == MediaTypes.Collection) return rating;
272+
if (!string.IsNullOrWhiteSpace(rating) || resultType == MediaTypes.Collection)
273+
{
274+
return rating;
275+
}
276+
273277
Logger.Debug("Rating is null or empty, getting rating from result");
274278
rating = result.VoteAverage.ToString(CultureInfo.InvariantCulture);
275279
Logger.Debug("Rating: {Rating}", rating);
@@ -286,6 +290,7 @@ private string PickResult(dynamic result,
286290
string localPosterPath)
287291
{
288292
id = 0;
293+
var mediaType = resultType;
289294
switch (resultType)
290295
{
291296
case MediaTypes.Tv:
@@ -312,11 +317,12 @@ private string PickResult(dynamic result,
312317
break;
313318
}
314319
case MediaTypes.Mtv:
315-
resultType = SelectMtvType(result, fullFolderPath, rating, isPickedById, out id, folderName, localPosterPath);
320+
mediaType = SelectMtvType(result, fullFolderPath, rating, isPickedById, out id, folderName, localPosterPath);
316321
break;
322+
default: throw new InvalidDataException($"Invalid Result Type: {resultType}");
317323
}
318324

319-
return resultType;
325+
return mediaType;
320326
}
321327

322328
private string SelectMtvType(dynamic result, string fullFolderPath, string rating, bool isPickedById, out int id, string folderName, string localPosterPath)

FoliCon/Modules/utils/FileUtils.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,12 @@ public static string GetResourcePath(string resource)
324324

325325
}
326326

327-
public static async Task CheckForUpdate(bool onlyShowIfUpdateAvailable = false)
327+
public static async Task CheckForUpdate()
328+
{
329+
await CheckForUpdate(false);
330+
}
331+
332+
public static async Task CheckForUpdate(bool onlyShowIfUpdateAvailable)
328333
{
329334
Logger.Debug("Checking for Update");
330335

FoliCon/ViewModels/PosterPickerViewModel.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,11 @@ private void ProcessImages(IEnumerable<IImage> images)
236236
{
237237
Index = item.Index + 1;
238238
TryLoadImage(item.Value);
239-
if (!StopSearch) continue;
239+
if (!StopSearch)
240+
{
241+
continue;
242+
}
243+
240244
Logger.Trace("Stop Search is true, breaking loop");
241245
break;
242246
}

0 commit comments

Comments
 (0)