Made the code checker a bit happier

This commit is contained in:
Flamefire committed 2013-02-26 16:25:29 +01:00
1 parent d5cb43a09f
commit 3ebd34fcc3
48 files changed
+1880 -1834

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Kopie von &quot;Microsoft Extended Correctness Rules&quot;" Description="These rules expand on the basic correctness rules to maximize the logic and framework usage errors that are reported. Extra emphasis is placed on specific scenarios such as COM interop and mobile applications. Consider including this rule set if one of these scenarios applies to your project or to find additional problems in your project." ToolsVersion="10.0">
<Include Path="basiccorrectnessrules.ruleset" Action="Default" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1032" Action="Warning" />
<Rule Id="CA1054" Action="Warning" />
<Rule Id="CA1055" Action="Warning" />
<Rule Id="CA1056" Action="Warning" />
<Rule Id="CA1057" Action="Warning" />
<Rule Id="CA1060" Action="None" />
<Rule Id="CA1301" Action="None" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1401" Action="None" />
<Rule Id="CA1402" Action="Warning" />
<Rule Id="CA1406" Action="Warning" />
<Rule Id="CA1407" Action="Warning" />
<Rule Id="CA1408" Action="Warning" />
<Rule Id="CA1409" Action="Warning" />
<Rule Id="CA1411" Action="Warning" />
<Rule Id="CA1412" Action="Warning" />
<Rule Id="CA1413" Action="Warning" />
<Rule Id="CA1414" Action="Warning" />
<Rule Id="CA1600" Action="Warning" />
<Rule Id="CA1601" Action="Warning" />
<Rule Id="CA1821" Action="Warning" />
<Rule Id="CA1824" Action="Warning" />
<Rule Id="CA2001" Action="Warning" />
<Rule Id="CA2003" Action="Warning" />
<Rule Id="CA2101" Action="None" />
<Rule Id="CA2135" Action="Warning" />
<Rule Id="CA2136" Action="Warning" />
<Rule Id="CA2139" Action="Warning" />
<Rule Id="CA2142" Action="Warning" />
<Rule Id="CA2143" Action="Warning" />
<Rule Id="CA2144" Action="Warning" />
<Rule Id="CA2145" Action="Warning" />
<Rule Id="CA2204" Action="Warning" />
<Rule Id="CA2211" Action="Warning" />
<Rule Id="CA2217" Action="Warning" />
<Rule Id="CA2218" Action="Warning" />
<Rule Id="CA2219" Action="Warning" />
<Rule Id="CA2225" Action="Warning" />
<Rule Id="CA2228" Action="Warning" />
<Rule Id="CA2230" Action="Warning" />
<Rule Id="CA2233" Action="Warning" />
<Rule Id="CA2234" Action="Warning" />
<Rule Id="CA2243" Action="Warning" />
</Rules>
</RuleSet>
+1 -1
View File
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocaluxe", "Vocaluxe\Vocaluxe.csproj", "{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}"
ProjectSection(ProjectDependencies) = postProject
{6F3E1874-F28A-40E9-AFBD-31934D593679} = {6F3E1874-F28A-40E9-AFBD-31934D593679}
+1 -1
View File
@@ -133,7 +133,7 @@ namespace Vocaluxe.Base
{
get
{
if (_CurrentPlaylistElement.Artist != "" && _CurrentPlaylistElement.Title != "")
if (_CurrentPlaylistElement.Artist.Length > 0 && _CurrentPlaylistElement.Title.Length > 0)
return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title;
else
return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath);
+253 -251
View File
@@ -287,276 +287,278 @@ namespace Vocaluxe.Base
XmlWriter writer = null;
try
{
writer = XmlWriter.Create(CSettings.sFileConfig, _settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Version", CSettings.GetFullVersionText());
writer.WriteElementString("Time", System.DateTime.Now.ToString());
writer.WriteElementString("Platform", System.Environment.OSVersion.Platform.ToString());
writer.WriteElementString("OSVersion", System.Environment.OSVersion.ToString());
writer.WriteElementString("ProcessorCount", System.Environment.ProcessorCount.ToString());
writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString());
writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString());
writer.WriteElementString("Directory", System.Environment.CurrentDirectory.ToString());
writer.WriteEndElement();
#endregion Info
#region Debug
writer.WriteStartElement("Debug");
writer.WriteComment("DebugLevel: " + CHelper.ListStrings(Enum.GetNames(typeof(EDebugLevel))));
writer.WriteElementString("DebugLevel", Enum.GetName(typeof(EDebugLevel), DebugLevel));
writer.WriteEndElement();
#endregion Debug
#region Graphics
writer.WriteStartElement("Graphics");
writer.WriteComment("Renderer: " + CHelper.ListStrings(Enum.GetNames(typeof(ERenderer))));
writer.WriteElementString("Renderer", Enum.GetName(typeof(ERenderer), Renderer));
writer.WriteComment("TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality))));
writer.WriteElementString("TextureQuality", Enum.GetName(typeof(ETextureQuality), TextureQuality));
writer.WriteComment("CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)");
writer.WriteElementString("CoverSize", CoverSize.ToString());
writer.WriteComment("Screen width and height (pixels)");
writer.WriteElementString("ScreenW", ScreenW.ToString());
writer.WriteElementString("ScreenH", ScreenH.ToString());
writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes))));
writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode));
writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDeep))));
writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDeep), Colors));
writer.WriteComment("MaxFPS should be between 1..200");
writer.WriteElementString("MaxFPS", MaxFPS.ToString("#"));
writer.WriteComment("VSync: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VSync", Enum.GetName(typeof(EOffOn), VSync));
writer.WriteComment("FullScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("FullScreen", Enum.GetName(typeof(EOffOn), FullScreen));
writer.WriteComment("FadeTime should be between 0..3 Seconds");
writer.WriteElementString("FadeTime", FadeTime.ToString("#0.00"));
writer.WriteEndElement();
#endregion Graphics
#region Theme
writer.WriteStartElement("Theme");
writer.WriteComment("Theme name");
writer.WriteElementString("Name", Theme);
writer.WriteComment("Skin name");
writer.WriteElementString("Skin", Skin);
writer.WriteComment("Name of cover-theme");
writer.WriteElementString("Cover", CoverTheme);
writer.WriteComment("Draw note-lines:" + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("DrawNoteLines", Enum.GetName(typeof(EOffOn), DrawNoteLines));
writer.WriteComment("Draw tone-helper:" + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("DrawToneHelper", Enum.GetName(typeof(EOffOn), DrawToneHelper));
writer.WriteComment("Look of timer:" + CHelper.ListStrings(Enum.GetNames(typeof(ETimerLook))));
writer.WriteElementString("TimerLook", Enum.GetName(typeof(ETimerLook), TimerLook));
writer.WriteComment("Information about players on SingScreen:" + CHelper.ListStrings(Enum.GetNames(typeof(EPlayerInfo))));
writer.WriteElementString("PlayerInfo", Enum.GetName(typeof(EPlayerInfo), PlayerInfo));
writer.WriteComment("Fade player-information with lyrics and notebars:" + CHelper.ListStrings(Enum.GetNames(typeof(EFadePlayerInfo))));
writer.WriteElementString("FadePlayerInfo", Enum.GetName(typeof(EFadePlayerInfo), FadePlayerInfo));
writer.WriteComment("Cover Loading:" + CHelper.ListStrings(Enum.GetNames(typeof(ECoverLoading))));
writer.WriteElementString("CoverLoading", Enum.GetName(typeof(ECoverLoading), CoverLoading));
writer.WriteComment("Lyric Style:" + CHelper.ListStrings(Enum.GetNames(typeof(ELyricStyle))));
writer.WriteElementString("LyricStyle", Enum.GetName(typeof(ELyricStyle), LyricStyle));
writer.WriteEndElement();
#endregion Theme
#region Sound
writer.WriteStartElement("Sound");
writer.WriteComment("PlayBackLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlaybackLib))));
writer.WriteElementString("PlayBackLib", Enum.GetName(typeof(EPlaybackLib), PlayBackLib));
writer.WriteComment("RecordLib: " + CHelper.ListStrings(Enum.GetNames(typeof(ERecordLib))));
writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib));
writer.WriteComment("AudioBufferSize: " + CHelper.ListStrings(Enum.GetNames(typeof(EBufferSize))));
writer.WriteElementString("AudioBufferSize", Enum.GetName(typeof(EBufferSize), AudioBufferSize));
writer.WriteComment("AudioLatency from -500 to 500 ms");
writer.WriteElementString("AudioLatency", AudioLatency.ToString());
writer.WriteComment("Background Music");
writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EOffOn), BackgroundMusic));
writer.WriteComment("Background Music Volume from 0 to 100");
writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString());
writer.WriteComment("Background Music Source");
writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource));
writer.WriteComment("Preview Volume from 0 to 100");
writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());
writer.WriteComment("Game Volume from 0 to 100");
writer.WriteElementString("GameMusicVolume", GameMusicVolume.ToString());
writer.WriteEndElement();
#endregion Sound
#region Game
writer.WriteStartElement("Game");
writer.WriteComment("Game-Language:");
writer.WriteElementString("Language", Language);
// SongFolder
// Check, if program was started with songfolder-parameters
if (SongFolderOld.Count > 0)
using (writer = XmlWriter.Create(CSettings.sFileConfig, _settings))
{
//Write "old" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolderOld.Count; i++)
writer.WriteStartDocument();
writer.WriteStartElement("root");
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Version", CSettings.GetFullVersionText());
writer.WriteElementString("Time", System.DateTime.Now.ToString());
writer.WriteElementString("Platform", System.Environment.OSVersion.Platform.ToString());
writer.WriteElementString("OSVersion", System.Environment.OSVersion.ToString());
writer.WriteElementString("ProcessorCount", System.Environment.ProcessorCount.ToString());
writer.WriteElementString("Screens", Screen.AllScreens.Length.ToString());
writer.WriteElementString("PrimaryScreenResolution", Screen.PrimaryScreen.Bounds.Size.ToString());
writer.WriteElementString("Directory", System.Environment.CurrentDirectory.ToString());
writer.WriteEndElement();
#endregion Info
#region Debug
writer.WriteStartElement("Debug");
writer.WriteComment("DebugLevel: " + CHelper.ListStrings(Enum.GetNames(typeof(EDebugLevel))));
writer.WriteElementString("DebugLevel", Enum.GetName(typeof(EDebugLevel), DebugLevel));
writer.WriteEndElement();
#endregion Debug
#region Graphics
writer.WriteStartElement("Graphics");
writer.WriteComment("Renderer: " + CHelper.ListStrings(Enum.GetNames(typeof(ERenderer))));
writer.WriteElementString("Renderer", Enum.GetName(typeof(ERenderer), Renderer));
writer.WriteComment("TextureQuality: " + CHelper.ListStrings(Enum.GetNames(typeof(ETextureQuality))));
writer.WriteElementString("TextureQuality", Enum.GetName(typeof(ETextureQuality), TextureQuality));
writer.WriteComment("CoverSize (pixels): 32, 64, 128, 256, 512, 1024 (default: 128)");
writer.WriteElementString("CoverSize", CoverSize.ToString());
writer.WriteComment("Screen width and height (pixels)");
writer.WriteElementString("ScreenW", ScreenW.ToString());
writer.WriteElementString("ScreenH", ScreenH.ToString());
writer.WriteComment("AAMode: " + CHelper.ListStrings(Enum.GetNames(typeof(EAntiAliasingModes))));
writer.WriteElementString("AAMode", Enum.GetName(typeof(EAntiAliasingModes), AAMode));
writer.WriteComment("Colors: " + CHelper.ListStrings(Enum.GetNames(typeof(EColorDeep))));
writer.WriteElementString("Colors", Enum.GetName(typeof(EColorDeep), Colors));
writer.WriteComment("MaxFPS should be between 1..200");
writer.WriteElementString("MaxFPS", MaxFPS.ToString("#"));
writer.WriteComment("VSync: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VSync", Enum.GetName(typeof(EOffOn), VSync));
writer.WriteComment("FullScreen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("FullScreen", Enum.GetName(typeof(EOffOn), FullScreen));
writer.WriteComment("FadeTime should be between 0..3 Seconds");
writer.WriteElementString("FadeTime", FadeTime.ToString("#0.00"));
writer.WriteEndElement();
#endregion Graphics
#region Theme
writer.WriteStartElement("Theme");
writer.WriteComment("Theme name");
writer.WriteElementString("Name", Theme);
writer.WriteComment("Skin name");
writer.WriteElementString("Skin", Skin);
writer.WriteComment("Name of cover-theme");
writer.WriteElementString("Cover", CoverTheme);
writer.WriteComment("Draw note-lines:" + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("DrawNoteLines", Enum.GetName(typeof(EOffOn), DrawNoteLines));
writer.WriteComment("Draw tone-helper:" + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("DrawToneHelper", Enum.GetName(typeof(EOffOn), DrawToneHelper));
writer.WriteComment("Look of timer:" + CHelper.ListStrings(Enum.GetNames(typeof(ETimerLook))));
writer.WriteElementString("TimerLook", Enum.GetName(typeof(ETimerLook), TimerLook));
writer.WriteComment("Information about players on SingScreen:" + CHelper.ListStrings(Enum.GetNames(typeof(EPlayerInfo))));
writer.WriteElementString("PlayerInfo", Enum.GetName(typeof(EPlayerInfo), PlayerInfo));
writer.WriteComment("Fade player-information with lyrics and notebars:" + CHelper.ListStrings(Enum.GetNames(typeof(EFadePlayerInfo))));
writer.WriteElementString("FadePlayerInfo", Enum.GetName(typeof(EFadePlayerInfo), FadePlayerInfo));
writer.WriteComment("Cover Loading:" + CHelper.ListStrings(Enum.GetNames(typeof(ECoverLoading))));
writer.WriteElementString("CoverLoading", Enum.GetName(typeof(ECoverLoading), CoverLoading));
writer.WriteComment("Lyric Style:" + CHelper.ListStrings(Enum.GetNames(typeof(ELyricStyle))));
writer.WriteElementString("LyricStyle", Enum.GetName(typeof(ELyricStyle), LyricStyle));
writer.WriteEndElement();
#endregion Theme
#region Sound
writer.WriteStartElement("Sound");
writer.WriteComment("PlayBackLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EPlaybackLib))));
writer.WriteElementString("PlayBackLib", Enum.GetName(typeof(EPlaybackLib), PlayBackLib));
writer.WriteComment("RecordLib: " + CHelper.ListStrings(Enum.GetNames(typeof(ERecordLib))));
writer.WriteElementString("RecordLib", Enum.GetName(typeof(ERecordLib), RecordLib));
writer.WriteComment("AudioBufferSize: " + CHelper.ListStrings(Enum.GetNames(typeof(EBufferSize))));
writer.WriteElementString("AudioBufferSize", Enum.GetName(typeof(EBufferSize), AudioBufferSize));
writer.WriteComment("AudioLatency from -500 to 500 ms");
writer.WriteElementString("AudioLatency", AudioLatency.ToString());
writer.WriteComment("Background Music");
writer.WriteElementString("BackgroundMusic", Enum.GetName(typeof(EOffOn), BackgroundMusic));
writer.WriteComment("Background Music Volume from 0 to 100");
writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString());
writer.WriteComment("Background Music Source");
writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource));
writer.WriteComment("Preview Volume from 0 to 100");
writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());
writer.WriteComment("Game Volume from 0 to 100");
writer.WriteElementString("GameMusicVolume", GameMusicVolume.ToString());
writer.WriteEndElement();
#endregion Sound
#region Game
writer.WriteStartElement("Game");
writer.WriteComment("Game-Language:");
writer.WriteElementString("Language", Language);
// SongFolder
// Check, if program was started with songfolder-parameters
if (SongFolderOld.Count > 0)
{
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolderOld[i]);
//Write "old" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolderOld.Count; i++)
{
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolderOld[i]);
}
}
}
else
{
//Write "normal" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolder.Count; i++)
else
{
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolder[i]);
//Write "normal" song-folders to config.
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ...");
for (int i = 0; i < SongFolder.Count; i++)
{
writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolder[i]);
}
}
}
writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))));
writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu));
writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))));
writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu));
writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting))));
writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting));
writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting))));
writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting));
writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles));
writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles));
writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds.");
writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString());
writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds.");
writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString());
writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))));
writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode));
writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))));
writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode));
writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString());
writer.WriteElementString("NumPlayer", NumPlayer.ToString());
writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString());
writer.WriteElementString("NumPlayer", NumPlayer.ToString());
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs));
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs));
writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("LyricsOnTop", Enum.GetName(typeof(EOffOn), LyricsOnTop));
writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("LyricsOnTop", Enum.GetName(typeof(EOffOn), LyricsOnTop));
writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung");
writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString());
writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung");
writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString());
writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":");
writer.WriteStartElement("Players");
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{
writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1]));
}
writer.WriteEndElement();
writer.WriteEndElement();
#endregion Game
#region Video
writer.WriteStartElement("Video");
writer.WriteComment("VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder))));
writer.WriteElementString("VideoDecoder", Enum.GetName(typeof(EVideoDecoder), VideoDecoder));
writer.WriteComment("VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideoBackgrounds", Enum.GetName(typeof(EOffOn), VideoBackgrounds));
writer.WriteComment("VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideoPreview", Enum.GetName(typeof(EOffOn), VideoPreview));
writer.WriteComment("Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs));
writer.WriteComment("Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground));
writer.WriteComment("WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib))));
writer.WriteElementString("WebcamLib", Enum.GetName(typeof(EWebcamLib), WebcamLib));
writer.WriteStartElement("WebcamConfig");
writer.WriteElementString("MonikerString", WebcamConfig.MonikerString);
writer.WriteElementString("Framerate", WebcamConfig.Framerate.ToString());
writer.WriteElementString("Width", WebcamConfig.Width.ToString());
writer.WriteElementString("Height", WebcamConfig.Height.ToString());
writer.WriteEndElement();
writer.WriteEndElement();
#endregion Video
#region Record
writer.WriteStartElement("Record");
for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
{
if (MicConfig[p - 1].DeviceName != String.Empty && MicConfig[p - 1].InputName != String.Empty && MicConfig[p - 1].Channel > 0)
writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":");
writer.WriteStartElement("Players");
for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
{
writer.WriteStartElement("MicConfig" + p.ToString());
writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
writer.WriteElementString("InputName", MicConfig[p - 1].InputName);
writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString());
writer.WriteEndElement();
writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1]));
}
writer.WriteEndElement();
writer.WriteEndElement();
#endregion Game
#region Video
writer.WriteStartElement("Video");
writer.WriteComment("VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder))));
writer.WriteElementString("VideoDecoder", Enum.GetName(typeof(EVideoDecoder), VideoDecoder));
writer.WriteComment("VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideoBackgrounds", Enum.GetName(typeof(EOffOn), VideoBackgrounds));
writer.WriteComment("VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideoPreview", Enum.GetName(typeof(EOffOn), VideoPreview));
writer.WriteComment("Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs));
writer.WriteComment("Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground));
writer.WriteComment("WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib))));
writer.WriteElementString("WebcamLib", Enum.GetName(typeof(EWebcamLib), WebcamLib));
writer.WriteStartElement("WebcamConfig");
writer.WriteElementString("MonikerString", WebcamConfig.MonikerString);
writer.WriteElementString("Framerate", WebcamConfig.Framerate.ToString());
writer.WriteElementString("Width", WebcamConfig.Width.ToString());
writer.WriteElementString("Height", WebcamConfig.Height.ToString());
writer.WriteEndElement();
writer.WriteEndElement();
#endregion Video
#region Record
writer.WriteStartElement("Record");
for (int p = 1; p <= CSettings.MaxNumPlayer; p++)
{
if (MicConfig[p - 1].DeviceName.Length > 0 && MicConfig[p - 1].InputName.Length > 0 && MicConfig[p - 1].Channel > 0)
{
writer.WriteStartElement("MicConfig" + p.ToString());
writer.WriteElementString("DeviceName", MicConfig[p - 1].DeviceName);
writer.WriteElementString("DeviceDriver", MicConfig[p - 1].DeviceDriver);
writer.WriteElementString("InputName", MicConfig[p - 1].InputName);
writer.WriteElementString("Channel", MicConfig[p - 1].Channel.ToString());
writer.WriteEndElement();
}
}
writer.WriteComment("Mic delay in ms. 0, 20, 40, 60 ... 500");
writer.WriteElementString("MicDelay", MicDelay.ToString());
writer.WriteEndElement();
#endregion Record
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
writer.WriteComment("Mic delay in ms. 0, 20, 40, 60 ... 500");
writer.WriteElementString("MicDelay", MicDelay.ToString());
writer.WriteEndElement();
#endregion Record
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
catch (Exception)
{
writer = null;
if (writer != null)
writer.Close();
return false;
}
writer = null;
return true;
}
@@ -731,7 +733,7 @@ namespace Vocaluxe.Base
//Only found a parameter
case 1:
if (!Regex.IsMatch(parts[0], @"\s") && parts[0] != string.Empty)
if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
{
//Add parameter
_Params.Add(parts[0]);
@@ -744,7 +746,7 @@ namespace Vocaluxe.Base
//Found parameter and value
case 2:
if (!Regex.IsMatch(parts[0], @"\s") && parts[0] != string.Empty)
if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
{
//Add parameter
_Params.Add(parts[0]);
@@ -856,7 +858,7 @@ namespace Vocaluxe.Base
return false;
}
}
if (Path.GetFileName(value) == string.Empty)
if (Path.GetFileName(value).Length == 0)
{
return false;
}
@@ -876,7 +878,7 @@ namespace Vocaluxe.Base
{
for (int j = 0; j < CSettings.MaxNumPlayer; j++)
{
if (Players[j] != string.Empty)
if (Players[j].Length > 0)
{
if (Path.GetFileName(CProfiles.Profiles[i].ProfileFile) == Players[j] && CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
{
+2 -2
View File
@@ -171,7 +171,7 @@ namespace Vocaluxe.Base
xmlReader.GetValue("//root/Info/Name", ref coverTheme.Name, String.Empty);
xmlReader.GetValue("//root/Info/Folder", ref coverTheme.Folder, String.Empty);
if (coverTheme.Folder != String.Empty && coverTheme.Name != String.Empty)
if (coverTheme.Folder.Length > 0 && coverTheme.Name.Length > 0)
{
coverTheme.File = file;
@@ -190,7 +190,7 @@ namespace Vocaluxe.Base
coverTheme = CoverTheme(coverThemeName);
if (coverTheme.Name != String.Empty)
if (coverTheme.Name.Length > 0)
{
CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(CSettings.sFolderCover, coverTheme.File)));
+926 -1055
View File
File diff suppressed because it is too large. Load diff
+17 -13
View File
@@ -73,7 +73,9 @@ namespace Vocaluxe.Base
public static bool Unload()
{
return _Draw.Unload();
bool result = _Draw.Unload();
_Draw = null;
return result;
}
public static int GetScreenWidth()
@@ -166,20 +168,22 @@ namespace Vocaluxe.Base
if (!System.IO.File.Exists(TexturePath))
return new STexture(-1);
Bitmap origin = new Bitmap(TexturePath);
int w = MaxSize;
int h = MaxSize;
using (Bitmap origin = new Bitmap(TexturePath))
{
int w = MaxSize;
int h = MaxSize;
if (origin.Width >= origin.Height && origin.Width > w)
h = (int)Math.Round((float)w / origin.Width * origin.Height);
else if (origin.Height > origin.Width && origin.Height > h)
w = (int)Math.Round((float)h / origin.Height * origin.Width);
if (origin.Width >= origin.Height && origin.Width > w)
h = (int)Math.Round((float)w / origin.Width * origin.Height);
else if (origin.Height > origin.Width && origin.Height > h)
w = (int)Math.Round((float)h / origin.Height * origin.Width);
Bitmap bmp = new Bitmap(origin, w, h);
STexture tex = _Draw.AddTexture(bmp);
bmp.Dispose();
origin.Dispose();
return tex;
using (Bitmap bmp = new Bitmap(origin, w, h))
{
STexture tex = _Draw.AddTexture(bmp);
return tex;
}
}
}
public static STexture AddTexture(int W, int H, IntPtr Data)
+86 -68
View File
@@ -36,66 +36,76 @@ namespace Vocaluxe.Base
float factor = GetFactor(chr, flags);
CFonts.Height = SIZEh * factor;
Bitmap bmp = new Bitmap(10, 10);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
Font fo;
Size sizeB;
SizeF size;
System.Drawing.Graphics g;
using (Bitmap bmp = new Bitmap(10, 10))
{
g = System.Drawing.Graphics.FromImage(bmp);
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
SizeF size = g.MeasureString(chr.ToString(), fo);
g.Dispose();
bmp.Dispose();
size = g.MeasureString(chr.ToString(), fo);
bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height);
g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.Transparent);
g.Dispose();
}
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
CFonts.Height = SIZEh;
fo = CFonts.GetFont();
using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
{
g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.Transparent);
PointF point = new PointF(
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + SIZEh / 5f,
(sizeB.Height - size.Height - (size.Height + SIZEh/4f) * (1f - factor)) / 2f);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
CFonts.Height = SIZEh;
fo = CFonts.GetFont();
GraphicsPath path = new GraphicsPath();
path.AddString(
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
SIZEh,
point,
new StringFormat());
PointF point = new PointF(
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + SIZEh / 5f,
(sizeB.Height - size.Height - (size.Height + SIZEh / 4f) * (1f - factor)) / 2f);
Pen pen = new Pen(
Color.FromArgb(
(int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255),
SIZEh * outline);
using (GraphicsPath path = new GraphicsPath())
{
path.AddString(
chr.ToString(),
fo.FontFamily,
(int)fo.Style,
SIZEh,
point,
new StringFormat());
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
using (Pen pen = new Pen(
Color.FromArgb(
(int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255),
SIZEh * outline))
{
/*
g.DrawString(
chr.ToString(),
fo,
Brushes.White,
point);
* */
pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path);
g.FillPath(Brushes.White, path);
}
}
Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png);
Chr = chr;
width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width/factor / bmp.Width);
/*
g.DrawString(
chr.ToString(),
fo,
Brushes.White,
point);
* */
bmp.Dispose();
Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png);
Chr = chr;
width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width);
}
g.Dispose();
fo.Dispose();
}
@@ -114,23 +124,31 @@ namespace Vocaluxe.Base
CFonts.Style = EStyle.Normal;
CFonts.Height = SIZEh;
Bitmap bmp = new Bitmap(10, 10);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
float h_style, h_normal;
using (Bitmap bmp = new Bitmap(10, 10))
{
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
{
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
float h_normal = sizeB.Height;
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo);
h_normal = sizeB.Height;
}
CFonts.Style = style;
CFonts.Style = style;
bmp = new Bitmap(10, 10);
g = System.Drawing.Graphics.FromImage(bmp);
}
using (Bitmap bmp = new Bitmap(10, 10))
{
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
{
fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
float h_style = sizeB.Height;
g.Dispose();
Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo);
h_style = sizeB.Height;
}
}
return h_normal / h_style;
}
}
@@ -415,7 +433,7 @@ namespace Vocaluxe.Base
if (h <= 0f)
return;
if (Text == String.Empty)
if (Text.Length == 0)
return;
Height = h;
@@ -452,7 +470,7 @@ namespace Vocaluxe.Base
if (h <= 0f)
return;
if (Text == String.Empty)
if (Text.Length == 0)
return;
Height = h;
@@ -489,7 +507,7 @@ namespace Vocaluxe.Base
if (h <= 0f)
return;
if (Text == String.Empty)
if (Text.Length == 0)
return;
Height = h;
@@ -955,7 +973,7 @@ namespace Vocaluxe.Base
private static int GetFontIndex(string ThemeName, string FontName)
{
if (ThemeName == String.Empty || FontName == String.Empty)
if (ThemeName.Length == 0 || FontName.Length == 0)
return -1;
for (int i = 0; i < _Fonts.Count; i++)
@@ -969,7 +987,7 @@ namespace Vocaluxe.Base
private static int GetFontIndexParty(int PartyModeID, string FontName)
{
if (PartyModeID == -1 || FontName == String.Empty)
if (PartyModeID == -1 || FontName.Length == 0)
return -1;
for (int i = 0; i < _Fonts.Count; i++)
+1 -1
View File
@@ -871,7 +871,7 @@ namespace Vocaluxe.Base
{
_Cursor.UnloadTextures();
if (CTheme.Cursor.color != string.Empty)
if (CTheme.Cursor.color.Length > 0)
{
SColorF color;
color = CTheme.GetColor(CTheme.Cursor.color, -1);
+1
View File
@@ -22,6 +22,7 @@ namespace Vocaluxe.Base
public static void Close()
{
_Input.Close();
_Input = null;
}
public static bool Connect()
+21 -19
View File
@@ -351,28 +351,30 @@ namespace Vocaluxe.Base
Params.IncludeDebugInformation = true;
#endif
CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp");
CompilerResults CompileResult = null;
using (CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp"))
{
CompilerResults CompileResult = null;
try
{
CompileResult = CDP.CompileAssemblyFromFile(Params, files);
}
catch (Exception e)
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.Message);
return null;
}
if (CompileResult.Errors.Count > 0)
{
for (int i = 0; i < CompileResult.Errors.Count; i++)
try
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + CompileResult.Errors[i].ErrorText);
}
return null;
CompileResult = CDP.CompileAssemblyFromFile(Params, files);
}
catch (Exception e)
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + e.Message);
return null;
}
if (CompileResult.Errors.Count > 0)
{
for (int i = 0; i < CompileResult.Errors.Count; i++)
{
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + CompileResult.Errors[i].ErrorText);
}
return null;
}
return CompileResult.CompiledAssembly;
}
return CompileResult.CompiledAssembly;
}
private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string XmlPath)
+32 -31
View File
@@ -105,7 +105,7 @@ namespace Vocaluxe.Base
{
if (PlaylistID < 0 || PlaylistID >= _Playlists.Count)
return;
if (_Playlists[PlaylistID].PlaylistFile != String.Empty)
if (_Playlists[PlaylistID].PlaylistFile.Length > 0)
{
try
{
@@ -233,46 +233,47 @@ namespace Vocaluxe.Base
try
{
sr = new StreamReader(file, Encoding.Default, true);
int pos = -1;
string line;
while((line = sr.ReadLine()) != null)
using (sr = new StreamReader(file, Encoding.Default, true))
{
pos = line.IndexOf(":");
if (pos > 0)
int pos = -1;
string line;
while ((line = sr.ReadLine()) != null)
{
//Name or comment
if (line[0] == '#')
pos = line.IndexOf(":");
if (pos > 0)
{
string Identifier = line.Substring(1, pos - 1).Trim();
string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (Identifier.ToUpper() == "NAME")
//Name or comment
if (line[0] == '#')
{
pl.PlaylistName = Value;
}
}
//Song
else
{
string Artist = line.Substring(0, pos - 1).Trim();
string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < AllSongs.Length; s++)
{
if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title)
string Identifier = line.Substring(1, pos - 1).Trim();
string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
if (Identifier.ToUpper() == "NAME")
{
pl.AddSong(AllSongs[s].ID);
found = true;
break;
pl.PlaylistName = Value;
}
}
if (!found)
CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file);
//Song
else
{
string Artist = line.Substring(0, pos - 1).Trim();
string Title = line.Substring(pos + 1, line.Length - pos - 1).Trim();
bool found = false;
for (int s = 0; s < AllSongs.Length; s++)
{
if (AllSongs[s].Artist == Artist && AllSongs[s].Title == Title)
{
pl.AddSong(AllSongs[s].ID);
found = true;
break;
}
}
if (!found)
CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file);
}
}
}
}
sr.Close();
File.Delete(file);
}
catch
+27 -26
View File
@@ -59,8 +59,8 @@ namespace Vocaluxe.Base
profile.Avatar = new SAvatar(-1);
profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
profile.Active = EOffOn.TR_CONFIG_ON;
if (FileName != String.Empty)
if (FileName.Length > 0)
profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName);
else
profile.ProfileFile = String.Empty;
@@ -253,7 +253,7 @@ namespace Vocaluxe.Base
{
if (ProfileID < 0 || ProfileID >= _Profiles.Count)
return;
if (_Profiles[ProfileID].ProfileFile != String.Empty)
if (_Profiles[ProfileID].ProfileFile.Length > 0)
{
try
{
@@ -293,7 +293,7 @@ namespace Vocaluxe.Base
if (ProfileID < 0 || ProfileID >= _Profiles.Count)
return;
if (_Profiles[ProfileID].ProfileFile == String.Empty)
if (_Profiles[ProfileID].ProfileFile.Length == 0)
{
string filename = string.Empty;
foreach (char chr in _Profiles[ProfileID].PlayerName)
@@ -302,7 +302,7 @@ namespace Vocaluxe.Base
filename += chr.ToString();
}
if (filename == String.Empty)
if (filename.Length == 0)
filename = "1";
int i = 0;
@@ -330,29 +330,30 @@ namespace Vocaluxe.Base
CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile + ": " + e.Message);
return;
}
if (writer == null)
try
{
CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile);
return;
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlayerName", _Profiles[ProfileID].PlayerName);
writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[ProfileID].Difficulty));
writer.WriteElementString("Avatar", _Profiles[ProfileID].Avatar.FileName);
writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].GuestProfile));
writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].Active));
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
}
finally
{
writer.Close();
writer = null;
}
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlayerName", _Profiles[ProfileID].PlayerName);
writer.WriteElementString("Difficulty", Enum.GetName(typeof(EGameDifficulty), _Profiles[ProfileID].Difficulty));
writer.WriteElementString("Avatar", _Profiles[ProfileID].Avatar.FileName);
writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].GuestProfile));
writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), _Profiles[ProfileID].Active));
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
private static void LoadProfile(string FileName)
+1 -1
View File
@@ -145,7 +145,7 @@ namespace Vocaluxe.Base
{
string sVersion = sProgramName;
if (sProgramCodeName != String.Empty)
if (sProgramCodeName.Length > 0)
sVersion += " \"" + sProgramCodeName + "\"";
return sVersion += " " + GetVersionText();
+5 -5
View File
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
get { return _SearchFilter; }
set
{
if (value != String.Empty)
if (value.Length > 0)
{
_Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs);
}
@@ -409,14 +409,14 @@ namespace Vocaluxe.Base
_FilteredSongs.Clear();
string[] searchStrings = null;
if (_SearchFilter != String.Empty)
if (_SearchFilter.Length > 0)
searchStrings = _SearchFilter.ToUpper().Split(new char[] { ' ' });
foreach (CSong song in _Songs)
{
if (!song.IsDuet || _ShowDuetSongs)
{
if (_SearchFilter == String.Empty)
if (_SearchFilter.Length == 0)
_FilteredSongs.Add(song);
else if (searchStrings != null)
{
@@ -480,7 +480,7 @@ namespace Vocaluxe.Base
FieldInfo field = null;
bool isString = false;
List<SongPointer> SortList = new List<SongPointer>();
if (fieldName == String.Empty)
if (fieldName.Length == 0)
_FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, "")));
{
field = Type.GetType("Vocaluxe.Menu.SongMenu.CSong,VocaluxeLib").GetField(fieldName, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
@@ -657,7 +657,7 @@ namespace Vocaluxe.Base
for (int i = 0; i < _SongsSortList.Length; i++)
{
string Year = _SongsSortList[i].SortString;
if (Year != "")
if (Year.Length > 0)
{
Year = Year.Substring(0, 3);
_SongsSortList[i].SortString = Year + "0 - " + Year + "9";
+1 -1
View File
@@ -165,7 +165,7 @@ namespace Vocaluxe.Base
break;
}
if (file == String.Empty)
if (file.Length == 0)
return -1;
int stream = CSound.Load(file);
+75 -73
View File
@@ -313,40 +313,41 @@ namespace Vocaluxe.Base
private static void SaveTheme(int ThemeIndex)
{
#region ThemeMainFile
XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion
writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString());
// ThemeSystemVersion
writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString());
#region Info
writer.WriteStartElement("Info");
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Themes[ThemeIndex].Name);
writer.WriteElementString("Author", _Themes[ThemeIndex].Author);
writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder);
writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString());
writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString());
writer.WriteElementString("Name", _Themes[ThemeIndex].Name);
writer.WriteElementString("Author", _Themes[ThemeIndex].Author);
writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder);
writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString());
writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString());
writer.WriteEndElement();
#endregion Info
writer.WriteEndElement();
#endregion Info
// Cursor
if (_Themes[ThemeIndex].PartyModeID == -1)
SaveCursor(writer);
// Cursor
if (_Themes[ThemeIndex].PartyModeID == -1)
SaveCursor(writer);
// save fonts
if (_Themes[ThemeIndex].PartyModeID == -1)
CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer);
// save fonts
if (_Themes[ThemeIndex].PartyModeID == -1)
CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer);
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
writer.Flush();
}
#endregion ThemeMainFile
}
@@ -354,53 +355,54 @@ namespace Vocaluxe.Base
{
for (int SkinIndex = 0; SkinIndex < _Skins.Count; SkinIndex++)
{
XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion
writer.WriteElementString("SkinSystemVersion", SkinSystemVersion.ToString());
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Skins[SkinIndex].Name);
writer.WriteElementString("Author", _Skins[SkinIndex].Author);
writer.WriteElementString("SkinVersionMajor", _Skins[SkinIndex].SkinVersionMajor.ToString());
writer.WriteElementString("SkinVersionMinor", _Skins[SkinIndex].SkinVersionMinor.ToString());
writer.WriteEndElement();
#endregion Info
// save colors
SaveColors(writer, SkinIndex);
#region Skins
writer.WriteStartElement("Skins");
foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values)
using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings))
{
writer.WriteElementString(element.Name, element.Value);
writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion
writer.WriteElementString("SkinSystemVersion", SkinSystemVersion.ToString());
#region Info
writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Skins[SkinIndex].Name);
writer.WriteElementString("Author", _Skins[SkinIndex].Author);
writer.WriteElementString("SkinVersionMajor", _Skins[SkinIndex].SkinVersionMajor.ToString());
writer.WriteElementString("SkinVersionMinor", _Skins[SkinIndex].SkinVersionMinor.ToString());
writer.WriteEndElement();
#endregion Info
// save colors
SaveColors(writer, SkinIndex);
#region Skins
writer.WriteStartElement("Skins");
foreach (SkinElement element in _Skins[SkinIndex].SkinList.Values)
{
writer.WriteElementString(element.Name, element.Value);
}
writer.WriteEndElement();
#endregion Skins
#region Videos
writer.WriteStartElement("Videos");
foreach (SkinElement element in _Skins[SkinIndex].VideoList)
{
writer.WriteElementString(element.Name, element.Value);
}
writer.WriteEndElement();
#endregion Videos
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
}
writer.WriteEndElement();
#endregion Skins
#region Videos
writer.WriteStartElement("Videos");
foreach (SkinElement element in _Skins[SkinIndex].VideoList)
{
writer.WriteElementString(element.Name, element.Value);
}
writer.WriteEndElement();
#endregion Videos
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
}
@@ -439,7 +441,7 @@ namespace Vocaluxe.Base
if (version == ThemeSystemVersion)
{
xmlReader.GetValue("//root/Info/Name", ref theme.Name, String.Empty);
if (theme.Name != String.Empty)
if (theme.Name.Length > 0)
{
xmlReader.GetValue("//root/Info/Author", ref theme.Author, String.Empty);
xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty);
@@ -514,7 +516,7 @@ namespace Vocaluxe.Base
if (version == SkinSystemVersion)
{
xmlReader.GetValue("//root/Info/Name", ref skin.Name, String.Empty);
if (skin.Name != String.Empty)
if (skin.Name.Length > 0)
{
xmlReader.GetValue("//root/Info/Author", ref skin.Author, String.Empty);
xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor);
@@ -866,7 +868,7 @@ namespace Vocaluxe.Base
writer.WriteElementString("W", Cursor.w.ToString("#0.000"));
writer.WriteElementString("H", Cursor.h.ToString("#0.000"));
if (Cursor.color != String.Empty)
if (Cursor.color.Length > 0)
{
writer.WriteElementString("Color", Cursor.color);
}
+14
View File
@@ -0,0 +1,14 @@
// Diese Datei wird von der Codeanalyse zur Wartung der SuppressMessage-
// Attribute verwendet, die auf dieses Projekt angewendet werden.
// Unterdrückungen auf Projektebene haben entweder kein Ziel oder
// erhalten ein spezifisches Ziel mit Namespace-, Typ-, Memberbereich usw.
//
// Wenn Sie dieser Datei eine Unterdrückung hinzufügen möchten, klicken Sie mit der
// rechten Maustaste auf die Meldung in der Fehlerliste, zeigen Sie auf
// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei".
// Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFrom", Scope = "member", Target = "Vocaluxe.MainProgram.#AssemblyResolver(System.Object,System.ResolveEventArgs)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Lib.Draw.CDrawWinForm.#ColorizeBitmap(System.Drawing.Bitmap,Vocaluxe.Menu.SColorF)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Lib.Draw.CDrawWinForm.#CopyScreen(Vocaluxe.Menu.STexture&)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Base.CGlyph.#.ctor(System.Char,System.Single)")]
+19 -12
View File
@@ -493,13 +493,14 @@ namespace Vocaluxe.Lib.Draw
//This creates a new white texture and adds it to the texture pool
//This texture is used for the DrawRect method
Bitmap blankMap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(blankMap);
g.Clear(Color.White);
g.Dispose();
_BlankTexture = AddTexture(blankMap);
using (Bitmap blankMap = new Bitmap(1, 1))
{
Graphics g = Graphics.FromImage(blankMap);
g.Clear(Color.White);
g.Dispose();
_BlankTexture = AddTexture(blankMap);
blankMap.Dispose();
}
return true;
}
else
@@ -560,7 +561,7 @@ namespace Vocaluxe.Lib.Draw
}
}
//Apply fullscreen mode
if ((CSettings.bFullScreen && !_fullscreen) || (!CSettings.bFullScreen && _fullscreen))
if (CSettings.bFullScreen != _fullscreen)
{
if (!_fullscreen)
EnterFullScreen();
@@ -575,10 +576,9 @@ namespace Vocaluxe.Lib.Draw
//Calculate the FPS Rate and restart the timer after a frame
CTime.CalculateFPS();
CTime.Restart();
}
else
this.Close();
}
}
this.Close();
}
/// <summary>
@@ -881,8 +881,15 @@ namespace Vocaluxe.Lib.Draw
CLog.LogError("Error loading Texture: " + TexturePath);
return new STexture(-1);
}
STexture s = AddTexture(bmp, TexturePath);
bmp.Dispose();
STexture s;
try
{
s = AddTexture(bmp, TexturePath);
}
finally
{
bmp.Dispose();
}
return s;
}
CLog.LogError("Can't find File: " + TexturePath);
+27 -22
View File
@@ -246,9 +246,8 @@ namespace Vocaluxe.Lib.Draw
CTime.CalculateFPS();
CTime.Restart();
}
else
this.Close();
}
this.Close();
}
public bool Unload()
@@ -396,8 +395,10 @@ namespace Vocaluxe.Lib.Draw
if (!found)
{
Bitmap bmp = new Bitmap(TexturePath);
return AddTexture(bmp);
using (Bitmap bmp = new Bitmap(TexturePath))
{
return AddTexture(bmp);
}
}
}
@@ -433,11 +434,13 @@ namespace Vocaluxe.Lib.Draw
public STexture AddTexture(int W, int H, ref byte[] Data)
{
Bitmap bmp = new Bitmap(W, H);
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
bmp.UnlockBits(bmp_data);
return AddTexture(bmp);
using (Bitmap bmp = new Bitmap(W, H))
{
BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
bmp.UnlockBits(bmp_data);
return AddTexture(bmp);
}
}
public bool UpdateTexture(ref STexture Texture, IntPtr Data)
@@ -525,23 +528,25 @@ namespace Vocaluxe.Lib.Draw
{
Bitmap newBitmap = new Bitmap(original.Width, original.Height);
Graphics g = Graphics.FromImage(newBitmap);
using (Graphics g = Graphics.FromImage(newBitmap))
{
ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = color.A;
cm.Matrix00 = color.R;
cm.Matrix11 = color.G;
cm.Matrix22 = color.B;
cm.Matrix44 = 1;
ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = color.A;
cm.Matrix00 = color.R;
cm.Matrix11 = color.G;
cm.Matrix22 = color.B;
cm.Matrix44 = 1;
ImageAttributes ia = new ImageAttributes();
ia.SetColorMatrix(cm);
using (ImageAttributes ia = new ImageAttributes())
{
ia.SetColorMatrix(cm);
g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
ia.Dispose();
g.Dispose();
}
}
return newBitmap;
}
+25 -24
View File
@@ -500,9 +500,8 @@ namespace Vocaluxe.Lib.Draw
CTime.CalculateFPS();
CTime.Restart();
}
else
this.Close();
}
this.Close();
}
public bool Unload()
@@ -617,17 +616,18 @@ namespace Vocaluxe.Lib.Draw
int width = GetScreenWidth();
int height = GetScreenHeight();
Bitmap screen = new Bitmap(width, height);
using (Bitmap screen = new Bitmap(width, height))
{
BitmapData bmp_data = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
BitmapData bmp_data = screen.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
screen.UnlockBits(bmp_data);
GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
screen.UnlockBits(bmp_data);
screen.RotateFlip(RotateFlipType.RotateNoneFlipY);
screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp);
screen.Dispose();
screen.RotateFlip(RotateFlipType.RotateNoneFlipY);
screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp);
}
}
public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2)
@@ -799,27 +799,28 @@ namespace Vocaluxe.Lib.Draw
texture.w2 = (float)MathHelper.NextPowerOfTwo(w);
texture.h2 = (float)MathHelper.NextPowerOfTwo(h);
Bitmap bmp2 = new Bitmap((int)texture.w2, (int)texture.h2);
Graphics g = Graphics.FromImage(bmp2);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
g.Dispose();
using (Bitmap bmp2 = new Bitmap((int)texture.w2, (int)texture.h2))
{
Graphics g = Graphics.FromImage(bmp2);
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
g.Dispose();
texture.width_ratio = 1f;
texture.height_ratio = 1f;
texture.width_ratio = 1f;
texture.height_ratio = 1f;
BitmapData bmp_data = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
BitmapData bmp_data = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.w2, (int)texture.h2, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.w2, (int)texture.h2, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmp_data.Width, bmp_data.Height,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmp_data.Width, bmp_data.Height,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
bmp2.UnlockBits(bmp_data);
bmp2.Dispose();
bmp2.UnlockBits(bmp_data);
}
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureParameterName.ClampToEdge);
+5 -2
View File
@@ -674,8 +674,11 @@ namespace Vocaluxe.Lib.Input.WiiMote
protected virtual void Dispose(bool disposing)
{
if(disposing)
Disconnect();
if (disposing)
{
Disconnect();
_ReadDone.Close();
}
}
#endregion
}
+35 -29
View File
@@ -43,7 +43,7 @@ namespace Vocaluxe.Lib.Playlist
public void SavePlaylist()
{
if (PlaylistFile == string.Empty)
if (PlaylistFile.Length == 0)
{
string filename = string.Empty;
foreach (char chr in PlaylistName)
@@ -52,7 +52,7 @@ namespace Vocaluxe.Lib.Playlist
filename += chr.ToString();
}
if (filename == String.Empty)
if (filename.Length == 0)
filename = "1";
int i = 0;
@@ -85,37 +85,43 @@ namespace Vocaluxe.Lib.Playlist
return;
}
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlaylistName", PlaylistName);
writer.WriteEndElement();
writer.WriteStartElement("Songs");
for (int i = 0; i < Songs.Count; i++)
try
{
CSong song = CSongs.GetSong(Songs[i].SongID);
if (song != null)
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlaylistName", PlaylistName);
writer.WriteEndElement();
writer.WriteStartElement("Songs");
for (int i = 0; i < Songs.Count; i++)
{
writer.WriteStartElement("Song" + (i + 1).ToString());
writer.WriteElementString("Artist", song.Artist);
writer.WriteElementString("Title", song.Title);
writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode));
writer.WriteEndElement();
}
else
{
CLog.LogError("Playlist.SavePlaylist(): Can't find Song. This should never happen!");
CSong song = CSongs.GetSong(Songs[i].SongID);
if (song != null)
{
writer.WriteStartElement("Song" + (i + 1).ToString());
writer.WriteElementString("Artist", song.Artist);
writer.WriteElementString("Title", song.Title);
writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode));
writer.WriteEndElement();
}
else
{
CLog.LogError("Playlist.SavePlaylist(): Can't find Song. This should never happen!");
}
}
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
}
finally
{
writer.Close();
}
writer.WriteEndElement();
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
private void LoadPlaylist()
+20 -20
View File
@@ -36,26 +36,27 @@ namespace Vocaluxe.Lib.Sound
int id = 0;
foreach (DeviceInformation dev in devices)
{
DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid);
using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid))
{
SRecordDevice device = new SRecordDevice();
device.Driver = dev.DriverGuid.ToString();
device.ID = id;
device.Name = dev.Description;
device.Inputs = new List<SInput>();
SRecordDevice device = new SRecordDevice();
device.Driver = dev.DriverGuid.ToString();
device.ID = id;
device.Name = dev.Description;
device.Inputs = new List<SInput>();
SInput inp = new SInput();
inp.Name = "Default";
inp.Channels = ds.Capabilities.Channels;
SInput inp = new SInput();
inp.Name = "Default";
inp.Channels = ds.Capabilities.Channels;
if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe
if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe
device.Inputs.Add(inp);
_Devices.Add(device);
device.Inputs.Add(inp);
_Devices.Add(device);
id++;
ds.Dispose();
id++;
}
}
_DeviceConfig = _Devices.ToArray();
@@ -68,11 +69,7 @@ namespace Vocaluxe.Lib.Sound
{
if (_initialized)
{
foreach (SoundCardSource source in _Sources)
{
source.Stop();
source.Dispose();
}
Stop();
_initialized = false;
}
//System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer);
@@ -131,7 +128,10 @@ namespace Vocaluxe.Lib.Sound
foreach (SoundCardSource source in _Sources)
{
source.Stop();
source.Dispose();
}
_Sources.Clear();
return true;
}
public void AnalyzeBuffer(int Player)
+1 -1
View File
@@ -164,7 +164,7 @@ namespace Vocaluxe.Lib.Webcam
return false;
//No MonikerString found, try first webcam
if (Config.MonikerString == String.Empty)
if (Config.MonikerString.Length == 0)
_Webcam = new VideoCaptureDevice(_WebcamDevices[0].MonikerString);
else //Found MonikerString
_Webcam = new VideoCaptureDevice(Config.MonikerString);
+33
View File
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("Vocaluxe.Properties")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Vocaluxe.Properties")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("da631594-f891-4994-9869-c37e626e44f9")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
[assembly: AssemblyVersion("0.3.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+2 -2
View File
@@ -597,7 +597,7 @@ namespace Vocaluxe.Screens
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
{
//Update texture and name
if (CConfig.Players[i] != String.Empty)
if (CConfig.Players[i].Length > 0)
{
Statics[htStatics(StaticPlayerAvatar[i])].Texture = CProfiles.Profiles[CGame.Player[i].ProfileID].Avatar.Texture;
Texts[htTexts(TextPlayer[i])].Text = CProfiles.Profiles[CGame.Player[i].ProfileID].PlayerName;
@@ -692,7 +692,7 @@ namespace Vocaluxe.Screens
Statics[htStatics("StaticPlayer" + i)].Visible = true;
Statics[htStatics("StaticPlayerAvatar" + i)].Visible = true;
Texts[htTexts("TextPlayer" + i)].Visible = true;
if (Texts[htTexts("TextPlayer" + i)].Text == string.Empty)
if (Texts[htTexts("TextPlayer" + i)].Text.Length == 0)
{
Texts[htTexts("TextPlayer" + i)].Text = CLanguage.Translate("TR_SCREENNAMES_PLAYER") + " " + i.ToString();
}
+2 -2
View File
@@ -622,7 +622,7 @@ namespace Vocaluxe.Screens
CDraw.RemoveTexture(ref _CurrentVideoTexture);
if (song.VideoFileName != String.Empty)
if (song.VideoFileName.Length > 0)
{
_CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName));
CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap);
@@ -630,7 +630,7 @@ namespace Vocaluxe.Screens
}
CDraw.RemoveTexture(ref _Background);
if (song.BackgroundFileName != String.Empty)
if (song.BackgroundFileName.Length > 0)
_Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName));
SingNotes[htSingNotes(SingBars)].Reset();
+2 -2
View File
@@ -1105,13 +1105,13 @@ namespace Vocaluxe.Screens
SongID = CSongs.VisibleSongs[SongIndex].ID;
}
if (NewFilterString == String.Empty && _sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
if (NewFilterString.Length == 0 && _sso.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
{
CSongs.Category = -1;
refresh = true;
}
if (NewFilterString != String.Empty && CSongs.Category != 0)
if (NewFilterString.Length > 0 && CSongs.Category != 0)
{
CSongs.Category = 0;
refresh = true;
+2
View File
@@ -63,6 +63,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>x64</PlatformTarget>
@@ -193,6 +194,7 @@
<Compile Include="GameModes\CGameMode.cs" />
<Compile Include="GameModes\CGameModeNormal.cs" />
<Compile Include="GameModes\IGameMode.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Lib\Draw\CDirect3D.cs">
<SubType>Form</SubType>
</Compile>
+12
View File
@@ -0,0 +1,12 @@
// Diese Datei wird von der Codeanalyse zur Wartung der SuppressMessage-
// Attribute verwendet, die auf dieses Projekt angewendet werden.
// Unterdrückungen auf Projektebene haben entweder kein Ziel oder
// erhalten ein spezifisches Ziel mit Namespace-, Typ-, Memberbereich usw.
//
// Wenn Sie dieser Datei eine Unterdrückung hinzufügen möchten, klicken Sie mit der
// rechten Maustaste auf die Meldung in der Fehlerliste, zeigen Sie auf
// "Meldung(en) unterdrücken", und klicken Sie auf "In Projektunterdrückungsdatei".
// Sie müssen dieser Datei nicht manuell Unterdrückungen hinzufügen.
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Vocaluxe.Menu.CHelper.TryParse(System.String,System.Single@)", Scope = "member", Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadHeader(System.String)")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "System.Int32.TryParse(System.String,System.Int32@)", Scope = "member", Target = "Vocaluxe.Menu.SongMenu.CSong.#ReadNotes(System.String,System.Boolean)")]
+5 -5
View File
@@ -104,7 +104,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -127,13 +127,13 @@ namespace Vocaluxe.Menu
public void Resume()
{
if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName != String.Empty && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
if (_Theme.Type == EBackgroundTypes.Video && _Theme.VideoName.Length > 0 && CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_ON)
CBase.Theme.SkinVideoResume(_Theme.VideoName, _PartyModeID);
}
public void Pause()
{
if (_Theme.VideoName != String.Empty)
if (_Theme.VideoName.Length > 0)
CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID);
}
@@ -153,7 +153,7 @@ namespace Vocaluxe.Menu
ok = DrawVideo();
}
if (_Theme.TextureName != String.Empty &&
if (_Theme.TextureName.Length > 0 &&
(_Theme.Type == EBackgroundTypes.Texture ||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
ok = DrawTexture();
@@ -171,7 +171,7 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
}
+4 -4
View File
@@ -227,7 +227,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -241,7 +241,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
@@ -370,10 +370,10 @@ namespace Vocaluxe.Menu
{
Text.LoadTextures();
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
}
+4 -4
View File
@@ -165,7 +165,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Equalizer color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -178,7 +178,7 @@ namespace Vocaluxe.Menu
}
writer.WriteComment("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("MaxColor", _Theme.ColorName);
}
@@ -273,10 +273,10 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.MaxColorName != String.Empty)
if (_Theme.MaxColorName.Length > 0)
MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID);
}
+3 -2
View File
@@ -73,8 +73,9 @@ namespace Vocaluxe.Menu
return 0;
}
int result = 0;
int.TryParse(value, out result);
return result;
if(int.TryParse(value, out result))
return result;
return 0;
}
public static void SetRect(RectangleF Bounds, ref RectangleF Rect, float RectAspect, EAspect Aspect)
+4 -4
View File
@@ -164,7 +164,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Lyric text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -178,7 +178,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
@@ -547,10 +547,10 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
ColorProcessed = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
}
+93 -92
View File
@@ -409,7 +409,7 @@ namespace Vocaluxe.Menu
public virtual void SaveTheme()
{
if (_ThemePath == String.Empty)
if (_ThemePath.Length == 0)
return;
XmlWriterSettings settings = new XmlWriterSettings();
@@ -418,98 +418,99 @@ namespace Vocaluxe.Menu
settings.ConformanceLevel = ConformanceLevel.Document;
string file = Path.Combine(_ThemePath, _ThemeName + ".xml");
XmlWriter writer = XmlWriter.Create(file, settings);
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement(_ThemeName);
// Screen Version
writer.WriteElementString("ScreenVersion", _ScreenVersion.ToString());
// Backgrounds
for (int i = 0; i < _Backgrounds.Count; i++)
_Backgrounds[i].SaveTheme(writer);
// Statics
for (int i = 0; i < _Statics.Count; i++)
_Statics[i].SaveTheme(writer);
// Texts
for (int i = 0; i < _Texts.Count; i++)
using (XmlWriter writer = XmlWriter.Create(file, settings))
{
_Texts[i].SaveTheme(writer);
writer.WriteStartDocument();
writer.WriteStartElement("root");
writer.WriteStartElement(_ThemeName);
// Screen Version
writer.WriteElementString("ScreenVersion", _ScreenVersion.ToString());
// Backgrounds
for (int i = 0; i < _Backgrounds.Count; i++)
_Backgrounds[i].SaveTheme(writer);
// Statics
for (int i = 0; i < _Statics.Count; i++)
_Statics[i].SaveTheme(writer);
// Texts
for (int i = 0; i < _Texts.Count; i++)
{
_Texts[i].SaveTheme(writer);
}
// Buttons
for (int i = 0; i < _Buttons.Count; i++)
{
_Buttons[i].SaveTheme(writer);
}
// SelectSlides
for (int i = 0; i < _SelectSlides.Count; i++)
{
_SelectSlides[i].SaveTheme(writer);
}
// SongMenus
for (int i = 0; i < _SongMenus.Count; i++)
{
_SongMenus[i].SaveTheme(writer);
}
// Lyrics
for (int i = 0; i < _Lyrics.Count; i++)
{
_Lyrics[i].SaveTheme(writer);
}
// SingBars
for (int i = 0; i < _SingNotes.Count; i++)
{
_SingNotes[i].SaveTheme(writer);
}
// NameSelections
for (int i = 0; i < _NameSelections.Count; i++)
{
_NameSelections[i].SaveTheme(writer);
}
//Equalizers
for (int i = 0; i < _Equalizers.Count; i++)
{
_Equalizers[i].SaveTheme(writer);
}
//Playlists
for (int i = 0; i < _Playlists.Count; i++)
{
_Playlists[i].SaveTheme(writer);
}
//ParticleEffects
for (int i = 0; i < _ParticleEffects.Count; i++)
{
_ParticleEffects[i].SaveTheme(writer);
}
//ScreenSettings
for (int i = 0; i < _ScreenSettings.Count; i++)
{
_ScreenSettings[i].SaveTheme(writer);
}
writer.WriteEndElement();
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
}
// Buttons
for (int i = 0; i < _Buttons.Count; i++)
{
_Buttons[i].SaveTheme(writer);
}
// SelectSlides
for (int i = 0; i < _SelectSlides.Count; i++)
{
_SelectSlides[i].SaveTheme(writer);
}
// SongMenus
for (int i = 0; i < _SongMenus.Count; i++)
{
_SongMenus[i].SaveTheme(writer);
}
// Lyrics
for (int i = 0; i < _Lyrics.Count; i++)
{
_Lyrics[i].SaveTheme(writer);
}
// SingBars
for (int i = 0; i < _SingNotes.Count; i++)
{
_SingNotes[i].SaveTheme(writer);
}
// NameSelections
for (int i = 0; i < _NameSelections.Count; i++)
{
_NameSelections[i].SaveTheme(writer);
}
//Equalizers
for (int i = 0; i < _Equalizers.Count; i++)
{
_Equalizers[i].SaveTheme(writer);
}
//Playlists
for (int i = 0; i < _Playlists.Count; i++)
{
_Playlists[i].SaveTheme(writer);
}
//ParticleEffects
for (int i = 0; i < _ParticleEffects.Count; i++)
{
_ParticleEffects[i].SaveTheme(writer);
}
//ScreenSettings
for (int i = 0; i < _ScreenSettings.Count; i++)
{
_ScreenSettings[i].SaveTheme(writer);
}
writer.WriteEndElement();
// End of File
writer.WriteEndElement(); //end of root
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
public virtual void ReloadTextures()
@@ -649,7 +650,7 @@ namespace Vocaluxe.Menu
public virtual void ReloadTheme(string XmlPath)
{
if (_ThemePath == String.Empty)
if (_ThemePath.Length == 0)
return;
UnloadTextures();
+4 -4
View File
@@ -182,7 +182,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorEmptyTileName != String.Empty)
if (_Theme.ColorEmptyTileName.Length > 0)
{
writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName);
}
@@ -215,7 +215,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Font>: Text font name");
writer.WriteElementString("Font", _Theme.NameFont);
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
if (_Theme.NameColorName != String.Empty)
if (_Theme.NameColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.NameColorName);
}
@@ -474,10 +474,10 @@ namespace Vocaluxe.Menu
_TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID);
_TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _PartyModeID);
if (_Theme.ColorEmptyTileName != String.Empty)
if (_Theme.ColorEmptyTileName.Length > 0)
ColorEmptyTile = CBase.Theme.GetColor(_Theme.ColorEmptyTileName, _PartyModeID);
if (_Theme.NameColorName != String.Empty)
if (_Theme.NameColorName.Length > 0)
_Theme.NameColor = CBase.Theme.GetColor(_Theme.NameColorName, _PartyModeID);
}
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Vocaluxe.Menu
Init();
}
protected virtual void Init()
protected void Init()
{
_Interactions = new List<CInteraction>();
_Selection = 0;
+5 -5
View File
@@ -287,7 +287,7 @@ namespace Vocaluxe.Menu
public void Draw()
{
if (_TextureName != String.Empty)
if (_TextureName.Length > 0)
CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
else
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
@@ -428,7 +428,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: ParticleEffect color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -544,7 +544,7 @@ namespace Vocaluxe.Menu
h = 0;
CParticle star;
if (_Theme.TextureName != String.Empty)
if (_Theme.TextureName.Length > 0)
{
star = new CParticle(_PartyModeID, _Theme.TextureName, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f,
@@ -611,9 +611,9 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if(_Theme.TextureName != String.Empty)
if(_Theme.TextureName.Length > 0)
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
}
+4 -4
View File
@@ -360,7 +360,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ColorBackground>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower priority)");
if (_Theme.ColorBackgroundName != String.Empty)
if (_Theme.ColorBackgroundName.Length > 0)
{
writer.WriteElementString("ColorBackground", _Theme.ColorBackgroundName);
}
@@ -374,7 +374,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColorBackground>: Selected paylist-entry color from ColorScheme (high priority)");
writer.WriteComment("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower priority)");
if (_Theme.SColorBackgroundName != String.Empty)
if (_Theme.SColorBackgroundName.Length > 0)
{
writer.WriteElementString("SColorBackground", _Theme.SColorBackgroundName);
}
@@ -467,10 +467,10 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorBackgroundName != String.Empty)
if (_Theme.ColorBackgroundName.Length > 0)
BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID);
if (_Theme.SColorBackgroundName != String.Empty)
if (_Theme.SColorBackgroundName.Length > 0)
BackgroundSColor = CBase.Theme.GetColor(_Theme.SColorBackgroundName, _PartyModeID);
_Theme.Text1.LoadTextures();
+14 -14
View File
@@ -413,7 +413,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -427,7 +427,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
@@ -441,7 +441,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower priority)");
if (_Theme.HColorName != String.Empty)
if (_Theme.HColorName.Length > 0)
{
writer.WriteElementString("HColor", _Theme.HColorName);
}
@@ -455,7 +455,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)");
if (_Theme.ArrowColorName != String.Empty)
if (_Theme.ArrowColorName.Length > 0)
{
writer.WriteElementString("ArrowColor", _Theme.ArrowColorName);
}
@@ -469,7 +469,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)");
if (_Theme.SArrowColorName != String.Empty)
if (_Theme.SArrowColorName.Length > 0)
{
writer.WriteElementString("ArrowSColor", _Theme.SArrowColorName);
}
@@ -483,7 +483,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)");
if (_Theme.TextColorName != String.Empty)
if (_Theme.TextColorName.Length > 0)
{
writer.WriteElementString("TextColor", _Theme.TextColorName);
}
@@ -497,7 +497,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)");
writer.WriteComment("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)");
if (_Theme.STextColorName != String.Empty)
if (_Theme.STextColorName.Length > 0)
{
writer.WriteElementString("TextSColor", _Theme.STextColorName);
}
@@ -817,25 +817,25 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
if (_Theme.HColorName != String.Empty)
if (_Theme.HColorName.Length > 0)
HColor = CBase.Theme.GetColor(_Theme.HColorName, _PartyModeID);
if (_Theme.ArrowColorName != String.Empty)
if (_Theme.ArrowColorName.Length > 0)
ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID);
if (_Theme.SArrowColorName != String.Empty)
if (_Theme.SArrowColorName.Length > 0)
SColorArrow = CBase.Theme.GetColor(_Theme.SArrowColorName, _PartyModeID);
if (_Theme.TextColorName != String.Empty)
if (_Theme.TextColorName.Length > 0)
TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
STextColor = CBase.Theme.GetColor(_Theme.STextColorName, _PartyModeID);
}
+2 -2
View File
@@ -186,7 +186,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -286,7 +286,7 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
}
+5 -5
View File
@@ -576,7 +576,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -590,7 +590,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower priority)");
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
{
writer.WriteElementString("SColor", _Theme.SColorName);
}
@@ -849,10 +849,10 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty)
if (_Theme.SColorName.Length > 0)
SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
}
@@ -879,7 +879,7 @@ namespace Vocaluxe.Menu
private void UpdateTextPosition()
{
if (_Text == String.Empty)
if (_Text.Length == 0)
return;
CBase.Fonts.SetFont(Fon);
+27 -20
View File
@@ -330,7 +330,7 @@ namespace Vocaluxe.Menu.SongMenu
this.FileName = Path.GetFileName(FilePath);
EHeaderFlags HeaderFlags = new EHeaderFlags();
StreamReader sr;
StreamReader sr = null;
try
{
@@ -362,6 +362,8 @@ namespace Vocaluxe.Menu.SongMenu
{
case "ENCODING":
this.Encoding = CEncoding.GetEncoding(Value);
sr.Dispose();
sr = null;
sr = new StreamReader(FilePath, this.Encoding);
Identifier = String.Empty;
@@ -369,9 +371,9 @@ namespace Vocaluxe.Menu.SongMenu
while (!sr.EndOfStream)
{
line = sr.ReadLine();
if (line.Length == 0)
if (line.Length == 0)
continue;
if(!line[0].ToString().Equals("#")) break;
if (!line[0].ToString().Equals("#")) break;
pos = line.IndexOf(":");
@@ -384,39 +386,39 @@ namespace Vocaluxe.Menu.SongMenu
}
break;
case "TITLE":
if (Value != String.Empty)
if (Value.Length > 0)
{
this.Title = Value;
HeaderFlags |= EHeaderFlags.Title;
}
break;
case "ARTIST":
if (Value != String.Empty)
if (Value.Length > 0)
{
this.Artist = Value;
HeaderFlags |= EHeaderFlags.Artist;
}
break;
case "TITLE-ON-SORTING":
if (Value != String.Empty)
if (Value.Length > 0)
{
this.TitleSorting = Value;
}
break;
case "ARTIST-ON-SORTING":
if (Value != String.Empty)
if (Value.Length > 0)
{
this.ArtistSorting = Value;
}
break;
case "P1":
if (Value != String.Empty)
if (Value.Length > 0)
{
this.DuetPart1 = Value;
}
break;
case "P2":
if (Value != String.Empty)
if (Value.Length > 0)
{
this.DuetPart2 = Value;
}
@@ -586,19 +588,21 @@ namespace Vocaluxe.Menu.SongMenu
}
catch (Exception e)
{
if (sr != null)
sr.Dispose();
CBase.Log.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message);
return false;
}
sr.Dispose();
CheckFiles();
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag.
if (this.ArtistSorting == String.Empty)
if (this.ArtistSorting.Length == 0)
{
this.ArtistSorting = this.Artist;
}
if (this.TitleSorting == String.Empty)
if (this.TitleSorting.Length == 0)
{
this.TitleSorting = this.Title;
}
@@ -634,7 +638,7 @@ namespace Vocaluxe.Menu.SongMenu
int Player = 0;
int FileLineNo = 0;
StreamReader sr;
StreamReader sr = null;
try
{
@@ -776,8 +780,11 @@ namespace Vocaluxe.Menu.SongMenu
catch (Exception e)
{
CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
if(sr != null)
sr.Dispose();
return false;
}
sr.Dispose();
FindRefrain();
FindShortEnd();
_NotesLoaded = true;
@@ -805,7 +812,7 @@ namespace Vocaluxe.Menu.SongMenu
{
if (_CoverSmallLoaded)
return;
if (this.CoverFileName != String.Empty)
if (this.CoverFileName.Length > 0)
{
if (!CBase.DataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
_CoverTextureSmall = CBase.Cover.GetNoCover();
@@ -818,7 +825,7 @@ namespace Vocaluxe.Menu.SongMenu
private void CheckFiles()
{
if(this.CoverFileName == String.Empty){
if(this.CoverFileName.Length == 0){
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
foreach(String file in files)
@@ -830,7 +837,7 @@ namespace Vocaluxe.Menu.SongMenu
}
}
if (this.BackgroundFileName == String.Empty)
if (this.BackgroundFileName.Length == 0)
{
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
@@ -847,12 +854,12 @@ namespace Vocaluxe.Menu.SongMenu
private void CheckDuet()
{
if (DuetPart1 == String.Empty)
if (DuetPart1.Length == 0)
{
DuetPart1 = "Part 1";
CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
}
if (DuetPart2 == String.Empty)
if (DuetPart2.Length == 0)
{
DuetPart2 = "Part 2";
CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\".");
@@ -889,7 +896,7 @@ namespace Vocaluxe.Menu.SongMenu
{
for (int j = i + 1; j < lines.LineCount; j++)
{
if (sentences[i] == sentences[j] && sentences[i] != String.Empty)
if (sentences[i] == sentences[j] && sentences[i].Length > 0)
{
Series tempSeries = new Series();
tempSeries.start = i;
@@ -903,7 +910,7 @@ namespace Vocaluxe.Menu.SongMenu
for (int k = 1; k <= max; k++)
{
if (sentences[i + k] == sentences[j + k] && sentences[i + k] != String.Empty)
if (sentences[i + k] == sentences[j + k] && sentences[i + k].Length > 0)
tempSeries.end = i + k;
else
break;
@@ -350,7 +350,7 @@ namespace Vocaluxe.Menu.SongMenu
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower priority)");
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
{
writer.WriteElementString("Color", _Theme.ColorName);
}
@@ -578,7 +578,7 @@ namespace Vocaluxe.Menu.SongMenu
{
Init();
if (_Theme.ColorName != String.Empty)
if (_Theme.ColorName.Length > 0)
_Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
}
@@ -652,7 +652,7 @@ namespace Vocaluxe.Menu.SongMenu
_streams.Add(_stream);
_actsongstream = _stream;
if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName != String.Empty && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
if (CBase.Songs.GetVisibleSong(_actsong).VideoFileName.Length > 0 && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
{
_video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName));
if (_video == -1)
@@ -144,7 +144,7 @@ namespace Vocaluxe.Menu.SongMenu
_MedleyTagIcon.Visible = false;
}
if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter() != String.Empty)
if (CBase.Songs.GetNumVisibleSongs() == 0 && CBase.Songs.GetSearchFilter().Length > 0)
{
_CoverBig.Texture = _CoverBigTexture;
_Artist.Text = String.Empty;
+2
View File
@@ -46,6 +46,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -110,6 +111,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Menu\CBackground.cs" />
<Compile Include="Menu\CBasic.cs" />
<Compile Include="Menu\CButton.cs" />