From 9c8a3f006d1b5993ba1ae9422adc7cde1741d522 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 4 Dec 2021 00:56:49 +0800 Subject: [PATCH] Resharper updates --- TVRename/Forms/UI.cs | 24 +++++++++---------- TVRename/Model/CachePersistor.cs | 6 ++--- .../FindNewItemsInDownloadFolders.cs | 6 ++--- TVRename/TVRename/ActionEngine.cs | 4 ++-- TVRename/TVRename/BulkAddMovieManager.cs | 6 ++--- TVRename/TVRename/BulkAddSeriesManager.cs | 6 ++--- TVRename/TVRename/TVDoc.cs | 4 ++-- TVRename/Utility/Helper/HTTPHelper.cs | 4 ++-- TVRename/Utility/Helper/RegistryHelper.cs | 6 ++--- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/TVRename/Forms/UI.cs b/TVRename/Forms/UI.cs index fa36d0bd..d49120ae 100644 --- a/TVRename/Forms/UI.cs +++ b/TVRename/Forms/UI.cs @@ -181,7 +181,7 @@ public UI(TVDoc doc, [NotNull] TVRenameSplash splash, bool showUi) SetupObjectListForScanResults(); UpdateSplashStatus(splash, "Running Auto-scan"); - + SetStartUpTab(); } @@ -273,7 +273,7 @@ public void ShowChildDialog(Form childForm) } // ReSharper disable once UnusedMember.Global - public void ShowChild(Form childForm) + public void ShowChild(Form childForm) { if (InvokeRequired) { @@ -2863,7 +2863,7 @@ private void AddMovie_Click(object sender, EventArgs e) { mDoc.Add(mov.AsList(),false); FillMyMovies(mov); - + mDoc.MoviesAddedOrEdited(true, false, WindowState == FormWindowState.Minimized, this, mov); FillMyMovies(mov); @@ -2895,7 +2895,7 @@ private void bnMyShowsAdd_Click(object sender, EventArgs e) ShowAddedOrEdited(false, false, si,false); SelectShow(si); ShowAddedOrEdited(true, false, si, false); - Logger.Info("Added new show called {0}", si.ShowName); + Logger.Info($"Added new show called {si.ShowName}" ); } else { @@ -2987,7 +2987,7 @@ private void RemoveFromDisk(string folderName,MediaConfiguration si) { return; } - try { + try { IEnumerable videofilesThatWouldBeDeleted = Directory .GetFiles(folderName, "*", SearchOption.AllDirectories) .Where(f => f.IsMovieFile()) @@ -3139,7 +3139,7 @@ internal void EditShow([NotNull] ShowConfiguration si) ShowAddedOrEdited(aes.HasChanged, false, si, true); SelectShow(si); - Logger.Info("Modified show called {0}", si.ShowName); + Logger.Info($"Modified show called {si.ShowName}"); } mDoc.AllowAutoScan(); @@ -3161,7 +3161,7 @@ internal void EditMovie([NotNull] MovieConfiguration si) FillMyMovies(); SelectMovie(si); - Logger.Info("Modified movie called {0}", si.ShowName); + Logger.Info($"Modified movie called {si.ShowName}" ); } mDoc.AllowAutoScan(); @@ -3825,14 +3825,14 @@ private void ActionAction(bool checkedNotSelected, bool unattended, bool doAll) Token = actionCancellationToken }; - bool showUi = WindowState !=FormWindowState.Minimized && !mDoc.Args.Hide && Visible && Environment.UserInteractive; + bool showUi = WindowState !=FormWindowState.Minimized && !mDoc.Args.Hide && Visible && Environment.UserInteractive; // If not /hide, show CopyMoveProgress dialog if (showUi) { CopyMoveProgress cmp = new(mDoc,sett, () => actionCancellationToken.Cancel()); ShowChild(cmp); } - + bwAction.RunWorkerAsync(sett); } @@ -3884,7 +3884,7 @@ private void lvAction_MouseClick([NotNull] object sender, [NotNull] MouseEventAr ItemList lvr = GetSelectedItems(); Item? action = olvAction.FocusedObject as Item; - + if (action?.Episode != null && lvr.Count == 1) { switchToWhenOpenMyShows = action.Episode; @@ -4573,7 +4573,7 @@ private void McbModifyMetadata_Click(object sender, EventArgs e) private void ThanksToolStripMenuItem_Click(object sender, EventArgs e) { ThanksForm form = new(); - form.ShowDialog(this); + form.ShowDialog(this); } private void TabControl1_DrawItem(object sender, [NotNull] DrawItemEventArgs e) @@ -5213,7 +5213,7 @@ private void settingsCheckToolStripMenuItem_Click(object sender, EventArgs e) SettingsReview form = new(mDoc, this); form.ShowDialog(this); - + mDoc.AllowAutoScan(); LessBusy(); } diff --git a/TVRename/Model/CachePersistor.cs b/TVRename/Model/CachePersistor.cs index b0626926..50768f12 100644 --- a/TVRename/Model/CachePersistor.cs +++ b/TVRename/Model/CachePersistor.cs @@ -73,7 +73,7 @@ private static void SaveCacheInternal([NotNull] ConcurrentDictionary([NotNull] FileInfo loadFrom, [NotNull] T cache) where T : MediaCache, iTVSource { - Logger.Info("Loading Cache from: {0}", loadFrom.FullName); + Logger.Info($"Loading Cache from: {loadFrom.FullName}" ); if (!loadFrom.Exists) { return true; // that's ok @@ -157,7 +157,7 @@ public static bool LoadTvCache([NotNull] FileInfo loadFrom, [NotNull] T cache public static bool LoadMovieCache([NotNull] FileInfo loadFrom, T cache) where T : MediaCache, iMovieSource { - Logger.Info("Loading Cache from: {0}", loadFrom.FullName); + Logger.Info($"Loading Cache from: {loadFrom.FullName}" ); if (!loadFrom.Exists) { return true; // that's ok diff --git a/TVRename/ScanActivity/FindNewItemsInDownloadFolders.cs b/TVRename/ScanActivity/FindNewItemsInDownloadFolders.cs index 7965d8ad..f036cac6 100644 --- a/TVRename/ScanActivity/FindNewItemsInDownloadFolders.cs +++ b/TVRename/ScanActivity/FindNewItemsInDownloadFolders.cs @@ -54,7 +54,7 @@ protected override void DoCheck(SetProgressDelegate prog) MDoc.TvAddedOrEdited(true, false, false, Settings.Owner, addedTvShows); //add each new show into the shows being scanned Settings.Shows.AddRange(addedTvShows); - LOGGER.Info("Added new shows called: {0}", addedTvShows.Select(s => s.ShowName).ToCsv()); + LOGGER.Info($"Added new shows called: {addedTvShows.Select(s => s.ShowName).ToCsv()}" ); } List addedMovies = addedShowsUnique.OfType().Distinct().ToList(); @@ -63,7 +63,7 @@ protected override void DoCheck(SetProgressDelegate prog) MDoc.Add(addedMovies, true); MDoc.MoviesAddedOrEdited(true, false, false, Settings.Owner, addedMovies); Settings.Movies.AddRange(addedMovies); - LOGGER.Info("Added new movies called: {0}", addedMovies.Select(s => s.ShowName).ToCsv()); + LOGGER.Info($"Added new movies called: {addedMovies.Select(s => s.ShowName).ToCsv()}"); } } @@ -94,7 +94,7 @@ private IEnumerable GetPossibleFiles() foreach (string dirPath in TVSettings.Instance.DownloadFolders.ToArray()) { - LOGGER.Info("Parsing {0} for new shows", dirPath); + LOGGER.Info($"Parsing {dirPath} for new shows" ); if (!Directory.Exists(dirPath)) { continue; diff --git a/TVRename/TVRename/ActionEngine.cs b/TVRename/TVRename/ActionEngine.cs index bfdae2ec..12918a6d 100644 --- a/TVRename/TVRename/ActionEngine.cs +++ b/TVRename/TVRename/ActionEngine.cs @@ -68,7 +68,7 @@ private void ProcessSingleAction(object infoIn) Action action = info.TheAction; - Logger.Trace("Triggering Action: {0} - {1} - {2}", action.Name, action.Produces, action.ToString()); + Logger.Trace($"Triggering Action: {action.Name} - {action.Produces} - {action}" ); action.Outcome = action.Go(mStats); if (action.Outcome.Error) { @@ -386,7 +386,7 @@ private static int GetQueueId([NotNull] Action action) return 0; default: - Logger.Fatal("No action type found for {0}, Please follow up with a developer.", action.GetType()); + Logger.Fatal($"No action type found for {action.GetType()}, Please follow up with a developer." ); // put it in this queue by default return 3; } diff --git a/TVRename/TVRename/BulkAddMovieManager.cs b/TVRename/TVRename/BulkAddMovieManager.cs index ead658eb..346e9f30 100644 --- a/TVRename/TVRename/BulkAddMovieManager.cs +++ b/TVRename/TVRename/BulkAddMovieManager.cs @@ -104,7 +104,7 @@ public BulkAddMovieManager(TVDoc doc) foreach (FileInfo newFilm in films) { // ....its good! - Logger.Info("Adding {0} as a new Movie", newFilm.FullName); + Logger.Info($"Adding {newFilm.FullName} as a new Movie"); PossibleNewMovie ai = new(newFilm, andGuess, showErrorMsgBox); AddItems.AddIfNew(ai); } @@ -113,7 +113,7 @@ public BulkAddMovieManager(TVDoc doc) } catch (UnauthorizedAccessException) { - Logger.Info("Can't access {0}, so ignoring it", di2.FullName); + Logger.Info($"Can't access {di2.FullName}, so ignoring it"); return (true, null); } } @@ -175,7 +175,7 @@ private void CheckFolderForShows([NotNull] DirectoryInfo di, CancellationToken t { if (fullLogging) { - Logger.Info("Rejecting {0} as it's on the ignore list.", di.FullName); + Logger.Info($"Rejecting {di.FullName} as it's on the ignore list." ); } return; diff --git a/TVRename/TVRename/BulkAddSeriesManager.cs b/TVRename/TVRename/BulkAddSeriesManager.cs index e9fbdf48..a0d90b08 100644 --- a/TVRename/TVRename/BulkAddSeriesManager.cs +++ b/TVRename/TVRename/BulkAddSeriesManager.cs @@ -312,7 +312,7 @@ private bool HasSeasonFolders([NotNull] DirectoryInfo di, out DirectoryInfo[]? s PossibleNewTvShow ai = new(di2, hasSeasonFolders, folderFormat); AddItems.Add(ai); - Logger.Info("Adding {0} as a new folder", theFolder); + Logger.Info($"Adding {theFolder} as a new folder"); if (andGuess) { GuessShowItem(ai, mDoc.TvLibrary, showErrorMsgBox); @@ -321,7 +321,7 @@ private bool HasSeasonFolders([NotNull] DirectoryInfo di, out DirectoryInfo[]? s } catch (UnauthorizedAccessException) { - Logger.Info("Can't access {0}, so ignoring it", di2.FullName); + Logger.Info($"Can't access {di2.FullName}, so ignoring it" ); return (true, null); } } @@ -396,7 +396,7 @@ private void CheckFolderForShows([NotNull] DirectoryInfo di, CancellationToken t { if (fullLogging) { - Logger.Info("Rejecting {0} as it's on the ignore list.", di.FullName); + Logger.Info($"Rejecting {di.FullName} as it's on the ignore list."); } return; diff --git a/TVRename/TVRename/TVDoc.cs b/TVRename/TVRename/TVDoc.cs index 251e1edd..ced36bb9 100644 --- a/TVRename/TVRename/TVDoc.cs +++ b/TVRename/TVRename/TVDoc.cs @@ -567,7 +567,7 @@ private void WriteXmlSettingsInternal() } // backup old settings before writing new ones FileHelper.Rotate(PathManager.TVDocSettingsFile.FullName); - Logger.Info("Saving Settings to {0}", PathManager.TVDocSettingsFile.FullName); + Logger.Info($"Saving Settings to {PathManager.TVDocSettingsFile.FullName}" ); XmlWriterSettings settings = new() { @@ -620,7 +620,7 @@ private void WriteXmlSettingsInternal() // ReSharper disable once InconsistentNaming private bool LoadXMLSettings(FileInfo? from) { - Logger.Info("Loading Settings from {0}", from?.FullName); + Logger.Info($"Loading Settings from {from?.FullName}" ); if (from is null) { return true; diff --git a/TVRename/Utility/Helper/HTTPHelper.cs b/TVRename/Utility/Helper/HTTPHelper.cs index 118ff37d..d9e0a607 100644 --- a/TVRename/Utility/Helper/HTTPHelper.cs +++ b/TVRename/Utility/Helper/HTTPHelper.cs @@ -129,7 +129,7 @@ public static string HttpRequest([NotNull] string method, [NotNull] string url, httpWebRequest.Headers.Add("Accept-Language", lang); } - Logger.Trace("Obtaining {0}", url); + Logger.Trace($"Obtaining {url}" ); if (method == "POST") { @@ -147,7 +147,7 @@ public static string HttpRequest([NotNull] string method, [NotNull] string url, { result = streamReader.ReadToEnd(); } - Logger.Trace("Returned {0}", result); + Logger.Trace($"Returned {result}" ); return result; } diff --git a/TVRename/Utility/Helper/RegistryHelper.cs b/TVRename/Utility/Helper/RegistryHelper.cs index ef8f4bb4..86b459be 100644 --- a/TVRename/Utility/Helper/RegistryHelper.cs +++ b/TVRename/Utility/Helper/RegistryHelper.cs @@ -120,13 +120,13 @@ private static bool SetBrowserEmulationVersion(BrowserEmulationVersion browserEm { // if it's a valid value, update or create the value key.SetValue(programName, (int)browserEmulationVersion, RegistryValueKind.DWord); - Logger.Warn("SETTING REGISTRY:{0}-{1}-{2}-{3}", key.Name, programName, (int)browserEmulationVersion, RegistryValueKind.DWord.ToString()); + Logger.Warn($"SETTING REGISTRY:{key.Name}-{programName}-{(int)browserEmulationVersion}-{RegistryValueKind.DWord}"); } else { // otherwise, remove the existing value key.DeleteValue(programName, false); - Logger.Warn("DELETING REGISTRY KEY:{0}-{1}", key.Name, programName); + Logger.Warn($"DELETING REGISTRY KEY:{key.Name}-{programName}"); } return true; @@ -153,7 +153,7 @@ private static bool SetBrowserEmulationVersion(BrowserEmulationVersion browserEm private static BrowserEmulationVersion GetInternetExplorerVersion() { int ieVersion = GetInternetExplorerMajorVersion(); - Logger.Info("IE Version {0} is identified", ieVersion); + Logger.Info($"IE Version {ieVersion} is identified"); if (ieVersion >= 11) {