Codestyle fixes (Codeanalysis)

This commit is contained in:
Flamefire committed 2013-03-15 16:15:34 +01:00
1 parent 8b70a42e09
commit c3cac56e1a
28 files changed
+122 -26

No files matched your search

+1
View File
@@ -77,6 +77,7 @@
<OutDir>..\Output\x64\gstreamer\</OutDir> <OutDir>..\Output\x64\gstreamer\</OutDir>
<IncludePath>$(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath)</IncludePath> <IncludePath>$(MSBuildProjectDirectory)\x64\lib\glib-2.0\include;$(MSBuildProjectDirectory)\x64\include\gstreamer-1.0;$(MSBuildProjectDirectory)\x64\include\glib-2.0;$(MSBuildProjectDirectory)\x64\include;$(IncludePath)</IncludePath>
<LibraryPath>$(MSBuildProjectDirectory)\x64\lib;$(LibraryPath)</LibraryPath> <LibraryPath>$(MSBuildProjectDirectory)\x64\lib;$(LibraryPath)</LibraryPath>
<CodeAnalysisRuleSet>..\CheckingRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWin|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
Binary file not shown.
@@ -4,6 +4,7 @@ using System.Text;
using Vocaluxe.Menu; using Vocaluxe.Menu;
[assembly: System.Runtime.InteropServices.ComVisible(false)]
namespace Vocaluxe.PartyModes namespace Vocaluxe.PartyModes
{ {
#region Communication #region Communication
@@ -47,6 +47,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 @@
<Compile Include="ChallengeRounds.cs"> <Compile Include="ChallengeRounds.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile> </Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="PartyModeChallenge.cs"> <Compile Include="PartyModeChallenge.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile> </Compile>
@@ -5,6 +5,7 @@ using System.Text;
using Vocaluxe.Menu; using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu; using Vocaluxe.Menu.SongMenu;
[assembly: System.Runtime.InteropServices.ComVisible(false)]
namespace Vocaluxe.PartyModes namespace Vocaluxe.PartyModes
{ {
#region Communication #region Communication
@@ -47,6 +47,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 @@
<Compile Include="ChallengeRounds.cs"> <Compile Include="ChallengeRounds.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile> </Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="PartyModeChallenge.cs"> <Compile Include="PartyModeChallenge.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile> </Compile>
Binary file not shown.
@@ -4,6 +4,7 @@ using System.Text;
using Vocaluxe.Menu; using Vocaluxe.Menu;
[assembly: System.Runtime.InteropServices.ComVisible(false)]
namespace Vocaluxe.PartyModes namespace Vocaluxe.PartyModes
{ {
public enum ESongSource public enum ESongSource
@@ -47,6 +47,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>
@@ -107,6 +108,7 @@
<StartupObject /> <StartupObject />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="PartyModeTicTacToe.cs"> <Compile Include="PartyModeTicTacToe.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile> </Compile>
+2 -3
View File
@@ -279,8 +279,7 @@ namespace Vocaluxe.Base
XmlWriter writer = null; XmlWriter writer = null;
try try
{ {
using (writer = XmlWriter.Create(CSettings.sFileConfig, _settings)) writer = XmlWriter.Create(CSettings.sFileConfig, _settings);
{
writer.WriteStartDocument(); writer.WriteStartDocument();
writer.WriteStartElement("root"); writer.WriteStartElement("root");
@@ -548,7 +547,7 @@ namespace Vocaluxe.Base
writer.WriteEndDocument(); writer.WriteEndDocument();
writer.Flush(); writer.Flush();
writer.Close(); writer.Close();
} writer = null;
} }
catch (Exception) catch (Exception)
{ {
-1
View File
@@ -38,7 +38,6 @@ namespace Vocaluxe.Base
private static bool _CoverLoaded = false; private static bool _CoverLoaded = false;
private static int _CoverLoadIndex = 0; private static int _CoverLoadIndex = 0;
private static int _CatIndex = -1; private static int _CatIndex = -1;
private static bool _Init = false;
private static List<CCategory> _CategoriesForRandom = new List<CCategory>(); private static List<CCategory> _CategoriesForRandom = new List<CCategory>();
private static Stopwatch _CoverLoadTimer = new Stopwatch(); private static Stopwatch _CoverLoadTimer = new Stopwatch();
+13
View File
@@ -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.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.#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.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)")]
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Vocaluxe.Lib.Input
public ushort UsagePage; public ushort UsagePage;
public ushort Usage; public ushort Usage;
public int InterfaceNumber; public int InterfaceNumber;
public IntPtr Next; internal IntPtr Next;
} }
public static class CHIDAPI public static class CHIDAPI
{ {
+2 -1
View File
@@ -23,7 +23,8 @@ namespace Vocaluxe.Lib.Sound
{ {
Init(); Init();
Log = new CGstreamerAudioWrapper.LogCallback(LogHandler); Log = new CGstreamerAudioWrapper.LogCallback(LogHandler);
GC.SuppressFinalize(Log); //Is this really needed? CodaAnalyzer complains about it...
//GC.SuppressFinalize(Log);
CGstreamerAudioWrapper.SetLogCallback(Log); CGstreamerAudioWrapper.SetLogCallback(Log);
} }
+14 -2
View File
@@ -13,7 +13,7 @@ using Vocaluxe.Lib.Sound.Decoder;
namespace Vocaluxe.Lib.Sound namespace Vocaluxe.Lib.Sound
{ {
class COpenALPlay : IPlayback class COpenALPlay : IPlayback, IDisposable
{ {
private bool _Initialized = false; private bool _Initialized = false;
private List<OpenAlStream> _Decoder = new List<OpenAlStream>(); private List<OpenAlStream> _Decoder = new List<OpenAlStream>();
@@ -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_size = 2048;
const int buffer_count = 5; const int buffer_count = 5;
@@ -913,6 +919,12 @@ namespace Vocaluxe.Lib.Sound
_Timer.Reset(); _Timer.Reset();
_Timer.Start(); _Timer.Start();
} }
public void Dispose()
{
EventDecode.Close();
EventDecode = null;
}
} }
} }
+16 -1
View File
@@ -382,7 +382,7 @@ namespace Vocaluxe.Lib.Sound
} }
} }
class PortAudioStream class PortAudioStream: IDisposable
{ {
const long BUFSIZE = 1000000L; const long BUFSIZE = 1000000L;
const long BEGINREFILL = 800000L; const long BEGINREFILL = 800000L;
@@ -452,6 +452,11 @@ namespace Vocaluxe.Lib.Sound
_DecoderThread = new Thread(Execute); _DecoderThread = new Thread(Execute);
} }
~PortAudioStream()
{
Dispose();
}
public void Free(CLOSEPROC close_proc, int StreamID) public void Free(CLOSEPROC close_proc, int StreamID)
{ {
_Closeproc = close_proc; _Closeproc = close_proc;
@@ -981,5 +986,15 @@ namespace Vocaluxe.Lib.Sound
} }
} }
} }
public void Dispose()
{
if (EventDecode != null)
{
EventDecode.Close();
EventDecode = null;
GC.SuppressFinalize(this);
}
}
} }
} }
@@ -9,7 +9,7 @@ using Vocaluxe.Lib.Video.Acinerella;
namespace Vocaluxe.Lib.Sound.Decoder namespace Vocaluxe.Lib.Sound.Decoder
{ {
class CAudioDecoderFFmpeg: CAudioDecoder class CAudioDecoderFFmpeg: CAudioDecoder, IDisposable
{ {
private TAc_read_callback _rc; private TAc_read_callback _rc;
private TAc_seek_callback _sc; private TAc_seek_callback _sc;
@@ -219,5 +219,11 @@ namespace Vocaluxe.Lib.Sound.Decoder
return (Int64)_fs.Seek((long)pos, (SeekOrigin)whence); return (Int64)_fs.Seek((long)pos, (SeekOrigin)whence);
} }
#endregion Callbacks #endregion Callbacks
public void Dispose()
{
_fs.Dispose();
_fs = null;
}
} }
} }
@@ -26,6 +26,7 @@ namespace Vocaluxe.Lib.Sound.Gstreamer
public static extern void SetLogCallback(LogCallback c); public static extern void SetLogCallback(LogCallback c);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool Init(); public static extern bool Init();
[DllImport(Dll)] [DllImport(Dll)]
@@ -41,7 +42,8 @@ namespace Vocaluxe.Lib.Sound.Gstreamer
public static extern int Load(string Media); public static extern int Load(string Media);
[DllImport(Dll, EntryPoint="LoadPrescan")] [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)] [DllImport(Dll)]
public static extern void Close(int Stream); public static extern void Close(int Stream);
@@ -50,7 +52,8 @@ namespace Vocaluxe.Lib.Sound.Gstreamer
public static extern void Play(int Stream); public static extern void Play(int Stream);
[DllImport(Dll, EntryPoint="PlayLoop")] [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)] [DllImport(Dll)]
public static extern void Pause(int Stream); public static extern void Pause(int Stream);
@@ -80,12 +83,15 @@ namespace Vocaluxe.Lib.Sound.Gstreamer
public static extern float GetPosition(int Stream); public static extern float GetPosition(int Stream);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IsPlaying(int Stream); public static extern bool IsPlaying(int Stream);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IsPaused(int Stream); public static extern bool IsPaused(int Stream);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IsFinished(int Stream); public static extern bool IsFinished(int Stream);
[DllImport(Dll)] [DllImport(Dll)]
+1 -1
View File
@@ -159,7 +159,7 @@ namespace PortAudioSharp {
public int channelCount; public int channelCount;
public PaSampleFormat sampleFormat; public PaSampleFormat sampleFormat;
public double suggestedLatency; public double suggestedLatency;
public IntPtr hostApiSpecificStreamInfo; internal IntPtr hostApiSpecificStreamInfo;
public override string ToString() { public override string ToString() {
return "[" + this.GetType().Name + "]" + "\n" return "[" + this.GetType().Name + "]" + "\n"
+1 -1
View File
@@ -119,7 +119,7 @@ namespace Vocaluxe.Lib.Video.Acinerella
public Int32 stream_index; public Int32 stream_index;
//Pointer to the buffer which contains the data. //Pointer to the buffer which contains the data.
public IntPtr buffer; internal IntPtr buffer;
//Size of the data in the buffer. //Size of the data in the buffer.
public Int32 buffer_size; public Int32 buffer_size;
} }
+7 -1
View File
@@ -213,7 +213,7 @@ namespace Vocaluxe.Lib.Video
public bool displayed; public bool displayed;
} }
class Decoder class Decoder: IDisposable
{ {
private IntPtr _instance = IntPtr.Zero; // acinerella instance private IntPtr _instance = IntPtr.Zero; // acinerella instance
private IntPtr _videodecoder = IntPtr.Zero; // acinerella video decoder 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); return (Int64)_fs.Seek((long)pos, (SeekOrigin)whence);
} }
#endregion Callbacks #endregion Callbacks
public void Dispose()
{
_fs.Dispose();
_fs = null;
}
} }
} }
+2 -1
View File
@@ -23,7 +23,8 @@ namespace Vocaluxe.Lib.Video
{ {
bool retval = CGstreamerVideoWrapper.InitVideo(); bool retval = CGstreamerVideoWrapper.InitVideo();
Log = new CGstreamerVideoWrapper.LogCallback(LogHandler); Log = new CGstreamerVideoWrapper.LogCallback(LogHandler);
GC.SuppressFinalize(Log); //Really needed? CodeAnalysis complains
//GC.SuppressFinalize(Log);
CGstreamerVideoWrapper.SetVideoLogCallback(Log); CGstreamerVideoWrapper.SetVideoLogCallback(Log);
return retval; return retval;
} }
@@ -6,7 +6,7 @@ using System.Text;
namespace Vocaluxe.Lib.Video.Gstreamer namespace Vocaluxe.Lib.Video.Gstreamer
{ {
public struct NativeFrame { public struct NativeFrame {
public IntPtr buffer; internal IntPtr buffer;
public int Size; public int Size;
public int Width; public int Width;
public int Height; public int Height;
@@ -43,6 +43,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer
public static extern void SetVideoLogCallback(LogCallback c); public static extern void SetVideoLogCallback(LogCallback c);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool InitVideo(); public static extern bool InitVideo();
[DllImport(Dll)] [DllImport(Dll)]
@@ -52,6 +53,7 @@ namespace Vocaluxe.Lib.Video.Gstreamer
public static extern int LoadVideo(string VideoFileName); public static extern int LoadVideo(string VideoFileName);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool CloseVideo(int StreamID); public static extern bool CloseVideo(int StreamID);
[DllImport(Dll)] [DllImport(Dll)]
@@ -86,10 +88,12 @@ namespace Vocaluxe.Lib.Video.Gstreamer
} }
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool Skip(int StreamID, float Start, float Gap); public static extern bool Skip(int StreamID, float Start, float Gap);
[DllImport(Dll)] [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)] [DllImport(Dll)]
public static extern void PauseVideo(int StreamID); public static extern void PauseVideo(int StreamID);
@@ -98,9 +102,11 @@ namespace Vocaluxe.Lib.Video.Gstreamer
public static extern void ResumeVideo(int StreamID); public static extern void ResumeVideo(int StreamID);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool Finished(int StreamID); public static extern bool Finished(int StreamID);
[DllImport(Dll)] [DllImport(Dll)]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool UpdateVideo(); public static extern bool UpdateVideo();
} }
+5 -4
View File
@@ -21,7 +21,8 @@ namespace Vocaluxe.Lib.Webcam
private VideoCaptureDevice _Webcam; private VideoCaptureDevice _Webcam;
private FilterInfoCollection _WebcamDevices; private FilterInfoCollection _WebcamDevices;
private SWebcamConfig _Config; private SWebcamConfig _Config;
byte[] data = new byte[1]; private byte[] data = new byte[1];
private static object _mutexData = new object();
int _Width, _Height; int _Width, _Height;
public void Close() public void Close()
@@ -39,7 +40,7 @@ namespace Vocaluxe.Lib.Webcam
{ {
if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Width * _Height * 4) 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) 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) if (_Webcam != null && _Width > 0 && _Height > 0 && data.Length == _Height * _Width * 4)
{ {
lock (data) lock (_mutexData)
{ {
Bitmap bmp = new Bitmap(_Width, _Height); Bitmap bmp = new Bitmap(_Width, _Height);
BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); BitmapData bitmapdata = bmp.LockBits(new Rectangle(0, 0, _Width, _Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
@@ -106,7 +107,7 @@ namespace Vocaluxe.Lib.Webcam
{ {
if (!_Paused) if (!_Paused)
{ {
lock (data) lock (_mutexData)
{ {
if (_Width != e.Frame.Width || _Height != e.Frame.Height || data.Length != e.Frame.Width * e.Frame.Height * 4) 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]; data = new byte[4 * e.Frame.Width * e.Frame.Height];
+21
View File
@@ -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 = "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", "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")]
+3 -3
View File
@@ -21,15 +21,15 @@ namespace Vocaluxe.Menu
get { return _Navigator; } get { return _Navigator; }
} }
public static CXMLReader OpenFile(string sUri) public static CXMLReader OpenFile(string sFile)
{ {
try try
{ {
return new CXMLReader(sUri); return new CXMLReader(sFile);
} }
catch (Exception e) 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; return null;
} }
} }
+1 -1
View File
@@ -4,7 +4,7 @@ using System.Text;
namespace Vocaluxe.Menu.SingNotes namespace Vocaluxe.Menu.SingNotes
{ {
interface ISingNotes public interface ISingNotes
{ {
void Reset(); void Reset();
int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr); int AddPlayer(SRectF Rect, SColorF Color, int PlayerNr);