From c3cac56e1a2974f394e87c8a51f23bea09ecd114 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Fri, 15 Mar 2013 16:15:34 +0100 Subject: [PATCH] Codestyle fixes (Codeanalysis) --- GstreamerHelper/GstreamerHelper.vcxproj | 1 + .../PartyModeChallenge/GlobalSuppressions.cs | Bin 0 -> 1466 bytes .../PartyModeChallenge/PartyModeChallenge.cs | 1 + .../PartyModeChallenge.csproj | 2 + .../GlobalSuppressions.cs | Bin 0 -> 1466 bytes .../PartyModeChallenge.cs | 1 + .../PartyModeChallengeMedley.csproj | 2 + .../PartyModeTicTacToe/GlobalSuppressions.cs | Bin 0 -> 1466 bytes .../PartyModeTicTacToe/PartyModeTicTacToe.cs | 1 + .../PartyModeTicTacToe.csproj | 2 + Vocaluxe/Base/CConfig.cs | 531 +++++++++--------- Vocaluxe/Base/CSongs.cs | 1 - Vocaluxe/GlobalSuppressions.cs | 13 + Vocaluxe/Lib/Input/CHIDAPI.cs | 2 +- Vocaluxe/Lib/Sound/CGstreamerAudio.cs | 3 +- Vocaluxe/Lib/Sound/COpenALPlay.cs | 16 +- Vocaluxe/Lib/Sound/CPortAudioPlay.cs | 17 +- .../Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs | 8 +- .../Sound/Gstreamer/CGstreamerAudioWrapper.cs | 10 +- Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs | 2 +- Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs | 2 +- Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs | 8 +- Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs | 3 +- .../Video/Gstreamer/CGstreamerVideoWrapper.cs | 10 +- Vocaluxe/Lib/Webcam/CAForgeNet.cs | 9 +- VocaluxeLib/GlobalSuppressions.cs | 21 + VocaluxeLib/Menu/CXMLReader.cs | 6 +- VocaluxeLib/Menu/SingNotes/ISingNotes.cs | 2 +- 28 files changed, 385 insertions(+), 289 deletions(-) create mode 100644 PartyModes/PartyModeChallenge/GlobalSuppressions.cs create mode 100644 PartyModes/PartyModeChallengeMedley/GlobalSuppressions.cs create mode 100644 PartyModes/PartyModeTicTacToe/GlobalSuppressions.cs diff --git a/GstreamerHelper/GstreamerHelper.vcxproj b/GstreamerHelper/GstreamerHelper.vcxproj index 6ade9eb8..8e692fe5 100644 --- a/GstreamerHelper/GstreamerHelper.vcxproj +++ b/GstreamerHelper/GstreamerHelper.vcxproj @@ -77,6 +77,7 @@ ..\Output\x64\gstreamer\ $(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath) $(MSBuildProjectDirectory)\x64\lib;$(LibraryPath) + ..\CheckingRules.ruleset false diff --git a/PartyModes/PartyModeChallenge/GlobalSuppressions.cs b/PartyModes/PartyModeChallenge/GlobalSuppressions.cs new file mode 100644 index 0000000000000000000000000000000000000000..6ac755b1eda579925b0a414de4487f191d7daa51 GIT binary patch literal 1466 zcmaKsPjAye5XI+QiSJ}F3HBYDm0e;bOv0h~_k0_V z-`Q*TF8moW*S6U1l}})Ij>WD0Vz28q)Gl4Ix?*+g3|>&dRlinEYDe7mUqzDFjLZY*2Yv>8GpriVV~V!& zp8H=_P$uKPipZt2pIz}LUer+wcvr=gb#1>Li)zw1_9dJMpO}Z{C!a7!hH!YRYqJy%o|qKHm8I*^>6+pt~&1j zE|jm_8IV-BbRQGR?|?VAPuLvdKj1M9;wv#L(tU;kLk z=XxM^pK|%`l@qJ#S52Y!_?-GQ5?eL6HQO{@8g7+pEi8faRIv$?G{ID(6YLMosF!el z=3X>a0`CH^ilaNHnx?Ac#F*Gyd&Bzprompt 4 Off + ..\..\CheckingRules.ruleset AnyCPU @@ -110,6 +111,7 @@ Always + Always diff --git a/PartyModes/PartyModeChallengeMedley/GlobalSuppressions.cs b/PartyModes/PartyModeChallengeMedley/GlobalSuppressions.cs new file mode 100644 index 0000000000000000000000000000000000000000..6ac755b1eda579925b0a414de4487f191d7daa51 GIT binary patch literal 1466 zcmaKsPjAye5XI+QiSJ}F3HBYDm0e;bOv0h~_k0_V z-`Q*TF8moW*S6U1l}})Ij>WD0Vz28q)Gl4Ix?*+g3|>&dRlinEYDe7mUqzDFjLZY*2Yv>8GpriVV~V!& zp8H=_P$uKPipZt2pIz}LUer+wcvr=gb#1>Li)zw1_9dJMpO}Z{C!a7!hH!YRYqJy%o|qKHm8I*^>6+pt~&1j zE|jm_8IV-BbRQGR?|?VAPuLvdKj1M9;wv#L(tU;kLk z=XxM^pK|%`l@qJ#S52Y!_?-GQ5?eL6HQO{@8g7+pEi8faRIv$?G{ID(6YLMosF!el z=3X>a0`CH^ilaNHnx?Ac#F*Gyd&Bzprompt 4 Off + ..\..\CheckingRules.ruleset AnyCPU @@ -110,6 +111,7 @@ Always + Always diff --git a/PartyModes/PartyModeTicTacToe/GlobalSuppressions.cs b/PartyModes/PartyModeTicTacToe/GlobalSuppressions.cs new file mode 100644 index 0000000000000000000000000000000000000000..6ac755b1eda579925b0a414de4487f191d7daa51 GIT binary patch literal 1466 zcmaKsPjAye5XI+QiSJ}F3HBYDm0e;bOv0h~_k0_V z-`Q*TF8moW*S6U1l}})Ij>WD0Vz28q)Gl4Ix?*+g3|>&dRlinEYDe7mUqzDFjLZY*2Yv>8GpriVV~V!& zp8H=_P$uKPipZt2pIz}LUer+wcvr=gb#1>Li)zw1_9dJMpO}Z{C!a7!hH!YRYqJy%o|qKHm8I*^>6+pt~&1j zE|jm_8IV-BbRQGR?|?VAPuLvdKj1M9;wv#L(tU;kLk z=XxM^pK|%`l@qJ#S52Y!_?-GQ5?eL6HQO{@8g7+pEi8faRIv$?G{ID(6YLMosF!el z=3X>a0`CH^ilaNHnx?Ac#F*Gyd&Bzprompt 4 Off + ..\..\CheckingRules.ruleset AnyCPU @@ -107,6 +108,7 @@ + Always diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index bfeaa405..d3ce7901 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -279,276 +279,275 @@ namespace Vocaluxe.Base XmlWriter writer = null; try { - using (writer = XmlWriter.Create(CSettings.sFileConfig, _settings)) + 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("Background Music use start-tag of songs"); + writer.WriteElementString("BackgroundMusicUseStart", Enum.GetName(typeof(EOffOn), BackgroundMusicUseStart)); + + writer.WriteComment("Preview Volume from 0 to 100"); + writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString()); + + 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.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("Background Music use start-tag of songs"); - writer.WriteElementString("BackgroundMusicUseStart", Enum.GetName(typeof(EOffOn), BackgroundMusicUseStart)); - - writer.WriteComment("Preview Volume from 0 to 100"); - writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString()); - - 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.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); + for (int i = 0; i < SongFolderOld.Count; 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]); - } + writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolderOld[i]); } - else - { - //Write "normal" song-folders to config. - writer.WriteComment("SongFolder: SongFolder1, SongFolder2, SongFolder3, ..."); - for (int i = 0; i < SongFolder.Count; i++) - { - writer.WriteElementString("SongFolder" + (i + 1).ToString(), SongFolder[i]); - } - } - - writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)))); - writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu)); - - writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting)))); - writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting)); - - writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles)); - - writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds."); - writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString()); - - writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)))); - writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode)); - - writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString()); - writer.WriteElementString("NumPlayer", NumPlayer.ToString()); - - writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs)); - - writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("LyricsOnTop", Enum.GetName(typeof(EOffOn), LyricsOnTop)); - - writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung"); - writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString()); - - writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":"); - writer.WriteStartElement("Players"); - for (int i = 1; i <= CSettings.MaxNumPlayer; i++) - { - writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1])); - } - writer.WriteEndElement(); - - writer.WriteEndElement(); - #endregion Game - - #region Video - writer.WriteStartElement("Video"); - - writer.WriteComment("VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder)))); - writer.WriteElementString("VideoDecoder", Enum.GetName(typeof(EVideoDecoder), VideoDecoder)); - - writer.WriteComment("VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideoBackgrounds", Enum.GetName(typeof(EOffOn), VideoBackgrounds)); - - writer.WriteComment("VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideoPreview", Enum.GetName(typeof(EOffOn), VideoPreview)); - - writer.WriteComment("Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs)); - - writer.WriteComment("Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); - writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground)); - - writer.WriteComment("WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib)))); - writer.WriteElementString("WebcamLib", Enum.GetName(typeof(EWebcamLib), WebcamLib)); - - writer.WriteStartElement("WebcamConfig"); - - writer.WriteElementString("MonikerString", WebcamConfig.MonikerString); - writer.WriteElementString("Framerate", WebcamConfig.Framerate.ToString()); - writer.WriteElementString("Width", WebcamConfig.Width.ToString()); - writer.WriteElementString("Height", WebcamConfig.Height.ToString()); - - writer.WriteEndElement(); - - writer.WriteEndElement(); - #endregion Video - - #region Record - writer.WriteStartElement("Record"); - - for (int p = 1; p <= CSettings.MaxNumPlayer; p++) - { - if (MicConfig[p - 1].DeviceName.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(); } + 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]); + } + } + + writer.WriteComment("SongMenu: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongMenu)))); + writer.WriteElementString("SongMenu", Enum.GetName(typeof(ESongMenu), SongMenu)); + + writer.WriteComment("SongSorting: " + CHelper.ListStrings(Enum.GetNames(typeof(ESongSorting)))); + writer.WriteElementString("SongSorting", Enum.GetName(typeof(ESongSorting), SongSorting)); + + writer.WriteComment("Ignore articles on song-sorting: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("IgnoreArticles", Enum.GetName(typeof(EOffOn), IgnoreArticles)); + + writer.WriteComment("ScoreAnimationTime: Values >= 1 or 0 for no animation. Time is in seconds."); + writer.WriteElementString("ScoreAnimationTime", ScoreAnimationTime.ToString()); + + writer.WriteComment("TimerMode: " + CHelper.ListStrings(Enum.GetNames(typeof(ETimerMode)))); + writer.WriteElementString("TimerMode", Enum.GetName(typeof(ETimerMode), TimerMode)); + + writer.WriteComment("NumPlayer: 1.." + CSettings.MaxNumPlayer.ToString()); + writer.WriteElementString("NumPlayer", NumPlayer.ToString()); + + writer.WriteComment("Order songs in tabs: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("Tabs", Enum.GetName(typeof(EOffOn), Tabs)); + + writer.WriteComment("Lyrics also on Top of screen: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("LyricsOnTop", Enum.GetName(typeof(EOffOn), LyricsOnTop)); + + writer.WriteComment("MinLineBreakTime: Value >= 0 in s. Minimum time the text is shown before it is to be sung"); + writer.WriteElementString("MinLineBreakTime", MinLineBreakTime.ToString()); + + writer.WriteComment("Default profile for players 1..." + CSettings.MaxNumPlayer.ToString() + ":"); + writer.WriteStartElement("Players"); + for (int i = 1; i <= CSettings.MaxNumPlayer; i++) + { + writer.WriteElementString("Player" + i.ToString(), Path.GetFileName(Players[i - 1])); + } + writer.WriteEndElement(); + + writer.WriteEndElement(); + #endregion Game + + #region Video + writer.WriteStartElement("Video"); + + writer.WriteComment("VideoDecoder: " + CHelper.ListStrings(Enum.GetNames(typeof(EVideoDecoder)))); + writer.WriteElementString("VideoDecoder", Enum.GetName(typeof(EVideoDecoder), VideoDecoder)); + + writer.WriteComment("VideoBackgrounds: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("VideoBackgrounds", Enum.GetName(typeof(EOffOn), VideoBackgrounds)); + + writer.WriteComment("VideoPreview: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("VideoPreview", Enum.GetName(typeof(EOffOn), VideoPreview)); + + writer.WriteComment("Show Videos while singing: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs)); + + writer.WriteComment("Show backgroundmusic videos as background: " + CHelper.ListStrings(Enum.GetNames(typeof(EOffOn)))); + writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground)); + + writer.WriteComment("WebcamLib: " + CHelper.ListStrings(Enum.GetNames(typeof(EWebcamLib)))); + writer.WriteElementString("WebcamLib", Enum.GetName(typeof(EWebcamLib), WebcamLib)); + + writer.WriteStartElement("WebcamConfig"); + + writer.WriteElementString("MonikerString", WebcamConfig.MonikerString); + writer.WriteElementString("Framerate", WebcamConfig.Framerate.ToString()); + writer.WriteElementString("Width", WebcamConfig.Width.ToString()); + writer.WriteElementString("Height", WebcamConfig.Height.ToString()); + + writer.WriteEndElement(); + + writer.WriteEndElement(); + #endregion Video + + #region Record + writer.WriteStartElement("Record"); + + for (int p = 1; p <= CSettings.MaxNumPlayer; p++) + { + if (MicConfig[p - 1].DeviceName.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 = null; } catch (Exception) { diff --git a/Vocaluxe/Base/CSongs.cs b/Vocaluxe/Base/CSongs.cs index c268f82e..013abf91 100644 --- a/Vocaluxe/Base/CSongs.cs +++ b/Vocaluxe/Base/CSongs.cs @@ -38,7 +38,6 @@ namespace Vocaluxe.Base private static bool _CoverLoaded = false; private static int _CoverLoadIndex = 0; private static int _CatIndex = -1; - private static bool _Init = false; private static List _CategoriesForRandom = new List(); private static Stopwatch _CoverLoadTimer = new Stopwatch(); diff --git a/Vocaluxe/GlobalSuppressions.cs b/Vocaluxe/GlobalSuppressions.cs index 05266267..f07fdadf 100644 --- a/Vocaluxe/GlobalSuppressions.cs +++ b/Vocaluxe/GlobalSuppressions.cs @@ -15,3 +15,16 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Lib.Draw.CDirect3D.#AddTexture(System.Drawing.Bitmap,System.String)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Lib.Draw.CDirect3D.#AddTexture(System.Int32,System.Int32,System.Byte[]&)")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Objekte verwerfen, bevor Bereich verloren geht", Scope = "member", Target = "Vocaluxe.Lib.Draw.CDirect3D.#CopyScreen()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Vocaluxe.Lib.Input.WiiMote.InputReport")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "PortAudioSharp.PortAudio+PaDeviceIndex")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "PortAudioSharp.PortAudio+PaSampleFormat")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "PortAudioSharp.PortAudio+PaStreamCallbackFlags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Vocaluxe.Lib.Video.Gstreamer.CGstreamerVideoWrapper.#GetFrame(System.Int32,System.Single)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Vocaluxe.Lib.Input.CHIDAPI.#ReadTimeout(System.IntPtr,System.Byte[]&,System.Int32,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "Vocaluxe.Lib.Input.CHIDAPI.#Read(System.IntPtr,System.Byte[]&,System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetVersionText()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetErrorText(PortAudioSharp.PortAudio+PaError)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetHostApiInfo(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetLastHostErrorInfo()")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetDeviceInfo(System.Int32)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2122:DoNotIndirectlyExposeMethodsWithLinkDemands", Scope = "member", Target = "PortAudioSharp.PortAudio.#Pa_GetStreamInfo(System.IntPtr)")] diff --git a/Vocaluxe/Lib/Input/CHIDAPI.cs b/Vocaluxe/Lib/Input/CHIDAPI.cs index f7157205..509c2d33 100644 --- a/Vocaluxe/Lib/Input/CHIDAPI.cs +++ b/Vocaluxe/Lib/Input/CHIDAPI.cs @@ -22,7 +22,7 @@ namespace Vocaluxe.Lib.Input public ushort UsagePage; public ushort Usage; public int InterfaceNumber; - public IntPtr Next; + internal IntPtr Next; } public static class CHIDAPI { diff --git a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs index 14b49b58..e8ee5aac 100644 --- a/Vocaluxe/Lib/Sound/CGstreamerAudio.cs +++ b/Vocaluxe/Lib/Sound/CGstreamerAudio.cs @@ -23,7 +23,8 @@ namespace Vocaluxe.Lib.Sound { Init(); Log = new CGstreamerAudioWrapper.LogCallback(LogHandler); - GC.SuppressFinalize(Log); + //Is this really needed? CodaAnalyzer complains about it... + //GC.SuppressFinalize(Log); CGstreamerAudioWrapper.SetLogCallback(Log); } diff --git a/Vocaluxe/Lib/Sound/COpenALPlay.cs b/Vocaluxe/Lib/Sound/COpenALPlay.cs index e79163ce..3b6310b7 100644 --- a/Vocaluxe/Lib/Sound/COpenALPlay.cs +++ b/Vocaluxe/Lib/Sound/COpenALPlay.cs @@ -13,7 +13,7 @@ using Vocaluxe.Lib.Sound.Decoder; namespace Vocaluxe.Lib.Sound { - class COpenALPlay : IPlayback + class COpenALPlay : IPlayback, IDisposable { private bool _Initialized = false; private List _Decoder = new List(); @@ -397,9 +397,15 @@ namespace Vocaluxe.Lib.Sound } } + + public void Dispose() + { + AC.Dispose(); + AC = null; + } } - class OpenAlStream + class OpenAlStream: IDisposable { const int buffer_size = 2048; const int buffer_count = 5; @@ -913,6 +919,12 @@ namespace Vocaluxe.Lib.Sound _Timer.Reset(); _Timer.Start(); } + + public void Dispose() + { + EventDecode.Close(); + EventDecode = null; + } } } diff --git a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs index 9eb62509..6256ad4e 100644 --- a/Vocaluxe/Lib/Sound/CPortAudioPlay.cs +++ b/Vocaluxe/Lib/Sound/CPortAudioPlay.cs @@ -382,7 +382,7 @@ namespace Vocaluxe.Lib.Sound } } - class PortAudioStream + class PortAudioStream: IDisposable { const long BUFSIZE = 1000000L; const long BEGINREFILL = 800000L; @@ -452,6 +452,11 @@ namespace Vocaluxe.Lib.Sound _DecoderThread = new Thread(Execute); } + ~PortAudioStream() + { + Dispose(); + } + public void Free(CLOSEPROC close_proc, int StreamID) { _Closeproc = close_proc; @@ -981,5 +986,15 @@ namespace Vocaluxe.Lib.Sound } } } + + public void Dispose() + { + if (EventDecode != null) + { + EventDecode.Close(); + EventDecode = null; + GC.SuppressFinalize(this); + } + } } } diff --git a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs index e7315aa4..0c8ed426 100644 --- a/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Sound/Decoder/CAudioDecoderFFmpeg.cs @@ -9,7 +9,7 @@ using Vocaluxe.Lib.Video.Acinerella; namespace Vocaluxe.Lib.Sound.Decoder { - class CAudioDecoderFFmpeg: CAudioDecoder + class CAudioDecoderFFmpeg: CAudioDecoder, IDisposable { private TAc_read_callback _rc; private TAc_seek_callback _sc; @@ -219,5 +219,11 @@ namespace Vocaluxe.Lib.Sound.Decoder return (Int64)_fs.Seek((long)pos, (SeekOrigin)whence); } #endregion Callbacks + + public void Dispose() + { + _fs.Dispose(); + _fs = null; + } } } diff --git a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs index c0fcaece..672b94a8 100644 --- a/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs +++ b/Vocaluxe/Lib/Sound/Gstreamer/CGstreamerAudioWrapper.cs @@ -26,6 +26,7 @@ namespace Vocaluxe.Lib.Sound.Gstreamer public static extern void SetLogCallback(LogCallback c); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool Init(); [DllImport(Dll)] @@ -41,7 +42,8 @@ namespace Vocaluxe.Lib.Sound.Gstreamer public static extern int Load(string Media); [DllImport(Dll, EntryPoint="LoadPrescan")] - public static extern int Load(string Media, bool Prescan); + public static extern int Load(string Media, + [MarshalAs(UnmanagedType.U1)] bool Prescan); [DllImport(Dll)] public static extern void Close(int Stream); @@ -50,7 +52,8 @@ namespace Vocaluxe.Lib.Sound.Gstreamer public static extern void Play(int Stream); [DllImport(Dll, EntryPoint="PlayLoop")] - public static extern void Play(int Stream, bool Loop); + public static extern void Play(int Stream, + [MarshalAs(UnmanagedType.U1)] bool Loop); [DllImport(Dll)] public static extern void Pause(int Stream); @@ -80,12 +83,15 @@ namespace Vocaluxe.Lib.Sound.Gstreamer public static extern float GetPosition(int Stream); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool IsPlaying(int Stream); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool IsPaused(int Stream); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool IsFinished(int Stream); [DllImport(Dll)] diff --git a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs index 930993df..0039333e 100644 --- a/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs +++ b/Vocaluxe/Lib/Sound/Portaudio/PortAudio.cs @@ -159,7 +159,7 @@ namespace PortAudioSharp { public int channelCount; public PaSampleFormat sampleFormat; public double suggestedLatency; - public IntPtr hostApiSpecificStreamInfo; + internal IntPtr hostApiSpecificStreamInfo; public override string ToString() { return "[" + this.GetType().Name + "]" + "\n" diff --git a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs index ed486447..22e50d25 100644 --- a/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs +++ b/Vocaluxe/Lib/Video/Acinerella/CAcinerella.cs @@ -119,7 +119,7 @@ namespace Vocaluxe.Lib.Video.Acinerella public Int32 stream_index; //Pointer to the buffer which contains the data. - public IntPtr buffer; + internal IntPtr buffer; //Size of the data in the buffer. public Int32 buffer_size; } diff --git a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs index 9b0f7828..6efc2aea 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderFFmpeg.cs @@ -213,7 +213,7 @@ namespace Vocaluxe.Lib.Video public bool displayed; } - class Decoder + class Decoder: IDisposable { private IntPtr _instance = IntPtr.Zero; // acinerella instance private IntPtr _videodecoder = IntPtr.Zero; // acinerella video decoder instance @@ -804,5 +804,11 @@ namespace Vocaluxe.Lib.Video return (Int64)_fs.Seek((long)pos, (SeekOrigin)whence); } #endregion Callbacks + + public void Dispose() + { + _fs.Dispose(); + _fs = null; + } } } diff --git a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs index 13f5b04f..3e675569 100644 --- a/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs +++ b/Vocaluxe/Lib/Video/CVideoDecoderGstreamer.cs @@ -23,7 +23,8 @@ namespace Vocaluxe.Lib.Video { bool retval = CGstreamerVideoWrapper.InitVideo(); Log = new CGstreamerVideoWrapper.LogCallback(LogHandler); - GC.SuppressFinalize(Log); + //Really needed? CodeAnalysis complains + //GC.SuppressFinalize(Log); CGstreamerVideoWrapper.SetVideoLogCallback(Log); return retval; } diff --git a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs index 17368cf5..ae6b3fbc 100644 --- a/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs +++ b/Vocaluxe/Lib/Video/Gstreamer/CGstreamerVideoWrapper.cs @@ -6,7 +6,7 @@ using System.Text; namespace Vocaluxe.Lib.Video.Gstreamer { public struct NativeFrame { - public IntPtr buffer; + internal IntPtr buffer; public int Size; public int Width; public int Height; @@ -43,6 +43,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer public static extern void SetVideoLogCallback(LogCallback c); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool InitVideo(); [DllImport(Dll)] @@ -52,6 +53,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer public static extern int LoadVideo(string VideoFileName); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool CloseVideo(int StreamID); [DllImport(Dll)] @@ -86,10 +88,12 @@ namespace Vocaluxe.Lib.Video.Gstreamer } [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool Skip(int StreamID, float Start, float Gap); [DllImport(Dll)] - public static extern void SetVideoLoop(int StreamID, bool Loop); + public static extern void SetVideoLoop(int StreamID, + [MarshalAs(UnmanagedType.U1)] bool Loop); [DllImport(Dll)] public static extern void PauseVideo(int StreamID); @@ -98,9 +102,11 @@ namespace Vocaluxe.Lib.Video.Gstreamer public static extern void ResumeVideo(int StreamID); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool Finished(int StreamID); [DllImport(Dll)] + [return: MarshalAs(UnmanagedType.U1)] public static extern bool UpdateVideo(); } diff --git a/Vocaluxe/Lib/Webcam/CAForgeNet.cs b/Vocaluxe/Lib/Webcam/CAForgeNet.cs index 9b1a333c..a301ff24 100644 --- a/Vocaluxe/Lib/Webcam/CAForgeNet.cs +++ b/Vocaluxe/Lib/Webcam/CAForgeNet.cs @@ -21,7 +21,8 @@ namespace Vocaluxe.Lib.Webcam private VideoCaptureDevice _Webcam; private FilterInfoCollection _WebcamDevices; private SWebcamConfig _Config; - byte[] data = new byte[1]; + private byte[] data = new byte[1]; + private static object _mutexData = new object(); int _Width, _Height; public void Close() @@ -39,7 +40,7 @@ namespace Vocaluxe.Lib.Webcam { if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Width * _Height * 4) { - lock (data) + lock (_mutexData) { if (Frame.index == -1 || _Width != Frame.width || _Height != Frame.height) { @@ -59,7 +60,7 @@ namespace Vocaluxe.Lib.Webcam { if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Height * _Width * 4) { - lock (data) + lock (_mutexData) { Bitmap bmp = new Bitmap(_Width, _Height); BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); @@ -106,7 +107,7 @@ namespace Vocaluxe.Lib.Webcam { if (!_Paused) { - lock (data) + lock (_mutexData) { if (_Width != e.Frame.Width || _Height != e.Frame.Height || data.Length != e.Frame.Width * e.Frame.Height * 4) data = new byte[4 * e.Frame.Width * e.Frame.Height]; diff --git a/VocaluxeLib/GlobalSuppressions.cs b/VocaluxeLib/GlobalSuppressions.cs index c04a0e50..88d94626 100644 --- a/VocaluxeLib/GlobalSuppressions.cs +++ b/VocaluxeLib/GlobalSuppressions.cs @@ -10,3 +10,24 @@ [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)")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Config")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Settings")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Theme")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Helper")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Log")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#BackgroundMusic")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Drawing")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Graphics")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Fonts")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Language")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Game")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Profiles")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Record")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Songs")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Video")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Sound")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Cover")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#DataBase")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Input")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Scope = "member", Target = "Vocaluxe.Menu.CBase.#Playlist")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Scope = "type", Target = "Vocaluxe.Menu.EColorDeep")] diff --git a/VocaluxeLib/Menu/CXMLReader.cs b/VocaluxeLib/Menu/CXMLReader.cs index 2bf58133..947877c0 100644 --- a/VocaluxeLib/Menu/CXMLReader.cs +++ b/VocaluxeLib/Menu/CXMLReader.cs @@ -21,15 +21,15 @@ namespace Vocaluxe.Menu get { return _Navigator; } } - public static CXMLReader OpenFile(string sUri) + public static CXMLReader OpenFile(string sFile) { try { - return new CXMLReader(sUri); + return new CXMLReader(sFile); } catch (Exception e) { - CBase.Log.LogError("Can't open XML file: " + sUri + ": " + e.Message); + CBase.Log.LogError("Can't open XML file: " + sFile + ": " + e.Message); return null; } } diff --git a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs index a3abb720..5584927d 100644 --- a/VocaluxeLib/Menu/SingNotes/ISingNotes.cs +++ b/VocaluxeLib/Menu/SingNotes/ISingNotes.cs @@ -4,7 +4,7 @@ using System.Text; namespace Vocaluxe.Menu.SingNotes { - interface ISingNotes + public interface ISingNotes { void Reset(); int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr);