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
+1877 -1831

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 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}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vocaluxe", "Vocaluxe\Vocaluxe.csproj", "{2A1E0F2D-5392-4BB7-B0A1-A9DFA13E79FF}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{6F3E1874-F28A-40E9-AFBD-31934D593679} = {6F3E1874-F28A-40E9-AFBD-31934D593679} {6F3E1874-F28A-40E9-AFBD-31934D593679} = {6F3E1874-F28A-40E9-AFBD-31934D593679}
+1 -1
View File
@@ -133,7 +133,7 @@ namespace Vocaluxe.Base
{ {
get get
{ {
if (_CurrentPlaylistElement.Artist != "" && _CurrentPlaylistElement.Title != "") if (_CurrentPlaylistElement.Artist.Length > 0 && _CurrentPlaylistElement.Title.Length > 0)
return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title; return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title;
else else
return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath); return Path.GetFileNameWithoutExtension(_CurrentPlaylistElement.MusicFilePath);
+253 -251
View File
@@ -287,276 +287,278 @@ namespace Vocaluxe.Base
XmlWriter writer = null; XmlWriter writer = null;
try try
{ {
writer = XmlWriter.Create(CSettings.sFileConfig, _settings); using (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)
{ {
//Write "old" song-folders to config. writer.WriteStartDocument();
writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); writer.WriteStartElement("root");
for (int i = 0; i < SongFolderOld.Count; i++)
#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
else
{
//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]); //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.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu))));
writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu)); writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu));
writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting)))); writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting))));
writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting)); writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting));
writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles)); writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles));
writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds."); writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds.");
writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString()); writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString());
writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)))); writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode))));
writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode)); writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode));
writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString()); writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString());
writer.WriteElementString("NumPlayer", NumPlayer.ToString()); writer.WriteElementString("NumPlayer", NumPlayer.ToString());
writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs)); writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs));
writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("LyricsOnTop", Enum.GetName(typeof(EOffOn), LyricsOnTop)); 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.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung");
writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString()); writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString());
writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":"); writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":");
writer.WriteStartElement("Players"); writer.WriteStartElement("Players");
for (int i = 1; i <= CSettings.MaxNumPlayer; i++) 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.WriteStartElement("MicConfig" + p.ToString()); writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1]));
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.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) catch (Exception)
{ {
writer = null; if (writer != null)
writer.Close();
return false; return false;
} }
writer = null;
return true; return true;
} }
@@ -731,7 +733,7 @@ namespace Vocaluxe.Base
//Only found a parameter //Only found a parameter
case 1: case 1:
if (!Regex.IsMatch(parts[0], @"\s") && parts[0] != string.Empty) if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
{ {
//Add parameter //Add parameter
_Params.Add(parts[0]); _Params.Add(parts[0]);
@@ -744,7 +746,7 @@ namespace Vocaluxe.Base
//Found parameter and value //Found parameter and value
case 2: case 2:
if (!Regex.IsMatch(parts[0], @"\s") && parts[0] != string.Empty) if (!Regex.IsMatch(parts[0], @"\s") && parts[0].Length > 0)
{ {
//Add parameter //Add parameter
_Params.Add(parts[0]); _Params.Add(parts[0]);
@@ -856,7 +858,7 @@ namespace Vocaluxe.Base
return false; return false;
} }
} }
if (Path.GetFileName(value) == string.Empty) if (Path.GetFileName(value).Length == 0)
{ {
return false; return false;
} }
@@ -876,7 +878,7 @@ namespace Vocaluxe.Base
{ {
for (int j = 0; j < CSettings.MaxNumPlayer; j++) 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) 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/Name", ref coverTheme.Name, String.Empty);
xmlReader.GetValue("//root/Info/Folder", ref coverTheme.Folder, 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; coverTheme.File = file;
@@ -190,7 +190,7 @@ namespace Vocaluxe.Base
coverTheme = CoverTheme(coverThemeName); coverTheme = CoverTheme(coverThemeName);
if (coverTheme.Name != String.Empty) if (coverTheme.Name.Length > 0)
{ {
CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(CSettings.sFolderCover, coverTheme.File))); CXMLReader xmlReader = CXMLReader.OpenFile((Path.Combine(CSettings.sFolderCover, coverTheme.File)));
+928 -1057
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() public static bool Unload()
{ {
return _Draw.Unload(); bool result = _Draw.Unload();
_Draw = null;
return result;
} }
public static int GetScreenWidth() public static int GetScreenWidth()
@@ -166,20 +168,22 @@ namespace Vocaluxe.Base
if (!System.IO.File.Exists(TexturePath)) if (!System.IO.File.Exists(TexturePath))
return new STexture(-1); return new STexture(-1);
Bitmap origin = new Bitmap(TexturePath); using (Bitmap origin = new Bitmap(TexturePath))
int w = MaxSize; {
int h = MaxSize; int w = MaxSize;
int h = MaxSize;
if (origin.Width >= origin.Height && origin.Width > w) if (origin.Width >= origin.Height && origin.Width > w)
h = (int)Math.Round((float)w / origin.Width * origin.Height); h = (int)Math.Round((float)w / origin.Width * origin.Height);
else if (origin.Height > origin.Width && origin.Height > h) else if (origin.Height > origin.Width && origin.Height > h)
w = (int)Math.Round((float)h / origin.Height * origin.Width); w = (int)Math.Round((float)h / origin.Height * origin.Width);
Bitmap bmp = new Bitmap(origin, w, h); using (Bitmap bmp = new Bitmap(origin, w, h))
STexture tex = _Draw.AddTexture(bmp); {
bmp.Dispose(); STexture tex = _Draw.AddTexture(bmp);
origin.Dispose(); return tex;
return tex; }
}
} }
public static STexture AddTexture(int W, int H, IntPtr Data) public static STexture AddTexture(int W, int H, IntPtr Data)
+85 -67
View File
@@ -36,66 +36,76 @@ namespace Vocaluxe.Base
float factor = GetFactor(chr, flags); float factor = GetFactor(chr, flags);
CFonts.Height = SIZEh * factor; CFonts.Height = SIZEh * factor;
Bitmap bmp = new Bitmap(10, 10); Font fo;
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp); 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(); fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags); sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
SizeF size = g.MeasureString(chr.ToString(), fo); size = g.MeasureString(chr.ToString(), fo);
g.Dispose(); g.Dispose();
bmp.Dispose(); }
bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height); using (Bitmap bmp = new Bitmap((int)(sizeB.Width * 2f), sizeB.Height))
g = System.Drawing.Graphics.FromImage(bmp); {
g.Clear(System.Drawing.Color.Transparent); g = System.Drawing.Graphics.FromImage(bmp);
g.Clear(System.Drawing.Color.Transparent);
g.SmoothingMode = SmoothingMode.AntiAlias; g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
CFonts.Height = SIZEh; CFonts.Height = SIZEh;
fo = CFonts.GetFont(); fo = CFonts.GetFont();
PointF point = new PointF( PointF point = new PointF(
outline * Math.Abs(sizeB.Width - size.Width) + (sizeB.Width - size.Width) / 2f + SIZEh / 5f, 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); (sizeB.Height - size.Height - (size.Height + SIZEh / 4f) * (1f - factor)) / 2f);
GraphicsPath path = new GraphicsPath(); using (GraphicsPath path = new GraphicsPath())
path.AddString( {
chr.ToString(), path.AddString(
fo.FontFamily, chr.ToString(),
(int)fo.Style, fo.FontFamily,
SIZEh, (int)fo.Style,
point, SIZEh,
new StringFormat()); point,
new StringFormat());
Pen pen = new Pen( using (Pen pen = new Pen(
Color.FromArgb( Color.FromArgb(
(int)CFonts.OutlineColor.A * 255, (int)CFonts.OutlineColor.A * 255,
(int)CFonts.OutlineColor.R * 255, (int)CFonts.OutlineColor.R * 255,
(int)CFonts.OutlineColor.G * 255, (int)CFonts.OutlineColor.G * 255,
(int)CFonts.OutlineColor.B * 255), (int)CFonts.OutlineColor.B * 255),
SIZEh * outline); SIZEh * outline))
{
pen.LineJoin = LineJoin.Round; pen.LineJoin = LineJoin.Round;
g.DrawPath(pen, path); g.DrawPath(pen, path);
g.FillPath(Brushes.White, path); g.FillPath(Brushes.White, path);
}
}
/* /*
g.DrawString( g.DrawString(
chr.ToString(), chr.ToString(),
fo, fo,
Brushes.White, Brushes.White,
point); point);
* */ * */
Texture = CDraw.AddTexture(bmp); Texture = CDraw.AddTexture(bmp);
//bmp.Save("test.png", ImageFormat.Png); //bmp.Save("test.png", ImageFormat.Png);
Chr = chr; Chr = chr;
width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width/factor / bmp.Width); width = (int)((1f + outline / 2f) * sizeB.Width * Texture.width / factor / bmp.Width);
bmp.Dispose(); }
g.Dispose(); g.Dispose();
fo.Dispose(); fo.Dispose();
} }
@@ -114,23 +124,31 @@ namespace Vocaluxe.Base
CFonts.Style = EStyle.Normal; CFonts.Style = EStyle.Normal;
CFonts.Height = SIZEh; CFonts.Height = SIZEh;
Bitmap bmp = new Bitmap(10, 10); float h_style, h_normal;
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp); using (Bitmap bmp = new Bitmap(10, 10))
{
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
{
Font fo = CFonts.GetFont(); Font fo = CFonts.GetFont();
Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags); Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//SizeF size = g.MeasureString(chr.ToString(), fo); //SizeF size = g.MeasureString(chr.ToString(), fo);
float h_normal = sizeB.Height; h_normal = sizeB.Height;
}
CFonts.Style = style;
CFonts.Style = style; }
bmp = new Bitmap(10, 10); using (Bitmap bmp = new Bitmap(10, 10))
g = System.Drawing.Graphics.FromImage(bmp); {
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
{
fo = CFonts.GetFont(); Font fo = CFonts.GetFont();
sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags); Size sizeB = TextRenderer.MeasureText(g, chr.ToString(), fo, new Size(int.MaxValue, int.MaxValue), flags);
//size = g.MeasureString(chr.ToString(), fo); //size = g.MeasureString(chr.ToString(), fo);
float h_style = sizeB.Height; h_style = sizeB.Height;
g.Dispose(); }
}
return h_normal / h_style; return h_normal / h_style;
} }
} }
@@ -415,7 +433,7 @@ namespace Vocaluxe.Base
if (h <= 0f) if (h <= 0f)
return; return;
if (Text == String.Empty) if (Text.Length == 0)
return; return;
Height = h; Height = h;
@@ -452,7 +470,7 @@ namespace Vocaluxe.Base
if (h <= 0f) if (h <= 0f)
return; return;
if (Text == String.Empty) if (Text.Length == 0)
return; return;
Height = h; Height = h;
@@ -489,7 +507,7 @@ namespace Vocaluxe.Base
if (h <= 0f) if (h <= 0f)
return; return;
if (Text == String.Empty) if (Text.Length == 0)
return; return;
Height = h; Height = h;
@@ -955,7 +973,7 @@ namespace Vocaluxe.Base
private static int GetFontIndex(string ThemeName, string FontName) private static int GetFontIndex(string ThemeName, string FontName)
{ {
if (ThemeName == String.Empty || FontName == String.Empty) if (ThemeName.Length == 0 || FontName.Length == 0)
return -1; return -1;
for (int i = 0; i < _Fonts.Count; i++) for (int i = 0; i < _Fonts.Count; i++)
@@ -969,7 +987,7 @@ namespace Vocaluxe.Base
private static int GetFontIndexParty(int PartyModeID, string FontName) private static int GetFontIndexParty(int PartyModeID, string FontName)
{ {
if (PartyModeID == -1 || FontName == String.Empty) if (PartyModeID == -1 || FontName.Length == 0)
return -1; return -1;
for (int i = 0; i < _Fonts.Count; i++) for (int i = 0; i < _Fonts.Count; i++)
+1 -1
View File
@@ -871,7 +871,7 @@ namespace Vocaluxe.Base
{ {
_Cursor.UnloadTextures(); _Cursor.UnloadTextures();
if (CTheme.Cursor.color != string.Empty) if (CTheme.Cursor.color.Length > 0)
{ {
SColorF color; SColorF color;
color = CTheme.GetColor(CTheme.Cursor.color, -1); color = CTheme.GetColor(CTheme.Cursor.color, -1);
+1
View File
@@ -22,6 +22,7 @@ namespace Vocaluxe.Base
public static void Close() public static void Close()
{ {
_Input.Close(); _Input.Close();
_Input = null;
} }
public static bool Connect() public static bool Connect()
+20 -18
View File
@@ -351,28 +351,30 @@ namespace Vocaluxe.Base
Params.IncludeDebugInformation = true; Params.IncludeDebugInformation = true;
#endif #endif
CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp"); using (CodeDomProvider CDP = CodeDomProvider.CreateProvider("CSharp"))
CompilerResults CompileResult = null; {
CompilerResults CompileResult = null;
try 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++)
{ {
CLog.LogError("Error Compiling Source (" + CHelper.ListStrings(files) + "): " + CompileResult.Errors[i].ErrorText); CompileResult = CDP.CompileAssemblyFromFile(Params, files);
} }
return null; 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) 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) if (PlaylistID < 0 || PlaylistID >= _Playlists.Count)
return; return;
if (_Playlists[PlaylistID].PlaylistFile != String.Empty) if (_Playlists[PlaylistID].PlaylistFile.Length > 0)
{ {
try try
{ {
@@ -233,46 +233,47 @@ namespace Vocaluxe.Base
try try
{ {
sr = new StreamReader(file, Encoding.Default, true); using (sr = new StreamReader(file, Encoding.Default, true))
int pos = -1;
string line;
while((line = sr.ReadLine()) != null)
{ {
pos = line.IndexOf(":");
if (pos > 0) int pos = -1;
string line;
while ((line = sr.ReadLine()) != null)
{ {
//Name or comment pos = line.IndexOf(":");
if (line[0] == '#') if (pos > 0)
{ {
string Identifier = line.Substring(1, pos - 1).Trim(); //Name or comment
string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim(); if (line[0] == '#')
if (Identifier.ToUpper() == "NAME")
{ {
pl.PlaylistName = Value; string Identifier = line.Substring(1, pos - 1).Trim();
} string Value = line.Substring(pos + 1, line.Length - pos - 1).Trim();
} if (Identifier.ToUpper() == "NAME")
//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); pl.PlaylistName = Value;
found = true;
break;
} }
} }
if (!found) //Song
CLog.LogError("Can't find song '" + Title + "' from '" + Artist + "' in playlist file: " + file); 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); File.Delete(file);
} }
catch catch
+26 -25
View File
@@ -60,7 +60,7 @@ namespace Vocaluxe.Base
profile.GuestProfile = EOffOn.TR_CONFIG_OFF; profile.GuestProfile = EOffOn.TR_CONFIG_OFF;
profile.Active = EOffOn.TR_CONFIG_ON; profile.Active = EOffOn.TR_CONFIG_ON;
if (FileName != String.Empty) if (FileName.Length > 0)
profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName); profile.ProfileFile = Path.Combine(CSettings.sFolderProfiles, FileName);
else else
profile.ProfileFile = String.Empty; profile.ProfileFile = String.Empty;
@@ -253,7 +253,7 @@ namespace Vocaluxe.Base
{ {
if (ProfileID < 0 || ProfileID >= _Profiles.Count) if (ProfileID < 0 || ProfileID >= _Profiles.Count)
return; return;
if (_Profiles[ProfileID].ProfileFile != String.Empty) if (_Profiles[ProfileID].ProfileFile.Length > 0)
{ {
try try
{ {
@@ -293,7 +293,7 @@ namespace Vocaluxe.Base
if (ProfileID < 0 || ProfileID >= _Profiles.Count) if (ProfileID < 0 || ProfileID >= _Profiles.Count)
return; return;
if (_Profiles[ProfileID].ProfileFile == String.Empty) if (_Profiles[ProfileID].ProfileFile.Length == 0)
{ {
string filename = string.Empty; string filename = string.Empty;
foreach (char chr in _Profiles[ProfileID].PlayerName) foreach (char chr in _Profiles[ProfileID].PlayerName)
@@ -302,7 +302,7 @@ namespace Vocaluxe.Base
filename += chr.ToString(); filename += chr.ToString();
} }
if (filename == String.Empty) if (filename.Length == 0)
filename = "1"; filename = "1";
int i = 0; int i = 0;
@@ -330,29 +330,30 @@ namespace Vocaluxe.Base
CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile + ": " + e.Message); CLog.LogError("Error creating/opening Profile File " + _Profiles[ProfileID].ProfileFile + ": " + e.Message);
return; return;
} }
try
if (writer == null)
{ {
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) private static void LoadProfile(string FileName)
+1 -1
View File
@@ -145,7 +145,7 @@ namespace Vocaluxe.Base
{ {
string sVersion = sProgramName; string sVersion = sProgramName;
if (sProgramCodeName != String.Empty) if (sProgramCodeName.Length > 0)
sVersion += " \"" + sProgramCodeName + "\""; sVersion += " \"" + sProgramCodeName + "\"";
return sVersion += " " + GetVersionText(); return sVersion += " " + GetVersionText();
+5 -5
View File
@@ -64,7 +64,7 @@ namespace Vocaluxe.Base
get { return _SearchFilter; } get { return _SearchFilter; }
set set
{ {
if (value != String.Empty) if (value.Length > 0)
{ {
_Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs); _Sort(_SongSorting, EOffOn.TR_CONFIG_OFF, _IgnoreArticles, value, false, _ShowDuetSongs);
} }
@@ -409,14 +409,14 @@ namespace Vocaluxe.Base
_FilteredSongs.Clear(); _FilteredSongs.Clear();
string[] searchStrings = null; string[] searchStrings = null;
if (_SearchFilter != String.Empty) if (_SearchFilter.Length > 0)
searchStrings = _SearchFilter.ToUpper().Split(new char[] { ' ' }); searchStrings = _SearchFilter.ToUpper().Split(new char[] { ' ' });
foreach (CSong song in _Songs) foreach (CSong song in _Songs)
{ {
if (!song.IsDuet || _ShowDuetSongs) if (!song.IsDuet || _ShowDuetSongs)
{ {
if (_SearchFilter == String.Empty) if (_SearchFilter.Length == 0)
_FilteredSongs.Add(song); _FilteredSongs.Add(song);
else if (searchStrings != null) else if (searchStrings != null)
{ {
@@ -480,7 +480,7 @@ namespace Vocaluxe.Base
FieldInfo field = null; FieldInfo field = null;
bool isString = false; bool isString = false;
List<SongPointer> SortList = new List<SongPointer>(); List<SongPointer> SortList = new List<SongPointer>();
if (fieldName == String.Empty) if (fieldName.Length == 0)
_FilteredSongs.ForEach((song) => SortList.Add(new SongPointer(song.ID, ""))); _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); 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++) for (int i = 0; i < _SongsSortList.Length; i++)
{ {
string Year = _SongsSortList[i].SortString; string Year = _SongsSortList[i].SortString;
if (Year != "") if (Year.Length > 0)
{ {
Year = Year.Substring(0, 3); Year = Year.Substring(0, 3);
_SongsSortList[i].SortString = Year + "0 - " + Year + "9"; _SongsSortList[i].SortString = Year + "0 - " + Year + "9";
+1 -1
View File
@@ -165,7 +165,7 @@ namespace Vocaluxe.Base
break; break;
} }
if (file == String.Empty) if (file.Length == 0)
return -1; return -1;
int stream = CSound.Load(file); int stream = CSound.Load(file);
+75 -73
View File
@@ -313,40 +313,41 @@ namespace Vocaluxe.Base
private static void SaveTheme(int ThemeIndex) private static void SaveTheme(int ThemeIndex)
{ {
#region ThemeMainFile #region ThemeMainFile
XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings); using (XmlWriter writer = XmlWriter.Create(Path.Combine(_Themes[ThemeIndex].Path, _Themes[ThemeIndex].FileName), _settings))
writer.WriteStartDocument(); {
writer.WriteStartElement("root"); writer.WriteStartDocument();
writer.WriteStartElement("root");
// ThemeSystemVersion // ThemeSystemVersion
writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString()); writer.WriteElementString("ThemeSystemVersion", ThemeSystemVersion.ToString());
#region Info #region Info
writer.WriteStartElement("Info"); writer.WriteStartElement("Info");
writer.WriteElementString("Name", _Themes[ThemeIndex].Name); writer.WriteElementString("Name", _Themes[ThemeIndex].Name);
writer.WriteElementString("Author", _Themes[ThemeIndex].Author); writer.WriteElementString("Author", _Themes[ThemeIndex].Author);
writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder); writer.WriteElementString("SkinFolder", _Themes[ThemeIndex].SkinFolder);
writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString()); writer.WriteElementString("ThemeVersionMajor", _Themes[ThemeIndex].ThemeVersionMajor.ToString());
writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString()); writer.WriteElementString("ThemeVersionMinor", _Themes[ThemeIndex].ThemeVersionMinor.ToString());
writer.WriteEndElement(); writer.WriteEndElement();
#endregion Info #endregion Info
// Cursor // Cursor
if (_Themes[ThemeIndex].PartyModeID == -1) if (_Themes[ThemeIndex].PartyModeID == -1)
SaveCursor(writer); SaveCursor(writer);
// save fonts // save fonts
if (_Themes[ThemeIndex].PartyModeID == -1) if (_Themes[ThemeIndex].PartyModeID == -1)
CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer); CFonts.SaveThemeFonts(_Themes[ThemeIndex].Name, writer);
// End of File // End of File
writer.WriteEndElement(); //end of root writer.WriteEndElement(); //end of root
writer.WriteEndDocument(); writer.WriteEndDocument();
writer.Flush(); writer.Flush();
writer.Close(); }
#endregion ThemeMainFile #endregion ThemeMainFile
} }
@@ -354,53 +355,54 @@ namespace Vocaluxe.Base
{ {
for (int SkinIndex = 0; SkinIndex < _Skins.Count; SkinIndex++) for (int SkinIndex = 0; SkinIndex < _Skins.Count; SkinIndex++)
{ {
XmlWriter writer = XmlWriter.Create(Path.Combine(_Skins[SkinIndex].Path, _Skins[SkinIndex].FileName), _settings); using (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)
{ {
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) if (version == ThemeSystemVersion)
{ {
xmlReader.GetValue("//root/Info/Name", ref theme.Name, String.Empty); 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/Author", ref theme.Author, String.Empty);
xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty); xmlReader.GetValue("//root/Info/SkinFolder", ref theme.SkinFolder, String.Empty);
@@ -514,7 +516,7 @@ namespace Vocaluxe.Base
if (version == SkinSystemVersion) if (version == SkinSystemVersion)
{ {
xmlReader.GetValue("//root/Info/Name", ref skin.Name, String.Empty); 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.GetValue("//root/Info/Author", ref skin.Author, String.Empty);
xmlReader.TryGetIntValue("//root/Info/SkinVersionMajor", ref skin.SkinVersionMajor); 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("W", Cursor.w.ToString("#0.000"));
writer.WriteElementString("H", Cursor.h.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); 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)")]
+18 -11
View File
@@ -493,13 +493,14 @@ namespace Vocaluxe.Lib.Draw
//This creates a new white texture and adds it to the texture pool //This creates a new white texture and adds it to the texture pool
//This texture is used for the DrawRect method //This texture is used for the DrawRect method
Bitmap blankMap = new Bitmap(1, 1); using (Bitmap blankMap = new Bitmap(1, 1))
Graphics g = Graphics.FromImage(blankMap); {
g.Clear(Color.White); Graphics g = Graphics.FromImage(blankMap);
g.Dispose(); g.Clear(Color.White);
_BlankTexture = AddTexture(blankMap); g.Dispose();
_BlankTexture = AddTexture(blankMap);
blankMap.Dispose(); }
return true; return true;
} }
else else
@@ -560,7 +561,7 @@ namespace Vocaluxe.Lib.Draw
} }
} }
//Apply fullscreen mode //Apply fullscreen mode
if ((CSettings.bFullScreen && !_fullscreen) || (!CSettings.bFullScreen && _fullscreen)) if (CSettings.bFullScreen != _fullscreen)
{ {
if (!_fullscreen) if (!_fullscreen)
EnterFullScreen(); EnterFullScreen();
@@ -576,9 +577,8 @@ namespace Vocaluxe.Lib.Draw
CTime.CalculateFPS(); CTime.CalculateFPS();
CTime.Restart(); CTime.Restart();
} }
else
this.Close();
} }
this.Close();
} }
/// <summary> /// <summary>
@@ -881,8 +881,15 @@ namespace Vocaluxe.Lib.Draw
CLog.LogError("Error loading Texture: " + TexturePath); CLog.LogError("Error loading Texture: " + TexturePath);
return new STexture(-1); return new STexture(-1);
} }
STexture s = AddTexture(bmp, TexturePath); STexture s;
bmp.Dispose(); try
{
s = AddTexture(bmp, TexturePath);
}
finally
{
bmp.Dispose();
}
return s; return s;
} }
CLog.LogError("Can't find File: " + TexturePath); CLog.LogError("Can't find File: " + TexturePath);
+27 -22
View File
@@ -246,9 +246,8 @@ namespace Vocaluxe.Lib.Draw
CTime.CalculateFPS(); CTime.CalculateFPS();
CTime.Restart(); CTime.Restart();
} }
else
this.Close();
} }
this.Close();
} }
public bool Unload() public bool Unload()
@@ -396,8 +395,10 @@ namespace Vocaluxe.Lib.Draw
if (!found) if (!found)
{ {
Bitmap bmp = new Bitmap(TexturePath); using (Bitmap bmp = new Bitmap(TexturePath))
return AddTexture(bmp); {
return AddTexture(bmp);
}
} }
} }
@@ -433,11 +434,13 @@ namespace Vocaluxe.Lib.Draw
public STexture AddTexture(int W, int H, ref byte[] Data) public STexture AddTexture(int W, int H, ref byte[] Data)
{ {
Bitmap bmp = new Bitmap(W, H); 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); BitmapData bmp_data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
bmp.UnlockBits(bmp_data); Marshal.Copy(Data, 0, bmp_data.Scan0, Data.Length);
return AddTexture(bmp); bmp.UnlockBits(bmp_data);
return AddTexture(bmp);
}
} }
public bool UpdateTexture(ref STexture Texture, IntPtr Data) public bool UpdateTexture(ref STexture Texture, IntPtr Data)
@@ -525,23 +528,25 @@ namespace Vocaluxe.Lib.Draw
{ {
Bitmap newBitmap = new Bitmap(original.Width, original.Height); Bitmap newBitmap = new Bitmap(original.Width, original.Height);
Graphics g = Graphics.FromImage(newBitmap); using (Graphics g = Graphics.FromImage(newBitmap))
{
ColorMatrix cm = new ColorMatrix(); ColorMatrix cm = new ColorMatrix();
cm.Matrix33 = color.A; cm.Matrix33 = color.A;
cm.Matrix00 = color.R; cm.Matrix00 = color.R;
cm.Matrix11 = color.G; cm.Matrix11 = color.G;
cm.Matrix22 = color.B; cm.Matrix22 = color.B;
cm.Matrix44 = 1; cm.Matrix44 = 1;
ImageAttributes ia = new ImageAttributes(); using (ImageAttributes ia = new ImageAttributes())
ia.SetColorMatrix(cm); {
ia.SetColorMatrix(cm);
g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height), g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia); 0, 0, original.Width, original.Height, GraphicsUnit.Pixel, ia);
ia.Dispose(); }
g.Dispose(); }
return newBitmap; return newBitmap;
} }
+25 -24
View File
@@ -500,9 +500,8 @@ namespace Vocaluxe.Lib.Draw
CTime.CalculateFPS(); CTime.CalculateFPS();
CTime.Restart(); CTime.Restart();
} }
else
this.Close();
} }
this.Close();
} }
public bool Unload() public bool Unload()
@@ -617,17 +616,18 @@ namespace Vocaluxe.Lib.Draw
int width = GetScreenWidth(); int width = GetScreenWidth();
int height = GetScreenHeight(); 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); GL.ReadPixels(0, 0, width, height, OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
screen.UnlockBits(bmp_data); screen.UnlockBits(bmp_data);
screen.RotateFlip(RotateFlipType.RotateNoneFlipY); screen.RotateFlip(RotateFlipType.RotateNoneFlipY);
screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp); screen.Save(Path.Combine(path, file + i.ToString("00000") + ".bmp"), ImageFormat.Bmp);
screen.Dispose(); }
} }
public void DrawLine(int a, int r, int g, int b, int w, int x1, int y1, int x2, int y2) 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.w2 = (float)MathHelper.NextPowerOfTwo(w);
texture.h2 = (float)MathHelper.NextPowerOfTwo(h); texture.h2 = (float)MathHelper.NextPowerOfTwo(h);
Bitmap bmp2 = new Bitmap((int)texture.w2, (int)texture.h2); using (Bitmap bmp2 = new Bitmap((int)texture.w2, (int)texture.h2))
Graphics g = Graphics.FromImage(bmp2); {
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; Graphics g = Graphics.FromImage(bmp2);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height)); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
g.Dispose(); g.DrawImage(bmp, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
g.Dispose();
texture.width_ratio = 1f; texture.width_ratio = 1f;
texture.height_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, GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, (int)texture.w2, (int)texture.h2, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero); OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmp_data.Width, bmp_data.Height, GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, bmp_data.Width, bmp_data.Height,
OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0); OpenTK.Graphics.OpenGL.PixelFormat.Bgra, PixelType.UnsignedByte, bmp_data.Scan0);
bmp2.UnlockBits(bmp_data); bmp2.UnlockBits(bmp_data);
bmp2.Dispose(); }
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge); GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureParameterName.ClampToEdge);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (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) protected virtual void Dispose(bool disposing)
{ {
if(disposing) if (disposing)
Disconnect(); {
Disconnect();
_ReadDone.Close();
}
} }
#endregion #endregion
} }
+35 -29
View File
@@ -43,7 +43,7 @@ namespace Vocaluxe.Lib.Playlist
public void SavePlaylist() public void SavePlaylist()
{ {
if (PlaylistFile == string.Empty) if (PlaylistFile.Length == 0)
{ {
string filename = string.Empty; string filename = string.Empty;
foreach (char chr in PlaylistName) foreach (char chr in PlaylistName)
@@ -52,7 +52,7 @@ namespace Vocaluxe.Lib.Playlist
filename += chr.ToString(); filename += chr.ToString();
} }
if (filename == String.Empty) if (filename.Length == 0)
filename = "1"; filename = "1";
int i = 0; int i = 0;
@@ -85,37 +85,43 @@ namespace Vocaluxe.Lib.Playlist
return; return;
} }
writer.WriteStartDocument(); try
writer.WriteStartElement("root");
writer.WriteStartElement("Info");
writer.WriteElementString("PlaylistName", PlaylistName);
writer.WriteEndElement();
writer.WriteStartElement("Songs");
for (int i = 0; i < Songs.Count; i++)
{ {
CSong song = CSongs.GetSong(Songs[i].SongID); writer.WriteStartDocument();
if (song != null) 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()); CSong song = CSongs.GetSong(Songs[i].SongID);
writer.WriteElementString("Artist", song.Artist); if (song != null)
writer.WriteElementString("Title", song.Title); {
writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode)); writer.WriteStartElement("Song" + (i + 1).ToString());
writer.WriteEndElement(); writer.WriteElementString("Artist", song.Artist);
} writer.WriteElementString("Title", song.Title);
else writer.WriteElementString("GameMode", Enum.GetName(typeof(EGameMode), Songs[i].GameMode));
{ writer.WriteEndElement();
CLog.LogError("Playlist.SavePlaylist(): Can't find Song. This should never happen!"); }
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() private void LoadPlaylist()
+20 -20
View File
@@ -36,26 +36,27 @@ namespace Vocaluxe.Lib.Sound
int id = 0; int id = 0;
foreach (DeviceInformation dev in devices) foreach (DeviceInformation dev in devices)
{ {
DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid); using (DirectSoundCapture ds = new DirectSoundCapture(dev.DriverGuid))
{
SRecordDevice device = new SRecordDevice(); SRecordDevice device = new SRecordDevice();
device.Driver = dev.DriverGuid.ToString(); device.Driver = dev.DriverGuid.ToString();
device.ID = id; device.ID = id;
device.Name = dev.Description; device.Name = dev.Description;
device.Inputs = new List<SInput>(); device.Inputs = new List<SInput>();
SInput inp = new SInput(); SInput inp = new SInput();
inp.Name = "Default"; inp.Name = "Default";
inp.Channels = ds.Capabilities.Channels; inp.Channels = ds.Capabilities.Channels;
if (inp.Channels > 2) if (inp.Channels > 2)
inp.Channels = 2; //more are not supported in vocaluxe inp.Channels = 2; //more are not supported in vocaluxe
device.Inputs.Add(inp); device.Inputs.Add(inp);
_Devices.Add(device); _Devices.Add(device);
id++; id++;
ds.Dispose(); }
} }
_DeviceConfig = _Devices.ToArray(); _DeviceConfig = _Devices.ToArray();
@@ -68,11 +69,7 @@ namespace Vocaluxe.Lib.Sound
{ {
if (_initialized) if (_initialized)
{ {
foreach (SoundCardSource source in _Sources) Stop();
{
source.Stop();
source.Dispose();
}
_initialized = false; _initialized = false;
} }
//System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer); //System.IO.File.WriteAllBytes("test0.raw", _Buffer[0].Buffer);
@@ -131,7 +128,10 @@ namespace Vocaluxe.Lib.Sound
foreach (SoundCardSource source in _Sources) foreach (SoundCardSource source in _Sources)
{ {
source.Stop(); source.Stop();
source.Dispose();
} }
_Sources.Clear();
return true; return true;
} }
public void AnalyzeBuffer(int Player) public void AnalyzeBuffer(int Player)
+1 -1
View File
@@ -164,7 +164,7 @@ namespace Vocaluxe.Lib.Webcam
return false; return false;
//No MonikerString found, try first webcam //No MonikerString found, try first webcam
if (Config.MonikerString == String.Empty) if (Config.MonikerString.Length == 0)
_Webcam = new VideoCaptureDevice(_WebcamDevices[0].MonikerString); _Webcam = new VideoCaptureDevice(_WebcamDevices[0].MonikerString);
else //Found MonikerString else //Found MonikerString
_Webcam = new VideoCaptureDevice(Config.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++) for (int i = 0; i < CSettings.MaxNumPlayer; i++)
{ {
//Update texture and name //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; 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; 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("StaticPlayer" + i)].Visible = true;
Statics[htStatics("StaticPlayerAvatar" + i)].Visible = true; Statics[htStatics("StaticPlayerAvatar" + i)].Visible = true;
Texts[htTexts("TextPlayer" + 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(); 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); CDraw.RemoveTexture(ref _CurrentVideoTexture);
if (song.VideoFileName != String.Empty) if (song.VideoFileName.Length > 0)
{ {
_CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName)); _CurrentVideo = CVideo.VdLoad(Path.Combine(song.Folder, song.VideoFileName));
CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap); CVideo.VdSkip(_CurrentVideo, song.Start, song.VideoGap);
@@ -630,7 +630,7 @@ namespace Vocaluxe.Screens
} }
CDraw.RemoveTexture(ref _Background); CDraw.RemoveTexture(ref _Background);
if (song.BackgroundFileName != String.Empty) if (song.BackgroundFileName.Length > 0)
_Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName)); _Background = CDraw.AddTexture(Path.Combine(song.Folder, song.BackgroundFileName));
SingNotes[htSingNotes(SingBars)].Reset(); SingNotes[htSingNotes(SingBars)].Reset();
+2 -2
View File
@@ -1105,13 +1105,13 @@ namespace Vocaluxe.Screens
SongID = CSongs.VisibleSongs[SongIndex].ID; 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; CSongs.Category = -1;
refresh = true; refresh = true;
} }
if (NewFilterString != String.Empty && CSongs.Category != 0) if (NewFilterString.Length > 0 && CSongs.Category != 0)
{ {
CSongs.Category = 0; CSongs.Category = 0;
refresh = true; refresh = true;
+2
View File
@@ -63,6 +63,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
@@ -193,6 +194,7 @@
<Compile Include="GameModes\CGameMode.cs" /> <Compile Include="GameModes\CGameMode.cs" />
<Compile Include="GameModes\CGameModeNormal.cs" /> <Compile Include="GameModes\CGameModeNormal.cs" />
<Compile Include="GameModes\IGameMode.cs" /> <Compile Include="GameModes\IGameMode.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Lib\Draw\CDirect3D.cs"> <Compile Include="Lib\Draw\CDirect3D.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </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("<Color>: Background color for type \"Color\" from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -127,13 +127,13 @@ namespace Vocaluxe.Menu
public void Resume() 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); CBase.Theme.SkinVideoResume(_Theme.VideoName, _PartyModeID);
} }
public void Pause() public void Pause()
{ {
if (_Theme.VideoName != String.Empty) if (_Theme.VideoName.Length > 0)
CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID); CBase.Theme.SkinVideoPause(_Theme.VideoName, _PartyModeID);
} }
@@ -153,7 +153,7 @@ namespace Vocaluxe.Menu
ok = DrawVideo(); ok = DrawVideo();
} }
if (_Theme.TextureName != String.Empty && if (_Theme.TextureName.Length > 0 &&
(_Theme.Type == EBackgroundTypes.Texture || (_Theme.Type == EBackgroundTypes.Texture ||
(_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok)))) (_Theme.Type == EBackgroundTypes.Video && (CBase.Config.GetVideoBackgrounds() == EOffOn.TR_CONFIG_OFF || !ok))))
ok = DrawTexture(); ok = DrawTexture();
@@ -171,7 +171,7 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); 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("<Color>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -241,7 +241,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Selected button color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower 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); writer.WriteElementString("SColor", _Theme.SColorName);
} }
@@ -370,10 +370,10 @@ namespace Vocaluxe.Menu
{ {
Text.LoadTextures(); Text.LoadTextures();
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty) if (_Theme.SColorName.Length > 0)
SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID); 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("<Color>: Equalizer color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); 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("<MaxColor>: Equalizer color for maximal volume from ColorScheme (high priority)");
writer.WriteComment("or <MaxR>, <MaxG>, <MaxB>, <MaxA> (lower 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); writer.WriteElementString("MaxColor", _Theme.ColorName);
} }
@@ -273,10 +273,10 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.MaxColorName != String.Empty) if (_Theme.MaxColorName.Length > 0)
MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID); MaxColor = CBase.Theme.GetColor(_Theme.MaxColorName, _PartyModeID);
} }
+3 -2
View File
@@ -73,8 +73,9 @@ namespace Vocaluxe.Menu
return 0; return 0;
} }
int result = 0; int result = 0;
int.TryParse(value, out result); if(int.TryParse(value, out result))
return result; return result;
return 0;
} }
public static void SetRect(RectangleF Bounds, ref RectangleF Rect, float RectAspect, EAspect Aspect) 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("<Color>: Lyric text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -178,7 +178,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Highlighted lyric color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower 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); writer.WriteElementString("SColor", _Theme.SColorName);
} }
@@ -547,10 +547,10 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty) if (_Theme.SColorName.Length > 0)
ColorProcessed = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID); ColorProcessed = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
} }
+93 -92
View File
@@ -409,7 +409,7 @@ namespace Vocaluxe.Menu
public virtual void SaveTheme() public virtual void SaveTheme()
{ {
if (_ThemePath == String.Empty) if (_ThemePath.Length == 0)
return; return;
XmlWriterSettings settings = new XmlWriterSettings(); XmlWriterSettings settings = new XmlWriterSettings();
@@ -418,98 +418,99 @@ namespace Vocaluxe.Menu
settings.ConformanceLevel = ConformanceLevel.Document; settings.ConformanceLevel = ConformanceLevel.Document;
string file = Path.Combine(_ThemePath, _ThemeName + ".xml"); string file = Path.Combine(_ThemePath, _ThemeName + ".xml");
XmlWriter writer = XmlWriter.Create(file, settings); using (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++)
{ {
_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() public virtual void ReloadTextures()
@@ -649,7 +650,7 @@ namespace Vocaluxe.Menu
public virtual void ReloadTheme(string XmlPath) public virtual void ReloadTheme(string XmlPath)
{ {
if (_ThemePath == String.Empty) if (_ThemePath.Length == 0)
return; return;
UnloadTextures(); UnloadTextures();
+4 -4
View File
@@ -182,7 +182,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)"); writer.WriteComment("<ColorEmptyTile>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("ColorEmptyTile", _Theme.ColorEmptyTileName);
} }
@@ -215,7 +215,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<Font>: Text font name"); writer.WriteComment("<Font>: Text font name");
writer.WriteElementString("Font", _Theme.NameFont); writer.WriteElementString("Font", _Theme.NameFont);
writer.WriteComment("<Color>: Text color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Text color from ColorScheme (high priority)");
if (_Theme.NameColorName != String.Empty) if (_Theme.NameColorName.Length > 0)
{ {
writer.WriteElementString("Color", _Theme.NameColorName); writer.WriteElementString("Color", _Theme.NameColorName);
} }
@@ -474,10 +474,10 @@ namespace Vocaluxe.Menu
_TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID); _TextureEmptyTile = CBase.Theme.GetSkinTexture(_Theme.TextureEmptyTileName, _PartyModeID);
_TextureTileSelected = CBase.Theme.GetSkinTexture(_Theme.TextureTileSelectedName, _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); 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); _Theme.NameColor = CBase.Theme.GetColor(_Theme.NameColorName, _PartyModeID);
} }
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Vocaluxe.Menu
Init(); Init();
} }
protected virtual void Init() protected void Init()
{ {
_Interactions = new List<CInteraction>(); _Interactions = new List<CInteraction>();
_Selection = 0; _Selection = 0;
+5 -5
View File
@@ -287,7 +287,7 @@ namespace Vocaluxe.Menu
public void Draw() 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)); CBase.Drawing.DrawTexture(CBase.Theme.GetSkinTexture(_TextureName, _PartyModeID), _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha));
else else
CBase.Drawing.DrawTexture(_Texture, _Rect, new SColorF(_Color.R, _Color.G, _Color.B, _Color.A * Alpha2 * _Alpha)); 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("<Color>: ParticleEffect color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -544,7 +544,7 @@ namespace Vocaluxe.Menu
h = 0; h = 0;
CParticle star; CParticle star;
if (_Theme.TextureName != String.Empty) if (_Theme.TextureName.Length > 0)
{ {
star = new CParticle(_PartyModeID, _Theme.TextureName, Color, star = new CParticle(_PartyModeID, _Theme.TextureName, Color,
CBase.Game.GetRandom(w) + Rect.X - size / 4f, CBase.Game.GetRandom(w) + Rect.X - size / 4f,
@@ -611,9 +611,9 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if(_Theme.TextureName != String.Empty) if(_Theme.TextureName.Length > 0)
Texture = CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID); 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("<ColorBackground>: Button color from ColorScheme (high priority)");
writer.WriteComment("or <BackgroundR>, <BackgroundG>, <BackgroundB>, <BackgroundA> (lower 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); 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("<SColorBackground>: Selected paylist-entry color from ColorScheme (high priority)");
writer.WriteComment("or <SBackgroundR>, <SBackgroundG>, <SBackgroundB>, <SBackgroundA> (lower 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); writer.WriteElementString("SColorBackground", _Theme.SColorBackgroundName);
} }
@@ -467,10 +467,10 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorBackgroundName != String.Empty) if (_Theme.ColorBackgroundName.Length > 0)
BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID); BackgroundColor = CBase.Theme.GetColor(_Theme.ColorBackgroundName, _PartyModeID);
if (_Theme.SColorBackgroundName != String.Empty) if (_Theme.SColorBackgroundName.Length > 0)
BackgroundSColor = CBase.Theme.GetColor(_Theme.SColorBackgroundName, _PartyModeID); BackgroundSColor = CBase.Theme.GetColor(_Theme.SColorBackgroundName, _PartyModeID);
_Theme.Text1.LoadTextures(); _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("<Color>: SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -427,7 +427,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Selected SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower 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); writer.WriteElementString("SColor", _Theme.SColorName);
} }
@@ -441,7 +441,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)"); writer.WriteComment("<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)");
writer.WriteComment("or <HR>, <HG>, <HB>, <HA> (lower 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); writer.WriteElementString("HColor", _Theme.HColorName);
} }
@@ -455,7 +455,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)"); writer.WriteComment("<ArrowColor>: Arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower 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); writer.WriteElementString("ArrowColor", _Theme.ArrowColorName);
} }
@@ -469,7 +469,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)"); writer.WriteComment("<ArrowSColor>: Selected arrow color from ColorScheme (high priority)");
writer.WriteComment("or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower 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); writer.WriteElementString("ArrowSColor", _Theme.SArrowColorName);
} }
@@ -483,7 +483,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)"); writer.WriteComment("<TextColor>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <TextR>, <TextG>, <TextB>, <TextA> (lower 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); writer.WriteElementString("TextColor", _Theme.TextColorName);
} }
@@ -497,7 +497,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)"); writer.WriteComment("<TextSColor>: Selected text color from ColorScheme (high priority)");
writer.WriteComment("or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower 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); writer.WriteElementString("TextSColor", _Theme.STextColorName);
} }
@@ -817,25 +817,25 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty) if (_Theme.SColorName.Length > 0)
SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID); SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
if (_Theme.HColorName != String.Empty) if (_Theme.HColorName.Length > 0)
HColor = CBase.Theme.GetColor(_Theme.HColorName, _PartyModeID); HColor = CBase.Theme.GetColor(_Theme.HColorName, _PartyModeID);
if (_Theme.ArrowColorName != String.Empty) if (_Theme.ArrowColorName.Length > 0)
ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID); ColorArrow = CBase.Theme.GetColor(_Theme.ArrowColorName, _PartyModeID);
if (_Theme.SArrowColorName != String.Empty) if (_Theme.SArrowColorName.Length > 0)
SColorArrow = CBase.Theme.GetColor(_Theme.SArrowColorName, _PartyModeID); SColorArrow = CBase.Theme.GetColor(_Theme.SArrowColorName, _PartyModeID);
if (_Theme.TextColorName != String.Empty) if (_Theme.TextColorName.Length > 0)
TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID); TextColor = CBase.Theme.GetColor(_Theme.TextColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty) if (_Theme.SColorName.Length > 0)
STextColor = CBase.Theme.GetColor(_Theme.STextColorName, _PartyModeID); 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("<Color>: Static color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -286,7 +286,7 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); 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("<Color>: Text color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -590,7 +590,7 @@ namespace Vocaluxe.Menu
writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)"); writer.WriteComment("<SColor>: Selected Text color from ColorScheme (high priority)");
writer.WriteComment("or <SR>, <SG>, <SB>, <SA> (lower 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); writer.WriteElementString("SColor", _Theme.SColorName);
} }
@@ -849,10 +849,10 @@ namespace Vocaluxe.Menu
public void LoadTextures() public void LoadTextures()
{ {
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
if (_Theme.SColorName != String.Empty) if (_Theme.SColorName.Length > 0)
SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID); SColor = CBase.Theme.GetColor(_Theme.SColorName, _PartyModeID);
} }
@@ -879,7 +879,7 @@ namespace Vocaluxe.Menu
private void UpdateTextPosition() private void UpdateTextPosition()
{ {
if (_Text == String.Empty) if (_Text.Length == 0)
return; return;
CBase.Fonts.SetFont(Fon); CBase.Fonts.SetFont(Fon);
+26 -19
View File
@@ -330,7 +330,7 @@ namespace Vocaluxe.Menu.SongMenu
this.FileName = Path.GetFileName(FilePath); this.FileName = Path.GetFileName(FilePath);
EHeaderFlags HeaderFlags = new EHeaderFlags(); EHeaderFlags HeaderFlags = new EHeaderFlags();
StreamReader sr; StreamReader sr = null;
try try
{ {
@@ -362,6 +362,8 @@ namespace Vocaluxe.Menu.SongMenu
{ {
case "ENCODING": case "ENCODING":
this.Encoding = CEncoding.GetEncoding(Value); this.Encoding = CEncoding.GetEncoding(Value);
sr.Dispose();
sr = null;
sr = new StreamReader(FilePath, this.Encoding); sr = new StreamReader(FilePath, this.Encoding);
Identifier = String.Empty; Identifier = String.Empty;
@@ -371,7 +373,7 @@ namespace Vocaluxe.Menu.SongMenu
line = sr.ReadLine(); line = sr.ReadLine();
if (line.Length == 0) if (line.Length == 0)
continue; continue;
if(!line[0].ToString().Equals("#")) break; if (!line[0].ToString().Equals("#")) break;
pos = line.IndexOf(":"); pos = line.IndexOf(":");
@@ -384,39 +386,39 @@ namespace Vocaluxe.Menu.SongMenu
} }
break; break;
case "TITLE": case "TITLE":
if (Value != String.Empty) if (Value.Length > 0)
{ {
this.Title = Value; this.Title = Value;
HeaderFlags |= EHeaderFlags.Title; HeaderFlags |= EHeaderFlags.Title;
} }
break; break;
case "ARTIST": case "ARTIST":
if (Value != String.Empty) if (Value.Length > 0)
{ {
this.Artist = Value; this.Artist = Value;
HeaderFlags |= EHeaderFlags.Artist; HeaderFlags |= EHeaderFlags.Artist;
} }
break; break;
case "TITLE-ON-SORTING": case "TITLE-ON-SORTING":
if (Value != String.Empty) if (Value.Length > 0)
{ {
this.TitleSorting = Value; this.TitleSorting = Value;
} }
break; break;
case "ARTIST-ON-SORTING": case "ARTIST-ON-SORTING":
if (Value != String.Empty) if (Value.Length > 0)
{ {
this.ArtistSorting = Value; this.ArtistSorting = Value;
} }
break; break;
case "P1": case "P1":
if (Value != String.Empty) if (Value.Length > 0)
{ {
this.DuetPart1 = Value; this.DuetPart1 = Value;
} }
break; break;
case "P2": case "P2":
if (Value != String.Empty) if (Value.Length > 0)
{ {
this.DuetPart2 = Value; this.DuetPart2 = Value;
} }
@@ -586,19 +588,21 @@ namespace Vocaluxe.Menu.SongMenu
} }
catch (Exception e) catch (Exception e)
{ {
if (sr != null)
sr.Dispose();
CBase.Log.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message); CBase.Log.LogError("Error reading txt header in file \"" + FilePath + "\": " + e.Message);
return false; return false;
} }
sr.Dispose();
CheckFiles(); CheckFiles();
//Before saving this tags to .txt: Check, if ArtistSorting and Artist are equal, then don't save this tag. //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; this.ArtistSorting = this.Artist;
} }
if (this.TitleSorting == String.Empty) if (this.TitleSorting.Length == 0)
{ {
this.TitleSorting = this.Title; this.TitleSorting = this.Title;
} }
@@ -634,7 +638,7 @@ namespace Vocaluxe.Menu.SongMenu
int Player = 0; int Player = 0;
int FileLineNo = 0; int FileLineNo = 0;
StreamReader sr; StreamReader sr = null;
try try
{ {
@@ -776,8 +780,11 @@ namespace Vocaluxe.Menu.SongMenu
catch (Exception e) catch (Exception e)
{ {
CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath); CBase.Log.LogError("Error loading song. Line No.: " + FileLineNo.ToString() + ". An unhandled exception occured (" + e.Message + "): " + FilePath);
if(sr != null)
sr.Dispose();
return false; return false;
} }
sr.Dispose();
FindRefrain(); FindRefrain();
FindShortEnd(); FindShortEnd();
_NotesLoaded = true; _NotesLoaded = true;
@@ -805,7 +812,7 @@ namespace Vocaluxe.Menu.SongMenu
{ {
if (_CoverSmallLoaded) if (_CoverSmallLoaded)
return; 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())) if (!CBase.DataBase.GetCover(Path.Combine(this.Folder, this.CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
_CoverTextureSmall = CBase.Cover.GetNoCover(); _CoverTextureSmall = CBase.Cover.GetNoCover();
@@ -818,7 +825,7 @@ namespace Vocaluxe.Menu.SongMenu
private void CheckFiles() private void CheckFiles()
{ {
if(this.CoverFileName == String.Empty){ if(this.CoverFileName.Length == 0){
List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false); List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
foreach(String file in files) 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); List<string> files = CHelper.ListFiles(this.Folder, "*.jpg", false);
files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false)); files.AddRange(CHelper.ListFiles(this.Folder, "*.png", false));
@@ -847,12 +854,12 @@ namespace Vocaluxe.Menu.SongMenu
private void CheckDuet() private void CheckDuet()
{ {
if (DuetPart1 == String.Empty) if (DuetPart1.Length == 0)
{ {
DuetPart1 = "Part 1"; DuetPart1 = "Part 1";
CBase.Log.LogError("Warning: Can't find #P1-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); 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"; DuetPart2 = "Part 2";
CBase.Log.LogError("Warning: Can't find #P2-tag for duets in \"" + this.Artist + " - " + this.Title + "\"."); 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++) 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(); Series tempSeries = new Series();
tempSeries.start = i; tempSeries.start = i;
@@ -903,7 +910,7 @@ namespace Vocaluxe.Menu.SongMenu
for (int k = 1; k <= max; k++) 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; tempSeries.end = i + k;
else else
break; break;
@@ -350,7 +350,7 @@ namespace Vocaluxe.Menu.SongMenu
writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)"); writer.WriteComment("<Color>: Tile color from ColorScheme (high priority)");
writer.WriteComment("or <R>, <G>, <B>, <A> (lower 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); writer.WriteElementString("Color", _Theme.ColorName);
} }
@@ -578,7 +578,7 @@ namespace Vocaluxe.Menu.SongMenu
{ {
Init(); Init();
if (_Theme.ColorName != String.Empty) if (_Theme.ColorName.Length > 0)
_Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID); _Color = CBase.Theme.GetColor(_Theme.ColorName, _PartyModeID);
} }
@@ -652,7 +652,7 @@ namespace Vocaluxe.Menu.SongMenu
_streams.Add(_stream); _streams.Add(_stream);
_actsongstream = _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)); _video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_actsong).Folder, CBase.Songs.GetVisibleSong(_actsong).VideoFileName));
if (_video == -1) if (_video == -1)
@@ -144,7 +144,7 @@ namespace Vocaluxe.Menu.SongMenu
_MedleyTagIcon.Visible = false; _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; _CoverBig.Texture = _CoverBigTexture;
_Artist.Text = String.Empty; _Artist.Text = String.Empty;
+2
View File
@@ -46,6 +46,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWin|x64'">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@@ -110,6 +111,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Menu\CBackground.cs" /> <Compile Include="Menu\CBackground.cs" />
<Compile Include="Menu\CBasic.cs" /> <Compile Include="Menu\CBasic.cs" />
<Compile Include="Menu\CButton.cs" /> <Compile Include="Menu\CButton.cs" />