diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 9284b73c..7137d260 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -15,7 +15,6 @@ namespace Vocaluxe.Base { static class CBackgroundMusic { - private static CHelper Helper = new CHelper(); private static int _CurrentMusicStream = -1; private static int _PreviousMusicIndex = 0; private static PlaylistElement _CurrentPlaylistElement = new PlaylistElement(); @@ -155,7 +154,7 @@ namespace Vocaluxe.Base foreach(string ending in CSettings.MusicFileTypes) { - templist.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true)); + templist.AddRange(CHelper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true)); } foreach (string path in templist) diff --git a/Vocaluxe/Base/CCover.cs b/Vocaluxe/Base/CCover.cs index 87138cfc..dc402c45 100644 --- a/Vocaluxe/Base/CCover.cs +++ b/Vocaluxe/Base/CCover.cs @@ -157,9 +157,8 @@ namespace Vocaluxe.Base { _CoverThemes.Clear(); - CHelper Helper = new CHelper(); string path = CSettings.sFolderCover; - List files = Helper.ListFiles(path, "*.xml", false); + List files = CHelper.ListFiles(path, "*.xml", false); foreach (string file in files) { @@ -230,13 +229,12 @@ namespace Vocaluxe.Base } } - CHelper Helper = new CHelper(); List files = new List(); - files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true)); - files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true)); - files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true)); - files.AddRange(Helper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.png", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpg", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.jpeg", true, true)); + files.AddRange(CHelper.ListFiles(Path.Combine(CSettings.sFolderCover, coverTheme.Folder), "*.bmp", true, true)); foreach (string file in files) diff --git a/Vocaluxe/Base/CLanguage.cs b/Vocaluxe/Base/CLanguage.cs index bc366e11..1c9b13ad 100644 --- a/Vocaluxe/Base/CLanguage.cs +++ b/Vocaluxe/Base/CLanguage.cs @@ -28,7 +28,6 @@ namespace Vocaluxe.Base { private static XmlWriterSettings _settings = new XmlWriterSettings(); private static List _Languages; - private static CHelper Helper = new CHelper(); private static int _CurrentLanguage = 0; private static int _FallbackLanguage = 0; @@ -62,7 +61,7 @@ namespace Vocaluxe.Base _settings.ConformanceLevel = ConformanceLevel.Document; List files = new List(); - files.AddRange(Helper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderLanguages, "*.xml", true, true)); foreach (string file in files) { @@ -228,7 +227,7 @@ namespace Vocaluxe.Base public static bool LoadPartyLanguageFiles(int PartyModeID, string Path) { List files = new List(); - files.AddRange(Helper.ListFiles(Path, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(Path, "*.xml", true, true)); foreach (string file in files) { diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index e8bd61ec..3ade852f 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -34,7 +34,6 @@ namespace Vocaluxe.Base { const int PartyModeSystemVersion = 1; - private static CHelper Helper; private static Dictionary _PartyModes; private static Queue _IDs; @@ -44,7 +43,6 @@ namespace Vocaluxe.Base #region public stuff public static void Init() { - Helper = new CHelper(); _PartyModes = new Dictionary(); _IDs = new Queue(1000); @@ -206,7 +204,7 @@ namespace Vocaluxe.Base private static void LoadPartyModes() { List files = new List(); - files.AddRange(Helper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderPartyModes, "*.xml", false, true)); foreach (string file in files) { @@ -269,7 +267,7 @@ namespace Vocaluxe.Base string PathToCode = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeCode); List FilesToCompile = new List(); - FilesToCompile.AddRange(Helper.ListFiles(PathToCode, "*.cs", false, true)); + FilesToCompile.AddRange(CHelper.ListFiles(PathToCode, "*.cs", false, true)); Assembly Output = CompileFiles(FilesToCompile.ToArray()); if (Output == null) diff --git a/Vocaluxe/Base/CPlaylists.cs b/Vocaluxe/Base/CPlaylists.cs index 6a0fc124..70569215 100644 --- a/Vocaluxe/Base/CPlaylists.cs +++ b/Vocaluxe/Base/CPlaylists.cs @@ -15,7 +15,6 @@ namespace Vocaluxe.Base static class CPlaylists { private static List _Playlists; - private static CHelper Helper = new CHelper(); public static CPlaylistFile[] Playlists { @@ -51,7 +50,7 @@ namespace Vocaluxe.Base public static void ConvertUSDXPlaylists() { List files = new List(); - files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.upl", true, true)); foreach (string file in files) { @@ -65,7 +64,7 @@ namespace Vocaluxe.Base { _Playlists = new List(); List files = new List(); - files.AddRange(Helper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderPlaylists, "*.xml", true, true)); foreach (string file in files) { diff --git a/Vocaluxe/Base/CProfiles.cs b/Vocaluxe/Base/CProfiles.cs index 8b7712cc..686f5c4a 100644 --- a/Vocaluxe/Base/CProfiles.cs +++ b/Vocaluxe/Base/CProfiles.cs @@ -12,7 +12,6 @@ namespace Vocaluxe.Base static class CProfiles { private static XmlWriterSettings _settings = new XmlWriterSettings(); - private static CHelper Helper = new CHelper(); private static List _Profiles; private static List _Avatars = new List(); @@ -86,7 +85,7 @@ namespace Vocaluxe.Base { _Profiles = new List(); List files = new List(); - files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.xml", true, true)); foreach (string file in files) { @@ -106,10 +105,10 @@ namespace Vocaluxe.Base _Avatars.Clear(); List files = new List(); - files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true)); - files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true)); - files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true)); - files.AddRange(Helper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.png", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpg", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.jpeg", true, true)); + files.AddRange(CHelper.ListFiles(CSettings.sFolderProfiles, "*.bmp", true, true)); foreach (string file in files) { diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index 74cb7faf..16b288c1 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -41,7 +41,6 @@ namespace Vocaluxe.Base private static SongPointer[] _SongsSortList = new SongPointer[0]; private static List _SongsForRandom = new List(); - private static CHelper Helper = new CHelper(); private static bool _SongsLoaded = false; private static bool _CoverLoaded = false; private static int _CoverLoadIndex = -1; @@ -707,8 +706,8 @@ namespace Vocaluxe.Base foreach (string p in CConfig.SongFolder) { string path = p; - files.AddRange(Helper.ListFiles(path, "*.txt", true, true)); - files.AddRange(Helper.ListFiles(path, "*.txd", true, true)); + files.AddRange(CHelper.ListFiles(path, "*.txt", true, true)); + files.AddRange(CHelper.ListFiles(path, "*.txd", true, true)); } CLog.StopBenchmark(2, "List Songs"); diff --git a/Vocaluxe/Base/CTheme.cs b/Vocaluxe/Base/CTheme.cs index 6c5dcf13..cbd80aab 100644 --- a/Vocaluxe/Base/CTheme.cs +++ b/Vocaluxe/Base/CTheme.cs @@ -406,11 +406,10 @@ namespace Vocaluxe.Base private static void ListThemes() { - CHelper Helper = new CHelper(); _Themes.Clear(); string path = Path.Combine(Directory.GetCurrentDirectory(), CSettings.sFolderThemes); - List files = Helper.ListFiles(path, "*.xml", false); + List files = CHelper.ListFiles(path, "*.xml", false); foreach (string file in files) { @@ -469,7 +468,6 @@ namespace Vocaluxe.Base public static void ListSkins() { - CHelper Helper = new CHelper(); int themeIndex = GetThemeIndex(-1); _Skins.Clear(); @@ -483,8 +481,6 @@ namespace Vocaluxe.Base public static void ListSkins(int ThemeIndex) { - CHelper Helper = new CHelper(); - if (ThemeIndex < 0 || ThemeIndex >= _Themes.Count) { CLog.LogError("Error List Skins. Can't find Theme index: " + ThemeIndex.ToString()); @@ -494,7 +490,7 @@ namespace Vocaluxe.Base Theme theme = _Themes[ThemeIndex]; string path = Path.Combine(theme.Path, theme.SkinFolder); - List files = Helper.ListFiles(path, "*.xml", false); + List files = CHelper.ListFiles(path, "*.xml", false); foreach (string file in files) { diff --git a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs index db08989d..38cca523 100644 --- a/Vocaluxe/Lib/Playlist/CPlaylistFile.cs +++ b/Vocaluxe/Lib/Playlist/CPlaylistFile.cs @@ -14,7 +14,6 @@ namespace Vocaluxe.Lib.Playlist public class CPlaylistFile { private static XmlWriterSettings _settings = new XmlWriterSettings(); - private static CHelper Helper = new CHelper(); public string PlaylistName; public string PlaylistFile; diff --git a/VocaluxeLib/Menu/CHelper.cs b/VocaluxeLib/Menu/CHelper.cs index c6f49b82..67d8a75e 100644 --- a/VocaluxeLib/Menu/CHelper.cs +++ b/VocaluxeLib/Menu/CHelper.cs @@ -7,8 +7,9 @@ using System.Text; namespace Vocaluxe.Menu { - public class CHelper + public static class CHelper { + public static int nCk(int n, int k) { if (k > n) @@ -128,17 +129,17 @@ namespace Vocaluxe.Menu - public List ListFiles(string path, string cast) + public static List ListFiles(string path, string cast) { return ListFiles(path, cast, false, false); } - public List ListFiles(string path, string cast, bool recursive) + public static List ListFiles(string path, string cast, bool recursive) { return ListFiles(path, cast, recursive, false); } - public List ListFiles(string path, string cast, bool recursive, bool fullpath) + public static List ListFiles(string path, string cast, bool recursive, bool fullpath) { List files = new List(); DirectoryInfo dir = new DirectoryInfo(path); @@ -151,7 +152,6 @@ namespace Vocaluxe.Menu if (!fullpath) files.Add(file.Name); else - //files.Add(Path.Combine(file.DirectoryName, file.Name)); files.Add(file.FullName); } diff --git a/VocaluxeLib/Menu/SongMenu/CSong.cs b/VocaluxeLib/Menu/SongMenu/CSong.cs index 8e51fb0b..9dc01b08 100644 --- a/VocaluxeLib/Menu/SongMenu/CSong.cs +++ b/VocaluxeLib/Menu/SongMenu/CSong.cs @@ -818,11 +818,9 @@ namespace Vocaluxe.Menu.SongMenu private void CheckFiles() { - CHelper Helper = new CHelper(); - if(this.CoverFileName == String.Empty){ - List files = Helper.ListFiles(this.Folder, "*.jpg", false); - files.AddRange(Helper.ListFiles(this.Folder, "*.png", false)); + List files = CHelper.ListFiles(this.Folder, "*.jpg", false); + files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); foreach(String file in files) { if (Regex.IsMatch(file, @".[CO].", RegexOptions.IgnoreCase) && (Regex.IsMatch(file, @"" + Regex.Escape(this.Title), RegexOptions.IgnoreCase) || Regex.IsMatch(file, @"" + Regex.Escape(this.Artist), RegexOptions.IgnoreCase))) @@ -834,8 +832,8 @@ namespace Vocaluxe.Menu.SongMenu if (this.BackgroundFileName == String.Empty) { - List files = Helper.ListFiles(this.Folder, "*.jpg", false); - files.AddRange(Helper.ListFiles(this.Folder, "*.png", false)); + List files = CHelper.ListFiles(this.Folder, "*.jpg", false); + files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); foreach (String file in files) {