From a92d7d711e5262aa0ae0020f33efabd42184e0c8 Mon Sep 17 00:00:00 2001 From: "Andrew J.Swan" Date: Tue, 7 Jan 2020 14:59:18 +0200 Subject: [PATCH] MP1-4982: Remove hard stop when Caching Graphics not found folders --- mediaportal/Core/guilib/TexturePacker.cs | 46 +++++++++++++++---- .../MediaPortal.Application/MediaPortal.cs | 3 +- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/mediaportal/Core/guilib/TexturePacker.cs b/mediaportal/Core/guilib/TexturePacker.cs index 51d9561adb5..ac4b1d98a63 100644 --- a/mediaportal/Core/guilib/TexturePacker.cs +++ b/mediaportal/Core/guilib/TexturePacker.cs @@ -347,17 +347,45 @@ public void PackSkinGraphics(string skinName) // The themes directory is not required to exist. } - string[] tvLogos = Directory.GetFiles(Config.GetSubFolder(Config.Dir.Thumbs, @"tv\logos"), "*.png", SearchOption.AllDirectories); - files.AddRange(tvLogos); - - string[] radioLogos = Directory.GetFiles(Config.GetSubFolder(Config.Dir.Thumbs, "Radio"), "*.png", SearchOption.AllDirectories); - files.AddRange(radioLogos); + try + { + string[] tvLogos = Directory.GetFiles(Config.GetSubFolder(Config.Dir.Thumbs, @"tv\logos"), "*.png", SearchOption.AllDirectories); + files.AddRange(tvLogos); + } + catch (DirectoryNotFoundException) + { + Log.Warn("TexturePacker: Folder not found: " + Config.GetSubFolder(Config.Dir.Thumbs, @"tv\logos")); + } - string[] weatherFiles = Directory.GetFiles(String.Format(@"{0}\media\weather", skinName), "*.png"); - files.AddRange(weatherFiles); + try + { + string[] radioLogos = Directory.GetFiles(Config.GetSubFolder(Config.Dir.Thumbs, "Radio"), "*.png", SearchOption.AllDirectories); + files.AddRange(radioLogos); + } + catch (DirectoryNotFoundException) + { + Log.Warn("TexturePacker: Folder not found: " + Config.GetSubFolder(Config.Dir.Thumbs, "Radio")); + } - string[] tetrisFiles = Directory.GetFiles(String.Format(@"{0}\media\tetris", skinName), "*.png"); - files.AddRange(tetrisFiles); + try + { + string[] weatherFiles = Directory.GetFiles(String.Format(@"{0}\media\weather", skinName), "*.png"); + files.AddRange(weatherFiles); + } + catch (DirectoryNotFoundException) + { + Log.Warn("TexturePacker: Folder not found: " + String.Format(@"{0}\media\weather", skinName)); + } + + try + { + string[] tetrisFiles = Directory.GetFiles(String.Format(@"{0}\media\tetris", skinName), "*.png"); + files.AddRange(tetrisFiles); + } + catch (DirectoryNotFoundException) + { + Log.Warn("TexturePacker: Folder not found: " + String.Format(@"{0}\media\tetris", skinName)); + } // Determine maximum texture dimensions try diff --git a/mediaportal/MediaPortal.Application/MediaPortal.cs b/mediaportal/MediaPortal.Application/MediaPortal.cs index 1da9c0edc6f..4ba02f17cda 100644 --- a/mediaportal/MediaPortal.Application/MediaPortal.cs +++ b/mediaportal/MediaPortal.Application/MediaPortal.cs @@ -3666,7 +3666,8 @@ protected override void InitializeDeviceObjects() catch (Exception exs) { // ReSharper disable LocalizableElement - MessageBox.Show(String.Format("Failed to load your skin! Aborting startup...\n\n{0}", exs.Message), "Critical error", MessageBoxButtons.OK, MessageBoxIcon.Stop); + // MessageBox.Show(String.Format("Failed to load your skin! Aborting startup...\n\n{0}", exs.Message), "Critical error", MessageBoxButtons.OK, MessageBoxIcon.Stop); + Log.Error("Startup: Failed to Caching Graphics! {0}", exs.Message); // ReSharper restore LocalizableElement Close(); }